From 81c6b8ffe87bf01c4ba7d22773b0aeda4376d37c Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sun, 12 Dec 2021 20:36:05 +0100 Subject: [PATCH] avcodec/mpegvideo: Move closed_gop to Mpeg1Context Only used there and only by the main thread. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpeg12dec.c | 8 +++++--- libavcodec/mpegvideo.c | 1 - libavcodec/mpegvideo.h | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 09b2902bca..672031b6db 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -69,6 +69,7 @@ typedef struct Mpeg1Context { int rc_buffer_size; AVRational frame_rate_ext; /* MPEG-2 specific framerate modificator */ int sync; /* Did we reach a sync point like a GOP/SEQ/KEYFrame? */ + int closed_gop; int tmpgexs; int first_slice; int extradata_decoded; @@ -2449,7 +2450,7 @@ static void mpeg_decode_gop(AVCodecContext *avctx, tc = s-> timecode_frame_start = get_bits(&s->gb, 25); - s->closed_gop = get_bits1(&s->gb); + s1->closed_gop = get_bits1(&s->gb); /* broken_link indicates that after editing the * reference frames of the first B-Frames after GOP I-Frame * are missing (open gop) */ @@ -2460,7 +2461,7 @@ static void mpeg_decode_gop(AVCodecContext *avctx, av_timecode_make_mpeg_tc_string(tcbuf, tc); av_log(s->avctx, AV_LOG_DEBUG, "GOP (%s) closed_gop=%d broken_link=%d\n", - tcbuf, s->closed_gop, broken_link); + tcbuf, s1->closed_gop, broken_link); } } @@ -2694,7 +2695,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, /* Skip B-frames if we do not have reference frames and * GOP is not closed. */ if (s2->pict_type == AV_PICTURE_TYPE_B) { - if (!s2->closed_gop) { + if (!s->closed_gop) { skip_frame = 1; av_log(s2->avctx, AV_LOG_DEBUG, "Skipping B slice due to open GOP\n"); @@ -2882,6 +2883,7 @@ static void flush(AVCodecContext *avctx) Mpeg1Context *s = avctx->priv_data; s->sync = 0; + s->closed_gop = 0; ff_mpeg_flush(avctx); } diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index ba5b51955e..55399a7478 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -2317,7 +2317,6 @@ void ff_mpeg_flush(AVCodecContext *avctx){ ff_mpeg_unref_picture(s->avctx, &s->next_picture); s->mb_x= s->mb_y= 0; - s->closed_gop= 0; #if FF_API_FLAG_TRUNCATED s->parse_context.state= -1; diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index e90669b776..85f02b1355 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -198,7 +198,6 @@ typedef struct MpegEncContext { int *lambda_table; int adaptive_quant; ///< use adaptive quantization int dquant; ///< qscale difference to prev qscale - int closed_gop; ///< MPEG1/2 GOP is closed int pict_type; ///< AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ... int vbv_delay; int last_pict_type; //FIXME removes