[FFmpeg-devel] [PATCH 3/3] avcodec: attempt to fix wrong pixel format for DNG

Michael Niedermayer michael at niedermayer.cc
Sat Jul 4 15:45:53 EEST 2020


This is just found by reading the code, I have not found a valid
file using this codepath so its untested.

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/mjpegdec.c | 2 +-
 libavcodec/tiff.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index e7a4e08c1c..c2b344371e 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -508,7 +508,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
         case 0x11110000: /* for bayer-encoded huffman lossless JPEGs embedded in DNGs */
             if (!s->bayer)
                 goto unk_pixfmt;
-            s->avctx->pix_fmt = AV_PIX_FMT_GRAY16LE;
+            s->avctx->pix_fmt = AV_PIX_FMT_GRAY16;
             break;
         case 0x11111100:
             if (s->rgb)
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 6a3ec3ef95..9508807b93 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -918,7 +918,7 @@ static int dng_decode_jpeg(AVCodecContext *avctx, AVFrame *frame,
     /* See dng_blit for explanation */
     if (s->avctx_mjpeg->width  == w * 2 &&
         s->avctx_mjpeg->height == h / 2 &&
-        s->avctx_mjpeg->pix_fmt == AV_PIX_FMT_GRAY16LE) {
+        s->avctx_mjpeg->pix_fmt == AV_PIX_FMT_GRAY16) {
         is_single_comp = 1;
     } else if (s->avctx_mjpeg->width  == w &&
                s->avctx_mjpeg->height == h &&
-- 
2.17.1



More information about the ffmpeg-devel mailing list