[FFmpeg-devel] [PATCH] avcodec/jpeglsdec: Don't allocate+free JPEGLSState for every frame

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Apr 20 18:47:01 EEST 2021


Michael Niedermayer:
> On Wed, Apr 14, 2021 at 11:21:40PM +0200, Andreas Rheinhardt wrote:
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
>> ---
>>  libavcodec/jpeglsdec.c | 16 ++++++++--------
>>  1 file changed, 8 insertions(+), 8 deletions(-)
> [...]
>> @@ -548,7 +548,7 @@ AVCodec ff_jpegls_decoder = {
>>      .long_name      = NULL_IF_CONFIG_SMALL("JPEG-LS"),
>>      .type           = AVMEDIA_TYPE_VIDEO,
>>      .id             = AV_CODEC_ID_JPEGLS,
>> -    .priv_data_size = sizeof(MJpegDecodeContext),
>> +    .priv_data_size = sizeof(JpegLSDecodeContext),
>>      .init           = ff_mjpeg_decode_init,
>>      .close          = ff_mjpeg_decode_end,
> 
> Sorry for not spotting this before it was applied but this feels problematic
> a mjpeg could contain jpeg-ls
> in fact iam pretty sure you can mix lossless and lossy coding in a single jpeg
> image. Not sure if there is something in jpeg-ls that would prevent it from
> being part of the mix.
> I think its easier/more robust if the same context type would be used
> 
I am now looking at this again and there is indeed nothing that prevents
other codecs using ff_mjpeg_decode_init() from calling
ff_jpegls_decode_picture(). I don't know why I didn't check this
earlier, sorry for that. And thanks. Will fix it.

- Andreas


More information about the ffmpeg-devel mailing list