[vlc-devel] [PATCH 09/24] opengl: expose GetAlignedSize()
Romain Vimont
rom1v at videolabs.io
Mon Jan 27 21:19:59 CET 2020
This util function will be called from other files.
---
modules/video_output/opengl/vout_helper.c | 15 ++++-----------
modules/video_output/opengl/vout_helper.h | 8 ++++++++
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index 80e47b2948..892da547f0 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -291,13 +291,6 @@ static void getOrientationTransformMatrix(video_orientation_t orientation,
}
}
-static inline GLsizei GetAlignedSize(unsigned size)
-{
- /* Return the smallest larger or equal power of 2 */
- unsigned align = 1 << (8 * sizeof (unsigned) - clz(size));
- return ((align >> 1) == size) ? size : align;
-}
-
static GLuint BuildVertexShader(const opengl_tex_converter_t *tc,
unsigned plane_count)
{
@@ -814,8 +807,8 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
vgl->tex_width[j] = w;
vgl->tex_height[j] = h;
} else {
- vgl->tex_width[j] = GetAlignedSize(w);
- vgl->tex_height[j] = GetAlignedSize(h);
+ vgl->tex_width[j] = vout_display_opengl_GetAlignedSize(w);
+ vgl->tex_height[j] = vout_display_opengl_GetAlignedSize(h);
}
}
@@ -1012,8 +1005,8 @@ vout_display_opengl_PrepareSubPicture(vout_display_opengl_t *vgl,
glr->width = r->fmt.i_visible_width;
glr->height = r->fmt.i_visible_height;
if (!vgl->supports_npot) {
- glr->width = GetAlignedSize(glr->width);
- glr->height = GetAlignedSize(glr->height);
+ glr->width = vout_display_opengl_GetAlignedSize(glr->width);
+ glr->height = vout_display_opengl_GetAlignedSize(glr->height);
glr->tex_width = (float) r->fmt.i_visible_width / glr->width;
glr->tex_height = (float) r->fmt.i_visible_height / glr->height;
} else {
diff --git a/modules/video_output/opengl/vout_helper.h b/modules/video_output/opengl/vout_helper.h
index 72895f8747..a03f50297f 100644
--- a/modules/video_output/opengl/vout_helper.h
+++ b/modules/video_output/opengl/vout_helper.h
@@ -29,6 +29,7 @@
#ifndef VLC_OPENGL_VOUT_HELPER_H
#define VLC_OPENGL_VOUT_HELPER_H
+#include <vlc_common.h>
#include "converter.h"
#ifdef HAVE_LIBPLACEBO
@@ -106,4 +107,11 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
int vout_display_opengl_Display(vout_display_opengl_t *vgl,
const video_format_t *source);
+static inline GLsizei vout_display_opengl_GetAlignedSize(unsigned size)
+{
+ /* Return the smallest larger or equal power of 2 */
+ unsigned align = 1 << (8 * sizeof (unsigned) - clz(size));
+ return ((align >> 1) == size) ? size : align;
+}
+
#endif
--
2.25.0
More information about the vlc-devel
mailing list