changeset 34923:eb76937af57e

Support FFmpeg pix_fmts YUV4xxP12*, YUV4xxP14*, GBR12P* and GBR14P*.
author cehoyos
date Thu, 12 Jul 2012 19:55:53 +0000
parents 20deec25c559
children 6b13e41172e2
files codec-cfg.c fmt-conversion.c libmpcodecs/img_format.c libmpcodecs/img_format.h libmpcodecs/mp_image.c libmpcodecs/vf_scale.c m_option.c
diffstat 7 files changed, 118 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/codec-cfg.c	Thu Jul 12 13:07:56 2012 +0000
+++ b/codec-cfg.c	Thu Jul 12 19:55:53 2012 +0000
@@ -178,12 +178,18 @@
     {"420P16LE",    IMGFMT_420P16_LE},
     {"420P16BE",    IMGFMT_420P16_BE},
     {"444P16",      IMGFMT_444P16},
+    {"444P14",      IMGFMT_444P14},
+    {"444P12",      IMGFMT_444P12},
     {"444P10",      IMGFMT_444P10},
     {"444P9",       IMGFMT_444P9},
     {"422P16",      IMGFMT_422P16},
+    {"422P14",      IMGFMT_422P14},
+    {"422P12",      IMGFMT_422P12},
     {"422P10",      IMGFMT_422P10},
     {"422P9",       IMGFMT_422P9},
     {"420P16",      IMGFMT_420P16},
+    {"420P14",      IMGFMT_420P14},
+    {"420P12",      IMGFMT_420P12},
     {"420P10",      IMGFMT_420P10},
     {"420P9",       IMGFMT_420P9},
     {"420A",        IMGFMT_420A},
@@ -222,6 +228,8 @@
     {"RGB1",        IMGFMT_RGB1},
     {"BGR1",        IMGFMT_BGR1},
     {"GBR24P",      IMGFMT_GBR24P},
+    {"GBR12P",      IMGFMT_GBR12P},
+    {"GBR14P",      IMGFMT_GBR14P},
 
     {"MPES",        IMGFMT_MPEGPES},
     {"ZRMJPEGNI",   IMGFMT_ZRMJPEGNI},
--- a/fmt-conversion.c	Thu Jul 12 13:07:56 2012 +0000
+++ b/fmt-conversion.c	Thu Jul 12 19:55:53 2012 +0000
@@ -70,6 +70,22 @@
 #endif
 #if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51, 20, 1)
     {IMGFMT_GBR24P,  PIX_FMT_GBRP},
+    {IMGFMT_GBR12PLE,  PIX_FMT_GBRP12LE},
+    {IMGFMT_GBR12PBE,  PIX_FMT_GBRP12BE},
+    {IMGFMT_GBR14PLE,  PIX_FMT_GBRP14LE},
+    {IMGFMT_GBR14PBE,  PIX_FMT_GBRP14BE},
+    {IMGFMT_420P14_LE,  PIX_FMT_YUV420P14LE},
+    {IMGFMT_420P14_BE,  PIX_FMT_YUV420P14BE},
+    {IMGFMT_420P12_LE,  PIX_FMT_YUV420P12LE},
+    {IMGFMT_420P12_BE,  PIX_FMT_YUV420P12BE},
+    {IMGFMT_422P14_LE,  PIX_FMT_YUV422P14LE},
+    {IMGFMT_422P14_BE,  PIX_FMT_YUV422P14BE},
+    {IMGFMT_422P12_LE,  PIX_FMT_YUV422P12LE},
+    {IMGFMT_422P12_BE,  PIX_FMT_YUV422P12BE},
+    {IMGFMT_444P14_LE,  PIX_FMT_YUV444P14LE},
+    {IMGFMT_444P14_BE,  PIX_FMT_YUV444P14BE},
+    {IMGFMT_444P12_LE,  PIX_FMT_YUV444P12LE},
+    {IMGFMT_444P12_BE,  PIX_FMT_YUV444P12BE},
 #endif
     {IMGFMT_YUY2,    PIX_FMT_YUYV422},
     {IMGFMT_UYVY,    PIX_FMT_UYVY422},
