[vlc-commits] [Git][videolan/vlc][master] 2 commits: pl_scale: enable only if HAVE_LIBPLACEBO
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Thu Nov 25 13:36:48 UTC 2021
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
8f758454 by Romain Vimont at 2021-11-25T13:13:04+00:00
pl_scale: enable only if HAVE_LIBPLACEBO
HAVE_LIBPLACEBO_SCALE checks the version of libplacebo, but if
libplacebo is explicitly disabled (but libplacebo_scale enabled), then
it failed.
- - - - -
6301793c by Romain Vimont at 2021-11-25T13:13:04+00:00
opengl: make scale vars independent of libplacebo
The upscaler and downscaler options are valid for all OpenGL vouts.
The fact that they use libplacebo is an implementation detail (they
could support another backend later).
In practice, this also avoids to crash if libplacebo is disabled:
the variables were defined only if HAVE_LIBPLACEBO, but they were read
in all cases.
Fixes #26315
- - - - -
6 changed files:
- modules/video_output/libplacebo/utils.h
- modules/video_output/opengl/Makefile.am
- + modules/video_output/opengl/gl_scale.h
- modules/video_output/opengl/pl_scale.c
- modules/video_output/opengl/vout_helper.c
- modules/video_output/opengl/vout_helper.h
Changes:
=====================================
modules/video_output/libplacebo/utils.h
=====================================
@@ -28,6 +28,8 @@
#include <libplacebo/shaders/colorspace.h>
#include <libplacebo/utils/upload.h>
+#include "../opengl/gl_scale.h"
+
// Create a libplacebo context, hooked up to the log system; or NULL on OOM
struct pl_context *vlc_placebo_CreateContext(vlc_object_t *);
@@ -301,6 +303,30 @@ enum {
SCALE_CUSTOM,
};
+static const int libplacebo_scale_map[] = {
+ [VLC_GLSCALE_BUILTIN] = SCALE_BUILTIN,
+ [VLC_GLSCALE_SPLINE16] = SCALE_SPLINE16,
+ [VLC_GLSCALE_SPLINE36] = SCALE_SPLINE36,
+ [VLC_GLSCALE_SPLINE64] = SCALE_SPLINE64,
+ [VLC_GLSCALE_MITCHELL] = SCALE_MITCHELL,
+ [VLC_GLSCALE_BICUBIC] = SCALE_BICUBIC,
+ [VLC_GLSCALE_EWA_LANCZOS] = SCALE_EWA_LANCZOS,
+ [VLC_GLSCALE_NEAREST] = SCALE_NEAREST,
+ [VLC_GLSCALE_BILINEAR] = SCALE_BILINEAR,
+ [VLC_GLSCALE_GAUSSIAN] = SCALE_GAUSSIAN,
+ [VLC_GLSCALE_LANCZOS] = SCALE_LANCZOS,
+ [VLC_GLSCALE_GINSENG] = SCALE_GINSENG,
+ [VLC_GLSCALE_EWA_GINSENG] = SCALE_EWA_GINSENG,
+ [VLC_GLSCALE_EWA_HANN] = SCALE_EWA_HANN,
+ [VLC_GLSCALE_CATMULL_ROM] = SCALE_CATMULL_ROM,
+ [VLC_GLSCALE_ROBIDOUX] = SCALE_ROBIDOUX,
+ [VLC_GLSCALE_ROBIDOUXSHARP] = SCALE_ROBIDOUXSHARP,
+ [VLC_GLSCALE_EWA_ROBIDOUX] = SCALE_EWA_ROBIDOUX,
+ [VLC_GLSCALE_EWA_ROBIDOUXSHARP] = SCALE_EWA_ROBIDOUXSHARP,
+ [VLC_GLSCALE_SINC] = SCALE_SINC,
+ [VLC_GLSCALE_EWA_JINC] = SCALE_EWA_JINC,
+};
+
static const int scale_values[] = {
SCALE_BUILTIN,
SCALE_SPLINE16,
=====================================
modules/video_output/opengl/Makefile.am
=====================================
@@ -29,6 +29,7 @@ OPENGL_COMMONLIBS += libplacebo_utils.la
endif
OPENGL_VOUT_COMMONSOURCES = \
+ video_output/opengl/gl_scale.h \
video_output/opengl/renderer.c \
video_output/opengl/renderer.h \
video_output/opengl/sub_renderer.c \
@@ -124,6 +125,7 @@ libglfilter_mock_plugin_la_CFLAGS = -DUSE_OPENGL_ES2=1
noinst_LTLIBRARIES += libglfilter_mock_plugin.la
endif
+if HAVE_LIBPLACEBO
if HAVE_LIBPLACEBO_SCALE
libpl_scale_plugin_la_SOURCES = video_output/opengl/pl_scale.c
@@ -150,6 +152,7 @@ libpl_scale_plugin_la_CPPFLAGS += -DUSE_OPENGL_ES2=1
video_filter_LTLIBRARIES += libpl_scale_plugin.la
endif
+endif
endif
libegl_display_generic_plugin_la_SOURCES = video_output/opengl/egl_display_generic.c
=====================================
modules/video_output/opengl/gl_scale.h
=====================================
@@ -0,0 +1,111 @@
+/*****************************************************************************
++ * gl_scale.h
++ *****************************************************************************
++ * Copyright (C) 2021 VLC authors and VideoLAN
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU Lesser General Public License as published by
++ * the Free Software Foundation; either version 2.1 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * along with this program; if not, write to the Free Software Foundation,
++ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
++ *****************************************************************************/
+
+#ifndef VLC_GL_SCALE_H
+#define VLC_GL_SCALE_H
+
+enum vlc_gl_scale {
+ VLC_GLSCALE_BUILTIN,
+ VLC_GLSCALE_SPLINE16,
+ VLC_GLSCALE_SPLINE36,
+ VLC_GLSCALE_SPLINE64,
+ VLC_GLSCALE_MITCHELL,
+ VLC_GLSCALE_BICUBIC,
+ VLC_GLSCALE_EWA_LANCZOS,
+ VLC_GLSCALE_NEAREST,
+ VLC_GLSCALE_BILINEAR,
+ VLC_GLSCALE_GAUSSIAN,
+ VLC_GLSCALE_LANCZOS,
+ VLC_GLSCALE_GINSENG,
+ VLC_GLSCALE_EWA_GINSENG,
+ VLC_GLSCALE_EWA_HANN,
+ VLC_GLSCALE_CATMULL_ROM,
+ VLC_GLSCALE_ROBIDOUX,
+ VLC_GLSCALE_ROBIDOUXSHARP,
+ VLC_GLSCALE_EWA_ROBIDOUX,
+ VLC_GLSCALE_EWA_ROBIDOUXSHARP,
+ VLC_GLSCALE_SINC,
+ VLC_GLSCALE_EWA_JINC,
+};
+
+static const int vlc_glscale_values[] = {
+ VLC_GLSCALE_BUILTIN,
+ VLC_GLSCALE_SPLINE16,
+ VLC_GLSCALE_SPLINE36,
+ VLC_GLSCALE_SPLINE64,
+ VLC_GLSCALE_MITCHELL,
+ VLC_GLSCALE_BICUBIC,
+ VLC_GLSCALE_EWA_LANCZOS,
+ VLC_GLSCALE_NEAREST,
+ VLC_GLSCALE_BILINEAR,
+ VLC_GLSCALE_GAUSSIAN,
+ VLC_GLSCALE_LANCZOS,
+ VLC_GLSCALE_GINSENG,
+ VLC_GLSCALE_EWA_GINSENG,
+ VLC_GLSCALE_EWA_HANN,
+ VLC_GLSCALE_CATMULL_ROM,
+ VLC_GLSCALE_ROBIDOUX,
+ VLC_GLSCALE_ROBIDOUXSHARP,
+ VLC_GLSCALE_EWA_ROBIDOUX,
+ VLC_GLSCALE_EWA_ROBIDOUXSHARP,
+ VLC_GLSCALE_SINC,
+ VLC_GLSCALE_EWA_JINC,
+};
+
+static const char *const vlc_glscale_text[] = {
+ "Built-in / fixed function (fast)",
+ "Spline 2 taps",
+ "Spline 3 taps (recommended upscaler)",
+ "Spline 4 taps",
+ "Mitchell-Netravali (recommended downscaler)",
+ "Bicubic",
+ "Jinc / EWA Lanczos 3 taps (high quality, slow)",
+ "Nearest neighbor",
+ "Bilinear",
+ "Gaussian",
+ "Lanczos 3 taps",
+ "Ginseng 3 taps",
+ "EWA Ginseng",
+ "EWA Hann",
+ "Catmull-Rom",
+ "Robidoux",
+ "RobidouxSharp",
+ "EWA Robidoux",
+ "EWA RobidouxSharp",
+ "Unwindowed sinc (clipped)",
+ "Unwindowed EWA Jinc (clipped)",
+};
+
+#define VLC_GL_UPSCALER_TEXT "OpenGL upscaler"
+#define VLC_GL_UPSCALER_LONGTEXT "Upscaler filter to apply during rendering"
+
+#define VLC_GL_DOWNSCALER_TEXT "OpenGL downscaler"
+#define VLC_GL_DOWNSCALER_LONGTEXT "Downscaler filter to apply during rendering"
+
+#define add_glscale_opts() \
+ set_section(N_("Scaling"), NULL) \
+ add_integer("gl-upscaler", VLC_GLSCALE_BUILTIN, VLC_GL_UPSCALER_TEXT, \
+ VLC_GL_UPSCALER_LONGTEXT) \
+ change_integer_list(vlc_glscale_values, vlc_glscale_text) \
+ add_integer("gl-downscaler", VLC_GLSCALE_BUILTIN, VLC_GL_DOWNSCALER_TEXT, \
+ VLC_GL_DOWNSCALER_LONGTEXT) \
+ change_integer_list(vlc_glscale_values, vlc_glscale_text) \
+
+#endif
=====================================
modules/video_output/opengl/pl_scale.c
=====================================
@@ -39,6 +39,7 @@
#include "video_output/opengl/filter.h"
#include "video_output/opengl/gl_api.h"
#include "video_output/opengl/gl_common.h"
+#include "video_output/opengl/gl_scale.h"
#include "video_output/opengl/gl_util.h"
#include "video_output/opengl/sampler.h"
#include "video_output/libplacebo/utils.h"
@@ -319,8 +320,12 @@ Open(struct vlc_gl_filter *filter, const config_chain_t *config,
};
sys->render_params = pl_render_default_params;
- sys->render_params.upscaler = scale_config[upscaler];
- sys->render_params.downscaler = scale_config[downscaler];
+
+ int upscaler_idx = libplacebo_scale_map[upscaler];
+ sys->render_params.upscaler = scale_config[upscaler_idx];
+
+ int downscaler_idx = libplacebo_scale_map[downscaler];
+ sys->render_params.downscaler = scale_config[downscaler_idx];
static const struct vlc_gl_filter_ops ops = {
.draw = Draw,
=====================================
modules/video_output/opengl/vout_helper.c
=====================================
@@ -147,8 +147,8 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
goto delete_interop;
}
- int upscaler = var_InheritInteger(gl, "pl-upscaler");
- int downscaler = var_InheritInteger(gl, "pl-downscaler");
+ int upscaler = var_InheritInteger(gl, "gl-upscaler");
+ int downscaler = var_InheritInteger(gl, "gl-downscaler");
if (upscaler || downscaler)
{
=====================================
modules/video_output/opengl/vout_helper.h
=====================================
@@ -30,17 +30,11 @@
#define VLC_OPENGL_VOUT_HELPER_H
#include "gl_common.h"
+#include "gl_scale.h"
#ifdef HAVE_LIBPLACEBO
#include "../libplacebo/utils.h"
-#define UPSCALER_TEXT "OpenGL upscaler"
-#define UPSCALER_LONGTEXT "Upscaler filter to apply during rendering"
-
-#define DOWNSCALER_TEXT "OpenGL downscaler"
-#define DOWNSCALER_LONGTEXT "Downscaler filter to apply during rendering"
-
-
#if PL_API_VER >= 10
#define add_desat_params() \
add_float("desat-strength", pl_color_map_default_params.desaturation_strength, \
@@ -57,13 +51,6 @@
#endif
#define add_glopts_placebo() \
- set_section(N_("Scaling"), NULL) \
- add_integer("pl-upscaler", SCALE_BUILTIN, UPSCALER_TEXT, \
- UPSCALER_LONGTEXT) \
- change_integer_list(scale_values, scale_text) \
- add_integer("pl-downscaler", SCALE_BUILTIN, DOWNSCALER_TEXT, \
- DOWNSCALER_LONGTEXT) \
- change_integer_list(scale_values, scale_text) \
set_section(N_("Colorspace conversion"), NULL) \
add_integer("rendering-intent", pl_color_map_default_params.intent, \
RENDER_INTENT_TEXT, RENDER_INTENT_LONGTEXT) \
@@ -95,6 +82,7 @@
#define add_glopts() \
add_module("glinterop", "glinterop", NULL, GLINTEROP_TEXT, GLINTEROP_LONGTEXT) \
+ add_glscale_opts() \
add_glopts_placebo ()
typedef struct vout_display_opengl_t vout_display_opengl_t;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6b5bc195a9811c6bb666ef3a30a100db7bb71092...6301793c01bfa75c36c7a2afc058f0dda63c52a3
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6b5bc195a9811c6bb666ef3a30a100db7bb71092...6301793c01bfa75c36c7a2afc058f0dda63c52a3
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list