Browse Source

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.
tags/n0.9
Stefano Sabatini 14 years ago
parent
commit
d68ba3feb8
1 changed files with 10 additions and 10 deletions
  1. +10
    -10
      libavfilter/vf_boxblur.c

+ 10
- 10
libavfilter/vf_boxblur.c View File

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


Loading…
Cancel
Save