for (j = 0; j < 3; j++)
fp->prev_shift[i][j] = noise + (av_lfg_get(lfg) & (MAX_SHIFT - 1));
- if (!n->rand_shift_init) {
- for (i = 0; i < MAX_RES; i++)
- n->rand_shift[i] = av_lfg_get(lfg) & (MAX_SHIFT - 1);
- n->rand_shift_init = 1;
- }
-
fp->noise = noise;
return 0;
}
FilterParams *p = &n->param[comp];
int8_t *noise = p->noise;
const int flags = p->flags;
- AVLFG *lfg = &p->lfg;
- int shift, y;
+ int y;
if (!noise) {
if (dst != src)
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];
+ int shift = n->rand_shift[ix];
if (flags & NOISE_AVERAGED) {
n->line_noise_avg(dst + x, src + x, w, (const int8_t**)p->prev_shift[ix]);
NoiseContext *n = ctx->priv;
ThreadData td;
AVFrame *out;
+ int comp, i;
if (av_frame_is_writable(inpicref)) {
out = inpicref;
av_frame_copy_props(out, inpicref);
}
+ for (comp = 0; comp < 4; comp++) {
+ FilterParams *fp = &n->param[comp];
+
+ if ((!n->rand_shift_init || (fp->flags & NOISE_TEMPORAL)) && fp->strength) {
+
+ for (i = 0; i < MAX_RES; i++) {
+ n->rand_shift[i] = av_lfg_get(&fp->lfg) & (MAX_SHIFT - 1);
+ }
+ n->rand_shift_init = 1;
+ }
+ }
+
td.in = inpicref; td.out = out;
ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(n->height[0], ctx->graph->nb_threads));
emms_c();