mirror of
https://github.com/mpv-player/mpv
synced 2025-05-03 08:39:03 +00:00
video/colorspaces: add new 9/10-bit formats from libavcodec
Add new internal 9/10-bit IMGFMT values and mappings to the corresponding libav* PIX_FMT_* values. Partially based on a patch from Arne Bochem <arneb.mp@ccan.de>.
This commit is contained in:
parent
949626ee46
commit
aba8a1838a
@ -180,8 +180,13 @@ static const struct {
|
||||
{"420P16LE", IMGFMT_420P16_LE},
|
||||
{"420P16BE", IMGFMT_420P16_BE},
|
||||
{"444P16", IMGFMT_444P16},
|
||||
{"444P10", IMGFMT_444P10},
|
||||
{"444P9", IMGFMT_444P9},
|
||||
{"422P16", IMGFMT_422P16},
|
||||
{"422P10", IMGFMT_422P10},
|
||||
{"420P16", IMGFMT_420P16},
|
||||
{"420P10", IMGFMT_420P10},
|
||||
{"420P9", IMGFMT_420P9},
|
||||
{"420A", IMGFMT_420A},
|
||||
{"444P", IMGFMT_444P},
|
||||
{"422P", IMGFMT_422P},
|
||||
|
@ -75,6 +75,20 @@ static const struct {
|
||||
|
||||
{IMGFMT_420P16_LE, PIX_FMT_YUV420P16LE},
|
||||
{IMGFMT_420P16_BE, PIX_FMT_YUV420P16BE},
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51, 2, 0)
|
||||
{IMGFMT_420P9_LE, PIX_FMT_YUV420P9LE},
|
||||
{IMGFMT_420P9_BE, PIX_FMT_YUV420P9BE},
|
||||
{IMGFMT_420P10_LE, PIX_FMT_YUV420P10LE},
|
||||
{IMGFMT_420P10_BE, PIX_FMT_YUV420P10BE},
|
||||
{IMGFMT_422P10_LE, PIX_FMT_YUV422P10LE},
|
||||
{IMGFMT_422P10_BE, PIX_FMT_YUV422P10BE},
|
||||
#endif
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51, 7, 0)
|
||||
{IMGFMT_444P9_BE , PIX_FMT_YUV444P9BE},
|
||||
{IMGFMT_444P9_LE , PIX_FMT_YUV444P9LE},
|
||||
{IMGFMT_444P10_BE, PIX_FMT_YUV444P10BE},
|
||||
{IMGFMT_444P10_LE, PIX_FMT_YUV444P10LE},
|
||||
#endif
|
||||
{IMGFMT_422P16_LE, PIX_FMT_YUV422P16LE},
|
||||
{IMGFMT_422P16_BE, PIX_FMT_YUV422P16BE},
|
||||
{IMGFMT_444P16_LE, PIX_FMT_YUV444P16LE},
|
||||
|
@ -59,10 +59,20 @@ const char *vo_format_name(int format)
|
||||
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_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";
|
||||
case IMGFMT_444P9_BE: return "Planar 444P 9-bit big-endian";
|
||||
case IMGFMT_420A: return "Planar 420P with alpha";
|
||||
case IMGFMT_444P: return "Planar 444P";
|
||||
case IMGFMT_422P: return "Planar 422P";
|
||||
@ -116,6 +126,10 @@ int mp_get_chroma_shift(int format, int *x_shift, int *y_shift)
|
||||
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:
|
||||
@ -131,6 +145,10 @@ int mp_get_chroma_shift(int format, int *x_shift, int *y_shift)
|
||||
break;
|
||||
case IMGFMT_444P16_LE:
|
||||
case IMGFMT_444P16_BE:
|
||||
case IMGFMT_444P10_LE:
|
||||
case IMGFMT_444P10_BE:
|
||||
case IMGFMT_444P9_LE:
|
||||
case IMGFMT_444P9_BE:
|
||||
bpp_factor = 2;
|
||||
case IMGFMT_444P:
|
||||
xs = 0;
|
||||
@ -138,6 +156,8 @@ int mp_get_chroma_shift(int format, int *x_shift, int *y_shift)
|
||||
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;
|
||||
|
@ -123,22 +123,42 @@
|
||||
|
||||
#define IMGFMT_444P16_LE 0x51343434
|
||||
#define IMGFMT_444P16_BE 0x34343451
|
||||
#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_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_444P10 IMGFMT_444P10_BE
|
||||
#define IMGFMT_444P9 IMGFMT_444P9_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
|
||||
#else
|
||||
#define IMGFMT_444P16 IMGFMT_444P16_LE
|
||||
#define IMGFMT_444P10 IMGFMT_444P10_LE
|
||||
#define IMGFMT_444P9 IMGFMT_444P9_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
|
||||
#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_NE(fmt) (((fmt ^ IMGFMT_420P16 ) & 0xff0000ff) == 0)
|
||||
#define IMGFMT_IS_YUVP16(fmt) (IMGFMT_IS_YUVP16_LE(fmt) || IMGFMT_IS_YUVP16_BE(fmt))
|
||||
|
||||
|
@ -145,10 +145,20 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
|
||||
case IMGFMT_440P:
|
||||
case IMGFMT_444P16_LE:
|
||||
case IMGFMT_444P16_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_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:
|
||||
|
@ -68,13 +68,23 @@ static const unsigned int outfmt_list[]={
|
||||
IMGFMT_444P,
|
||||
IMGFMT_444P16_LE,
|
||||
IMGFMT_444P16_BE,
|
||||
IMGFMT_444P10_LE,
|
||||
IMGFMT_444P10_BE,
|
||||
IMGFMT_444P9_LE,
|
||||
IMGFMT_444P9_BE,
|
||||
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,
|
||||
|
15
m_option.c
15
m_option.c
@ -1108,12 +1108,27 @@ static struct {
|
||||
} mp_imgfmt_list[] = {
|
||||
{"444p16le", IMGFMT_444P16_LE},
|
||||
{"444p16be", IMGFMT_444P16_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},
|
||||
{"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},
|
||||
{"444p10", IMGFMT_444P10},
|
||||
{"444p9", IMGFMT_444P9},
|
||||
{"422p16", IMGFMT_422P16},
|
||||
{"422p10", IMGFMT_422P10},
|
||||
{"420p10", IMGFMT_420P10},
|
||||
{"420p9", IMGFMT_420P9},
|
||||
{"420p16", IMGFMT_420P16},
|
||||
{"420a", IMGFMT_420A},
|
||||
{"444p", IMGFMT_444P},
|
||||
|
Loading…
Reference in New Issue
Block a user