summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--video/filter/vf_scale.c1
-rw-r--r--video/fmt-conversion.c6
-rw-r--r--video/img_format.c3
-rw-r--r--video/img_format.h9
4 files changed, 19 insertions, 0 deletions
diff --git a/video/filter/vf_scale.c b/video/filter/vf_scale.c
index 08fb0c7ae1..92b9e71d08 100644
--- a/video/filter/vf_scale.c
+++ b/video/filter/vf_scale.c
@@ -155,6 +155,7 @@ static int preferred_conversions[][2] = {
{IMGFMT_GBRP, IMGFMT_BGR32},
{IMGFMT_GBRP, IMGFMT_RGB32},
{IMGFMT_PAL8, IMGFMT_BGR32},
+ {IMGFMT_XYZ12, IMGFMT_RGB48},
{0, 0}
};
diff --git a/video/fmt-conversion.c b/video/fmt-conversion.c
index 819448772e..b38e5676dd 100644
--- a/video/fmt-conversion.c
+++ b/video/fmt-conversion.c
@@ -133,6 +133,12 @@ static const struct {
{IMGFMT_444AP16_LE, AV_PIX_FMT_YUVA444P16LE},
#endif
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(52, 25, 0)
+ // Libav added this already at 52.10.0
+ {IMGFMT_XYZ12_LE, AV_PIX_FMT_XYZ12LE},
+ {IMGFMT_XYZ12_BE, AV_PIX_FMT_XYZ12BE},
+#endif
+
// ffmpeg only
#if LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT > AV_VERSION_INT(52, 0, 0)
{IMGFMT_420P12_LE, PIX_FMT_YUV420P12LE},
diff --git a/video/img_format.c b/video/img_format.c
index dfb82d2081..46b5d7a250 100644
--- a/video/img_format.c
+++ b/video/img_format.c
@@ -111,6 +111,7 @@ struct mp_imgfmt_entry mp_imgfmt_list[] = {
FMT_ENDIAN("gbrp12", IMGFMT_GBRP12)
FMT_ENDIAN("gbrp14", IMGFMT_GBRP14)
FMT_ENDIAN("gbrp16", IMGFMT_GBRP16)
+ FMT_ENDIAN("xyz12", IMGFMT_XYZ12)
FMT("vdpau_mpeg1", IMGFMT_VDPAU_MPEG1)
FMT("vdpau_mpeg2", IMGFMT_VDPAU_MPEG2)
FMT("vdpau_h264", IMGFMT_VDPAU_H264)
@@ -197,6 +198,8 @@ static struct mp_imgfmt_desc get_avutil_fmt(enum PixelFormat fmt)
fmt != PIX_FMT_PAL8)
{
desc.flags |= MP_IMGFLAG_YUV;
+ } else if (mpfmt == IMGFMT_XYZ12_LE || mpfmt == IMGFMT_XYZ12_BE) {
+ desc.flags |= MP_IMGFLAG_XYZ;
} else {
desc.flags |= MP_IMGFLAG_RGB;
}
diff --git a/video/img_format.h b/video/img_format.h
index 0d77872123..0cc48d937f 100644
--- a/video/img_format.h
+++ b/video/img_format.h
@@ -41,6 +41,8 @@
#define MP_IMGFLAG_YUV 0x200
// set if it's RGB colorspace
#define MP_IMGFLAG_RGB 0x400
+// set if it's XYZ colorspace
+#define MP_IMGFLAG_XYZ 0x800
// set if the format is in a standard YUV format:
// - planar and yuv colorspace
// - chroma shift 0-2
@@ -228,6 +230,11 @@ enum mp_imgfmt {
IMGFMT_GBRP16_LE,
IMGFMT_GBRP16_BE,
+ // XYZ colorspace, similar organization to RGB48. Even though it says "12",
+ // the components are stored as 16 bit, with lower 4 bits set to 0.
+ IMGFMT_XYZ12_LE,
+ IMGFMT_XYZ12_BE,
+
// Hardware acclerated formats. Plane data points to special data
// structures, instead of pixel data.
@@ -301,6 +308,8 @@ enum mp_imgfmt {
IMGFMT_GBRP12 = MP_SELECT_LE_BE(IMGFMT_GBRP12_LE, IMGFMT_GBRP12_BE),
IMGFMT_GBRP14 = MP_SELECT_LE_BE(IMGFMT_GBRP14_LE, IMGFMT_GBRP14_BE),
IMGFMT_GBRP16 = MP_SELECT_LE_BE(IMGFMT_GBRP16_LE, IMGFMT_GBRP16_BE),
+
+ IMGFMT_XYZ12 = MP_SELECT_LE_BE(IMGFMT_XYZ12_LE, IMGFMT_XYZ12_BE),
};
static inline bool IMGFMT_IS_RGB(unsigned int fmt)