[FFmpeg-devel] [PATCH 3/5] avcodec/mpegvideo: remove picture_number parameter from encode functions

Marton Balint cus at passwd.hu
Tue Jan 24 02:13:20 EET 2023


They are unused.

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavcodec/flvenc.c        |  2 +-
 libavcodec/flvenc.h        |  2 +-
 libavcodec/h261enc.c       |  2 +-
 libavcodec/h261enc.h       |  2 +-
 libavcodec/h263enc.h       |  2 +-
 libavcodec/ituh263enc.c    |  2 +-
 libavcodec/mpeg12enc.c     |  2 +-
 libavcodec/mpeg12enc.h     |  2 +-
 libavcodec/mpeg4videoenc.c |  2 +-
 libavcodec/mpeg4videoenc.h |  2 +-
 libavcodec/mpegvideo_enc.c | 26 ++++++++++++--------------
 libavcodec/msmpeg4enc.c    |  2 +-
 libavcodec/msmpeg4enc.h    |  2 +-
 libavcodec/rv10enc.c       |  2 +-
 libavcodec/rv10enc.h       |  4 ++--
 libavcodec/rv20enc.c       |  2 +-
 libavcodec/wmv2enc.c       |  2 +-
 libavcodec/wmv2enc.h       |  2 +-
 18 files changed, 30 insertions(+), 32 deletions(-)

diff --git a/libavcodec/flvenc.c b/libavcodec/flvenc.c
index b49ca2e0d5..3329eb0d90 100644
--- a/libavcodec/flvenc.c
+++ b/libavcodec/flvenc.c
@@ -25,7 +25,7 @@
 #include "mpegvideodata.h"
 #include "mpegvideoenc.h"
 
-void ff_flv_encode_picture_header(MpegEncContext *s, int picture_number)
+void ff_flv_encode_picture_header(MpegEncContext *s)
 {
     int format;
 
diff --git a/libavcodec/flvenc.h b/libavcodec/flvenc.h
index aaa0fcffab..1ecbb46b17 100644
--- a/libavcodec/flvenc.h
+++ b/libavcodec/flvenc.h
@@ -24,7 +24,7 @@
 #include "mpegvideo.h"
 #include "put_bits.h"
 
-void ff_flv_encode_picture_header(MpegEncContext *s, int picture_number);
+void ff_flv_encode_picture_header(MpegEncContext *s);
 void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level, int run,
                            int last);
 
diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c
index e8ea357cbb..9d6c9a055f 100644
--- a/libavcodec/h261enc.c
+++ b/libavcodec/h261enc.c
@@ -52,7 +52,7 @@ typedef struct H261EncContext {
     } format;
 } H261EncContext;
 
-void ff_h261_encode_picture_header(MpegEncContext *s, int picture_number)
+void ff_h261_encode_picture_header(MpegEncContext *s)
 {
     H261EncContext *const h = (H261EncContext *)s;
     int temp_ref;
diff --git a/libavcodec/h261enc.h b/libavcodec/h261enc.h
index 102e994494..d8fdcad7aa 100644
--- a/libavcodec/h261enc.h
+++ b/libavcodec/h261enc.h
@@ -33,7 +33,7 @@
 void ff_h261_reorder_mb_index(MpegEncContext *s);
 void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64],
                        int motion_x, int motion_y);
-void ff_h261_encode_picture_header(MpegEncContext *s, int picture_number);
+void ff_h261_encode_picture_header(MpegEncContext *s);
 int ff_h261_encode_init(MpegEncContext *s);
 
 #endif
diff --git a/libavcodec/h263enc.h b/libavcodec/h263enc.h
index fff85a18f2..e45475686e 100644
--- a/libavcodec/h263enc.h
+++ b/libavcodec/h263enc.h
@@ -25,7 +25,7 @@
 #include "mpegvideoenc.h"
 
 void ff_h263_encode_init(MpegEncContext *s);
