[vlc-commits] opengl: add NV12 support
Thomas Guillem
git at videolan.org
Thu Feb 2 09:52:50 CET 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb 1 09:55:06 2017 +0100| [ca7d2ea4b618b5bc1a8a03c0318d4f2afaf3007f] | committer: Thomas Guillem
opengl: add NV12 support
This will be mainly used by CVPX_NV12.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ca7d2ea4b618b5bc1a8a03c0318d4f2afaf3007f
---
modules/video_output/opengl/converters.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/modules/video_output/opengl/converters.c b/modules/video_output/opengl/converters.c
index 9ddf088..e2b4d3c 100644
--- a/modules/video_output/opengl/converters.c
+++ b/modules/video_output/opengl/converters.c
@@ -109,19 +109,21 @@ tc_yuv_base_init(opengl_tex_converter_t *tc, GLenum tex_target,
if (desc == NULL)
return VLC_EGENERIC;
- GLint oneplane_texfmt, oneplane16_texfmt;
+ GLint oneplane_texfmt, oneplane16_texfmt, twoplanes_texfmt;
#if !defined(USE_OPENGL_ES2)
if (HasExtension(tc->glexts, "GL_ARB_texture_rg"))
{
oneplane_texfmt = GL_RED;
oneplane16_texfmt = GL_R16;
+ twoplanes_texfmt = GL_RG;
}
else
#endif
{
oneplane_texfmt = GL_LUMINANCE;
oneplane16_texfmt = GL_LUMINANCE16;
+ twoplanes_texfmt = GL_LUMINANCE_ALPHA;
}
float yuv_range_correction = 1.0;
@@ -161,6 +163,30 @@ tc_yuv_base_init(opengl_tex_converter_t *tc, GLenum tex_target,
if (oneplane_texfmt == GL_RED)
swizzle_per_tex[0] = swizzle_per_tex[1] = swizzle_per_tex[2] = "r";
}
+ else if (desc->plane_count == 2)
+ {
+ if (desc->pixel_size != 1)
+ return VLC_EGENERIC;
+
+ tc->tex_count = 2;
+ tc->texs[0] = (struct opengl_tex_cfg) {
+ { 1, 1 }, { 1, 1 }, oneplane_texfmt, oneplane_texfmt, GL_UNSIGNED_BYTE
+ };
+ tc->texs[1] = (struct opengl_tex_cfg) {
+ { 1, 2 }, { 1, 2 }, twoplanes_texfmt, twoplanes_texfmt, GL_UNSIGNED_BYTE
+ };
+
+ if (oneplane_texfmt == GL_RED)
+ {
+ swizzle_per_tex[0] = "r";
+ swizzle_per_tex[1] = "rg";
+ }
+ else
+ {
+ swizzle_per_tex[0] = NULL;
+ swizzle_per_tex[1] = "xa";
+ }
+ }
else
return VLC_EGENERIC;
@@ -201,7 +227,8 @@ tc_yuv_base_init(opengl_tex_converter_t *tc, GLenum tex_target,
tc->chroma = chroma;
tc->yuv_color = true;
- *swap_uv = chroma == VLC_CODEC_YV12 || chroma == VLC_CODEC_YV9;
+ *swap_uv = chroma == VLC_CODEC_YV12 || chroma == VLC_CODEC_YV9 ||
+ chroma == VLC_CODEC_NV21;
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list