--- a/libmpcodecs/img_format.c	Thu Jul 12 13:07:56 2012 +0000
+++ b/libmpcodecs/img_format.c	Thu Jul 12 19:55:53 2012 +0000
@@ -53,6 +53,8 @@
     case IMGFMT_ARGB:    return "ARGB";
     case IMGFMT_RGBA:    return "RGBA";
     case IMGFMT_GBR24P:  return "Planar GBR 24-bit";
+    case IMGFMT_GBR12P:  return "Planar GBR 36-bit";
+    case IMGFMT_GBR14P:  return "Planar GBR 42-bit";
     case IMGFMT_YVU9:    return "Planar YVU9";
     case IMGFMT_IF09:    return "Planar IF09";
     case IMGFMT_YV12:    return "Planar YV12";
@@ -63,18 +65,30 @@
     case IMGFMT_Y8:      return "Planar Y8";
     case IMGFMT_420P16_LE: return "Planar 420P 16-bit little-endian";
     case IMGFMT_420P16_BE: return "Planar 420P 16-bit big-endian";
+    case IMGFMT_420P14_LE: return "Planar 420P 14-bit little-endian";
+    case IMGFMT_420P14_BE: return "Planar 420P 14-bit big-endian";
+    case IMGFMT_420P12_LE: return "Planar 420P 12-bit little-endian";
+    case IMGFMT_420P12_BE: return "Planar 420P 12-bit big-endian";
     case IMGFMT_420P10_LE: return "Planar 420P 10-bit little-endian";
     case IMGFMT_420P10_BE: return "Planar 420P 10-bit big-endian";
     case IMGFMT_420P9_LE:  return "Planar 420P 9-bit little-endian";
     case IMGFMT_420P9_BE:  return "Planar 420P 9-bit big-endian";
     case IMGFMT_422P16_LE: return "Planar 422P 16-bit little-endian";
     case IMGFMT_422P16_BE: return "Planar 422P 16-bit big-endian";
+    case IMGFMT_422P14_LE: return "Planar 422P 14-bit little-endian";
+    case IMGFMT_422P14_BE: return "Planar 422P 14-bit big-endian";
+    case IMGFMT_422P12_LE: return "Planar 422P 12-bit little-endian";
+    case IMGFMT_422P12_BE: return "Planar 422P 12-bit big-endian";
     case IMGFMT_422P10_LE: return "Planar 422P 10-bit little-endian";
     case IMGFMT_422P10_BE: return "Planar 422P 10-bit big-endian";
     case IMGFMT_422P9_LE:  return "Planar 422P 9-bit little-endian";
     case IMGFMT_422P9_BE:  return "Planar 422P 9-bit big-endian";
     case IMGFMT_444P16_LE: return "Planar 444P 16-bit little-endian";
     case IMGFMT_444P16_BE: return "Planar 444P 16-bit big-endian";
+    case IMGFMT_444P14_LE: return "Planar 444P 14-bit little-endian";
+    case IMGFMT_444P14_BE: return "Planar 444P 14-bit big-endian";
+    case IMGFMT_444P12_LE: return "Planar 444P 12-bit little-endian";
+    case IMGFMT_444P12_BE: return "Planar 444P 12-bit big-endian";
     case IMGFMT_444P10_LE: return "Planar 444P 10-bit little-endian";
     case IMGFMT_444P10_BE: return "Planar 444P 10-bit big-endian";
     case IMGFMT_444P9_LE:  return "Planar 444P 9-bit little-endian";
--- a/libmpcodecs/img_format.h	Thu Jul 12 13:07:56 2012 +0000
+++ b/libmpcodecs/img_format.h	Thu Jul 12 19:55:53 2012 +0000
@@ -52,6 +52,10 @@
 #define IMGFMT_BGR32 (IMGFMT_BGR|32)
 
 #define IMGFMT_GBR24P (('G'<<24)|('B'<<16)|('R'<<8)|24)
