changeset 33364:e1ee4895e500

Support displaying of 9- and 10-bit pixel formats, as used by v210 and H264. Patch by Arne Bochem, arneb D mp a ccan D de
author cehoyos
date Tue, 10 May 2011 08:42:52 +0000
parents 02021152bad3
children 706871635af7
files codec-cfg.c etc/codecs.conf fmt-conversion.c libmpcodecs/img_format.c libmpcodecs/img_format.h libmpcodecs/mp_image.c libmpcodecs/vf_scale.c m_option.c
diffstat 8 files changed, 58 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/codec-cfg.c	Mon May 09 18:47:27 2011 +0000
+++ b/codec-cfg.c	Tue May 10 08:42:52 2011 +0000
@@ -179,7 +179,10 @@
     {"420P16BE", IMGFMT_420P16_BE},
     {"444P16", IMGFMT_444P16},
     {"422P16", IMGFMT_422P16},
+    {"422P10", IMGFMT_422P10},
     {"420P16", IMGFMT_420P16},
+    {"420P10", IMGFMT_420P10},
+    {"420P9", IMGFMT_420P9},
     {"420A",  IMGFMT_420A},
     {"444P",  IMGFMT_444P},
     {"422P",  IMGFMT_422P},
--- a/etc/codecs.conf	Mon May 09 18:47:27 2011 +0000
+++ b/etc/codecs.conf	Tue May 10 08:42:52 2011 +0000
@@ -1064,7 +1064,7 @@
   format 0x10000005
   driver ffmpeg
   dll h264
-  out YV12,I420,IYUV
+  out YV12,I420,IYUV,420P10,420P9
 
 videocodec ffh264vdpau
   info "FFmpeg H.264 (VDPAU)"
@@ -3003,7 +3003,7 @@
   fourcc v210
   driver ffmpeg
   dll v210
-  out 422P16
+  out 422P10
 
 videocodec qtcine
   info "cinewave uncompressed 10-bit codec"
--- a/fmt-conversion.c	Mon May 09 18:47:27 2011 +0000
+++ b/fmt-conversion.c	Tue May 10 08:42:52 2011 +0000
@@ -76,8 +76,14 @@
 
     {IMGFMT_420P16_LE,  PIX_FMT_YUV420P16LE},
     {IMGFMT_420P16_BE,  PIX_FMT_YUV420P16BE},
+    {IMGFMT_420P10_LE,  PIX_FMT_YUV420P10LE},
+    {IMGFMT_420P10_BE,  PIX_FMT_YUV420P10BE},
+    {IMGFMT_420P9_LE,   PIX_FMT_YUV420P9LE},
+    {IMGFMT_420P9_BE,   PIX_FMT_YUV420P9BE},
     {IMGFMT_422P16_LE,  PIX_FMT_YUV422P16LE},
     {IMGFMT_422P16_BE,  PIX_FMT_YUV422P16BE},
+    {IMGFMT_422P10_LE,  PIX_FMT_YUV422P10LE},
+    {IMGFMT_422P10_BE,  PIX_FMT_YUV422P10BE},
     {IMGFMT_444P16_LE,  PIX_FMT_YUV444P16LE},
     {IMGFMT_444P16_BE,  PIX_FMT_YUV444P16BE},
 
--- a/libmpcodecs/img_format.c	Mon May 09 18:47:27 2011 +0000
+++ b/libmpcodecs/img_format.c	Tue May 10 08:42:52 2011 +0000
@@ -59,8 +59,14 @@
     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_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_422P10_LE: return "Planar 422P 10-bit little-endian";
