History

vf_tonemap: Fix order of planes

This resulted in a dimmed tonemapping due to bad resulting luma calculation. Found by: Derek Buitenhuis

Vittorio Giovara committed 4 years ago

Commit 7d377551 parent edd305e1 file · +8 −7Browse files

Unified · Split

libavfilter/vf_tonemap.c+8−7
@@ -119,18 +119,19 @@ static float mobius(float in, float j, double peak) · 118 unmodified lines
119static void tonemap(TonemapContext *s, AVFrame *out, const AVFrame *in,119static void tonemap(TonemapContext *s, AVFrame *out, const AVFrame *in,
120 const AVPixFmtDescriptor *desc, int x, int y, double peak)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]);122 int map[3] = { desc->comp[0].plane, desc->comp[1].plane, desc->comp[2].plane };
123 const float *b_in = (const float *)(in->data[1] + x * desc->comp[1].step + y * in->linesize[1]);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[2] + x * desc->comp[2].step + y * in->linesize[2]);124 const float *g_in = (const float *)(in->data[map[1]] + x * desc->comp[map[1]].step + y * in->linesize[map[1]]);
125 float *r_out = (float *)(out->data[0] + x * desc->comp[0].step + y * out->linesize[0]);125 const float *b_in = (const float *)(in->data[map[2]] + x * desc->comp[map[2]].step + y * in->linesize[map[2]]);
126 float *b_out = (float *)(out->data[1] + x * desc->comp[1].step + y * out->linesize[1]);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[2] + x * desc->comp[2].step + y * out->linesize[2]);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 float sig, sig_orig;129 float sig, sig_orig;
129 130
130 /* load values */131 /* load values */
131 *r_out = *r_in;132 *r_out = *r_in;
132 *b_out = *b_in;
133 *g_out = *g_in;133 *g_out = *g_in;
134 *b_out = *b_in;
134 135
135 /* desaturate to prevent unnatural colors */136 /* desaturate to prevent unnatural colors */
136 if (s->desat > 0) {137 if (s->desat > 0) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t