-void ff_h263_encode_picture_header(MpegEncContext *s, int picture_number);
+void ff_h263_encode_picture_header(MpegEncContext *s);
 void ff_h263_encode_gob_header(MpegEncContext * s, int mb_line);
 void ff_h263_encode_mb(MpegEncContext *s,
                        int16_t block[6][64],
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index 22e5a8368d..b52b9da52c 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -105,7 +105,7 @@ av_const int ff_h263_aspect_to_info(AVRational aspect){
     return FF_ASPECT_EXTENDED;
 }
 
-void ff_h263_encode_picture_header(MpegEncContext * s, int picture_number)
+void ff_h263_encode_picture_header(MpegEncContext * s)
 {
     int format, coded_frame_rate, coded_frame_rate_base, i, temp_ref;
     int best_clock_code=1;
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 3ad1cd84a1..a6663a158b 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -468,7 +468,7 @@ void ff_mpeg1_encode_slice_header(MpegEncContext *s)
     put_bits(&s->pb, 1, 0);
 }
 
-void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
+void ff_mpeg1_encode_picture_header(MpegEncContext *s)
 {
     MPEG12EncContext *const mpeg12 = (MPEG12EncContext*)s;
     AVFrameSideData *side_data;
diff --git a/libavcodec/mpeg12enc.h b/libavcodec/mpeg12enc.h
index 0455e5e4e2..0b35af8a30 100644
--- a/libavcodec/mpeg12enc.h
+++ b/libavcodec/mpeg12enc.h
@@ -26,7 +26,7 @@
 
 #include "mpegvideo.h"
 
-void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
+void ff_mpeg1_encode_picture_header(MpegEncContext *s);
 void ff_mpeg1_encode_mb(MpegEncContext *s, int16_t block[8][64],
                         int motion_x, int motion_y);
 void ff_mpeg1_encode_init(MpegEncContext *s);
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index e327334d59..27df9ba098 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -1056,7 +1056,7 @@ static void mpeg4_encode_vol_header(MpegEncContext *s,
 }
 
 /* write MPEG-4 VOP header */
-int ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number)
+int ff_mpeg4_encode_picture_header(MpegEncContext *s)
 {
     uint64_t time_incr;
     int64_t time_div, time_mod;
diff --git a/libavcodec/mpeg4videoenc.h b/libavcodec/mpeg4videoenc.h
index 243cd297a2..f0d5c3d077 100644
--- a/libavcodec/mpeg4videoenc.h
+++ b/libavcodec/mpeg4videoenc.h
@@ -32,7 +32,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s,
                         int16_t block[6][64],
                         int motion_x, int motion_y);
 void ff_set_mpeg4_time(MpegEncContext *s);
-int ff_mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
+int ff_mpeg4_encode_picture_header(MpegEncContext *s);
 
 void ff_mpeg4_encode_video_packet_header(MpegEncContext *s);
 void ff_mpeg4_stuffing(PutBitContext *pbc);
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 9b11c5c05a..bb101612e5 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -83,7 +83,7 @@
 #define QMAT_SHIFT_MMX 16
 #define QMAT_SHIFT 21
 
-static int encode_picture(MpegEncContext *s, int picture_number);
+static int encode_picture(MpegEncContext *s);
 static int dct_quantize_refine(MpegEncContext *s, int16_t *block, int16_t *weight, int16_t *orig, int n, int qscale);
 static int sse_mb(MpegEncContext *s);
 static void denoise_dct_c(MpegEncContext *s, int16_t *block);
@@ -1795,7 +1795,7 @@ int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
         if (ret < 0)
             return ret;
 vbv_retry:
-        ret = encode_picture(s, s->picture_number);
+        ret = encode_picture(s);
         if (growing_buffer) {
             av_assert0(s->pb.buf == avctx->internal->byte_buffer);
             pkt->data = s->pb.buf;
@@ -3556,14 +3556,12 @@ static void set_frame_distances(MpegEncContext * s){
     }
 }
 
-static int encode_picture(MpegEncContext *s, int picture_number)
+static int encode_picture(MpegEncContext *s)
 {
     int i, ret;
     int bits;
     int context_count = s->slice_context_count;
 
-    s->picture_number = picture_number;
-
     /* Reset the average MB variance */
     s->me.mb_var_sum_temp    =
     s->me.mc_mb_var_sum_temp = 0;
@@ -3788,32 +3786,32 @@ static int encode_picture(MpegEncContext *s, int picture_number)
         break;
     case FMT_H261:
         if (CONFIG_H261_ENCODER)
-            ff_h261_encode_picture_header(s, picture_number);
+            ff_h261_encode_picture_header(s);
         break;
     case FMT_H263:
         if (CONFIG_WMV2_ENCODER && s->codec_id == AV_CODEC_ID_WMV2)
-            ff_wmv2_encode_picture_header(s, picture_number);
+            ff_wmv2_encode_picture_header(s);
         else if (CONFIG_MSMPEG4ENC && s->msmpeg4_version)
-            ff_msmpeg4_encode_picture_header(s, picture_number);
+            ff_msmpeg4_encode_picture_header(s);
         else if (CONFIG_MPEG4_ENCODER && s->h263_pred) {
-            ret = ff_mpeg4_encode_picture_header(s, picture_number);
+            ret = ff_mpeg4_encode_picture_header(s);
             if (ret < 0)
                 return ret;
         } else if (CONFIG_RV10_ENCODER && s->codec_id == AV_CODEC_ID_RV10) {
-            ret = ff_rv10_encode_picture_header(s, picture_number);
+            ret = ff_rv10_encode_picture_header(s);
             if (ret < 0)
                 return ret;
         }
         else if (CONFIG_RV20_ENCODER && s->codec_id == AV_CODEC_ID_RV20)
-            ff_rv20_encode_picture_header(s, picture_number);
+            ff_rv20_encode_picture_header(s);
         else if (CONFIG_FLV_ENCODER && s->codec_id == AV_CODEC_ID_FLV1)
-            ff_flv_encode_picture_header(s, picture_number);
+            ff_flv_encode_picture_header(s);
         else if (CONFIG_H263_ENCODER)
-            ff_h263_encode_picture_header(s, picture_number);
+            ff_h263_encode_picture_header(s);
         break;
     case FMT_MPEG1:
         if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER)
-            ff_mpeg1_encode_picture_header(s, picture_number);
+            ff_mpeg1_encode_picture_header(s);
         break;
     default:
         av_assert0(0);
diff --git a/libavcodec/msmpeg4enc.c b/libavcodec/msmpeg4enc.c
index 9b6e5efa0c..8798b15152 100644
--- a/libavcodec/msmpeg4enc.c
+++ b/libavcodec/msmpeg4enc.c
@@ -216,7 +216,7 @@ static void find_best_tables(MSMPEG4EncContext *ms)
 }
 
 /* write MSMPEG4 compatible frame header */
