[FFmpeg-devel] [PATCH] avcodec/jpeglsenc: Remove redundant pixel format checks

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Apr 13 02:45:12 EEST 2021


James Almer:
> 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.
> 

I am aware of that and my current plan is to just remove the whole init
function in the patch that removes the coded frame. I don't think it
makes much sense to touch the #ifs and even add new ones.

> LGTM regardless of the above.


More information about the ffmpeg-devel mailing list