[FFmpeg-cvslog] avcodec/mpegvideo: make mc_mb_var_sum / mb_var_sum 64bit

Michael Niedermayer git at videolan.org
Sun Mar 23 21:12:15 CET 2014


ffmpeg | branch: release/2.2 | Michael Niedermayer <michaelni at gmx.at> | Fri Mar 21 18:24:56 2014 +0100| [dca463b728c1d2c228b7b911dac812300bd0258b] | committer: Michael Niedermayer

avcodec/mpegvideo: make mc_mb_var_sum / mb_var_sum 64bit

This avoids a hypothetical integer overflow with very high resolution video

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit e92a78a4095d69d876bef189225608a35166dc4a)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/mpegvideo.h     |    4 ++--
 libavcodec/mpegvideo_enc.c |    2 +-
 libavcodec/ratecontrol.c   |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 14a4439..92aac6d 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -195,8 +195,8 @@ typedef struct Picture{
     int mbaff;                  ///< h264 1 -> MBAFF frame 0-> not MBAFF
     int field_picture;          ///< whether or not the picture was encoded in separate fields
 
-    int mb_var_sum;             ///< sum of MB variance for current frame
-    int mc_mb_var_sum;          ///< motion compensated MB variance for current frame
+    int64_t mb_var_sum;         ///< sum of MB variance for current frame
+    int64_t mc_mb_var_sum;      ///< motion compensated MB variance for current frame
 
     int b_frame_score;
     int needs_realloc;          ///< Picture needs to be reallocated (eg due to a frame size change)
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 64d73dd..eaa80e2 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -3443,7 +3443,7 @@ static int encode_picture(MpegEncContext *s, int picture_number)
             s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA;
         if(s->msmpeg4_version >= 3)
             s->no_rounding=1;
-        av_dlog(s, "Scene change detected, encoding as I Frame %d %d\n",
+        av_dlog(s, "Scene change detected, encoding as I Frame %"PRId64" %"PRId64"\n",
                 s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum);
     }
 
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index 7db248e..31eae5b 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -46,7 +46,7 @@ void ff_write_pass1_stats(MpegEncContext *s)
 {
     snprintf(s->avctx->stats_out, 256,
              "in:%d out:%d type:%d q:%d itex:%d ptex:%d mv:%d misc:%d "
-             "fcode:%d bcode:%d mc-var:%d var:%d icount:%d skipcount:%d hbits:%d;\n",
+             "fcode:%d bcode:%d mc-var:%"PRId64" var:%"PRId64" icount:%d skipcount:%d hbits:%d;\n",
              s->current_picture_ptr->f.display_picture_number,
              s->current_picture_ptr->f.coded_picture_number,
              s->pict_type,
@@ -879,7 +879,7 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
     if (s->avctx->debug & FF_DEBUG_RC) {
         av_log(s->avctx, AV_LOG_DEBUG,
                "%c qp:%d<%2.1f<%d %d want:%d total:%d comp:%f st_q:%2.2f "
-               "size:%d var:%d/%d br:%d fps:%d\n",
+               "size:%d var:%"PRId64"/%"PRId64" br:%d fps:%d\n",
                av_get_picture_type_char(pict_type),
                qmin, q, qmax, picture_number,
                (int)wanted_bits / 1000, (int)s->total_bits / 1000,



More information about the ffmpeg-cvslog mailing list