static void flat(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 c0_linesize = in->linesize[ plane + 0 ];

    const int c1_linesize = in->linesize[(plane + 1) % s->ncomp];

    const int c2_linesize = in->linesize[(plane + 2) % s->ncomp];

    const int d0_linesize = out->linesize[ plane + 0 ];

    const int d1_linesize = out->linesize[(plane + 1) % s->ncomp];

    const int max = 255 - intensity;

    const int src_h = in->height;

    const int src_w = in->width;

    int x, y;



    if (column) {

        const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);

        const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);



        for (x = 0; x < src_w; x++) {

            const uint8_t *c0_data = in->data[plane + 0];

            const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp];

            const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp];

            uint8_t *d0_data = out->data[plane] + offset * d0_linesize;

            uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset * d1_linesize;

            uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1);

            uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data);

            uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1);

            uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data);



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

                const int c0 = c0_data[x] + 256;

                const int c1 = FFABS(c1_data[x] - 128) + FFABS(c2_data[x] - 128);

                uint8_t *target;

                int p;



                target = d0 + x + d0_signed_linesize * c0;

                update(target, max, intensity);



                for (p = c0 - c1; p < c0 + c1; p++) {

                    target = d1 + x + d1_signed_linesize * p;

                    update(target, max, 1);

                }

                c0_data += c0_linesize;

                c1_data += c1_linesize;

                c2_data += c2_linesize;

                d0_data += d0_linesize;

                d1_data += d1_linesize;

            }

        }

    } else {

        const uint8_t *c0_data = in->data[plane];

        const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp];

        const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp];

        uint8_t *d0_data = out->data[plane] + offset;

        uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset;



        if (mirror) {

            d0_data += s->size - 1;

            d1_data += s->size - 1;

        }



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

            for (x = 0; x < src_w; x++) {

                int c0 = c0_data[x] + 256;

                const int c1 = FFABS(c1_data[x] - 128) + FFABS(c2_data[x] - 128);

                uint8_t *target;

                int p;



                if (mirror)

                    target = d0_data - c0;

                else

                    target = d0_data + c0;



                update(target, max, intensity);



                for (p = c0 - c1; p < c0 + c1; p++) {

                    if (mirror)

                        target = d1_data - p;

                    else

                        target = d1_data + p;



                    update(target, max, 1);

                }

            }



            c0_data += c0_linesize;

            c1_data += c1_linesize;

            c2_data += c2_linesize;

            d0_data += d0_linesize;

            d1_data += d1_linesize;

        }

    }



    envelope(s, out, plane, plane);

    envelope(s, out, plane, (plane + 1) % s->ncomp);

}

