summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-07 16:28:19 +0100
committerwm4 <wm4@nowhere>2016-01-07 16:31:52 +0100
commit27bc881cd860e6cf3ad360f2f8cb24a21cbcd981 (patch)
treea5bca82a9b12ac1c8bede3c0c7bc4915155d6399 /video/out/opengl/video.c
parentb0c1455aa4c9fc319d91fe340fa4f6766e2ad898 (diff)
downloadmpv-27bc881cd860e6cf3ad360f2f8cb24a21cbcd981.tar.bz2
mpv-27bc881cd860e6cf3ad360f2f8cb24a21cbcd981.tar.xz
vo_opengl: generic semi-planar support
Should take care of the planned FFmpeg AV_PIX_FMT_P010 addition. (This will eventually be needed when doing HEVC Main 10 decoding with DXVA2 copyback.)
Diffstat (limited to 'video/out/opengl/video.c')
-rw-r--r--video/out/opengl/video.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index 3600dda8c4..24618937d8 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -1880,9 +1880,7 @@ static void pass_render_frame_dumb(struct gl_video *p, int fbo)
gl_transform_rect(transform, &p->pass_tex[3].src);
GLSL(vec4 color = texture(texture0, texcoord0);)
- if (p->image_params.imgfmt == IMGFMT_NV12 ||
- p->image_params.imgfmt == IMGFMT_NV21)
- {
+ if (p->image_desc.flags & MP_IMGFLAG_YUV_NV) {
GLSL(color.gb = texture(texture1, texcoord1).RG;)
} else if (p->plane_count >= 3) {
GLSL(color.g = texture(texture1, texcoord1).r;)
@@ -2659,12 +2657,15 @@ static bool init_format(int fmt, struct gl_video *init)
}
// YUV/half-packed
- if (fmt == IMGFMT_NV12 || fmt == IMGFMT_NV21) {
- plane_format[0] = find_tex_format(gl, 1, 1);
- plane_format[1] = find_tex_format(gl, 1, 2);
- if (fmt == IMGFMT_NV21)
- snprintf(init->color_swizzle, sizeof(init->color_swizzle), "rbga");
- goto supported;
+ if (desc.flags & MP_IMGFLAG_YUV_NV) {
+ int bits = desc.component_bits;
+ if ((desc.flags & MP_IMGFLAG_NE) && bits >= 8 && bits <= 16) {
+ plane_format[0] = find_tex_format(gl, (bits + 7) / 8, 1);
+ plane_format[1] = find_tex_format(gl, (bits + 7) / 8, 2);
+ if (desc.flags & MP_IMGFLAG_YUV_NV_SWAP)
+ snprintf(init->color_swizzle, sizeof(init->color_swizzle), "rbga");
+ goto supported;
+ }
}
// XYZ (same organization as RGB packed, but requires conversion matrix)