[FFmpeg-cvslog] libavcodec/jpeg2000dec: Enhance pix fmt selection

Gautam Ramakrishnan git at videolan.org
Mon Jul 6 02:43:09 EEST 2020


ffmpeg | branch: master | Gautam Ramakrishnan <gautamramk at gmail.com> | Sun Jul  5 00:51:08 2020 +0530| [69522e04001f9dad710a420a6d46aa138659244e] | committer: Michael Niedermayer

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 at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=69522e04001f9dad710a420a6d46aa138659244e
---

 libavcodec/jpeg2000dec.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 3f4a9ef96c..f62553c874 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -436,6 +436,18 @@ static int get_siz(Jpeg2000DecoderContext *s)
                 s->cdef[3] = 3;
                 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;
         }
     }
 



More information about the ffmpeg-cvslog mailing list