summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2017-12-25 10:04:59 +0100
committerPaul B Mahol <onemda@gmail.com>2017-12-25 10:06:07 +0100
commitec6608f51b2d5a979b59d0dcc6a06629a0f8bd81 (patch)
tree71b51a8a3616713679532d10e21fe6a518de1976 /libavfilter
parentbe2da4c52221c5ec0769ccea675a896e324d1f41 (diff)
avfilter/vf_convolve: clear coefficients only when needed
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_convolve.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libavfilter/vf_convolve.c b/libavfilter/vf_convolve.c
index 6eb9548456..2af9df5983 100644
--- a/libavfilter/vf_convolve.c
+++ b/libavfilter/vf_convolve.c
@@ -158,39 +158,37 @@ static void fft_horizontal(ConvolveContext *s, FFTComplex *fft_hdata,
const int iw = (n - w) / 2, ih = (n - h) / 2;
int y, x;
- for (y = 0; y < n; y++) {
- for (x = 0; x < n; x++) {
- fft_hdata[y * n + x].re = 0;
- fft_hdata[y * n + x].im = 0;
- }
- }
-
if (s->depth == 8) {
for (y = 0; y < h; y++) {
const uint8_t *src = in->data[plane] + in->linesize[plane] * y;
for (x = 0; x < w; x++) {
fft_hdata[(y + ih) * n + iw + x].re = src[x] * scale;
+ fft_hdata[(y + ih) * n + iw + x].im = 0;
}
for (x = 0; x < iw; x++) {
fft_hdata[(y + ih) * n + x].re = fft_hdata[(y + ih) * n + iw].re;
+ fft_hdata[(y + ih) * n + x].im = 0;
}
for (x = n - iw; x < n; x++) {
fft_hdata[(y + ih) * n + x].re = fft_hdata[(y + ih) * n + n - iw - 1].re;
+ fft_hdata[(y + ih) * n + x].im = 0;
}
}
for (y = 0; y < ih; y++) {
for (x = 0; x < n; x++) {
fft_hdata[y * n + x].re = fft_hdata[ih * n + x].re;
+ fft_hdata[y * n + x].im = 0;
}
}
for (y = n - ih; y < n; y++) {
for (x = 0; x < n; x++) {
fft_hdata[y * n + x].re = fft_hdata[(n - ih - 1) * n + x].re;
+ fft_hdata[y * n + x].im = 0;
}
}
} else {
@@ -199,26 +197,31 @@ static void fft_horizontal(ConvolveContext *s, FFTComplex *fft_hdata,
for (x = 0; x < w; x++) {
fft_hdata[(y + ih) * n + iw + x].re = src[x] * scale;
+ fft_hdata[(y + ih) * n + iw + x].im = 0;
}
for (x = 0; x < iw; x++) {
fft_hdata[(y + ih) * n + x].re = fft_hdata[(y + ih) * n + iw].re;
+ fft_hdata[(y + ih) * n + x].im = 0;
}
for (x = n - iw; x < n; x++) {
fft_hdata[(y + ih) * n + x].re = fft_hdata[(y + ih) * n + n - iw - 1].re;
+ fft_hdata[(y + ih) * n + x].im = 0;
}
}
for (y = 0; y < ih; y++) {
for (x = 0; x < n; x++) {
fft_hdata[y * n + x].re = fft_hdata[ih * n + x].re;
+ fft_hdata[y * n + x].im = 0;
}
}
for (y = n - ih; y < n; y++) {
for (x = 0; x < n; x++) {
fft_hdata[y * n + x].re = fft_hdata[(n - ih - 1) * n + x].re;
+ fft_hdata[y * n + x].im = 0;
}
}
}