[FFmpeg-devel] [PATCH 7/9] lavfi/nlmeans: switch from double to float
Moritz Barsnick
barsnick at gmx.net
Sun May 6 17:53:54 EEST 2018
On Sun, May 06, 2018 at 13:40:58 +0200, Clément Bœsch wrote:
> Overall speed appears to be 1.1x faster with no noticeable quality impact.
Probably platform dependant?
> struct weighted_avg {
> - double total_weight;
> - double sum;
> + float total_weight;
> + float sum;
> };
I believe these calculaions in nlmeans_plane() will promote to double
before being cast back to float:
// Also weight the centered pixel
wa->total_weight += 1.0;
wa->sum += 1.0 * src[y*src_linesize + x];
(At least the second one. The first one - just an assignment of a
constant - is covered by the preprocessor, IIUC.) They need to use
"1.0f".
(There are others, but only in init(), which don't matter for
performance.)
Cheers,
Moritz
More information about the ffmpeg-devel
mailing list