From patchwork Wed Jan 5 15:15:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vittorio Giovara X-Patchwork-Id: 33089 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp815532iog; Wed, 5 Jan 2022 07:15:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDVSWVDhvngsImNrdKOTblZ30cDgaACLteOGSSvrbpJGgRe99nnGt/+y03Xb0iNDtdxO/H X-Received: by 2002:a17:907:9621:: with SMTP id gb33mr43206956ejc.394.1641395720615; Wed, 05 Jan 2022 07:15:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641395720; cv=none; d=google.com; s=arc-20160816; b=UvyrPTmPbIhVlMW4n2AcWWdFWHD5pRBc46BkatbNKoTkvjVhuiTpcjtb7ZDzjov8Z+ VJWoKZgjD40Xsxvsoy4x3P1qmcqVtpq0sAAWCCmrs8nI59ZgOIpN3YZ3VtRauYVIU910 jFXsgdbhdVfbenH95y45HMccJF1gVc9ewAEgMWX2GkIAS8aQBq9eJQp45wBVIFzIYyMU z17Cu8O7Cx/eRBwc0mYHHj84+K9tnejY/0eNCBg42AYfuuh03EvGDWqpUwBpn7fSKOfD bittBAnDJhyf4xR4ksEJM/olUokk35+75PNuANokrb3KL90gxzTEjx/RjDOvfkpJ3oqs FKhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=2Ghv7Y5DQYUUTYk8CJrn9X1zJxhhTZjsGRHz7vS79Mg=; b=tzolKQ10J4LchJmUZ2XPjcgA9feMLwN2Pu3E+jLzO021JoAzH2huiLOeJ8elz3qHg6 iQ19QMq4A8ZnMlXg+J/2LtF0VhP9XZ6rYyj91CunpaX1BPED7UQQBld7pfWj4kgoUwgg ivXuBHuJYIRRDEyi7PMf5ltu3EtOWkLioQOqyTBrBgonSUNmrAObMj5SzkP8uhr8/E7J 30CSRiVFA/uX16WxK5f2AGpnh5DxcKMaJLSD1hsJTUD6mcUqxfeFpoM7NNkC1jdKH/jZ X5Q1+mnxnWjtq8Z0qKeMZvNX9U4Yu36atR1WggTeqIuR6vcf2Ae31FwCKHgqIB1QIycO A+ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=lovSna8I; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h7si15661445ejl.487.2022.01.05.07.15.19; Wed, 05 Jan 2022 07:15:20 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=lovSna8I; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 909FD687FCE; Wed, 5 Jan 2022 17:15:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 54D63687FCE for ; Wed, 5 Jan 2022 17:15:09 +0200 (EET) Received: by mail-ed1-f47.google.com with SMTP id j21so163206733edt.9 for ; Wed, 05 Jan 2022 07:15:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Uv+yajco3nTBQh8rca/LDtny8XGQp/3xgsJNASHET9s=; b=lovSna8IYeCQpvLOCfwdVH0SUKPI8vP6ip+VGQJXeKjJD5ekIQObpOd77wC4oG7AG+ nc5/6LY/urugoUMB4fGWzAz4xwovslR5Qlm+qPQKde6yegXdeKT3ebjTrQE0qK7hEpru DaTTvdwaYCt57IcPcwBnDdhA7r25AB6ATVuhe70orQoAcnL02NPnACy3H8y9daYNt23n hLxY8rQpydin7RL259P+pxeqLeFiVz8Au88+et0mJHEMZd2DDjA64ON0D3baMYAr9pee GxfXi+y/AiqqxGbZSpyCrZQkNAtQNjCclvliu7DXGRpQpe7kijd5TPyMS9tcETfzMusg Y3Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Uv+yajco3nTBQh8rca/LDtny8XGQp/3xgsJNASHET9s=; b=ndX9rVwqeGJHffARzl5u75UqH4xB5OIr0XiKQFmp2BqhDPhInLI0ikpchA52bGrUaQ c4pTsJ272qf5E71Jr+69Iy6DhAYMNNMn1EBZPY58z6ffbKrRB12gkQi8usDShFhrVwdV UKI6EmHYEgiQ4Q+XDUK/Ih5jDUSZi9gZ0FZWREhVRjWQiki5PR40zHC8dA2W2XIhHg2i mV5/3moonkYkJNEckygzFsN2kWmBNy3LHcR37u92jT3MagSarw/I4cbLzkwUfAJ6Yiym SDucj5g7rdJCDRqD6atNCB7EpnUoSVoPSjtp8mAFOsJwLL2Gjh9z60bV/h2t4cfKXLi8 oJFw== X-Gm-Message-State: AOAM5328u6fKpwz4E6c2hGNhzeof4h0I6jgrN/STOyj4E0Tw1vLWiPZy +YdfQbdr+5EtJ0+fTaHng+Oay4COa7m67aV+ X-Received: by 2002:a17:906:3bd7:: with SMTP id v23mr45803045ejf.395.1641395708701; Wed, 05 Jan 2022 07:15:08 -0800 (PST) Received: from vimacbookpro.vimeows.com ([2001:b07:a11:213c:a483:2d11:35e9:a6d6]) by smtp.gmail.com with ESMTPSA id s26sm12281390eja.152.2022.01.05.07.15.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jan 2022 07:15:08 -0800 (PST) From: Vittorio Giovara To: ffmpeg-devel@ffmpeg.org Date: Wed, 5 Jan 2022 16:15:06 +0100 Message-Id: <20220105151506.74794-1-vittorio.giovara@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220105135941.85715-1-vittorio.giovara@gmail.com> References: <20220105135941.85715-1-vittorio.giovara@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] vf_tonemap: Fix order of planes X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: JmnKq+hFxtC2 This resulted in a dimmed tonemapping due to bad resulting luma calculation. Found by: Derek Buitenhuis Signed-off-by: Vittorio Giovara --- libavfilter/vf_tonemap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavfilter/vf_tonemap.c b/libavfilter/vf_tonemap.c index 363df8034b..644c9fd9e3 100644 --- a/libavfilter/vf_tonemap.c +++ b/libavfilter/vf_tonemap.c @@ -120,17 +120,17 @@ static void tonemap(TonemapContext *s, AVFrame *out, const AVFrame *in, const AVPixFmtDescriptor *desc, int x, int y, double peak) { const float *r_in = (const float *)(in->data[0] + x * desc->comp[0].step + y * in->linesize[0]); - const float *b_in = (const float *)(in->data[1] + x * desc->comp[1].step + y * in->linesize[1]); - const float *g_in = (const float *)(in->data[2] + x * desc->comp[2].step + y * in->linesize[2]); + const float *g_in = (const float *)(in->data[1] + x * desc->comp[1].step + y * in->linesize[1]); + const float *b_in = (const float *)(in->data[2] + x * desc->comp[2].step + y * in->linesize[2]); float *r_out = (float *)(out->data[0] + x * desc->comp[0].step + y * out->linesize[0]); - float *b_out = (float *)(out->data[1] + x * desc->comp[1].step + y * out->linesize[1]); - float *g_out = (float *)(out->data[2] + x * desc->comp[2].step + y * out->linesize[2]); + float *g_out = (float *)(out->data[1] + x * desc->comp[1].step + y * out->linesize[1]); + float *b_out = (float *)(out->data[2] + x * desc->comp[2].step + y * out->linesize[2]); float sig, sig_orig; /* load values */ *r_out = *r_in; - *b_out = *b_in; *g_out = *g_in; + *b_out = *b_in; /* desaturate to prevent unnatural colors */ if (s->desat > 0) {