From 317b722c5129d9f5e4e4fea244cb9e99f1cafda8 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 1 Jun 2020 13:15:21 +0200 Subject: [PATCH] avfilter/vf_lut3d: Fix mixed declaration and code Reviewed-by: Paul B Mahol Signed-off-by: Andreas Rheinhardt --- libavfilter/vf_lut3d.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c index e5d9fcc068..6730a424ce 100644 --- a/libavfilter/vf_lut3d.c +++ b/libavfilter/vf_lut3d.c @@ -261,10 +261,11 @@ static inline float prelut_interp_1d_linear(const Lut3DPreLut *prelut, static inline struct rgbvec apply_prelut(const Lut3DPreLut *prelut, const struct rgbvec *s) { + struct rgbvec c; + if (prelut->size <= 0) return *s; - struct rgbvec c; c.r = prelut_interp_1d_linear(prelut, 0, s->r); c.g = prelut_interp_1d_linear(prelut, 1, s->g); c.b = prelut_interp_1d_linear(prelut, 2, s->b); @@ -975,17 +976,16 @@ static int parse_cinespace(AVFilterContext *ctx, FILE *f) for (int i = 0; i < lut3d->prelut.size; ++i) { float mix = (float) i / (float)(lut3d->prelut.size - 1); - float x = lerpf(in_min[c], in_max[c], mix); + float x = lerpf(in_min[c], in_max[c], mix), a, b; int idx = nearest_sample_index(in_prelut[c], x, 0, prelut_sizes[c]-1); av_assert0(idx + 1 < prelut_sizes[c]); - float a = out_prelut[c][idx + 0]; - float b = out_prelut[c][idx + 1]; + a = out_prelut[c][idx + 0]; + b = out_prelut[c][idx + 1]; mix = x - in_prelut[c][idx]; - float outval = lerpf(a, b, mix); - lut3d->prelut.lut[c][i] = sanitizef(outval); + lut3d->prelut.lut[c][i] = sanitizef(lerpf(a, b, mix)); } } lut3d->scale.r = 1.00f;