summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-16 13:23:39 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-16 13:23:39 +0200
commit411be72dcbc99b339a7b3fbd1011b54a9185add3 (patch)
tree386825097fb7d6410c2b3ea32a34521579a75e22 /libavfilter
parenta9b613b60e5108692d329c5779e1cc7488cadf0d (diff)
avfilter/vf_noise: fix high resolution support
Fixes Ticket4017 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_noise.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/libavfilter/vf_noise.c b/libavfilter/vf_noise.c
index 1028a3c41f..051ccc206a 100644
--- a/libavfilter/vf_noise.c
+++ b/libavfilter/vf_noise.c
@@ -348,16 +348,20 @@ static void noise(uint8_t *dst, const uint8_t *src,
for (y = start; y < end; y++) {
const int ix = y & (MAX_RES - 1);
- if (flags & NOISE_TEMPORAL)
- shift = av_lfg_get(lfg) & (MAX_SHIFT - 1);
- else
- shift = n->rand_shift[ix];
+ int x;
+ for (x=0; x < width; x+= MAX_RES) {
+ int w = FFMIN(width - x, MAX_RES);
+ if (flags & NOISE_TEMPORAL)
+ shift = av_lfg_get(lfg) & (MAX_SHIFT - 1);
+ else
+ shift = n->rand_shift[ix];
- if (flags & NOISE_AVERAGED) {
- n->line_noise_avg(dst, src, width, (const int8_t**)p->prev_shift[ix]);
- p->prev_shift[ix][shift & 3] = noise + shift;
- } else {
- n->line_noise(dst, src, noise, width, shift);
+ if (flags & NOISE_AVERAGED) {
+ n->line_noise_avg(dst + x, src + x, w, (const int8_t**)p->prev_shift[ix]);
+ p->prev_shift[ix][shift & 3] = noise + shift;
+ } else {
+ n->line_noise(dst + x, src + x, noise, w, shift);
+ }
}
dst += dst_linesize;
src += src_linesize;