[FFmpeg-devel] [PATCH 1/2] libavcodec/jpeg2000dec: Enhance pix fmt selection

Gautam Ramakrishnan gautamramk at gmail.com
Thu Jul 2 06:10:05 EEST 2020


On Thu, Jul 2, 2020 at 3:42 AM Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
>
> Am Mi., 1. Juli 2020 um 20:34 Uhr schrieb <gautamramk at gmail.com>:
> >
> > From: Gautam Ramakrishnan <gautamramk at gmail.com>
> >
> > This patch assigns default pix format values when
> > a match does not take place.
> > ---
> >  libavcodec/jpeg2000dec.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> > index 3f4a9ef96c..86f9170723 100644
> > --- a/libavcodec/jpeg2000dec.c
> > +++ b/libavcodec/jpeg2000dec.c
> > @@ -436,6 +436,15 @@ static int get_siz(Jpeg2000DecoderContext *s)
> >                  s->cdef[3] = 3;
> >                  i = 0;
> >              }
> > +        } else if (ncomponents == 3 && s->precision == 8) {
> > +            s->avctx->pix_fmt = AV_PIX_FMT_RGB24;
> > +            i = 0;
> > +        } else if (ncomponents == 2 && s->precision == 8) {
> > +            s->avctx->pix_fmt = AV_PIX_FMT_YA8;
> > +            i = 0;
>
> Which samples does this fix / why is this a good idea?
Sorry I missed out on this. This is for samples p0_10.j2k,
p1_01.j2k and p1_07.j2k. I finally fully understood what
pix_fmt_match() was doing and realized a previous patch,
which removes a check based on log2_chroma_wh was a bad
idea.I felt that pix_fmt_match was rejecting a few samples just
because the subsampling rate of a few images was not 1, as the
pix_fmt_match() function rejects rgb24, gray8 and ya8 if the sampling
was not 1. This patch adds a default pixel format in these cases.



-- 
-------------
Gautam |


More information about the ffmpeg-devel mailing list