[FFmpeg-devel] [PATCH 4/7] avcodec/mathops: Move bitswap_32() to its only user

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu Mar 17 14:43:16 EET 2022


Effectively reverts eaff1aa09e90e2711207c9463db8bf8e8dec8178
given that bitswap_32 is no longer used outside of bitstream.c
since 03008c2811ec26cf338780a89b6b2b849b399e3c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/bitstream.c | 11 +++++++++--
 libavcodec/dstdec.c    |  1 +
 libavcodec/mathops.h   |  9 ---------
 libavcodec/mpeg12dec.c |  1 +
 libavcodec/pcm.c       |  1 +
 libavcodec/s302m.c     |  1 +
 libavcodec/s302menc.c  |  1 +
 libavcodec/tiff.c      |  1 +
 libavcodec/xbmdec.c    |  1 +
 libavcodec/xbmenc.c    |  1 +
 10 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index c948c889b6..04817f9a84 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -35,7 +35,6 @@
 
 #include "config.h"
 #include "libavutil/avassert.h"
-#include "libavutil/bswap.h"
 #include "libavutil/error.h"
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
@@ -43,7 +42,7 @@
 #include "libavutil/macros.h"
 #include "libavutil/mem.h"
 #include "libavutil/qsort.h"
-#include "mathops.h"
+#include "libavutil/reverse.h"
 #include "put_bits.h"
 #include "vlc.h"
 
@@ -134,6 +133,14 @@ static int alloc_table(VLC *vlc, int size, int use_static)
 
 #define LOCALBUF_ELEMS 1500 // the maximum currently needed is 1296 by rv34
 
+static av_always_inline uint32_t bitswap_32(uint32_t x)
+{
+    return (uint32_t)ff_reverse[ x        & 0xFF] << 24 |
+           (uint32_t)ff_reverse[(x >> 8)  & 0xFF] << 16 |
+           (uint32_t)ff_reverse[(x >> 16) & 0xFF] << 8  |
+           (uint32_t)ff_reverse[ x >> 24];
+}
+
 typedef struct VLCcode {
     uint8_t bits;
     VLC_TYPE symbol;
diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c
index 0458856580..3ea3f38eee 100644
--- a/libavcodec/dstdec.c
+++ b/libavcodec/dstdec.c
@@ -27,6 +27,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mem_internal.h"
+#include "libavutil/reverse.h"
 #include "codec_internal.h"
 #include "internal.h"
 #include "get_bits.h"
diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index 1c35664318..239e0e492f 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -25,7 +25,6 @@
 #include <stdint.h>
 
 #include "libavutil/common.h"
-#include "libavutil/reverse.h"
 #include "config.h"
 
 #define MAX_NEG_CROP 1024
@@ -240,12 +239,4 @@ static inline int8_t ff_u8_to_s8(uint8_t a)
     return b.s8;
 }
 
-static av_always_inline uint32_t bitswap_32(uint32_t x)
-{
-    return (uint32_t)ff_reverse[ x        & 0xFF] << 24 |
-           (uint32_t)ff_reverse[(x >> 8)  & 0xFF] << 16 |
-           (uint32_t)ff_reverse[(x >> 16) & 0xFF] << 8  |
-           (uint32_t)ff_reverse[ x >> 24];
-}
-
 #endif /* AVCODEC_MATHOPS_H */
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 6110e63af8..6b6cadeb05 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -34,6 +34,7 @@
 #include "libavutil/imgutils.h"
 #include "libavutil/internal.h"
 #include "libavutil/mem_internal.h"
+#include "libavutil/reverse.h"
 #include "libavutil/stereo3d.h"
 #include "libavutil/timecode.h"
 
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 1e83b356ac..aaccd86199 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -28,6 +28,7 @@
 #include "config_components.h"
 #include "libavutil/attributes.h"
 #include "libavutil/float_dsp.h"
+#include "libavutil/reverse.h"
 #include "libavutil/thread.h"
 #include "avcodec.h"
 #include "bytestream.h"
diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c
index 2c0cfc699a..d90549e487 100644
--- a/libavcodec/s302m.c
+++ b/libavcodec/s302m.c
@@ -24,6 +24,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/opt.h"
 #include "libavutil/log.h"
+#include "libavutil/reverse.h"
 #include "avcodec.h"
 #include "codec_internal.h"
 #include "internal.h"
diff --git a/libavcodec/s302menc.c b/libavcodec/s302menc.c
index ad5186d69c..737fc94697 100644
--- a/libavcodec/s302menc.c
+++ b/libavcodec/s302menc.c
@@ -21,6 +21,7 @@
  */
 
 #include "libavutil/channel_layout.h"
+#include "libavutil/reverse.h"
 #include "avcodec.h"
 #include "codec_internal.h"
 #include "encode.h"
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 88ac838587..fdd3ae5c68 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -39,6 +39,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/opt.h"
+#include "libavutil/reverse.h"
 #include "avcodec.h"
 #include "bytestream.h"
 #include "codec_internal.h"
diff --git a/libavcodec/xbmdec.c b/libavcodec/xbmdec.c
index 0ea5883024..9dbd0ac571 100644
--- a/libavcodec/xbmdec.c
+++ b/libavcodec/xbmdec.c
@@ -21,6 +21,7 @@
  */
 
 #include "libavutil/avstring.h"
+#include "libavutil/reverse.h"
 
 #include "avcodec.h"
 #include "codec_internal.h"
diff --git a/libavcodec/xbmenc.c b/libavcodec/xbmenc.c
index d578eec930..95db87dba6 100644
--- a/libavcodec/xbmenc.c
+++ b/libavcodec/xbmenc.c
@@ -20,6 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/reverse.h"
 #include "avcodec.h"
 #include "codec_internal.h"
 #include "encode.h"
-- 
2.32.0



More information about the ffmpeg-devel mailing list