[FFmpeg-cvslog] avcodec/dpx: support for 8 and 16 bit luma only files

Paul B Mahol git at videolan.org
Mon Oct 7 13:58:09 CEST 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Oct  7 10:10:39 2013 +0000| [23824b9698bbc5b2640c87f6538598510f4bbf18] | committer: Paul B Mahol

avcodec/dpx: support for 8 and 16 bit luma only files

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 libavcodec/dpx.c    |   13 +++++++++++++
 libavcodec/dpxenc.c |    7 +++++++
 2 files changed, 20 insertions(+)

diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index e956f6d..4b997e4 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -149,6 +149,9 @@ static int decode_frame(AVCodecContext *avctx,
         avctx->sample_aspect_ratio = (AVRational){ 0, 1 };
 
     switch (descriptor) {
+    case 6:  // Y
+        elements = 1;
+        break;
     case 51: // RGBA
         elements = 4;
         break;
@@ -191,6 +194,10 @@ static int decode_frame(AVCodecContext *avctx,
     }
 
     switch (1000 * descriptor + 10 * bits_per_color + endian) {
+    case 6081:
+    case 6080:
+        avctx->pix_fmt = AV_PIX_FMT_GRAY8;
+        break;
     case 50081:
     case 50080:
         avctx->pix_fmt = AV_PIX_FMT_RGB24;
@@ -211,6 +218,12 @@ static int decode_frame(AVCodecContext *avctx,
     case 51121:
         avctx->pix_fmt = AV_PIX_FMT_GBRP12;
         break;
+    case 6161:
+        avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
+        break;
+    case 6160:
+        avctx->pix_fmt = AV_PIX_FMT_GRAY16LE;
+        break;
     case 50161:
         avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
         break;
diff --git a/libavcodec/dpxenc.c b/libavcodec/dpxenc.c
index 997e3d6..875862d 100644
--- a/libavcodec/dpxenc.c
+++ b/libavcodec/dpxenc.c
@@ -43,6 +43,11 @@ static av_cold int encode_init(AVCodecContext *avctx)
     s->planar             = !!(desc->flags & AV_PIX_FMT_FLAG_PLANAR);
 
     switch (avctx->pix_fmt) {
+    case AV_PIX_FMT_GRAY16BE:
+    case AV_PIX_FMT_GRAY16LE:
+    case AV_PIX_FMT_GRAY8:
+        s->descriptor = 6;
+        break;
     case AV_PIX_FMT_GBRP10BE:
     case AV_PIX_FMT_GBRP10LE:
     case AV_PIX_FMT_GBRP12BE:
@@ -242,7 +247,9 @@ AVCodec ff_dpx_encoder = {
     .init           = encode_init,
     .encode2        = encode_frame,
     .pix_fmts       = (const enum AVPixelFormat[]){
+        AV_PIX_FMT_GRAY8,
         AV_PIX_FMT_RGB24,    AV_PIX_FMT_RGBA,
+        AV_PIX_FMT_GRAY16LE, AV_PIX_FMT_GRAY16BE,
         AV_PIX_FMT_RGB48LE,  AV_PIX_FMT_RGB48BE,
         AV_PIX_FMT_RGBA64LE, AV_PIX_FMT_RGBA64BE,
         AV_PIX_FMT_GBRP10LE, AV_PIX_FMT_GBRP10BE,



More information about the ffmpeg-cvslog mailing list