1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfilter/vf_nlmeans: round values toward nearest integer

Instead of rounding toward zero and thus producing
darker output.
This commit is contained in:
Paul B Mahol 2019-10-20 21:53:11 +02:00
parent 0afc1fe147
commit a174e5f8da

View File

@ -419,7 +419,7 @@ static void weight_averages(uint8_t *dst, ptrdiff_t dst_linesize,
// Also weight the centered pixel // Also weight the centered pixel
wa[x].total_weight += 1.f; wa[x].total_weight += 1.f;
wa[x].sum += 1.f * src[x]; wa[x].sum += 1.f * src[x];
dst[x] = av_clip_uint8(wa[x].sum / wa[x].total_weight); dst[x] = av_clip_uint8(wa[x].sum / wa[x].total_weight + 0.5f);
} }
dst += dst_linesize; dst += dst_linesize;
src += src_linesize; src += src_linesize;