[MPlayer-dev-eng] [PATCH] Add support for 9-bit/10-bit H.264
Arne Bochem
arneb.mp at ccan.de
Sun May 8 22:22:02 CEST 2011
Since ffv210 was changed to output 422P10 too, I have updated its
codecs.conf entry accordingly.
> Could you please provide some samples to test?
Of course, here are some samples encoded with recent x264:
http://ps-auxw.de/10bit-h264-sample/
For convenience's sake, v210:
http://samples.multimedia.cx/V-codecs/v210.mov
> The idea was to just count up, that's why it's 0x51 for the 16 bit formats,
> you should just continue with 0x52, 0x53...
I see. Changed.
> With IMGFMT_IS_YUVP16_* covering these formats vo_gl will incorrectly
> claim to support them but it might still be best.
Since IMGFMT_IS_YUVP16_* doesn't seem to be used elsewhere, not having
it apply to P10/P9 probably wouldn't hurt much, though.
> You should be able to use
> #define IMGFMT_IS_YUVP16_LE(fmt) (((fmt - 0x51000034) & 0xfc0000ff) == 0)
> #define IMGFMT_IS_YUVP16_BE(fmt) (((fmt - 0x34000051) & 0xff0000fc) == 0)
Switched to this for now.
> It might make sense to extend mp_get_chroma_shift to also return something
> like y_bits or so.
Where y_bits would be 9/10 for 420P9/10? I suppose I could add something
like that, but I'm not sure where and how the result should be used.
Regards,
Arne Bochem
-------------- next part --------------
Index: libmpcodecs/mp_image.c
===================================================================
--- libmpcodecs/mp_image.c (revision 33447)
+++ libmpcodecs/mp_image.c (working copy)
@@ -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:
Index: libmpcodecs/img_format.c
===================================================================
--- libmpcodecs/img_format.c (revision 33447)
+++ libmpcodecs/img_format.c (working copy)
@@ -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;
Index: libmpcodecs/img_format.h
===================================================================
--- libmpcodecs/img_format.h (revision 33447)
+++ libmpcodecs/img_format.h (working copy)
@@ -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 */
Index: libmpcodecs/vf_scale.c
===================================================================
--- libmpcodecs/vf_scale.c (revision 33447)
+++ libmpcodecs/vf_scale.c (working copy)
@@ -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,
Index: fmt-conversion.c
===================================================================
--- fmt-conversion.c (revision 33447)
+++ fmt-conversion.c (working copy)
@@ -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},
Index: codec-cfg.c
===================================================================
--- codec-cfg.c (revision 33447)
+++ codec-cfg.c (working copy)
@@ -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},
Index: m_option.c
===================================================================
--- m_option.c (revision 33447)
+++ m_option.c (working copy)
@@ -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},
Index: etc/codecs.conf
===================================================================
--- etc/codecs.conf (revision 33447)
+++ etc/codecs.conf (working copy)
@@ -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"
More information about the MPlayer-dev-eng
mailing list