[FFmpeg-devel] [PATCH] vf_tonemap: Fix order of planes

Vittorio Giovara vittorio.giovara at gmail.com
Wed Jan 5 15:59:41 EET 2022


This resulted in a dimmed tonemapping due to bad resulting luma
calculation.

Found by: Derek Buitenhuis

Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
---
 libavfilter/vf_tonemap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_tonemap.c b/libavfilter/vf_tonemap.c
index 363df8034b..c4ecf8a675 100644
--- a/libavfilter/vf_tonemap.c
+++ b/libavfilter/vf_tonemap.c
@@ -120,11 +120,11 @@ 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 */
-- 
2.34.1



More information about the ffmpeg-devel mailing list