[FFmpeg-devel] [PATCH] avcodec/zmbv: Simplify assigning decode_intra function pointer

Paul B Mahol onemda at gmail.com
Mon Oct 7 11:35:36 EEST 2019


lgtm

On 10/7/19, Andreas Rheinhardt <andreas.rheinhardt at gmail.com> wrote:
> zmbv has only one function for decoding intra frames, namely
> decode_intra. This can be used to simplify the process of choosing the
> right function pointer.
>
> This also removes spec-incompliant conversions between function pointers
> and pointers of type void * and thereby fixes the warning "ISO C forbids
> assignment between function pointer and ‘void *’" that GCC emits with
> the -pedantic option.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
>  libavcodec/zmbv.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
> index 99e735cfd9..8e9e13c936 100644
> --- a/libavcodec/zmbv.c
> +++ b/libavcodec/zmbv.c
> @@ -425,7 +425,6 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame, AVPac
>      c->flags = buf[0];
>      buf++; len--;
>      if (c->flags & ZMBV_KEYFRAME) {
> -        void *decode_intra = NULL;
>          c->decode_intra= NULL;
>
>          if (len < 6)
> @@ -436,7 +435,6 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame, AVPac
>          c->fmt = buf[3];
>          c->bw = buf[4];
>          c->bh = buf[5];
> -        c->decode_intra = NULL;
>          c->decode_xor = NULL;
>
>          buf += 6;
> @@ -460,7 +458,6 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame, AVPac
>          switch (c->fmt) {
>          case ZMBV_FMT_8BPP:
>              c->bpp = 8;
> -            decode_intra = zmbv_decode_intra;
>              c->decode_xor = zmbv_decode_xor_8;
>              avctx->pix_fmt = AV_PIX_FMT_PAL8;
>              c->stride = c->width;
> @@ -468,7 +465,6 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame, AVPac
>          case ZMBV_FMT_15BPP:
>          case ZMBV_FMT_16BPP:
>              c->bpp = 16;
> -            decode_intra = zmbv_decode_intra;
>              c->decode_xor = zmbv_decode_xor_16;
>              if (c->fmt == ZMBV_FMT_15BPP)
>                  avctx->pix_fmt = AV_PIX_FMT_RGB555LE;
> @@ -479,7 +475,6 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame, AVPac
>  #ifdef ZMBV_ENABLE_24BPP
>          case ZMBV_FMT_24BPP:
>              c->bpp = 24;
> -            decode_intra = zmbv_decode_intra;
>              c->decode_xor = zmbv_decode_xor_24;
>              avctx->pix_fmt = AV_PIX_FMT_BGR24;
>              c->stride = c->width * 3;
> @@ -487,7 +482,6 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame, AVPac
>  #endif //ZMBV_ENABLE_24BPP
>          case ZMBV_FMT_32BPP:
>              c->bpp = 32;
> -            decode_intra = zmbv_decode_intra;
>              c->decode_xor = zmbv_decode_xor_32;
>              avctx->pix_fmt = AV_PIX_FMT_BGR0;
>              c->stride = c->width * 4;
> @@ -517,7 +511,7 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame, AVPac
>          }
>          memset(c->cur, 0, avctx->width * avctx->height * (c->bpp / 8));
>          memset(c->prev, 0, avctx->width * avctx->height * (c->bpp / 8));
> -        c->decode_intra= decode_intra;
> +        c->decode_intra = zmbv_decode_intra;
>      }
>      if (c->flags & ZMBV_KEYFRAME) {
>          expected_size = avctx->width * avctx->height * (c->bpp / 8);
> --
> 2.20.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list