static void lowpass16(WaveformContext *s, AVFrame *in, AVFrame *out,

                      int component, int intensity, int offset, int column)

{

    const int plane = s->desc->comp[component].plane;

    const int mirror = s->mirror;

    const int is_chroma = (component == 1 || component == 2);

    const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);

    const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);

    const int src_linesize = in->linesize[plane] / 2;

    const int dst_linesize = out->linesize[plane] / 2;

    const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);

    const int limit = s->size - 1;

    const int max = limit - intensity;

    const int src_h = FF_CEIL_RSHIFT(in->height, shift_h);

    const int src_w = FF_CEIL_RSHIFT(in->width, shift_w);

    const uint16_t *src_data = (const uint16_t *)in->data[plane];

    uint16_t *dst_data = (uint16_t *)out->data[plane] + (column ? (offset >> shift_h) * dst_linesize : offset >> shift_w);

    uint16_t * const dst_bottom_line = dst_data + dst_linesize * ((s->size >> shift_h) - 1);

    uint16_t * const dst_line = (mirror ? dst_bottom_line : dst_data);

    const uint16_t *p;

    int y;



    if (!column && mirror)

        dst_data += s->size >> shift_w;



    for (y = 0; y < src_h; y++) {

        const uint16_t *src_data_end = src_data + src_w;

        uint16_t *dst = dst_line;



        for (p = src_data; p < src_data_end; p++) {

            uint16_t *target;

            int v = FFMIN(*p, limit);



            if (column) {

                target = dst++ + dst_signed_linesize * (v >> shift_h);

            } else {

                if (mirror)

                    target = dst_data - (v >> shift_w) - 1;

                else

                    target = dst_data + (v >> shift_w);

            }

            update16(target, max, intensity, limit);

        }

        src_data += src_linesize;

        dst_data += dst_linesize;

    }



    envelope16(s, out, plane, plane);

}

static void lowpass16(WaveformContext *s, AVFrame *in, AVFrame *out,

                      int component, int intensity, int offset, int column)

{

    const int plane = s->desc->comp[component].plane;

    const int mirror = s->mirror;

    const int is_chroma = (component == 1 || component == 2);

    const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);

    const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);

    const int src_linesize = in->linesize[plane] / 2;

    const int dst_linesize = out->linesize[plane] / 2;

    const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);

    const int limit = s->size - 1;

    const int max = limit - intensity;

    const int src_h = FF_CEIL_RSHIFT(in->height, shift_h);

    const int src_w = FF_CEIL_RSHIFT(in->width, shift_w);

    const uint16_t *src_data = (const uint16_t *)in->data[plane];

    uint16_t *dst_data = (uint16_t *)out->data[plane] + (column ? (offset >> shift_h) * dst_linesize : offset >> shift_w);

    uint16_t * const dst_bottom_line = dst_data + dst_linesize * ((s->size >> shift_h) - 1);

    uint16_t * const dst_line = (mirror ? dst_bottom_line : dst_data);

    const uint16_t *p;

    int y;



    if (!column && mirror)

        dst_data += s->size >> shift_w;



    for (y = 0; y < src_h; y++) {

        const uint16_t *src_data_end = src_data + src_w;

        uint16_t *dst = dst_line;



        for (p = src_data; p < src_data_end; p++) {

            uint16_t *target;

            int v = FFMIN(*p, limit);



            if (column) {

                target = dst++ + dst_signed_linesize * (v >> shift_h);

            } else {

                if (mirror)

                    target = dst_data - (v >> shift_w) - 1;

                else

                    target = dst_data + (v >> shift_w);

            }

            update16(target, max, intensity, limit);

        }

        src_data += src_linesize;

        dst_data += dst_linesize;

    }



    envelope16(s, out, plane, plane);

}

static void FUNC_0(WaveformContext *VAR_0, AVFrame *VAR_1, AVFrame *VAR_2,

                      int VAR_3, int VAR_4, int VAR_5, int VAR_6)

