mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
video: add XYZ support
Needed for the ffmpeg j2k decoder.
This commit is contained in:
@@ -155,6 +155,7 @@ static int preferred_conversions[][2] = {
|
|||||||
{IMGFMT_GBRP, IMGFMT_BGR32},
|
{IMGFMT_GBRP, IMGFMT_BGR32},
|
||||||
{IMGFMT_GBRP, IMGFMT_RGB32},
|
{IMGFMT_GBRP, IMGFMT_RGB32},
|
||||||
{IMGFMT_PAL8, IMGFMT_BGR32},
|
{IMGFMT_PAL8, IMGFMT_BGR32},
|
||||||
|
{IMGFMT_XYZ12, IMGFMT_RGB48},
|
||||||
{0, 0}
|
{0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -133,6 +133,12 @@ static const struct {
|
|||||||
{IMGFMT_444AP16_LE, AV_PIX_FMT_YUVA444P16LE},
|
{IMGFMT_444AP16_LE, AV_PIX_FMT_YUVA444P16LE},
|
||||||
#endif
|
#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
|
// ffmpeg only
|
||||||
#if LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT > AV_VERSION_INT(52, 0, 0)
|
#if LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT > AV_VERSION_INT(52, 0, 0)
|
||||||
{IMGFMT_420P12_LE, PIX_FMT_YUV420P12LE},
|
{IMGFMT_420P12_LE, PIX_FMT_YUV420P12LE},
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ struct mp_imgfmt_entry mp_imgfmt_list[] = {
|
|||||||
FMT_ENDIAN("gbrp12", IMGFMT_GBRP12)
|
FMT_ENDIAN("gbrp12", IMGFMT_GBRP12)
|
||||||
FMT_ENDIAN("gbrp14", IMGFMT_GBRP14)
|
FMT_ENDIAN("gbrp14", IMGFMT_GBRP14)
|
||||||
FMT_ENDIAN("gbrp16", IMGFMT_GBRP16)
|
FMT_ENDIAN("gbrp16", IMGFMT_GBRP16)
|
||||||
|
FMT_ENDIAN("xyz12", IMGFMT_XYZ12)
|
||||||
FMT("vdpau_mpeg1", IMGFMT_VDPAU_MPEG1)
|
FMT("vdpau_mpeg1", IMGFMT_VDPAU_MPEG1)
|
||||||
FMT("vdpau_mpeg2", IMGFMT_VDPAU_MPEG2)
|
FMT("vdpau_mpeg2", IMGFMT_VDPAU_MPEG2)
|
||||||
FMT("vdpau_h264", IMGFMT_VDPAU_H264)
|
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)
|
fmt != PIX_FMT_PAL8)
|
||||||
{
|
{
|
||||||
desc.flags |= MP_IMGFLAG_YUV;
|
desc.flags |= MP_IMGFLAG_YUV;
|
||||||
|
} else if (mpfmt == IMGFMT_XYZ12_LE || mpfmt == IMGFMT_XYZ12_BE) {
|
||||||
|
desc.flags |= MP_IMGFLAG_XYZ;
|
||||||
} else {
|
} else {
|
||||||
desc.flags |= MP_IMGFLAG_RGB;
|
desc.flags |= MP_IMGFLAG_RGB;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,8 @@
|
|||||||
#define MP_IMGFLAG_YUV 0x200
|
#define MP_IMGFLAG_YUV 0x200
|
||||||
// set if it's RGB colorspace
|
// set if it's RGB colorspace
|
||||||
#define MP_IMGFLAG_RGB 0x400
|
#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:
|
// set if the format is in a standard YUV format:
|
||||||
// - planar and yuv colorspace
|
// - planar and yuv colorspace
|
||||||
// - chroma shift 0-2
|
// - chroma shift 0-2
|
||||||
@@ -228,6 +230,11 @@ enum mp_imgfmt {
|
|||||||
IMGFMT_GBRP16_LE,
|
IMGFMT_GBRP16_LE,
|
||||||
IMGFMT_GBRP16_BE,
|
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
|
// Hardware acclerated formats. Plane data points to special data
|
||||||
// structures, instead of pixel 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_GBRP12 = MP_SELECT_LE_BE(IMGFMT_GBRP12_LE, IMGFMT_GBRP12_BE),
|
||||||
IMGFMT_GBRP14 = MP_SELECT_LE_BE(IMGFMT_GBRP14_LE, IMGFMT_GBRP14_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_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)
|
static inline bool IMGFMT_IS_RGB(unsigned int fmt)
|
||||||
|
|||||||
Reference in New Issue
Block a user