summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-04-04 16:56:30 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-04-04 16:56:30 +0000
commitb8a7ed8a79ed6d9c911bc2be082f86bf2d92c48d (patch)
tree19dd7fb39e56dc13f5d81f01c726160fdc7d382d /libvo
parentad26195a80a3325969d479b5e6bea308e64cf844 (diff)
downloadmpv-b8a7ed8a79ed6d9c911bc2be082f86bf2d92c48d.tar.bz2
mpv-b8a7ed8a79ed6d9c911bc2be082f86bf2d92c48d.tar.xz
Factor out the YUV->RGB conversion auto-selection and also
enable auto-selection of ATI fragment shaders since they should do accurate conversions now. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31006 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/gl_common.c14
-rw-r--r--libvo/gl_common.h1
-rw-r--r--libvo/vo_gl.c3
-rw-r--r--libvo/vo_gl2.c4
4 files changed, 18 insertions, 4 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 07593989ae..e8b66e1ccc 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -1380,6 +1380,20 @@ static void glSetupYUVFragprog(gl_conversion_params_t *params) {
}
/**
+ * \brief detect the best YUV->RGB conversion method available
+ */
+int glAutodetectYUVConversion(void) {
+ const char *extensions = mpglGetString(GL_EXTENSIONS);
+ if (strstr(extensions, "GL_ARB_fragment_program"))
+ return YUV_CONVERSION_FRAGMENT;
+ if (strstr(extensions, "GL_ATI_text_fragment_shader"))
+ return YUV_CONVERSION_TEXT_FRAGMENT;
+ if (strstr(extensions, "GL_ATI_fragment_shader"))
+ return YUV_CONVERSION_COMBINERS_ATI;
+ return YUV_CONVERSION_NONE;
+}
+
+/**
* \brief setup YUV->RGB conversion
* \param parms struct containing parameters like conversion and scaler type,
* brightness, ...
diff --git a/libvo/gl_common.h b/libvo/gl_common.h
index d1a382079e..6fb28fdb80 100644
--- a/libvo/gl_common.h
+++ b/libvo/gl_common.h
@@ -345,6 +345,7 @@ typedef struct {
float filter_strength;
} gl_conversion_params_t;
+int glAutodetectYUVConversion(void);
void glSetupYUVConversion(gl_conversion_params_t *params);
void glEnableYUVConversion(GLenum target, int type);
void glDisableYUVConversion(GLenum target, int type);
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index d27a72e3a2..6c80eeddfc 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -480,7 +480,8 @@ static void autodetectGlExtensions(void) {
if (ati_hack == -1) ati_hack = ati_broken_pbo;
if (force_pbo == -1) force_pbo = strstr(extensions, "_pixel_buffer_object") ? is_ati : 0;
if (use_rectangle == -1) use_rectangle = strstr(extensions, "_texture_non_power_of_two") ? 0 : 0;
- if (use_yuv == -1) use_yuv = strstr(extensions, "GL_ARB_fragment_program") ? 2 : 0;
+ if (use_yuv == -1)
+ use_yuv = glAutodetectYUVConversion();
if (is_ati && (lscale == 1 || lscale == 2 || cscale == 1 || cscale == 2))
mp_msg(MSGT_VO, MSGL_WARN, "[gl] Selected scaling mode may be broken on ATI cards.\n"
"Tell _them_ to fix GL_REPEAT if you have issues.\n");
diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c
index 9385a158b3..e59ec25e47 100644
--- a/libvo/vo_gl2.c
+++ b/libvo/vo_gl2.c
@@ -886,7 +886,6 @@ static int preinit(const char *arg)
}
if(!init_mpglcontext(&glctx, gltype)) goto err_out;
if (use_yuv == -1) {
- const char *extensions;
#ifdef CONFIG_GL_WIN32
if (config_w32(320, 200, 320, 200, VOFLAG_HIDDEN, "", 0) == -1)
#else
@@ -895,8 +894,7 @@ static int preinit(const char *arg)
goto err_out;
if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED)
goto err_out;
- extensions = mpglGetString(GL_EXTENSIONS);
- use_yuv = strstr(extensions, "GL_ARB_fragment_program") ? 2 : 0;
+ use_yuv = glAutodetectYUVConversion();
}
return 0;