[vlc-commits] opengl: refactor

Thomas Guillem git at videolan.org
Mon Jan 8 11:47:05 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jan  2 14:06:56 2018 +0100| [fc1095f25a0b5bb09d51b0c18b00ecfa0d77d243] | committer: Jean-Baptiste Kempf

opengl: refactor

fetch vlc_chroma_description_t only one time.

(cherry picked from commit 6569392799839aa9df286a04f58aa040e4aa1c08)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 cbd0a52858..ac2edcc618 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