diff options
author | Bin Jin <bjin1990@gmail.com> | 2015-12-05 18:54:25 +0000 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-12-07 23:48:15 +0100 |
commit | c1a96de41c9e3b38d0946d5c02c1faf5b39d4074 (patch) | |
tree | e5f5b4b955943f48a535d5b87a9a72711dec50c4 /video/out/opengl/video.c | |
parent | 18fe6e6dc8784348cf4f55b3a07c191a0ed8943d (diff) | |
download | mpv-c1a96de41c9e3b38d0946d5c02c1faf5b39d4074.tar.bz2 mpv-c1a96de41c9e3b38d0946d5c02c1faf5b39d4074.tar.xz |
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.
Diffstat (limited to 'video/out/opengl/video.c')
-rw-r--r-- | video/out/opengl/video.c | 10 |
1 files changed, 6 insertions, 4 deletions
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); } |