[FFmpeg-devel] [PATCH 2/2] avcodec/mjpegdec: postpone calling ff_get_buffer() until the SOS marker
Michael Niedermayer
michael at niedermayer.cc
Thu Apr 22 16:01:37 EEST 2021
On Wed, Apr 21, 2021 at 02:40:55PM -0300, James Almer wrote:
> With JPEG-LS PAL8 samples, the JPEG-LS extension parameters signaled with
> the LSE marker show up after SOF but before SOS. For those, the pixel format
> chosen by get_format() in SOF is GRAY8, and then replaced by PAL8 in LSE.
> This has not been an issue given both pixel formats allocate the second data
> plane for the palette, but after the upcoming soname bump, GRAY8 will no longer
> do that. This will result in segfauls when ff_jpegls_decode_lse() attempts to
> write the palette on a buffer originally allocated as a GRAY8 one.
>
> Work around this by calling ff_get_buffer() after the actual pixel format is
> known.
>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> With this, the removal of AV_PIX_FMT_FLAG_PSEUDOPAL will no longer generate
> segfauls.
> I can't test hwaccels like vaapi to ensure things still work as inteded, seeing
> i also had to move the call to start_frame().
>
> Better solutions are very much welcome.
>
> libavcodec/jpeglsdec.c | 6 ++--
> libavcodec/mjpegdec.c | 72 +++++++++++++++++++++++-------------------
> libavcodec/mjpegdec.h | 2 ++
> 3 files changed, 43 insertions(+), 37 deletions(-)
this causes a change in one timestamp on decode of:
./ffmpeg -ss 1.2 -i ~/tickets/3245/bad-example.mov -vframes 10 outnew.avi
./ffmpeg -i out.avi -f framecrc /tmp/crc
--- /tmp/crc 2021-04-22 14:56:47.981354127 +0200
+++ /tmp/crcnew 2021-04-22 14:56:32.373271448 +0200
@@ -23,8 +23,8 @@
0, 4, 4, 1, 622080, 0xf24584d3
1, 8064, 8064, 1152, 4608, 0x70bf8dc7
1, 9216, 9216, 1152, 4608, 0xd00f873a
+0, 5, 5, 1, 622080, 0x5f8afe7d
1, 10368, 10368, 1152, 4608, 0xd45d84b8
-0, 6, 6, 1, 622080, 0x5f8afe7d
1, 11520, 11520, 1152, 4608, 0x64b5866e
1, 12672, 12672, 1152, 4608, 0x36a18daf
0, 7, 7, 1, 622080, 0x09918d93
I did not investigate why or if that is even a issue, just wanted to
report it
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The smallest minority on earth is the individual. Those who deny
individual rights cannot claim to be defenders of minorities. - Ayn Rand
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210422/94ec1cba/attachment.sig>
More information about the ffmpeg-devel
mailing list