From patchwork Mon Jun 1 11:32:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 20053 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 53BC9449674 for ; Mon, 1 Jun 2020 14:33:17 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 36BBC6881BA; Mon, 1 Jun 2020 14:33:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9FE9068A47E for ; Mon, 1 Jun 2020 14:33:10 +0300 (EEST) Received: by mail-wr1-f51.google.com with SMTP id y17so11098370wrn.11 for ; Mon, 01 Jun 2020 04:33:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nilDhe3Nui4BD7Cgs70rjnQ7ISHKeZBhNhDQaOgPAJc=; b=iQrmb0X5YI+o3waDzqw2vuhU5YdS67VCyy83hmXrVQR5RQ+BwyvqlfJdNtWhgdwCYg 4tRxWeEkxtCO+oOsceXyclXBMic9a94+9i0vLRnMrmlMsyXX+30KTd8GzNTC36o4N60g 3m7R3Ul04pY1Mg+1SRHohqxsTtYCH12Ypcox93fkGnT33fE32FE8jmzTdhw6K/5Sg2GT jKtupGpqDRpi4grPVcTABNNefN0G6bVDva7ZtO1GWfGlpssLtYr9c4CtqcTMSsrAE80P lAjwIH0VKqp/gBC+6QuXF5PVfGzYj/6LOFTacVIFd0I3WOym38iVsUxFagRa22WznfIR ilRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nilDhe3Nui4BD7Cgs70rjnQ7ISHKeZBhNhDQaOgPAJc=; b=OuKM4AxCDLT2RwIdKIfk/nXyVLVpa8zBkeStEnGSLVYO841VNCbn4JkD2km0meSlf0 djiktVDJ1MHywcQYbBl4YQ8Cmtvn56xS/iG3h1WeCvW0TyE0kGzrWbjUrbl5byX5yAGd TkBF8JMk5xDUGruJXNZg6h6Po8PaahC0U5DFDX9F64k06DtpagubrVubuyhGJKRFdg0l fjKyIKEW7Q6XziFhTTqQCiWXleixkwo4BgqFsh5jlEPjJMw7Us5t7Hn7lJynmgei2KfF 3tOLCnon8Ee+Szx/YLb2N+UncoDjGq8/4G/rzGa17seikLRNPYaHaTlTyUW0H4/g3xrq wckw== X-Gm-Message-State: AOAM533XeGPdz9giFn7p+aOfmfS7DwWVeb+018hlfkBSujKkakB19ba7 Ex0vzK8+oxlzoyfGNAvPxeRDlfAA X-Google-Smtp-Source: ABdhPJxHcJMU9uDCPKa+LVOd0sve1Mk6urApvqYreSW1GlEWfmPL8CbmWHPjmOllEoLdhUP0vKV8dg== X-Received: by 2002:adf:aad7:: with SMTP id i23mr13384792wrc.331.1591011189772; Mon, 01 Jun 2020 04:33:09 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1ab57.dynamic.kabel-deutschland.de. [188.193.171.87]) by smtp.gmail.com with ESMTPSA id v19sm10278645wml.26.2020.06.01.04.33.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jun 2020 04:33:09 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 1 Jun 2020 13:32:37 +0200 Message-Id: <20200601113237.15114-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200601113237.15114-1-andreas.rheinhardt@gmail.com> References: <20200601113237.15114-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avfilter/vf_lut3d: Fix mixed declaration and code X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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;