[FFmpeg-devel] [PATCH]lavc/dpx: Support gray12

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Nov 11 00:08:23 EET 2016


Hi!

Not sure how useful this is but we also support gprp12.

Please comment, Carl Eugen
-------------- next part --------------
From 525d19c0486bae49d2ee304d1afc8960d4f58bbc Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
Date: Thu, 10 Nov 2016 23:04:46 +0100
Subject: [PATCH] lavc/dpx: Support GRAY12 colourspace.

---
 libavcodec/dpx.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index e4dd1b0..1aa2cbd 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -243,6 +243,10 @@ static int decode_frame(AVCodecContext *avctx,
     case 6080:
         avctx->pix_fmt = AV_PIX_FMT_GRAY8;
         break;
+    case 6121:
+    case 6120:
+        avctx->pix_fmt = AV_PIX_FMT_GRAY12;
+        break;
     case 50081:
     case 50080:
         avctx->pix_fmt = AV_PIX_FMT_RGB24;
@@ -345,12 +349,12 @@ static int decode_frame(AVCodecContext *avctx,
                                 (uint16_t*)ptr[2],
                                 (uint16_t*)ptr[3]};
             for (y = 0; y < avctx->width; y++) {
-                *dst[2] = read16(&buf, endian) >> 4;
-                dst[2]++;
+                if (elements >= 3)
+                    *dst[2]++ = read16(&buf, endian) >> 4;
                 *dst[0] = read16(&buf, endian) >> 4;
                 dst[0]++;
-                *dst[1] = read16(&buf, endian) >> 4;
-                dst[1]++;
+                if (elements >= 2)
+                    *dst[1]++ = read16(&buf, endian) >> 4;
                 if (elements == 4)
                     *dst[3]++ = read16(&buf, endian) >> 4;
             }
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list