static void flat(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 c0_linesize = in->linesize[ plane + 0 ];

    const int c1_linesize = in->linesize[(plane + 1) % s->ncomp];

    const int c2_linesize = in->linesize[(plane + 2) % s->ncomp];

    const int d0_linesize = out->linesize[ plane + 0 ];

    const int d1_linesize = out->linesize[(plane + 1) % s->ncomp];

    const int max = 255 - intensity;

    const int src_h = in->height;

    const int src_w = in->width;

    int x, y;



    if (column) {

        const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);

        const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);



        for (x = 0; x < src_w; x++) {

            const uint8_t *c0_data = in->data[plane + 0];

            const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp];

            const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp];

            uint8_t *d0_data = out->data[plane] + offset * d0_linesize;

            uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset * d1_linesize;

            uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1);

            uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data);

            uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1);

            uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data);



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

                const int c0 = c0_data[x] + 256;

                const int c1 = FFABS(c1_data[x] - 128) + FFABS(c2_data[x] - 128);

                uint8_t *target;

                int p;



                target = d0 + x + d0_signed_linesize * c0;

                update(target, max, intensity);



                for (p = c0 - c1; p < c0 + c1; p++) {

                    target = d1 + x + d1_signed_linesize * p;

                    update(target, max, 1);

                }

                c0_data += c0_linesize;

                c1_data += c1_linesize;

                c2_data += c2_linesize;

                d0_data += d0_linesize;

                d1_data += d1_linesize;

            }

        }

    } else {

        const uint8_t *c0_data = in->data[plane];

        const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp];

        const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp];

        uint8_t *d0_data = out->data[plane] + offset;

        uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset;



        if (mirror) {

            d0_data += s->size - 1;

            d1_data += s->size - 1;

        }



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

            for (x = 0; x < src_w; x++) {

                int c0 = c0_data[x] + 256;

                const int c1 = FFABS(c1_data[x] - 128) + FFABS(c2_data[x] - 128);

                uint8_t *target;

                int p;



                if (mirror)

                    target = d0_data - c0;

                else

                    target = d0_data + c0;



                update(target, max, intensity);



                for (p = c0 - c1; p < c0 + c1; p++) {

                    if (mirror)

                        target = d1_data - p;

                    else

                        target = d1_data + p;



                    update(target, max, 1);

                }

            }



            c0_data += c0_linesize;

            c1_data += c1_linesize;

            c2_data += c2_linesize;

            d0_data += d0_linesize;

            d1_data += d1_linesize;

        }

    }



    envelope(s, out, plane, plane);

    envelope(s, out, plane, (plane + 1) % s->ncomp);

}

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_1->linesize[ VAR_7 + 0 ];

    const int VAR_10 = VAR_1->linesize[(VAR_7 + 1) % VAR_0->ncomp];

    const int VAR_11 = VAR_1->linesize[(VAR_7 + 2) % VAR_0->ncomp];

    const int VAR_12 = VAR_2->linesize[ VAR_7 + 0 ];

    const int VAR_13 = VAR_2->linesize[(VAR_7 + 1) % VAR_0->ncomp];

    const int VAR_14 = 255 - VAR_4;

    const int VAR_15 = VAR_1->height;

    const int VAR_16 = VAR_1->width;

    int VAR_17, VAR_18;



    if (VAR_6) {

        const int VAR_19 = VAR_12 * (VAR_8 == 1 ? -1 : 1);

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



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

            const uint8_t *VAR_27 = VAR_1->data[VAR_7 + 0];

            const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 1) % VAR_0->ncomp];

            const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 2) % VAR_0->ncomp];

            uint8_t *d0_data = VAR_2->data[VAR_7] + VAR_5 * VAR_12;

            uint8_t *d1_data = VAR_2->data[(VAR_7 + 1) % VAR_0->ncomp] + VAR_5 * VAR_13;

            uint8_t * const d0_bottom_line = d0_data + VAR_12 * (VAR_0->size - 1);

            uint8_t * const d0 = (VAR_8 ? d0_bottom_line : d0_data);

            uint8_t * const d1_bottom_line = d1_data + VAR_13 * (VAR_0->size - 1);

            uint8_t * const d1 = (VAR_8 ? d1_bottom_line : d1_data);



            for (VAR_18 = 0; VAR_18 < VAR_15; VAR_18++) {

                const int VAR_27 = VAR_27[VAR_17] + 256;

                const int VAR_27 = FFABS(VAR_27[VAR_17] - 128) + FFABS(VAR_27[VAR_17] - 128);

                uint8_t *target;

                int VAR_27;



                target = d0 + VAR_17 + VAR_19 * VAR_27;

                update(target, VAR_14, VAR_4);



                for (VAR_27 = VAR_27 - VAR_27; VAR_27 < VAR_27 + VAR_27; VAR_27++) {

                    target = d1 + VAR_17 + VAR_20 * VAR_27;

                    update(target, VAR_14, 1);

                }

                VAR_27 += VAR_9;

                VAR_27 += VAR_10;

                VAR_27 += VAR_11;

                d0_data += VAR_12;

                d1_data += VAR_13;

            }

        }

    } else {

        const uint8_t *VAR_27 = VAR_1->data[VAR_7];

        const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 1) % VAR_0->ncomp];

        const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 2) % VAR_0->ncomp];

        uint8_t *d0_data = VAR_2->data[VAR_7] + VAR_5;

        uint8_t *d1_data = VAR_2->data[(VAR_7 + 1) % VAR_0->ncomp] + VAR_5;



        if (VAR_8) {

            d0_data += VAR_0->size - 1;

            d1_data += VAR_0->size - 1;

        }



        for (VAR_18 = 0; VAR_18 < VAR_15; VAR_18++) {

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

                int VAR_27 = VAR_27[VAR_17] + 256;

                const int VAR_27 = FFABS(VAR_27[VAR_17] - 128) + FFABS(VAR_27[VAR_17] - 128);

                uint8_t *target;

                int VAR_27;



                if (VAR_8)

                    target = d0_data - VAR_27;

                else

                    target = d0_data + VAR_27;



                update(target, VAR_14, VAR_4);



                for (VAR_27 = VAR_27 - VAR_27; VAR_27 < VAR_27 + VAR_27; VAR_27++) {

                    if (VAR_8)

                        target = d1_data - VAR_27;

                    else

                        target = d1_data + VAR_27;



                    update(target, VAR_14, 1);

                }

            }



            VAR_27 += VAR_9;

            VAR_27 += VAR_10;

            VAR_27 += VAR_11;

            d0_data += VAR_12;

            d1_data += VAR_13;

        }

    }



    envelope(VAR_0, VAR_2, VAR_7, VAR_7);

    envelope(VAR_0, VAR_2, VAR_7, (VAR_7 + 1) % VAR_0->ncomp);

}

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_1->linesize[ VAR_7 + 0 ]; const int VAR_10 = VAR_1->linesize[(VAR_7 + 1) % VAR_0->ncomp]; const int VAR_11 = VAR_1->linesize[(VAR_7 + 2) % VAR_0->ncomp]; const int VAR_12 = VAR_2->linesize[ VAR_7 + 0 ]; const int VAR_13 = VAR_2->linesize[(VAR_7 + 1) % VAR_0->ncomp]; const int VAR_14 = 255 - VAR_4; const int VAR_15 = VAR_1->height; const int VAR_16 = VAR_1->width; int VAR_17, VAR_18; if (VAR_6) { const int VAR_19 = VAR_12 * (VAR_8 == 1 ? -1 : 1); const int VAR_20 = VAR_13 * (VAR_8 == 1 ? -1 : 1); for (VAR_17 = 0; VAR_17 < VAR_16; VAR_17++) { const uint8_t *VAR_27 = VAR_1->data[VAR_7 + 0]; const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 1) % VAR_0->ncomp]; const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 2) % VAR_0->ncomp]; uint8_t *d0_data = VAR_2->data[VAR_7] + VAR_5 * VAR_12; uint8_t *d1_data = VAR_2->data[(VAR_7 + 1) % VAR_0->ncomp] + VAR_5 * VAR_13; uint8_t * const d0_bottom_line = d0_data + VAR_12 * (VAR_0->size - 1); uint8_t * const d0 = (VAR_8 ? d0_bottom_line : d0_data); uint8_t * const d1_bottom_line = d1_data + VAR_13 * (VAR_0->size - 1); uint8_t * const d1 = (VAR_8 ? d1_bottom_line : d1_data); for (VAR_18 = 0; VAR_18 < VAR_15; VAR_18++) { const int VAR_27 = VAR_27[VAR_17] + 256; const int VAR_27 = FFABS(VAR_27[VAR_17] - 128) + FFABS(VAR_27[VAR_17] - 128); uint8_t *target; int VAR_27; target = d0 + VAR_17 + VAR_19 * VAR_27; update(target, VAR_14, VAR_4); for (VAR_27 = VAR_27 - VAR_27; VAR_27 < VAR_27 + VAR_27; VAR_27++) { target = d1 + VAR_17 + VAR_20 * VAR_27; update(target, VAR_14, 1); } VAR_27 += VAR_9; VAR_27 += VAR_10; VAR_27 += VAR_11; d0_data += VAR_12; d1_data += VAR_13; } } } else { const uint8_t *VAR_27 = VAR_1->data[VAR_7]; const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 1) % VAR_0->ncomp]; const uint8_t *VAR_27 = VAR_1->data[(VAR_7 + 2) % VAR_0->ncomp]; uint8_t *d0_data = VAR_2->data[VAR_7] + VAR_5; uint8_t *d1_data = VAR_2->data[(VAR_7 + 1) % VAR_0->ncomp] + VAR_5; if (VAR_8) { d0_data += VAR_0->size - 1; d1_data += VAR_0->size - 1; } for (VAR_18 = 0; VAR_18 < VAR_15; VAR_18++) { for (VAR_17 = 0; VAR_17 < VAR_16; VAR_17++) { int VAR_27 = VAR_27[VAR_17] + 256; const int VAR_27 = FFABS(VAR_27[VAR_17] - 128) + FFABS(VAR_27[VAR_17] - 128); uint8_t *target; int VAR_27; if (VAR_8)
target = d0_data - VAR_27; else
target = d0_data + VAR_27; update(target, VAR_14, VAR_4); for (VAR_27 = VAR_27 - VAR_27; VAR_27 < VAR_27 + VAR_27; VAR_27++) { if (VAR_8)
target = d1_data - VAR_27; else
target = d1_data + VAR_27; update(target, VAR_14, 1); } } VAR_27 += VAR_9; VAR_27 += VAR_10; VAR_27 += VAR_11; d0_data += VAR_12; d1_data += VAR_13; } } envelope(VAR_0, VAR_2, VAR_7, VAR_7); envelope(VAR_0, VAR_2, VAR_7, (VAR_7 + 1) % VAR_0->ncomp); }