summaryrefslogtreecommitdiffstats
path: root/video/out/vo_direct3d.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-12-24 01:10:57 +0100
committerwm4 <wm4@nowhere>2013-01-13 20:04:11 +0100
commit5830d639b8d58b0911510db1ccb5de296adfcb4b (patch)
tree750496d0c09dc293a2ba7a8589a7679535edfc35 /video/out/vo_direct3d.c
parent3791c226b7f3bebbb63a96b61db67b9dc97ff9b8 (diff)
downloadmpv-5830d639b8d58b0911510db1ccb5de296adfcb4b.tar.bz2
mpv-5830d639b8d58b0911510db1ccb5de296adfcb4b.tar.xz
video: remove img_format compat hacks
Remove the strange things the old mp_image_setfmt() code did to the image format parameters. This includes setting chroma shift to 31 for gray (Y8) formats and more. Y8 + vo_opengl_old didn't actually work for unknown reasons (regression in this branch). Fix this. The difference is that Y8 is now interpreted as gray RGB (LUMINANCE texture) instead of involving YUV (and levels) conversion. Get rid of distinguishing RGB and BGR. There wasn't really any good reason for this. Remove mp_get_chroma_shift() and IMGFMT_IS_YUVP16*(). mp_imgfmt_desc gives the same information and more.
Diffstat (limited to 'video/out/vo_direct3d.c')
-rw-r--r--video/out/vo_direct3d.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c
index 6dbf1d3d59..6b9ca7e32b 100644
--- a/video/out/vo_direct3d.c
+++ b/video/out/vo_direct3d.c
@@ -961,14 +961,12 @@ static int get_chroma_clear_val(int bit_depth)
// this macro is supposed to work on all formats supported by 3D rendering, and
// that produce "reasonable" output (i.e. no mixed up colors)
#define IMGFMT_IS_ANY_RND(x) \
- (IMGFMT_IS_BGR(x) || IMGFMT_IS_RGB(x) || IMGFMT_IS_Y(x))
+ (IMGFMT_IS_RGB(x) || IMGFMT_IS_Y(x))
// pixel size in bit for any IMGFMT_IS_ANY_RND(x)==true
// we assume that the actual pixel strides are always aligned on bytes
static int imgfmt_any_rnd_depth(int fmt)
{
- if (IMGFMT_IS_BGR(fmt))
- return IMGFMT_BGR_DEPTH(fmt);
if (IMGFMT_IS_RGB(fmt))
return IMGFMT_RGB_DEPTH(fmt);
if (IMGFMT_IS_Y(fmt))
@@ -1033,9 +1031,12 @@ static D3DFORMAT check_shader_conversion(d3d_priv *priv, uint32_t fmt)
{
if (priv->opt_disable_shaders)
return 0;
- int component_bits;
- if (!mp_get_chroma_shift(fmt, NULL, NULL, &component_bits))
+ struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(fmt);
+ if (!(desc.flags & MP_IMGFLAG_YUV_P) || !(desc.flags & MP_IMGFLAG_NE))
return 0;
+ if (desc.num_planes != 3)
+ return 0;
+ int component_bits = desc.plane_bits;
if (component_bits < 8 || component_bits > 16)
return 0;
bool is_8bit = component_bits == 8;
@@ -1116,17 +1117,15 @@ static bool init_rendering_mode(d3d_priv *priv, uint32_t fmt, bool initialize)
} else {
mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Using YUV shaders.\n");
- int sx, sy, component_bits;
- mp_get_chroma_shift(priv->image_format, &sx, &sy, &component_bits);
+ struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(priv->image_format);
priv->plane_count = 3;
for (n = 0; n < 3; n++) {
planes[n].d3d_format = shader_d3dfmt;
- planes[n].bits_per_pixel = component_bits;
- if (n > 0) {
- planes[n].shift_x = sx;
- planes[n].shift_y = sy;
- planes[n].clearval = get_chroma_clear_val(component_bits);
- }
+ planes[n].bits_per_pixel = desc.plane_bits;
+ planes[n].shift_x = desc.xs[n];
+ planes[n].shift_y = desc.ys[n];
+ if (n > 0)
+ planes[n].clearval = get_chroma_clear_val(desc.plane_bits);
}
if (shader_d3dfmt != D3DFMT_A8L8) {
priv->pixel_shader_data = d3d_shader_yuv;