-void ff_msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number)
+void ff_msmpeg4_encode_picture_header(MpegEncContext * s)
 {
     MSMPEG4EncContext *const ms = (MSMPEG4EncContext*)s;
 
diff --git a/libavcodec/msmpeg4enc.h b/libavcodec/msmpeg4enc.h
index 602e60112d..da9a45b589 100644
--- a/libavcodec/msmpeg4enc.h
+++ b/libavcodec/msmpeg4enc.h
@@ -34,7 +34,7 @@ typedef struct MSMPEG4EncContext {
 } MSMPEG4EncContext;
 
 void ff_msmpeg4_encode_init(MpegEncContext *s);
-void ff_msmpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
+void ff_msmpeg4_encode_picture_header(MpegEncContext *s);
 void ff_msmpeg4_encode_ext_header(MpegEncContext *s);
 void ff_msmpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64],
                           int motion_x, int motion_y);
diff --git a/libavcodec/rv10enc.c b/libavcodec/rv10enc.c
index d0704c5a4b..7f7477ad7b 100644
--- a/libavcodec/rv10enc.c
+++ b/libavcodec/rv10enc.c
@@ -31,7 +31,7 @@
 #include "put_bits.h"
 #include "rv10enc.h"
 
-int ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number)
+int ff_rv10_encode_picture_header(MpegEncContext *s)
 {
     int full_frame= 0;
 
diff --git a/libavcodec/rv10enc.h b/libavcodec/rv10enc.h
index 66672f8087..fc3665e839 100644
--- a/libavcodec/rv10enc.h
+++ b/libavcodec/rv10enc.h
@@ -23,7 +23,7 @@
 
 #include "mpegvideo.h"
 
-int ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number);
-void ff_rv20_encode_picture_header(MpegEncContext *s, int picture_number);
+int ff_rv10_encode_picture_header(MpegEncContext *s);
+void ff_rv20_encode_picture_header(MpegEncContext *s);
 
 #endif /* AVCODEC_RV10ENC_H */
diff --git a/libavcodec/rv20enc.c b/libavcodec/rv20enc.c
index 00f6c41e77..b1b88819db 100644
--- a/libavcodec/rv20enc.c
+++ b/libavcodec/rv20enc.c
@@ -34,7 +34,7 @@
 #include "put_bits.h"
 #include "rv10enc.h"
 
-void ff_rv20_encode_picture_header(MpegEncContext *s, int picture_number){
+void ff_rv20_encode_picture_header(MpegEncContext *s) {
     put_bits(&s->pb, 2, s->pict_type); //I 0 vs. 1 ?
     put_bits(&s->pb, 1, 0);     /* unknown bit */
     put_bits(&s->pb, 5, s->qscale);
diff --git a/libavcodec/wmv2enc.c b/libavcodec/wmv2enc.c
index 05f993525d..cdc450060b 100644
--- a/libavcodec/wmv2enc.c
+++ b/libavcodec/wmv2enc.c
@@ -93,7 +93,7 @@ static av_cold int wmv2_encode_init(AVCodecContext *avctx)
     return 0;
 }
 
-int ff_wmv2_encode_picture_header(MpegEncContext *s, int picture_number)
+int ff_wmv2_encode_picture_header(MpegEncContext *s)
 {
     WMV2EncContext *const w = (WMV2EncContext *) s;
 
diff --git a/libavcodec/wmv2enc.h b/libavcodec/wmv2enc.h
index 3f7f5104a6..263265acf3 100644
--- a/libavcodec/wmv2enc.h
+++ b/libavcodec/wmv2enc.h
@@ -23,7 +23,7 @@
 
 #include "mpegvideo.h"
 
-int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number);
+int ff_wmv2_encode_picture_header(MpegEncContext * s);
 void ff_wmv2_encode_mb(MpegEncContext * s, int16_t block[6][64],
                        int motion_x, int motion_y);
 
-- 
2.35.3



More information about the ffmpeg-devel mailing list