static void noise(uint8_t *dst, const uint8_t *src,

                  int dst_linesize, int src_linesize,

                  int width, int start, int end, NoiseContext *n, int comp)

{

    FilterParams *p = &n->param[comp];

    int8_t *noise = p->noise;

    const int flags = p->flags;

    AVLFG *lfg = &p->lfg;

    int shift, y;



    if (!noise) {

        if (dst != src)

            av_image_copy_plane(dst, dst_linesize, src, src_linesize, width, end - start);

        return;

    }



    for (y = start; y < end; y++) {

        if (flags & NOISE_TEMPORAL)

            shift = av_lfg_get(lfg) & (MAX_SHIFT - 1);

        else

            shift = n->rand_shift[y];



        if (flags & NOISE_AVERAGED) {

            n->line_noise_avg(dst, src, width, p->prev_shift[y]);

            p->prev_shift[y][shift & 3] = noise + shift;

        } else {

            n->line_noise(dst, src, noise, width, shift);

        }

        dst += dst_linesize;

        src += src_linesize;

    }

}

static void noise(uint8_t *dst, const uint8_t *src,

                  int dst_linesize, int src_linesize,

                  int width, int start, int end, NoiseContext *n, int comp)

{

    FilterParams *p = &n->param[comp];

    int8_t *noise = p->noise;

    const int flags = p->flags;

    AVLFG *lfg = &p->lfg;

    int shift, y;



    if (!noise) {

        if (dst != src)

            av_image_copy_plane(dst, dst_linesize, src, src_linesize, width, end - start);

        return;

    }



    for (y = start; y < end; y++) {

        if (flags & NOISE_TEMPORAL)

            shift = av_lfg_get(lfg) & (MAX_SHIFT - 1);

        else

            shift = n->rand_shift[y];



        if (flags & NOISE_AVERAGED) {

            n->line_noise_avg(dst, src, width, p->prev_shift[y]);

            p->prev_shift[y][shift & 3] = noise + shift;

        } else {

            n->line_noise(dst, src, noise, width, shift);

        }

        dst += dst_linesize;

        src += src_linesize;

    }

}

static void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,

                  int VAR_2, int VAR_3,

                  int VAR_4, int VAR_5, int VAR_6, NoiseContext *VAR_7, int VAR_8)

{

    FilterParams *p = &VAR_7->param[VAR_8];

    int8_t *FUNC_0 = p->FUNC_0;

    const int VAR_9 = p->VAR_9;

    AVLFG *lfg = &p->lfg;

    int VAR_10, VAR_11;



    if (!FUNC_0) {

        if (VAR_0 != VAR_1)

            av_image_copy_plane(VAR_0, VAR_2, VAR_1, VAR_3, VAR_4, VAR_6 - VAR_5);

        return;

    }



    for (VAR_11 = VAR_5; VAR_11 < VAR_6; VAR_11++) {

        if (VAR_9 & NOISE_TEMPORAL)

            VAR_10 = av_lfg_get(lfg) & (MAX_SHIFT - 1);

        else

            VAR_10 = VAR_7->rand_shift[VAR_11];



        if (VAR_9 & NOISE_AVERAGED) {

            VAR_7->line_noise_avg(VAR_0, VAR_1, VAR_4, p->prev_shift[VAR_11]);

            p->prev_shift[VAR_11][VAR_10 & 3] = FUNC_0 + VAR_10;

        } else {

            VAR_7->line_noise(VAR_0, VAR_1, FUNC_0, VAR_4, VAR_10);

        }

        VAR_0 += VAR_2;

        VAR_1 += VAR_3;

    }

}

static void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,
int VAR_2, int VAR_3,
int VAR_4, int VAR_5, int VAR_6, NoiseContext *VAR_7, int VAR_8)
{ FilterParams *p = &VAR_7->param[VAR_8]; int8_t *FUNC_0 = p->FUNC_0; const int VAR_9 = p->VAR_9; AVLFG *lfg = &p->lfg; int VAR_10, VAR_11; if (!FUNC_0) { if (VAR_0 != VAR_1)
av_image_copy_plane(VAR_0, VAR_2, VAR_1, VAR_3, VAR_4, VAR_6 - VAR_5); return; } for (VAR_11 = VAR_5; VAR_11 < VAR_6; VAR_11++) { if (VAR_9 & NOISE_TEMPORAL)
VAR_10 = av_lfg_get(lfg) & (MAX_SHIFT - 1); else
VAR_10 = VAR_7->rand_shift[VAR_11]; if (VAR_9 & NOISE_AVERAGED) { VAR_7->line_noise_avg(VAR_0, VAR_1, VAR_4, p->prev_shift[VAR_11]); p->prev_shift[VAR_11][VAR_10 & 3] = FUNC_0 + VAR_10; } else { VAR_7->line_noise(VAR_0, VAR_1, FUNC_0, VAR_4, VAR_10); } VAR_0 += VAR_2; VAR_1 += VAR_3; } }