[vlc-commits] opengl: refactor

Thomas Guillem git at videolan.org
Thu Jan 4 12:09:52 CET 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jan  2 14:06:56 2018 +0100| [6569392799839aa9df286a04f58aa040e4aa1c08] | committer: Thomas Guillem

opengl: refactor

fetch vlc_chroma_description_t only one time.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6569392799839aa9df286a04f58aa040e4aa1c08
---

 modules/video_output/opengl/fragment_shaders.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules/video_output/opengl/fragment_shaders.c b/modules/video_output/opengl/fragment_shaders.c
index 3cc9222284..8b4d2b57ed 100644
--- a/modules/video_output/opengl/fragment_shaders.c
+++ b/modules/video_output/opengl/fragment_shaders.c
@@ -96,13 +96,10 @@ static int GetTexFormatSize(opengl_tex_converter_t *tc, int target,
 
 static int
 tc_yuv_base_init(opengl_tex_converter_t *tc, GLenum tex_target,
-                 vlc_fourcc_t chroma, video_color_space_t yuv_space,
+                 vlc_fourcc_t chroma, const vlc_chroma_description_t *desc,
+                 video_color_space_t yuv_space,
                  bool *swap_uv, const char *swizzle_per_tex[])
 {
-    const vlc_chroma_description_t *desc = vlc_fourcc_GetChromaDescription(chroma);
-    if (desc == NULL)
-        return VLC_EGENERIC;
-
     GLint oneplane_texfmt, oneplane16_texfmt,
           twoplanes_texfmt, twoplanes16_texfmt;
 
@@ -560,11 +557,15 @@ opengl_fragment_shader_init_impl(opengl_tex_converter_t *tc, GLenum tex_target,
     bool yuv_swap_uv = false;
     int ret;
 
+    const vlc_chroma_description_t *desc = vlc_fourcc_GetChromaDescription(chroma);
+    if (desc == NULL)
+        return VLC_EGENERIC;
+
     if (chroma == VLC_CODEC_XYZ12)
         return xyz12_shader_init(tc);
 
     if (is_yuv)
-        ret = tc_yuv_base_init(tc, tex_target, chroma, yuv_space,
+        ret = tc_yuv_base_init(tc, tex_target, chroma, desc, yuv_space,
                                &yuv_swap_uv, swizzle_per_tex);
     else
         ret = tc_rgb_base_init(tc, tex_target, chroma);



More information about the vlc-commits mailing list