[FFmpeg-cvslog] avcodec/mpeg12dec: Remove redundant save_width/height

Andreas Rheinhardt git at videolan.org
Wed May 21 04:27:25 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sat May 17 00:56:02 2025 +0200| [562192e28321e869c9e2f0c7434996a4687e2191] | committer: Andreas Rheinhardt

avcodec/mpeg12dec: Remove redundant save_width/height

These have been added in 29644cb504eee88bd40f95abaa392047946c6066
in 2007 at a time when the MPEG-1/2 parser just set
the AVCodecContext's dimensions when encountering a sequence header,
so that the checks for the coded dimensions didn't trigger.
Yet this is no more and so we can simply remove these redundant checks.

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

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

 libavcodec/mpeg12dec.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index e70261fd14..078f0fa999 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -80,7 +80,7 @@ typedef struct Mpeg1Context {
     int has_afd;
     int slice_count;
     unsigned aspect_ratio_info;
-    int save_width, save_height, save_progressive_seq, save_chroma_format;
+    int save_progressive_seq, save_chroma_format;
     AVRational frame_rate_ext;  /* MPEG-2 specific framerate modificator */
     unsigned frame_rate_index;
     int sync;                   /* Did we reach a sync point like a GOP/SEQ/KEYFrame? */
@@ -915,8 +915,6 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
     if (!s->context_initialized                             ||
         avctx->coded_width       != s->width                ||
         avctx->coded_height      != s->height               ||
-        s1->save_width           != s->width                ||
-        s1->save_height          != s->height               ||
         s1->save_chroma_format   != s->chroma_format        ||
         (s1->save_progressive_seq != s->progressive_sequence && FFALIGN(s->height, 16) != FFALIGN(s->height, 32)) ||
         0) {
@@ -934,8 +932,6 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
                    (s1->bit_rate != 0x3FFFF*400 || s1->vbv_delay != 0xFFFF)) {
             avctx->bit_rate = s1->bit_rate;
         }
-        s1->save_width           = s->width;
-        s1->save_height          = s->height;
         s1->save_progressive_seq = s->progressive_sequence;
         s1->save_chroma_format   = s->chroma_format;
 
@@ -1863,8 +1859,6 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
     } else {
         s->codec_id              = s->avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
     }
-    s1->save_width           = s->width;
-    s1->save_height          = s->height;
     s1->save_progressive_seq = s->progressive_sequence;
     s1->save_chroma_format   = s->chroma_format;
     return 0;



More information about the ffmpeg-cvslog mailing list