diff mbox series

[FFmpeg-devel] lavc/mjpegdec: Support pixel format 0x11311100

Message ID CAB0OVGpcQJYzcskLUR4EJc+DCRs=gY=Dw4iggUs3K=fHVXtUxw@mail.gmail.com
State New
Headers show
Series [FFmpeg-devel] lavc/mjpegdec: Support pixel format 0x11311100
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Carl Eugen Hoyos March 27, 2021, 11:35 p.m. UTC
Hi!

Attached patch fixes decoding of a sample mentioned in ticket #8930.

Please comment, Carl Eugen
Subject: [PATCH] lavc/mjpegdec: Support pixel format 0x11311100.

Fixes decoding of Nene3xRGB.jpg
---
 libavcodec/mjpegdec.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 5583d2aa35..575b2d8d4a 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -615,6 +615,17 @@  int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
                 s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;
             }
             break;
+        case 0x11311100:
+            if (s->bits > 8)
+                goto unk_pixfmt;
+            if (s->component_id[0] == 'R' - 1 && s->component_id[1] == 'G' - 1 && s->component_id[2] == 'B' - 1) {
+                s->avctx->pix_fmt = AV_PIX_FMT_GBRP;
+            } else {
+                goto unk_pixfmt;
+            }
+            s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;
+            s->upscale_h[1] = s->upscale_h[2] = 2;
+            break;
         case 0x31111100:
             if (s->bits > 8)
                 goto unk_pixfmt;