+#define IMGFMT_GBR12PLE (('G'<<24)|('B'<<16)|('R'<<8)|36)
+#define IMGFMT_GBR12PBE (('G'<<24)|('B'<<16)|('R'<<8)|36|128)
+#define IMGFMT_GBR14PLE (('G'<<24)|('B'<<16)|('R'<<8)|42)
+#define IMGFMT_GBR14PBE (('G'<<24)|('B'<<16)|('R'<<8)|42|128)
 
 #if HAVE_BIGENDIAN
 #define IMGFMT_ABGR    IMGFMT_RGB32
@@ -72,6 +76,8 @@
 #define IMGFMT_BGR15LE (IMGFMT_BGR15|128)
 #define IMGFMT_BGR16BE IMGFMT_BGR16
 #define IMGFMT_BGR16LE (IMGFMT_BGR16|128)
+#define IMGFMT_GBR12P IMGFMT_GBR12PBE
+#define IMGFMT_GBR14P IMGFMT_GBR14PBE
 #else
 #define IMGFMT_ABGR (IMGFMT_BGR32|128)
 #define IMGFMT_BGRA IMGFMT_BGR32
@@ -91,6 +97,8 @@
 #define IMGFMT_BGR15LE IMGFMT_BGR15
 #define IMGFMT_BGR16BE (IMGFMT_BGR16|128)
 #define IMGFMT_BGR16LE IMGFMT_BGR16
+#define IMGFMT_GBR12P IMGFMT_GBR12PLE
+#define IMGFMT_GBR14P IMGFMT_GBR14PLE
 #endif
 
 /* old names for compatibility */
@@ -133,41 +141,65 @@
 
 #define IMGFMT_444P16_LE 0x51343434
 #define IMGFMT_444P16_BE 0x34343451
+#define IMGFMT_444P14_LE 0x54343434
+#define IMGFMT_444P14_BE 0x34343454
+#define IMGFMT_444P12_LE 0x55343434
+#define IMGFMT_444P12_BE 0x34343455
 #define IMGFMT_444P10_LE 0x52343434
 #define IMGFMT_444P10_BE 0x34343452
 #define IMGFMT_444P9_LE  0x53343434
 #define IMGFMT_444P9_BE  0x34343453
 #define IMGFMT_422P16_LE 0x51323234
 #define IMGFMT_422P16_BE 0x34323251
+#define IMGFMT_422P14_LE 0x54323234
+#define IMGFMT_422P14_BE 0x34323254
+#define IMGFMT_422P12_LE 0x55323234
+#define IMGFMT_422P12_BE 0x34323255
 #define IMGFMT_422P10_LE 0x52323234
 #define IMGFMT_422P10_BE 0x34323252
 #define IMGFMT_422P9_LE  0x53323234
 #define IMGFMT_422P9_BE  0x34323253
 #define IMGFMT_420P16_LE 0x51303234
 #define IMGFMT_420P16_BE 0x34323051
+#define IMGFMT_420P14_LE 0x54303234
+#define IMGFMT_420P14_BE 0x34323054
+#define IMGFMT_420P12_LE 0x55303234
+#define IMGFMT_420P12_BE 0x34323055
 #define IMGFMT_420P10_LE 0x52303234
 #define IMGFMT_420P10_BE 0x34323052
 #define IMGFMT_420P9_LE  0x53303234
 #define IMGFMT_420P9_BE  0x34323053
 #if HAVE_BIGENDIAN
 #define IMGFMT_444P16 IMGFMT_444P16_BE
+#define IMGFMT_444P14 IMGFMT_444P14_BE
+#define IMGFMT_444P12 IMGFMT_444P12_BE
 #define IMGFMT_444P10 IMGFMT_444P10_BE
 #define IMGFMT_444P9  IMGFMT_444P9_BE
 #define IMGFMT_422P16 IMGFMT_422P16_BE
