From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id B9CCA42BF0 for ; Wed, 12 Jan 2022 14:31:06 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2B0BC68ABD1; Wed, 12 Jan 2022 16:31:04 +0200 (EET) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2A9C668A8E6 for ; Wed, 12 Jan 2022 16:30:58 +0200 (EET) Received: by mail-wm1-f42.google.com with SMTP id c66so1727450wma.5 for ; Wed, 12 Jan 2022 06:30:58 -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=9UlOMaj0gh9VZfkrZvP5b1Y40WeFEj+jqmyt4FnNHOg=; b=S09F4DyDNXv0DLbtVWLBESOSPoZ5BaliwaDdPT4bBeQBHBbbBuuYs6R7jqdTKjiJ1W sD32GpEoKqmZgYPg3eNiI8MEg5sTgp75rvPywC68FdyLYLKmo15qyYYC31Ys0daZsDD4 wcfRyUSBXRfYME8ZHscLPRfpm299p/Jpvfd7IFFWM/h5uh5CdchSRCKAcGbZr5HgC4bt P1XZmzjRV3BNXIPCxGZLikMbRJXni74qo1wIDvwn/4XCAGx/UhM5kVV6889SjftWcyUg DvoIkfzKtAFjdlGQHxrqaQysVQ9klrICAiZHZ/HapkvyM+HocCI0VUjceAADTWWNv1Je XTCw== 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=9UlOMaj0gh9VZfkrZvP5b1Y40WeFEj+jqmyt4FnNHOg=; b=yZif7AYvM36tYoPHkj/XFWHdDycJmXLiv3vbZ260v19USX82Snu9Amk22rjblodMGb rN07t008oY3pTk/lMH2ZMp1IzUHFY2MICLUGbFqiRu1PbmK4UL1b45XG7/dCBVpM7I/Y g0VWSdfB9JhUKZwKTxdR1SYoHzCyCUe0EI3nR21EHBGaofPsso+2uTgFNdYduOFt59O3 QrI6VQ0e1XTZ969ZJWh/qVO+b9zHrYSsc76rbq7PEKtGGo1CnCLAjl3WrVr//f4Dwfbc 1czJFBo9iAO2d6pqgdt8BPd/+EmZx1JNsayCylql5X4x1taOWr7ZW8n1uyGX+eMcl4VR ADaQ== X-Gm-Message-State: AOAM53306vauRPZwEyutWg3Lssr3WVU9wuUqYpCOMjXhG82EYBhwD3yG LUNS/iGmn8FFb9+EqGCJH0KnTMEPD9WyQw== X-Google-Smtp-Source: ABdhPJyH6rrVT5GIGlqtQ7JPzHjFim0miQScBp8YcknWUYNpf2zSnfQj6gTWHIhO0P6p82cx/FNYuQ== X-Received: by 2002:a1c:7517:: with SMTP id o23mr7044172wmc.120.1641997857530; Wed, 12 Jan 2022 06:30:57 -0800 (PST) Received: from localhost.localdomain ([2001:b07:a11:213c:909b:111e:6742:9e0d]) by smtp.gmail.com with ESMTPSA id a2sm85380wri.17.2022.01.12.06.30.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jan 2022 06:30:57 -0800 (PST) From: Vittorio Giovara To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jan 2022 15:30:55 +0100 Message-Id: <20220112143055.62347-1-vittorio.giovara@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_tonemap.c b/libavfilter/vf_tonemap.c index 363df8034b..1285dbaa4d 100644 --- a/libavfilter/vf_tonemap.c +++ b/libavfilter/vf_tonemap.c @@ -119,18 +119,19 @@ static float mobius(float in, float j, double peak) 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]); - 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]); + int map[3] = { desc->comp[0].plane, desc->comp[1].plane, desc->comp[2].plane }; + const float *r_in = (const float *)(in->data[map[0]] + x * desc->comp[map[0]].step + y * in->linesize[map[0]]); + const float *g_in = (const float *)(in->data[map[1]] + x * desc->comp[map[1]].step + y * in->linesize[map[1]]); + const float *b_in = (const float *)(in->data[map[2]] + x * desc->comp[map[2]].step + y * in->linesize[map[2]]); + float *r_out = (float *)(out->data[map[0]] + x * desc->comp[map[0]].step + y * out->linesize[map[0]]); + float *g_out = (float *)(out->data[map[1]] + x * desc->comp[map[1]].step + y * out->linesize[map[1]]); + float *b_out = (float *)(out->data[map[2]] + x * desc->comp[map[2]].step + y * out->linesize[map[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) { -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".