[FFmpeg-cvslog] vf_boxblur: prefer the name "len" over "w" in the blur routines

Stefano Sabatini git at videolan.org
Wed Aug 3 11:21:44 CEST 2011


ffmpeg | branch: master | Stefano Sabatini <stefano.sabatini-lala at poste.it> | Tue Aug  2 23:45:30 2011 +0200| [d68ba3feb80f9fbb6c80c2ede4a105062084fef8] | committer: Stefano Sabatini

vf_boxblur: prefer the name "len" over "w" in the blur routines

Make more clear the meaning of the variables. They specify the length
of a (vertical or horizontal) line rather than a width.
Less confusing.

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

 libavfilter/vf_boxblur.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavfilter/vf_boxblur.c b/libavfilter/vf_boxblur.c
index 7fb1ec5..398014a 100644
--- a/libavfilter/vf_boxblur.c
+++ b/libavfilter/vf_boxblur.c
@@ -206,7 +206,7 @@ static int config_input(AVFilterLink *inlink)
 }
 
 static inline void blur(uint8_t *dst, int dst_step, const uint8_t *src, int src_step,
-                        int w, int radius)
+                        int len, int radius)
 {
     /* Naive boxblur would sum source pixels from x-radius .. x+radius
      * for destination pixel x. That would be O(radius*width).
@@ -235,39 +235,39 @@ static inline void blur(uint8_t *dst, int dst_step, const uint8_t *src, int src_
         dst[x*dst_step] = (sum*inv + (1<<15))>>16;
     }
 
-    for (; x < w-radius; x++) {
+    for (; x < len-radius; x++) {
         sum += src[(radius+x)*src_step] - src[(x-radius-1)*src_step];
         dst[x*dst_step] = (sum*inv + (1<<15))>>16;
     }
 
-    for (; x < w; x++) {
-        sum += src[(2*w-radius-x-1)*src_step] - src[(x-radius-1)*src_step];
+    for (; x < len; x++) {
+        sum += src[(2*len-radius-x-1)*src_step] - src[(x-radius-1)*src_step];
         dst[x*dst_step] = (sum*inv + (1<<15))>>16;
     }
 }
 
 static inline void blur_power(uint8_t *dst, int dst_step, const uint8_t *src, int src_step,
-                              int w, int radius, int power, uint8_t *temp[2])
+                              int len, int radius, int power, uint8_t *temp[2])
 {
     uint8_t *a = temp[0], *b = temp[1];
 
     if (radius && power) {
-        blur(a, 1, src, src_step, w, radius);
+        blur(a, 1, src, src_step, len, radius);
         for (; power > 2; power--) {
             uint8_t *c;
-            blur(b, 1, a, 1, w, radius);
+            blur(b, 1, a, 1, len, radius);
             c = a; a = b; b = c;
         }
         if (power > 1) {
-            blur(dst, dst_step, a, 1, w, radius);
+            blur(dst, dst_step, a, 1, len, radius);
         } else {
             int i;
-            for (i = 0; i < w; i++)
+            for (i = 0; i < len; i++)
                 dst[i*dst_step] = a[i];
         }
     } else {
         int i;
-        for (i = 0; i < w; i++)
+        for (i = 0; i < len; i++)
             dst[i*dst_step] = src[i*src_step];
     }
 }



More information about the ffmpeg-cvslog mailing list