{

    const int VAR_7 = VAR_0->desc->comp[VAR_3].VAR_7;

    const int VAR_8 = VAR_0->VAR_8;

    const int VAR_9 = (VAR_3 == 1 || VAR_3 == 2);

    const int VAR_10 = (VAR_9 ? VAR_0->desc->log2_chroma_w : 0);

    const int VAR_11 = (VAR_9 ? VAR_0->desc->log2_chroma_h : 0);

    const int VAR_12 = VAR_1->linesize[VAR_7] / 2;

    const int VAR_13 = VAR_2->linesize[VAR_7] / 2;

    const int VAR_14 = VAR_13 * (VAR_8 == 1 ? -1 : 1);

    const int VAR_15 = VAR_0->size - 1;

    const int VAR_16 = VAR_15 - VAR_4;

    const int VAR_17 = FF_CEIL_RSHIFT(VAR_1->height, VAR_11);

    const int VAR_18 = FF_CEIL_RSHIFT(VAR_1->width, VAR_10);

    const uint16_t *VAR_19 = (const uint16_t *)VAR_1->data[VAR_7];

    uint16_t *dst_data = (uint16_t *)VAR_2->data[VAR_7] + (VAR_6 ? (VAR_5 >> VAR_11) * VAR_13 : VAR_5 >> VAR_10);

    uint16_t * const dst_bottom_line = dst_data + VAR_13 * ((VAR_0->size >> VAR_11) - 1);

    uint16_t * const dst_line = (VAR_8 ? dst_bottom_line : dst_data);

    const uint16_t *VAR_20;

    int VAR_21;



    if (!VAR_6 && VAR_8)

        dst_data += VAR_0->size >> VAR_10;



    for (VAR_21 = 0; VAR_21 < VAR_17; VAR_21++) {

        const uint16_t *VAR_22 = VAR_19 + VAR_18;

        uint16_t *dst = dst_line;



        for (VAR_20 = VAR_19; VAR_20 < VAR_22; VAR_20++) {

            uint16_t *target;

            int v = FFMIN(*VAR_20, VAR_15);



            if (VAR_6) {

                target = dst++ + VAR_14 * (v >> VAR_11);

            } else {

                if (VAR_8)

                    target = dst_data - (v >> VAR_10) - 1;

                else

                    target = dst_data + (v >> VAR_10);

            }

            update16(target, VAR_16, VAR_4, VAR_15);

        }

        VAR_19 += VAR_12;

        dst_data += VAR_13;

    }



    envelope16(VAR_0, VAR_2, VAR_7, VAR_7);

}

static void FUNC_0(WaveformContext *VAR_0, AVFrame *VAR_1, AVFrame *VAR_2,
int VAR_3, int VAR_4, int VAR_5, int VAR_6)
{ const int VAR_7 = VAR_0->desc->comp[VAR_3].VAR_7; const int VAR_8 = VAR_0->VAR_8; const int VAR_9 = (VAR_3 == 1 || VAR_3 == 2); const int VAR_10 = (VAR_9 ? VAR_0->desc->log2_chroma_w : 0); const int VAR_11 = (VAR_9 ? VAR_0->desc->log2_chroma_h : 0); const int VAR_12 = VAR_1->linesize[VAR_7] / 2; const int VAR_13 = VAR_2->linesize[VAR_7] / 2; const int VAR_14 = VAR_13 * (VAR_8 == 1 ? -1 : 1); const int VAR_15 = VAR_0->size - 1; const int VAR_16 = VAR_15 - VAR_4; const int VAR_17 = FF_CEIL_RSHIFT(VAR_1->height, VAR_11); const int VAR_18 = FF_CEIL_RSHIFT(VAR_1->width, VAR_10); const uint16_t *VAR_19 = (const uint16_t *)VAR_1->data[VAR_7]; uint16_t *dst_data = (uint16_t *)VAR_2->data[VAR_7] + (VAR_6 ? (VAR_5 >> VAR_11) * VAR_13 : VAR_5 >> VAR_10); uint16_t * const dst_bottom_line = dst_data + VAR_13 * ((VAR_0->size >> VAR_11) - 1); uint16_t * const dst_line = (VAR_8 ? dst_bottom_line : dst_data); const uint16_t *VAR_20; int VAR_21; if (!VAR_6 && VAR_8)
dst_data += VAR_0->size >> VAR_10; for (VAR_21 = 0; VAR_21 < VAR_17; VAR_21++) { const uint16_t *VAR_22 = VAR_19 + VAR_18; uint16_t *dst = dst_line; for (VAR_20 = VAR_19; VAR_20 < VAR_22; VAR_20++) { uint16_t *target; int v = FFMIN(*VAR_20, VAR_15); if (VAR_6) { target = dst++ + VAR_14 * (v >> VAR_11); } else { if (VAR_8)
target = dst_data - (v >> VAR_10) - 1; else
target = dst_data + (v >> VAR_10); } update16(target, VAR_16, VAR_4, VAR_15); } VAR_19 += VAR_12; dst_data += VAR_13; } envelope16(VAR_0, VAR_2, VAR_7, VAR_7); }