+#define IMGFMT_422P14 IMGFMT_422P14_BE
+#define IMGFMT_422P12 IMGFMT_422P12_BE
 #define IMGFMT_422P10 IMGFMT_422P10_BE
 #define IMGFMT_422P9  IMGFMT_422P9_BE
 #define IMGFMT_420P16 IMGFMT_420P16_BE
+#define IMGFMT_420P14 IMGFMT_420P14_BE
+#define IMGFMT_420P12 IMGFMT_420P12_BE
 #define IMGFMT_420P10 IMGFMT_420P10_BE
 #define IMGFMT_420P9  IMGFMT_420P9_BE
 #define IMGFMT_IS_YUVP16_NE(fmt) IMGFMT_IS_YUVP16_BE(fmt)
 #else
 #define IMGFMT_444P16 IMGFMT_444P16_LE
+#define IMGFMT_444P14 IMGFMT_444P14_LE
+#define IMGFMT_444P12 IMGFMT_444P12_LE
 #define IMGFMT_444P10 IMGFMT_444P10_LE
 #define IMGFMT_444P9  IMGFMT_444P9_LE
 #define IMGFMT_422P16 IMGFMT_422P16_LE
+#define IMGFMT_422P14 IMGFMT_422P14_LE
+#define IMGFMT_422P12 IMGFMT_422P12_LE
 #define IMGFMT_422P10 IMGFMT_422P10_LE
 #define IMGFMT_422P9  IMGFMT_422P9_LE
 #define IMGFMT_420P16 IMGFMT_420P16_LE
+#define IMGFMT_420P14 IMGFMT_420P14_LE
+#define IMGFMT_420P12 IMGFMT_420P12_LE
 #define IMGFMT_420P10 IMGFMT_420P10_LE
 #define IMGFMT_420P9  IMGFMT_420P9_LE
 #define IMGFMT_IS_YUVP16_NE(fmt) IMGFMT_IS_YUVP16_LE(fmt)
--- a/libmpcodecs/mp_image.c	Thu Jul 12 13:07:56 2012 +0000
+++ b/libmpcodecs/mp_image.c	Thu Jul 12 19:55:53 2012 +0000
@@ -126,6 +126,14 @@
         mpi->bpp=24;
         mpi->flags|=MP_IMGFLAG_PLANAR;
         return;
