[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