[FFmpeg-cvslog] avcodec/mpegvideo_enc: Don't reset statistics twice

Andreas Rheinhardt git at videolan.org
Wed Mar 26 06:10:48 EET 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed Mar 19 12:53:44 2025 +0100| [8b15979a4b49f2981c27a85f202bf29b6a1c0de7] | committer: Andreas Rheinhardt

avcodec/mpegvideo_enc: Don't reset statistics twice

This happens currently for the non-main slice contexts.
But these variables get reset at the start of encode_thread()
anyway for all slices, so this is unnecessary.

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

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

 libavcodec/mpegvideo_enc.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 9004720c9a..39b303b22a 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -3582,6 +3582,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
     return 0;
 }
 
+#define ADD(field)   dst->field += src->field;
 #define MERGE(field) dst->field += src->field; src->field=0
 static void merge_context_after_me(MPVEncContext *const dst, MPVEncContext *const src)
 {
@@ -3596,14 +3597,14 @@ static void merge_context_after_encode(MPVEncContext *const dst, MPVEncContext *
 
     MERGE(dct_count[0]); //note, the other dct vars are not part of the context
     MERGE(dct_count[1]);
-    MERGE(mv_bits);
-    MERGE(i_tex_bits);
-    MERGE(p_tex_bits);
-    MERGE(i_count);
-    MERGE(misc_bits);
-    MERGE(encoding_error[0]);
-    MERGE(encoding_error[1]);
-    MERGE(encoding_error[2]);
+    ADD(mv_bits);
+    ADD(i_tex_bits);
+    ADD(p_tex_bits);
+    ADD(i_count);
+    ADD(misc_bits);
+    ADD(encoding_error[0]);
+    ADD(encoding_error[1]);
+    ADD(encoding_error[2]);
 
     if (dst->dct_error_sum) {
         for(i=0; i<64; i++){



More information about the ffmpeg-cvslog mailing list