[FFmpeg-devel] [PATCH] avcodec/jpeglsenc: Remove redundant pixel format checks
    James Almer 
    jamrial at gmail.com
       
    Tue Apr 13 02:39:13 EEST 2021
    
    
  
On 4/12/2021 2:07 PM, Andreas Rheinhardt wrote:
> This encoder has AVCodec.pix_fmts set, so ff_encode_preinit() already
> checks for this.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
> Will apply tomorrow unless there are objections.
> 
>   libavcodec/jpeglsenc.c | 8 --------
>   1 file changed, 8 deletions(-)
> 
> diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c
> index 2bb6b1407a..d03ce32f41 100644
> --- a/libavcodec/jpeglsenc.c
> +++ b/libavcodec/jpeglsenc.c
> @@ -429,14 +429,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
>   FF_ENABLE_DEPRECATION_WARNINGS
>   #endif
>   
> -    if (ctx->pix_fmt != AV_PIX_FMT_GRAY8  &&
> -        ctx->pix_fmt != AV_PIX_FMT_GRAY16 &&
> -        ctx->pix_fmt != AV_PIX_FMT_RGB24  &&
> -        ctx->pix_fmt != AV_PIX_FMT_BGR24) {
> -        av_log(ctx, AV_LOG_ERROR,
> -               "Only grayscale and RGB24/BGR24 images are supported\n");
> -        return -1;
> -    }
>       return 0;
>   }
nit: The only code left in this function after this patch will be gone 
after the bump, so maybe either wrap the entire function (and the 
AVCodec initializer) with the relevant check, or postpone applying this 
patch until after the bump so you can remove the whole thing in one go.
LGTM regardless of the above.
    
    
More information about the ffmpeg-devel
mailing list