diff mbox series

[FFmpeg-devel,01/10] avcodec/mpeg12dec: Don't set write-only variable

Message ID AM7PR03MB6660E16D4E4345D825454C178F4B9@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 750c765ca421ba4546461f803f9ce2396399fb67
Headers show
Series [FFmpeg-devel,01/10] avcodec/mpeg12dec: Don't set write-only variable | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 5, 2022, 9:53 p.m. UTC
MpegEncContext.picture_number is write-only for MPEG-1/2 decoding.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpeg12dec.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Andreas Rheinhardt Jan. 8, 2022, 1:08 p.m. UTC | #1
Andreas Rheinhardt:
> MpegEncContext.picture_number is write-only for MPEG-1/2 decoding.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/mpeg12dec.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index 35dfc74fe7..6ad9fb245c 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -1066,7 +1066,6 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
>  
>      s2->chroma_format              = 1;
>      s->mpeg_enc_ctx_allocated      = 0;
> -    s->mpeg_enc_ctx.picture_number = 0;
>      s->repeat_field                = 0;
>      avctx->color_range             = AVCOL_RANGE_MPEG;
>      return 0;
> @@ -1092,9 +1091,6 @@ static int mpeg_decode_update_thread_context(AVCodecContext *avctx,
>      if (!ctx->mpeg_enc_ctx_allocated)
>          memcpy(s + 1, s1 + 1, sizeof(Mpeg1Context) - sizeof(MpegEncContext));
>  
> -    if (!(s->pict_type == AV_PICTURE_TYPE_B || s->low_delay))
> -        s->picture_number++;
> -
>      return 0;
>  }
>  #endif
> @@ -2072,10 +2068,7 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict)
>              ff_print_debug_info(s, s->current_picture_ptr, pict);
>              ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG2);
>          } else {
> -            if (avctx->active_thread_type & FF_THREAD_FRAME)
> -                s->picture_number++;
>              /* latency of 1 frame for I- and P-frames */
> -            /* XXX: use another variable than picture_number */
>              if (s->last_picture_ptr) {
>                  int ret = av_frame_ref(pict, s->last_picture_ptr->f);
>                  if (ret < 0)
> 

Will apply this patchset tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 35dfc74fe7..6ad9fb245c 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1066,7 +1066,6 @@  static av_cold int mpeg_decode_init(AVCodecContext *avctx)
 
     s2->chroma_format              = 1;
     s->mpeg_enc_ctx_allocated      = 0;
-    s->mpeg_enc_ctx.picture_number = 0;
     s->repeat_field                = 0;
     avctx->color_range             = AVCOL_RANGE_MPEG;
     return 0;
@@ -1092,9 +1091,6 @@  static int mpeg_decode_update_thread_context(AVCodecContext *avctx,
     if (!ctx->mpeg_enc_ctx_allocated)
         memcpy(s + 1, s1 + 1, sizeof(Mpeg1Context) - sizeof(MpegEncContext));
 
-    if (!(s->pict_type == AV_PICTURE_TYPE_B || s->low_delay))
-        s->picture_number++;
-
     return 0;
 }
 #endif
@@ -2072,10 +2068,7 @@  static int slice_end(AVCodecContext *avctx, AVFrame *pict)
             ff_print_debug_info(s, s->current_picture_ptr, pict);
             ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG2);
         } else {
-            if (avctx->active_thread_type & FF_THREAD_FRAME)
-                s->picture_number++;
             /* latency of 1 frame for I- and P-frames */
-            /* XXX: use another variable than picture_number */
             if (s->last_picture_ptr) {
                 int ret = av_frame_ref(pict, s->last_picture_ptr->f);
                 if (ret < 0)