Instead of rounding toward zero and thus producing darker output.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -156,7 +156,7 @@ static void export_row8(FFTComplex *src, uint8_t *dst, int rw, float scale, int · 155 unmodified lines | |||
| 156 | int j; | 156 | int j; |
| 157 | 157 | ||
| 158 | for (j = 0; j < rw; j++) | 158 | for (j = 0; j < rw; j++) |
| 159 | dst[j] = av_clip_uint8(src[j].re * scale); | 159 | dst[j] = av_clip_uint8(src[j].re * scale + 0.5f); |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | static void import_row16(FFTComplex *dst, uint8_t *srcp, int rw) | 162 | static void import_row16(FFTComplex *dst, uint8_t *srcp, int rw) |
| @@ -176,7 +176,7 @@ static void export_row16(FFTComplex *src, uint8_t *dstp, int rw, float scale, in · 13 unmodified lines | |||
| 176 | int j; | 176 | int j; |
| 177 | 177 | ||
| 178 | for (j = 0; j < rw; j++) | 178 | for (j = 0; j < rw; j++) |
| 179 | dst[j] = av_clip_uintp2_c(src[j].re * scale, depth); | 179 | dst[j] = av_clip_uintp2_c(src[j].re * scale + 0.5f, depth); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | static int config_input(AVFilterLink *inlink) | 182 | static int config_input(AVFilterLink *inlink) |