[FFmpeg-cvslog] avfilter/vf_nlmeans: make access to pointer to lut faster

Paul B Mahol git at videolan.org
Fri Oct 29 19:46:24 EEST 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Oct 24 14:26:35 2021 +0200| [959ec353ce974ff22863927c0a9dd354d0968c85] | committer: Paul B Mahol

avfilter/vf_nlmeans: make access to pointer to lut faster

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=959ec353ce974ff22863927c0a9dd354d0968c85
---

 libavfilter/vf_nlmeans.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_nlmeans.c b/libavfilter/vf_nlmeans.c
index b8d8bb2ec0..0962056a6e 100644
--- a/libavfilter/vf_nlmeans.c
+++ b/libavfilter/vf_nlmeans.c
@@ -344,6 +344,7 @@ static int nlmeans_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs
     const int dist_b = 2*p + 1;
     const int dist_d = dist_b * s->ii_lz_32;
     const int dist_e = dist_d + dist_b;
+    const float *const weight_lut = s->weight_lut;
 
     for (int y = starty; y < endy; y++) {
         const uint8_t *src = td->src + y*src_linesize;
@@ -385,7 +386,7 @@ static int nlmeans_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs
             const uint32_t patch_diff_sq = e - d - b + a;
 
             if (patch_diff_sq < s->max_meaningful_diff) {
-                const float weight = s->weight_lut[patch_diff_sq]; // exp(-patch_diff_sq * s->pdiff_scale)
+                const float weight = weight_lut[patch_diff_sq]; // exp(-patch_diff_sq * s->pdiff_scale)
                 wa[x].total_weight += weight;
                 wa[x].sum += weight * src[x];
             }



More information about the ffmpeg-cvslog mailing list