+    case IMGFMT_422P10_BE: return "Planar 422P 10-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_420A: return "Planar 420P with alpha";
@@ -116,6 +122,10 @@
     switch (format) {
     case IMGFMT_420P16_LE:
     case IMGFMT_420P16_BE:
+    case IMGFMT_420P10_LE:
+    case IMGFMT_420P10_BE:
+    case IMGFMT_420P9_LE:
+    case IMGFMT_420P9_BE:
         bpp_factor = 2;
     case IMGFMT_420A:
     case IMGFMT_I420:
@@ -138,6 +148,8 @@
         break;
     case IMGFMT_422P16_LE:
     case IMGFMT_422P16_BE:
+    case IMGFMT_422P10_LE:
+    case IMGFMT_422P10_BE:
         bpp_factor = 2;
     case IMGFMT_422P:
         xs = 1;
--- a/libmpcodecs/img_format.h	Mon May 09 18:47:27 2011 +0000
+++ b/libmpcodecs/img_format.h	Tue May 10 08:42:52 2011 +0000
@@ -125,22 +125,34 @@
 #define IMGFMT_444P16_BE 0x34343451
 #define IMGFMT_422P16_LE 0x51323234
 #define IMGFMT_422P16_BE 0x34323251
+#define IMGFMT_422P10_LE 0x52323234
+#define IMGFMT_422P10_BE 0x34323252
 #define IMGFMT_420P16_LE 0x51303234
 #define IMGFMT_420P16_BE 0x34323051
+#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_422P16 IMGFMT_422P16_BE
+#define IMGFMT_422P10 IMGFMT_422P10_BE
 #define IMGFMT_420P16 IMGFMT_420P16_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_422P16 IMGFMT_422P16_LE
+#define IMGFMT_422P10 IMGFMT_422P10_LE
 #define IMGFMT_420P16 IMGFMT_420P16_LE
+#define IMGFMT_420P10 IMGFMT_420P10_LE
+#define IMGFMT_420P9 IMGFMT_420P9_LE
 #define IMGFMT_IS_YUVP16_NE(fmt) IMGFMT_IS_YUVP16_LE(fmt)
 #endif
 
-#define IMGFMT_IS_YUVP16_LE(fmt) (((fmt  ^ IMGFMT_420P16_LE) & 0xff0000ff) == 0)
-#define IMGFMT_IS_YUVP16_BE(fmt) (((fmt  ^ IMGFMT_420P16_BE) & 0xff0000ff) == 0)
+#define IMGFMT_IS_YUVP16_LE(fmt) (((fmt - 0x51000034) & 0xfc0000ff) == 0)
+#define IMGFMT_IS_YUVP16_BE(fmt) (((fmt - 0x34000051) & 0xff0000fc) == 0)
 #define IMGFMT_IS_YUVP16(fmt)    (IMGFMT_IS_YUVP16_LE(fmt) || IMGFMT_IS_YUVP16_BE(fmt))
 
 /* Packed YUV Formats */
--- a/libmpcodecs/mp_image.c	Mon May 09 18:47:27 2011 +0000
+++ b/libmpcodecs/mp_image.c	Tue May 10 08:42:52 2011 +0000
@@ -147,8 +147,14 @@
     case IMGFMT_444P16_BE:
     case IMGFMT_422P16_LE:
     case IMGFMT_422P16_BE:
+    case IMGFMT_422P10_LE:
+    case IMGFMT_422P10_BE:
     case IMGFMT_420P16_LE:
     case IMGFMT_420P16_BE:
+    case IMGFMT_420P10_LE:
+    case IMGFMT_420P10_BE:
+    case IMGFMT_420P9_LE:
+    case IMGFMT_420P9_BE:
         return;
     case IMGFMT_Y800:
     case IMGFMT_Y8:
--- a/libmpcodecs/vf_scale.c	Mon May 09 18:47:27 2011 +0000
+++ b/libmpcodecs/vf_scale.c	Tue May 10 08:42:52 2011 +0000
@@ -71,10 +71,16 @@
     IMGFMT_422P,
     IMGFMT_422P16_LE,
     IMGFMT_422P16_BE,
+    IMGFMT_422P10_LE,
+    IMGFMT_422P10_BE,
     IMGFMT_YV12,
     IMGFMT_I420,
     IMGFMT_420P16_LE,
     IMGFMT_420P16_BE,
+    IMGFMT_420P10_LE,
+    IMGFMT_420P10_BE,
+    IMGFMT_420P9_LE,
+    IMGFMT_420P9_BE,
     IMGFMT_420A,
     IMGFMT_IYUV,
     IMGFMT_YVU9,
--- a/m_option.c	Mon May 09 18:47:27 2011 +0000
+++ b/m_option.c	Tue May 10 08:42:52 2011 +0000
@@ -1054,11 +1054,20 @@
   {"444p16be", IMGFMT_444P16_BE},
   {"422p16le", IMGFMT_422P16_LE},
   {"422p16be", IMGFMT_422P16_BE},
+  {"422p10le", IMGFMT_422P10_LE},
+  {"422p10be", IMGFMT_422P10_BE},
   {"420p16le", IMGFMT_420P16_LE},
   {"420p16be", IMGFMT_420P16_BE},
+  {"420p10le", IMGFMT_420P10_LE},
+  {"420p10be", IMGFMT_420P10_BE},
+  {"420p9le", IMGFMT_420P9_LE},
+  {"420p9be", IMGFMT_420P9_BE},
   {"444p16", IMGFMT_444P16},
   {"422p16", IMGFMT_422P16},
+  {"422p10", IMGFMT_422P10},
   {"420p16", IMGFMT_420P16},
+  {"420p10", IMGFMT_420P10},
+  {"420p9", IMGFMT_420P9},
   {"420a", IMGFMT_420A},
   {"444p", IMGFMT_444P},
   {"422p", IMGFMT_422P},