[FFmpeg-devel] [FFmpeg-cvslog] avcodec/mjpegenc: Simplify allocating huffman table
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Thu Mar 27 13:38:51 EET 2025
Andreas Rheinhardt:
> Michael Niedermayer:
>> On Wed, Mar 26, 2025 at 04:08:55AM +0000, Andreas Rheinhardt wrote:
>>> ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon Mar 3 02:36:55 2025 +0100| [24dbc4c2e82481f89d6fcacee1949e5038c5c2fc] | committer: Andreas Rheinhardt
>>>
>>> avcodec/mjpegenc: Simplify allocating huffman table
>>>
>>> Reuse the already computed value of macroblocks; use an array
>>> instead of a switch, evaluate 64 * sizeof(MJpegHuffmanCode)
>>> at compile-time.
>>>
>>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
>>>
>>>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=24dbc4c2e82481f89d6fcacee1949e5038c5c2fc
>>> ---
>>>
>>> libavcodec/mjpegenc.c | 24 ++++++++++--------------
>>> 1 file changed, 10 insertions(+), 14 deletions(-)
>>
>> Breaks: (did not investigate why)
>>
>> ./ffmpeg -i lena.pnm -strict -1 -s 4096x2048 -bitexact -y /tmp/file-4096x2048.m2v && ./ffmpeg -i /tmp/file-4096x2048.m2v -y -bitexact /tmp/file-4096x2048-dec.jpg
>>
>> [vost#0:0/mjpeg @ 0x5576d6b7ab00] [enc:mjpeg @ 0x5576d6b79580] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
>> [vf#0:0 @ 0x5576d6b7f140] Error sending frames to consumers: Cannot allocate memory
>> [vf#0:0 @ 0x5576d6b7f140] Task finished with error code: -12 (Cannot allocate memory)
>> [vf#0:0 @ 0x5576d6b7f140] Terminating thread with return code -12 (Cannot allocate memory)
>> [vost#0:0/mjpeg @ 0x5576d6b7ab00] [enc:mjpeg @ 0x5576d6b79580] Could not open encoder before EOF
>> [vost#0:0/mjpeg @ 0x5576d6b7ab00] Task finished with error code: -22 (Invalid argument)
>> [vost#0:0/mjpeg @ 0x5576d6b7ab00] Terminating thread with return code -22 (Invalid argument)
>> [out#0/image2 @ 0x5576d6b7ec80] Nothing was written into output file, because at least one of its streams received no packets.
>>
>
> Patch attached. Thanks for testing.
>
> - Andreas
>
Will apply soon unless there are objections.
- Andreas
More information about the ffmpeg-devel
mailing list