diff options
author | wm4 <wm4@nowhere> | 2012-11-14 11:19:04 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-11-14 11:50:02 +0100 |
commit | e5f7976000af0fb8da5fd0c3a01cfd44e6e64516 (patch) | |
tree | d0745e2f279e2f7e9702d89cbf6e0e6bf58de3f5 | |
parent | a86ec729868e9bd5777f5800527e5cd9bf79fe85 (diff) | |
download | mpv-e5f7976000af0fb8da5fd0c3a01cfd44e6e64516.tar.bz2 mpv-e5f7976000af0fb8da5fd0c3a01cfd44e6e64516.tar.xz |
video: add IMGFMT_Y16/PIX_FMT_GRAY16
This pixel format is sometimes used with yuv4mpeg.
vo_direct3d used its own IMGFMT_Y16 internally for some reason.
vo_opengl, vo_opengl_old, and vo_direct3d should be able to display
this pixel format natively.
-rw-r--r-- | video/fmt-conversion.c | 2 | ||||
-rw-r--r-- | video/img_format.c | 9 | ||||
-rw-r--r-- | video/img_format.h | 16 | ||||
-rw-r--r-- | video/mp_image.c | 2 | ||||
-rw-r--r-- | video/out/vo_direct3d.c | 2 |
5 files changed, 26 insertions, 5 deletions
diff --git a/video/fmt-conversion.c b/video/fmt-conversion.c index 6ce5140d58..736af8701c 100644 --- a/video/fmt-conversion.c +++ b/video/fmt-conversion.c @@ -62,6 +62,8 @@ static const struct { {IMGFMT_NV21, PIX_FMT_NV21}, {IMGFMT_Y800, PIX_FMT_GRAY8}, {IMGFMT_Y8, PIX_FMT_GRAY8}, + {IMGFMT_Y16LE, PIX_FMT_GRAY16LE}, + {IMGFMT_Y16BE, PIX_FMT_GRAY16BE}, {IMGFMT_YVU9, PIX_FMT_YUV410P}, {IMGFMT_IF09, PIX_FMT_YUV410P}, {IMGFMT_YV12, PIX_FMT_YUV420P}, diff --git a/video/img_format.c b/video/img_format.c index 8038e82324..42df721435 100644 --- a/video/img_format.c +++ b/video/img_format.c @@ -103,6 +103,12 @@ int mp_get_chroma_shift(int format, int *x_shift, int *y_shift, xs = 31; ys = 31; break; + case IMGFMT_Y16BE: + case IMGFMT_Y16LE: + bits = 16; + xs = 31; + ys = 31; + break; default: err = 1; break; @@ -164,6 +170,9 @@ struct mp_imgfmt_entry mp_imgfmt_list[] = { {"hm12", IMGFMT_HM12}, {"y800", IMGFMT_Y800}, {"y8", IMGFMT_Y8}, + {"y16ne", IMGFMT_Y16}, + {"y16le", IMGFMT_Y16LE}, + {"y16be", IMGFMT_Y16BE}, {"nv12", IMGFMT_NV12}, {"nv21", IMGFMT_NV21}, {"bgr24", IMGFMT_BGR24}, diff --git a/video/img_format.h b/video/img_format.h index c32600f519..f3611a5fab 100644 --- a/video/img_format.h +++ b/video/img_format.h @@ -102,7 +102,17 @@ #define IMGFMT_BGR_DEPTH(fmt) ((fmt)&0x3F) // AV_PIX_FMT_BGR0 -#define IMGFMT_BGR0 0x1DC70000 +#define IMGFMT_BGR0 0x1DC70000 +// AV_PIX_FMT_GRAY16LE +#define IMGFMT_Y16LE 0x1DC70001 +// AV_PIX_FMT_GRAY16BE +#define IMGFMT_Y16BE 0x1DC70002 + +#if BYTE_ORDER == BIG_ENDIAN +#define IMGFMT_Y16 IMGFMT_Y16BE +#else +#define IMGFMT_Y16 IMGFMT_Y16LE +#endif /* Planar YUV Formats */ @@ -170,8 +180,8 @@ #endif // These macros are misnamed - they actually match 9, 10 or 16 bits -#define IMGFMT_IS_YUVP16_LE(fmt) (((fmt - 0x51000034) & 0xfc0000ff) == 0) -#define IMGFMT_IS_YUVP16_BE(fmt) (((fmt - 0x34000051) & 0xff0000fc) == 0) +#define IMGFMT_IS_YUVP16_LE(fmt) (((fmt - 0x51000034) & 0xfc0000ff) == 0 || fmt == IMGFMT_Y16LE) +#define IMGFMT_IS_YUVP16_BE(fmt) (((fmt - 0x34000051) & 0xff0000fc) == 0 || fmt == IMGFMT_Y16BE) #define IMGFMT_IS_YUVP16(fmt) (IMGFMT_IS_YUVP16_LE(fmt) || IMGFMT_IS_YUVP16_BE(fmt)) /* Packed YUV Formats */ diff --git a/video/mp_image.c b/video/mp_image.c index e910830a8b..73164fdc59 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -193,6 +193,8 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){ return; case IMGFMT_Y800: case IMGFMT_Y8: + case IMGFMT_Y16LE: + case IMGFMT_Y16BE: /* they're planar ones, but for easier handling use them as packed */ mpi->flags&=~MP_IMGFLAG_PLANAR; mpi->num_planes=1; diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c index f1c92d2a6e..3a70a081bf 100644 --- a/video/out/vo_direct3d.c +++ b/video/out/vo_direct3d.c @@ -49,8 +49,6 @@ // TODO: beg someone to add this (there is already IMGFMT_Y8) -// equals MAKEFOURCC('Y', '1', '6', ' ') -#define IMGFMT_Y16 0x20363159 #define IMGFMT_A8Y8 MAKEFOURCC('A', '8', 'Y', '8') #define IMGFMT_IS_Y(x) ((x) == IMGFMT_Y8 || (x) == IMGFMT_Y16 || (x) == IMGFMT_A8Y8) |