From c1a96de41c9e3b38d0946d5c02c1faf5b39d4074 Mon Sep 17 00:00:00 2001 From: Bin Jin Date: Sat, 5 Dec 2015 18:54:25 +0000 Subject: vo_opengl: Fix minor LUT sampling error Define a macro to correct the coordinate for lookup texture. Cache the corrected coordinate for 1D filter and use mix() to minimize the performance impact. --- video/out/opengl/video.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'video/out/opengl/video.c') diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index 6f3aba249c..de20984cdc 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -1081,14 +1081,16 @@ static void reinit_scaler(struct gl_video *p, struct scaler *scaler, gl->BindTexture(target, scaler->gl_lut); - float *weights = talloc_array(NULL, float, LOOKUP_TEXTURE_SIZE * size); - mp_compute_lut(scaler->kernel, LOOKUP_TEXTURE_SIZE, weights); + scaler->lut_size = LOOKUP_TEXTURE_SIZE; + + float *weights = talloc_array(NULL, float, scaler->lut_size * size); + mp_compute_lut(scaler->kernel, scaler->lut_size, weights); if (target == GL_TEXTURE_1D) { - gl->TexImage1D(target, 0, fmt->internal_format, LOOKUP_TEXTURE_SIZE, + gl->TexImage1D(target, 0, fmt->internal_format, scaler->lut_size, 0, fmt->format, GL_FLOAT, weights); } else { - gl->TexImage2D(target, 0, fmt->internal_format, width, LOOKUP_TEXTURE_SIZE, + gl->TexImage2D(target, 0, fmt->internal_format, width, scaler->lut_size, 0, fmt->format, GL_FLOAT, weights); } -- cgit v1.2.3