[FFmpeg-cvslog] avcodec/flvenc: Move ff_flv2_encode_ac_esc() to ituh263enc.c

Andreas Rheinhardt git at videolan.org
Sat Jun 21 23:21:03 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun May 25 22:20:23 2025 +0200| [514e5ea0db841416c0bc86bb536c83ecdae2dc2f] | committer: Andreas Rheinhardt

avcodec/flvenc: Move ff_flv2_encode_ac_esc() to ituh263enc.c

This is the only place where it is used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=514e5ea0db841416c0bc86bb536c83ecdae2dc2f
---

 libavcodec/flvenc.c     | 22 ----------------------
 libavcodec/flvenc.h     |  4 ----
 libavcodec/ituh263enc.c | 24 +++++++++++++++++++++++-
 3 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/libavcodec/flvenc.c b/libavcodec/flvenc.c
index 184e688ebd..4143e7eecf 100644
--- a/libavcodec/flvenc.c
+++ b/libavcodec/flvenc.c
@@ -67,28 +67,6 @@ int ff_flv_encode_picture_header(MPVMainEncContext *const m)
     return 0;
 }
 
-void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level,
-                           int run, int last)
-{
-    unsigned code;
-    int bits;
-    if (level < 64) { // 7-bit level
-        bits = 1 + 1 + 6 + 7;
-        code = (0 << (1 + 6 + 7)) |
-               (last <<  (6 + 7)) |
-               (run << 7) |
-               (slevel & 0x7f);
-    } else {
-        /* 11-bit level */
-        bits = 1 + 1 + 6 + 11;
-        code = (1 << (1 + 6 + 11)) |
-               (last <<  (6 + 11)) |
-               (run << 11) |
-               (slevel & 0x7ff);
-    }
-    put_bits(pb, bits, code);
-}
-
 const FFCodec ff_flv_encoder = {
     .p.name         = "flv",
     CODEC_LONG_NAME("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)"),
diff --git a/libavcodec/flvenc.h b/libavcodec/flvenc.h
index 3dc7480376..a244145e42 100644
--- a/libavcodec/flvenc.h
+++ b/libavcodec/flvenc.h
@@ -21,12 +21,8 @@
 #ifndef AVCODEC_FLVENC_H
 #define AVCODEC_FLVENC_H
 
-#include "put_bits.h"
-
 typedef struct MPVMainEncContext MPVMainEncContext;
 
 int ff_flv_encode_picture_header(MPVMainEncContext *const m);
-void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level, int run,
-                           int last);
 
 #endif /* AVCODEC_FLV_H */
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index 8126bf5c84..35d6aea9b5 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -417,6 +417,28 @@ void ff_clean_h263_qscales(MPVEncContext *const s)
 
 static const int dquant_code[5]= {1,0,9,2,3};
 
+static void flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level,
+                               int run, int last)
+{
+    unsigned code;
+    int bits;
+    if (level < 64) { // 7-bit level
+        bits = 1 + 1 + 6 + 7;
+        code = (0 << (1 + 6 + 7)) |
+               (last <<  (6 + 7)) |
+               (run << 7) |
+               (slevel & 0x7f);
+    } else {
+        /* 11-bit level */
+        bits = 1 + 1 + 6 + 11;
+        code = (1 << (1 + 6 + 11)) |
+               (last <<  (6 + 11)) |
+               (run << 11) |
+               (slevel & 0x7ff);
+    }
+    put_bits(pb, bits, code);
+}
+
 /**
  * Encode an 8x8 block.
  * @param block the 8x8 block
@@ -522,7 +544,7 @@ static void h263_encode_block(MPVEncContext *const s, int16_t block[], int n)
                         put_sbits(&s->pb, 6, slevel>>5);
                     }
                 } else {
-                    ff_flv2_encode_ac_esc(&s->pb, slevel, level, run, last);
+                    flv2_encode_ac_esc(&s->pb, slevel, level, run, last);
                 }
             } else {
                 put_bits(&s->pb, 1, sign);



More information about the ffmpeg-cvslog mailing list