[FFmpeg-devel] [PATCH 9/9] lavfi/nlmeans: reorder memory accesses in get_integral_patch_value

Clément Bœsch u at pkh.me
Sun May 6 14:41:00 EEST 2018


This doesn't seem to make much of a difference but it can't hurt.
---
 libavfilter/vf_nlmeans.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_nlmeans.c b/libavfilter/vf_nlmeans.c
index abe708a2fc..38c50bc94a 100644
--- a/libavfilter/vf_nlmeans.c
+++ b/libavfilter/vf_nlmeans.c
@@ -131,10 +131,10 @@ static int query_formats(AVFilterContext *ctx)
  */
 static inline int get_integral_patch_value(const uint32_t *ii, int ii_lz_32, int x, int y, int p)
 {
-    const int e = ii[(y + p    ) * ii_lz_32 + (x + p    )];
-    const int d = ii[(y + p    ) * ii_lz_32 + (x - p - 1)];
-    const int b = ii[(y - p - 1) * ii_lz_32 + (x + p    )];
     const int a = ii[(y - p - 1) * ii_lz_32 + (x - p - 1)];
+    const int b = ii[(y - p - 1) * ii_lz_32 + (x + p    )];
+    const int d = ii[(y + p    ) * ii_lz_32 + (x - p - 1)];
+    const int e = ii[(y + p    ) * ii_lz_32 + (x + p    )];
     return e - d - b + a;
 }
 
-- 
2.17.0



More information about the ffmpeg-devel mailing list