This resulted in a dimmed tonemapping due to bad resulting luma calculation. Found by: Derek Buitenhuis
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -119,18 +119,19 @@ static float mobius(float in, float j, double peak) · 118 unmodified lines | ||
| 119 | 119 | static void tonemap(TonemapContext *s, AVFrame *out, const AVFrame *in, |
| 120 | 120 | const AVPixFmtDescriptor *desc, int x, int y, double peak) |
| 121 | 121 | { |
| 122 | − const float *r_in = (const float *)(in->data[0] + x * desc->comp[0].step + y * in->linesize[0]); | |
| 123 | − const float *b_in = (const float *)(in->data[1] + x * desc->comp[1].step + y * in->linesize[1]); | |
| 124 | − const float *g_in = (const float *)(in->data[2] + x * desc->comp[2].step + y * in->linesize[2]); | |
| 125 | − float *r_out = (float *)(out->data[0] + x * desc->comp[0].step + y * out->linesize[0]); | |
| 126 | − float *b_out = (float *)(out->data[1] + x * desc->comp[1].step + y * out->linesize[1]); | |
| 127 | − float *g_out = (float *)(out->data[2] + x * desc->comp[2].step + y * out->linesize[2]); | |
| 122 | + int map[3] = { desc->comp[0].plane, desc->comp[1].plane, desc->comp[2].plane }; | |
| 123 | + const float *r_in = (const float *)(in->data[map[0]] + x * desc->comp[map[0]].step + y * in->linesize[map[0]]); | |
| 124 | + const float *g_in = (const float *)(in->data[map[1]] + x * desc->comp[map[1]].step + y * in->linesize[map[1]]); | |
| 125 | + const float *b_in = (const float *)(in->data[map[2]] + x * desc->comp[map[2]].step + y * in->linesize[map[2]]); | |
| 126 | + float *r_out = (float *)(out->data[map[0]] + x * desc->comp[map[0]].step + y * out->linesize[map[0]]); | |
| 127 | + float *g_out = (float *)(out->data[map[1]] + x * desc->comp[map[1]].step + y * out->linesize[map[1]]); | |
| 128 | + float *b_out = (float *)(out->data[map[2]] + x * desc->comp[map[2]].step + y * out->linesize[map[2]]); | |
| 128 | 129 | float sig, sig_orig; |
| 129 | 130 | |
| 130 | 131 | /* load values */ |
| 131 | 132 | *r_out = *r_in; |
| 132 | − *b_out = *b_in; | |
| 133 | 133 | *g_out = *g_in; |
| 134 | + *b_out = *b_in; | |
| 134 | 135 | |
| 135 | 136 | /* desaturate to prevent unnatural colors */ |
| 136 | 137 | if (s->desat > 0) { |