+    } else if (out_fmt == IMGFMT_GBR12P) {
+        mpi->bpp=36;
+        mpi->flags|=MP_IMGFLAG_PLANAR;
+        return;
+    } else if (out_fmt == IMGFMT_GBR14P) {
+        mpi->bpp=42;
+        mpi->flags|=MP_IMGFLAG_PLANAR;
+        return;
     }
     mpi->flags|=MP_IMGFLAG_YUV;
     if (mp_get_chroma_shift(out_fmt, NULL, NULL, NULL)) {
@@ -152,18 +160,30 @@
     case IMGFMT_440P:
     case IMGFMT_444P16_LE:
     case IMGFMT_444P16_BE:
+    case IMGFMT_444P14_LE:
+    case IMGFMT_444P14_BE:
+    case IMGFMT_444P12_LE:
+    case IMGFMT_444P12_BE:
     case IMGFMT_444P10_LE:
     case IMGFMT_444P10_BE:
     case IMGFMT_444P9_LE:
     case IMGFMT_444P9_BE:
     case IMGFMT_422P16_LE:
     case IMGFMT_422P16_BE:
+    case IMGFMT_422P14_LE:
+    case IMGFMT_422P14_BE:
+    case IMGFMT_422P12_LE:
+    case IMGFMT_422P12_BE:
     case IMGFMT_422P10_LE:
     case IMGFMT_422P10_BE:
     case IMGFMT_422P9_LE:
     case IMGFMT_422P9_BE:
     case IMGFMT_420P16_LE:
     case IMGFMT_420P16_BE:
+    case IMGFMT_420P14_LE:
+    case IMGFMT_420P14_BE:
+    case IMGFMT_420P12_LE:
+    case IMGFMT_420P12_BE:
     case IMGFMT_420P10_LE:
     case IMGFMT_420P10_BE:
     case IMGFMT_420P9_LE:
--- a/libmpcodecs/vf_scale.c	Thu Jul 12 13:07:56 2012 +0000
+++ b/libmpcodecs/vf_scale.c	Thu Jul 12 19:55:53 2012 +0000
@@ -68,6 +68,10 @@
     IMGFMT_444P,
     IMGFMT_444P16_LE,
     IMGFMT_444P16_BE,
+    IMGFMT_444P14_LE,
+    IMGFMT_444P14_BE,
+    IMGFMT_444P12_LE,
+    IMGFMT_444P12_BE,
     IMGFMT_444P10_LE,
     IMGFMT_444P10_BE,
     IMGFMT_444P9_LE,
@@ -75,6 +79,10 @@
     IMGFMT_422P,
     IMGFMT_422P16_LE,
     IMGFMT_422P16_BE,
+    IMGFMT_422P14_LE,
+    IMGFMT_422P14_BE,
+    IMGFMT_422P12_LE,
+    IMGFMT_422P12_BE,
     IMGFMT_422P10_LE,
     IMGFMT_422P10_BE,
     IMGFMT_422P9_LE,
@@ -83,6 +91,10 @@
     IMGFMT_I420,
     IMGFMT_420P16_LE,
     IMGFMT_420P16_BE,
+    IMGFMT_420P14_LE,
+    IMGFMT_420P14_BE,
+    IMGFMT_420P12_LE,
+    IMGFMT_420P12_BE,
     IMGFMT_420P10_LE,
     IMGFMT_420P10_BE,
     IMGFMT_420P9_LE,
@@ -105,6 +117,10 @@
     IMGFMT_BGR24,
     IMGFMT_RGB24,
     IMGFMT_GBR24P,
+    IMGFMT_GBR12PLE,
+    IMGFMT_GBR12PBE,
+    IMGFMT_GBR14PLE,
+    IMGFMT_GBR14PBE,
     IMGFMT_RGB48LE,
     IMGFMT_RGB48BE,
     IMGFMT_BGR16,
--- a/m_option.c	Thu Jul 12 13:07:56 2012 +0000
+++ b/m_option.c	Thu Jul 12 19:55:53 2012 +0000
@@ -1076,12 +1076,20 @@
 } mp_imgfmt_list[] = {
   {"444p16le", IMGFMT_444P16_LE},
   {"444p16be", IMGFMT_444P16_BE},
+  {"444p14le", IMGFMT_444P14_LE},
+  {"444p14be", IMGFMT_444P14_BE},
+  {"444p12le", IMGFMT_444P12_LE},
+  {"444p12be", IMGFMT_444P12_BE},
   {"444p10le", IMGFMT_444P10_LE},
   {"444p10be", IMGFMT_444P10_BE},
   {"444p9le",  IMGFMT_444P9_LE},
   {"444p9be",  IMGFMT_444P9_BE},
   {"422p16le", IMGFMT_422P16_LE},
   {"422p16be", IMGFMT_422P16_BE},
+  {"422p14le", IMGFMT_422P14_LE},
+  {"422p14be", IMGFMT_422P14_BE},
+  {"422p12le", IMGFMT_422P12_LE},
+  {"422p12be", IMGFMT_422P12_BE},
   {"422p10le", IMGFMT_422P10_LE},
   {"422p10be", IMGFMT_422P10_BE},
   {"422p9le",  IMGFMT_422P9_LE},
@@ -1146,6 +1154,10 @@
   {"argb", IMGFMT_ARGB},
   {"bgra", IMGFMT_BGRA},
   {"abgr", IMGFMT_ABGR},
+  {"gbr14pbe", IMGFMT_GBR14PLE},
+  {"gbr14ple", IMGFMT_GBR14PBE},
+  {"gbr12pbe", IMGFMT_GBR12PLE},
+  {"gbr12ple", IMGFMT_GBR12PBE},
   {"gbr24p", IMGFMT_GBR24P},
   {"mjpeg", IMGFMT_MJPEG},
   {"mjpg", IMGFMT_MJPEG},