[FFmpeg-devel] [PATCH 3/4] avcodec/mjpegdec: Decode to PAL8 independant of the location of LSE

Michael Niedermayer michael at niedermayer.cc
Mon May 3 21:59:37 EEST 2021


On Sun, May 02, 2021 at 02:51:20PM -0300, James Almer wrote:
> On 5/2/2021 10:59 AM, Michael Niedermayer wrote:
> > This simply performs a 2nd pass if a LSE is encountered with GRAY8
> > 
> > Fixes: tickets/3933/128.jls
> > 
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >   libavcodec/jpeglsdec.c |  6 ++++--
> >   libavcodec/mjpegdec.c  | 10 +++++++---
> >   libavcodec/mjpegdec.h  |  1 +
> >   3 files changed, 12 insertions(+), 5 deletions(-)
> > 
> > diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
> > index d79bbe1ee3..bd9224d97d 100644
> > --- a/libavcodec/jpeglsdec.c
> > +++ b/libavcodec/jpeglsdec.c
> > @@ -118,8 +118,10 @@ int ff_jpegls_decode_lse(MJpegDecodeContext *s)
> >                   shift = 8 - s->avctx->bits_per_raw_sample;
> >               }
> > -            s->picture_ptr->format =
> > -            s->avctx->pix_fmt = AV_PIX_FMT_PAL8;
> > +            s->force_pal8 = 1;
> > +            if (!pal)
> > +                return 1;
> > +
> >               for (i=s->palette_index; i<=maxtab; i++) {
> 
> Can maxtab be < 255? The palette may need to be zeroed in that case, because
> get_buffer2 does not require this from implementations.
> avcodec_default_get_buffer2() does it when allocating buffers in the pool,
> though, but not after fetching them, so reused buffers may be dirty. They
> will also be dirty if memory_poisoning is enabled.

will clear the palette after obtaining the picture
and will apply the patchset

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- 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/20210503/d7f7becc/attachment.sig>


More information about the ffmpeg-devel mailing list