diff mbox series

[FFmpeg-devel,2/7] avfilter/vf_nlmeans: make access to pointer to lut faster

Message ID 20211029151903.1078367-2-onemda@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/7] avfilter/vf_nlmeans: use more friendlier 'for (int ...'
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/configureppc warning Failed to apply patch

Commit Message

Paul B Mahol Oct. 29, 2021, 3:18 p.m. UTC
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavfilter/vf_nlmeans.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

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];
             }