libavcodec/jpeg2000dec: Enhance pix fmt selection

This patch assigns default pix format values when
a match does not take place.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/344/head^2
Gautam Ramakrishnan 4 years ago committed by Michael Niedermayer
parent 4091f4f780
commit 69522e0400
  1. 12
      libavcodec/jpeg2000dec.c

@ -436,6 +436,18 @@ static int get_siz(Jpeg2000DecoderContext *s)
s->cdef[3] = 3; s->cdef[3] = 3;
i = 0; i = 0;
} }
} else if (ncomponents == 3 && s->precision == 8 &&
s->cdx[0] == s->cdx[1] && s->cdx[0] == s->cdx[2] &&
s->cdy[0] == s->cdy[1] && s->cdy[0] == s->cdy[2]) {
s->avctx->pix_fmt = AV_PIX_FMT_RGB24;
i = 0;
} else if (ncomponents == 2 && s->precision == 8 &&
s->cdx[0] == s->cdx[1] && s->cdy[0] == s->cdy[1]) {
s->avctx->pix_fmt = AV_PIX_FMT_YA8;
i = 0;
} else if (ncomponents == 1 && s->precision == 8) {
s->avctx->pix_fmt = AV_PIX_FMT_GRAY8;
i = 0;
} }
} }

Loading…
Cancel
Save