avfilter/vf_noise: fix high resolution support

Fixes Ticket4017
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-10-16 13:23:39 +02:00
parent a9b613b60e
commit 411be72dcb

View File

@ -348,16 +348,20 @@ static void noise(uint8_t *dst, const uint8_t *src,
for (y = start; y < end; y++) { for (y = start; y < end; y++) {
const int ix = y & (MAX_RES - 1); const int ix = y & (MAX_RES - 1);
if (flags & NOISE_TEMPORAL) int x;
shift = av_lfg_get(lfg) & (MAX_SHIFT - 1); for (x=0; x < width; x+= MAX_RES) {
else int w = FFMIN(width - x, MAX_RES);
shift = n->rand_shift[ix]; if (flags & NOISE_TEMPORAL)
shift = av_lfg_get(lfg) & (MAX_SHIFT - 1);
else
shift = n->rand_shift[ix];
if (flags & NOISE_AVERAGED) { if (flags & NOISE_AVERAGED) {
n->line_noise_avg(dst, src, width, (const int8_t**)p->prev_shift[ix]); n->line_noise_avg(dst + x, src + x, w, (const int8_t**)p->prev_shift[ix]);
p->prev_shift[ix][shift & 3] = noise + shift; p->prev_shift[ix][shift & 3] = noise + shift;
} else { } else {
n->line_noise(dst, src, noise, width, shift); n->line_noise(dst + x, src + x, noise, w, shift);
}
} }
dst += dst_linesize; dst += dst_linesize;
src += src_linesize; src += src_linesize;