[vlc-commits] opengl: converter: pass texture sizes to pf_update

Thomas Guillem git at videolan.org
Thu Feb 2 09:52:49 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb  1 11:40:31 2017 +0100| [34ea88d494f61ca9573f57c8f94b5ed0efbc1f09] | committer: Thomas Guillem

opengl: converter: pass texture sizes to pf_update

Since it's already calculated from vout_helper.

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

 modules/video_output/opengl/converter_android.c |  4 ++--
 modules/video_output/opengl/converters.c        | 19 ++++++++-----------
 modules/video_output/opengl/internal.h          |  6 +++---
 modules/video_output/opengl/vout_helper.c       |  6 ++----
 4 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/modules/video_output/opengl/converter_android.c b/modules/video_output/opengl/converter_android.c
index 7075c04..3c304a9 100644
--- a/modules/video_output/opengl/converter_android.c
+++ b/modules/video_output/opengl/converter_android.c
@@ -124,10 +124,10 @@ error:
 
 static int
 tc_anop_update(const opengl_tex_converter_t *tc, GLuint *textures,
-               unsigned width, unsigned height,
+               const GLsizei *tex_width, const GLsizei *tex_height,
                picture_t *pic, const size_t *plane_offset)
 {
-    (void) width; (void) height; (void) plane_offset;
+    (void) tex_width; (void) tex_height; (void) plane_offset;
     assert(textures[0] != 0);
 
     if (plane_offset != NULL)
diff --git a/modules/video_output/opengl/converters.c b/modules/video_output/opengl/converters.c
index a8631e4..bf83d6f 100644
--- a/modules/video_output/opengl/converters.c
+++ b/modules/video_output/opengl/converters.c
@@ -160,7 +160,8 @@ pbo_release_gpupics(const opengl_tex_converter_t *tc, bool force)
 
 static int
 pbo_common_update(const opengl_tex_converter_t *tc, const GLuint *textures,
-                  unsigned width, unsigned height, picture_t *pic)
+                  const GLsizei *tex_width, const GLsizei *tex_height,
+                  picture_t *pic)
 {
     struct priv *priv = tc->priv;
     picture_sys_t *picsys = pic->p_sys;
@@ -178,9 +179,7 @@ pbo_common_update(const opengl_tex_converter_t *tc, const GLuint *textures,
         glPixelStorei(GL_UNPACK_ROW_LENGTH,
                       pic->p[i].i_pitch / pic->p[i].i_pixel_pitch);
 
-        glTexSubImage2D(tc->tex_target, 0, 0, 0,
-                        width * tc->desc->p[i].w.num / tc->desc->p[i].w.den,
-                        height * tc->desc->p[i].h.num / tc->desc->p[i].h.den,
+        glTexSubImage2D(tc->tex_target, 0, 0, 0, tex_width[i], tex_height[i],
                         priv->tex_format, priv->tex_type, NULL);
     }
 
@@ -331,7 +330,7 @@ tc_common_allocate_texture(const opengl_tex_converter_t *tc, GLuint texture,
 
 static int
 upload_plane(const opengl_tex_converter_t *tc,
-             unsigned width, unsigned height,
+             GLsizei width, GLsizei height,
              unsigned pitch, unsigned pixel_pitch, const void *pixels)
 {
     struct priv *priv = tc->priv;
@@ -364,7 +363,7 @@ upload_plane(const opengl_tex_converter_t *tc,
             }
             destination = priv->texture_temp_buf;
 
-            for (unsigned h = 0; h < height ; h++)
+            for (GLsizei h = 0; h < height ; h++)
             {
                 memcpy(destination, source, width * pixel_pitch);
                 source += pitch;
@@ -391,12 +390,12 @@ upload_plane(const opengl_tex_converter_t *tc,
 
 static int
 tc_common_update(const opengl_tex_converter_t *tc, GLuint *textures,
-                 unsigned width, unsigned height,
+                 const GLsizei *tex_width, const GLsizei *tex_height,
                  picture_t *pic, const size_t *plane_offset)
 {
 #ifdef VLCGL_HAS_PBO
     if (pic->p_sys != NULL)
-        return pbo_common_update(tc, textures, width, height, pic);
+        return pbo_common_update(tc, textures, tex_width, tex_height, pic);
 #endif
 
     int ret = VLC_SUCCESS;
@@ -410,9 +409,7 @@ tc_common_update(const opengl_tex_converter_t *tc, GLuint *textures,
                              &pic->p[i].p_pixels[plane_offset[i]] :
                              pic->p[i].p_pixels;
 
-        ret = upload_plane(tc,
-                           width * tc->desc->p[i].w.num / tc->desc->p[i].w.den,
-                           height * tc->desc->p[i].h.num / tc->desc->p[i].h.den,
+        ret = upload_plane(tc, tex_width[i], tex_height[i],
                            pic->p[i].i_pitch, pic->p[i].i_pixel_pitch, pixels);
     }
     return ret;
diff --git a/modules/video_output/opengl/internal.h b/modules/video_output/opengl/internal.h
index 19733c7..a11d5c9 100644
--- a/modules/video_output/opengl/internal.h
+++ b/modules/video_output/opengl/internal.h
@@ -219,15 +219,15 @@ struct opengl_tex_converter_t
      *
      * \param fc OpenGL tex converter
      * \param textures array of textures to bind (one per plane)
-     * \param width width in pixels
-     * \param height height in pixels
+     * \param tex_width array of tex width (one per plane)
+     * \param tex_height array of tex height (one per plane)
      * \param pic picture to update
      * \param plane_offset offsets of each picture planes to read data from
      * (one per plane, can be NULL)
      * \return VLC_SUCCESS or a VLC error
      */
     int (*pf_update)(const opengl_tex_converter_t *fc, GLuint *textures,
-                     unsigned width, unsigned height,
+                     const GLsizei *tex_width, const GLsizei *tex_height,
                      picture_t *pic, const size_t *plane_offset);
 
     /*
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index a312bf4..5fd5ebc 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -953,8 +953,7 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
     opengl_tex_converter_t *tc = &vgl->prgm->tc;
 
     /* Update the texture */
-    int ret = tc->pf_update(tc, vgl->texture,
-                            vgl->fmt.i_visible_width, vgl->fmt.i_visible_height,
+    int ret = tc->pf_update(tc, vgl->texture, vgl->tex_width, vgl->tex_height,
                             picture, NULL);
     if (ret != VLC_SUCCESS)
         return ret;
@@ -1020,8 +1019,7 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
                 if (ret != VLC_SUCCESS)
                     continue;
             }
-            ret = tc->pf_update(tc, &glr->texture,
-                                r->fmt.i_visible_width, r->fmt.i_visible_height,
+            ret = tc->pf_update(tc, &glr->texture, &glr->width, &glr->height,
                                 r->p_picture, &pixels_offset);
         }
     }



More information about the vlc-commits mailing list