static void chroma(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 + 1) % s->ncomp];

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

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

    const int max = 255 - intensity;

    const int src_h = in->height;

    const int src_w = in->width;

    int x, y;



    if (column) {

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



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

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

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

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

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

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

            uint8_t *dst = dst_line;



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

                const int sum = FFABS(c0_data[x] - 128) + FFABS(c1_data[x] - 128);

                uint8_t *target;

                int p;



                for (p = 256 - sum; p < 256 + sum; p++) {

                    target = dst + x + dst_signed_linesize * p;

                    update(target, max, 1);

                }



                c0_data += c0_linesize;

                c1_data += c1_linesize;

                dst_data += dst_linesize;

            }

        }

    } else {

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

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

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



        if (mirror)

            dst_data += s->size - 1;

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

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

                const int sum = FFABS(c0_data[x] - 128) + FFABS(c1_data[x] - 128);

                uint8_t *target;

                int p;



                for (p = 256 - sum; p < 256 + sum; p++) {

                    if (mirror)

                        target = dst_data - p;

                    else

                        target = dst_data + p;



                    update(target, max, 1);

                }

            }



            c0_data += c0_linesize;

            c1_data += c1_linesize;

            dst_data += dst_linesize;

        }

    }



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

}

static void chroma(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 + 1) % s->ncomp];

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

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

    const int max = 255 - intensity;

    const int src_h = in->height;

    const int src_w = in->width;

    int x, y;



    if (column) {

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



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

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

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

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

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

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

            uint8_t *dst = dst_line;



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

                const int sum = FFABS(c0_data[x] - 128) + FFABS(c1_data[x] - 128);

                uint8_t *target;

                int p;



                for (p = 256 - sum; p < 256 + sum; p++) {

                    target = dst + x + dst_signed_linesize * p;

                    update(target, max, 1);

                }



                c0_data += c0_linesize;

                c1_data += c1_linesize;

                dst_data += dst_linesize;

            }

        }

    } else {

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

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

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



        if (mirror)

            dst_data += s->size - 1;

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

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

                const int sum = FFABS(c0_data[x] - 128) + FFABS(c1_data[x] - 128);

                uint8_t *target;

                int p;



                for (p = 256 - sum; p < 256 + sum; p++) {

                    if (mirror)

                        target = dst_data - p;

                    else

                        target = dst_data + p;



                    update(target, max, 1);

                }

            }



            c0_data += c0_linesize;

            c1_data += c1_linesize;

            dst_data += dst_linesize;

        }

    }



    envelope(s, out, plane, (plane + 0) % 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 + 1) % VAR_0->ncomp];

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

    const int VAR_11 = VAR_2->linesize[VAR_7];

    const int VAR_12 = 255 - VAR_4;

    const int VAR_13 = VAR_1->height;

    const int VAR_14 = VAR_1->width;

    int VAR_15, VAR_16;



    if (VAR_6) {

        const int VAR_17 = VAR_11 * (VAR_8 == 1 ? -1 : 1);



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

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

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

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

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

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

            uint8_t *dst = dst_line;



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

                const int VAR_22 = FFABS(VAR_22[VAR_15] - 128) + FFABS(VAR_22[VAR_15] - 128);

                uint8_t *target;

                int VAR_22;



                for (VAR_22 = 256 - VAR_22; VAR_22 < 256 + VAR_22; VAR_22++) {

                    target = dst + VAR_15 + VAR_17 * VAR_22;

                    update(target, VAR_12, 1);

                }



                VAR_22 += VAR_9;

                VAR_22 += VAR_10;

                dst_data += VAR_11;

            }

        }

    } else {

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

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

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



        if (VAR_8)

            dst_data += VAR_0->size - 1;

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

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

                const int VAR_22 = FFABS(VAR_22[VAR_15] - 128) + FFABS(VAR_22[VAR_15] - 128);

                uint8_t *target;

                int VAR_22;



                for (VAR_22 = 256 - VAR_22; VAR_22 < 256 + VAR_22; VAR_22++) {

                    if (VAR_8)

                        target = dst_data - VAR_22;

                    else

                        target = dst_data + VAR_22;



                    update(target, VAR_12, 1);

                }

            }



            VAR_22 += VAR_9;

            VAR_22 += VAR_10;

            dst_data += VAR_11;

        }

    }



    envelope(VAR_0, VAR_2, VAR_7, (VAR_7 + 0) % 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 + 1) % VAR_0->ncomp]; const int VAR_10 = VAR_1->linesize[(VAR_7 + 2) % VAR_0->ncomp]; const int VAR_11 = VAR_2->linesize[VAR_7]; const int VAR_12 = 255 - VAR_4; const int VAR_13 = VAR_1->height; const int VAR_14 = VAR_1->width; int VAR_15, VAR_16; if (VAR_6) { const int VAR_17 = VAR_11 * (VAR_8 == 1 ? -1 : 1); for (VAR_15 = 0; VAR_15 < VAR_14; VAR_15++) { const uint8_t *VAR_22 = VAR_1->data[(VAR_7 + 1) % VAR_0->ncomp]; const uint8_t *VAR_22 = VAR_1->data[(VAR_7 + 2) % VAR_0->ncomp]; uint8_t *dst_data = VAR_2->data[VAR_7] + VAR_5 * VAR_11; uint8_t * const dst_bottom_line = dst_data + VAR_11 * (VAR_0->size - 1); uint8_t * const dst_line = (VAR_8 ? dst_bottom_line : dst_data); uint8_t *dst = dst_line; for (VAR_16 = 0; VAR_16 < VAR_13; VAR_16++) { const int VAR_22 = FFABS(VAR_22[VAR_15] - 128) + FFABS(VAR_22[VAR_15] - 128); uint8_t *target; int VAR_22; for (VAR_22 = 256 - VAR_22; VAR_22 < 256 + VAR_22; VAR_22++) { target = dst + VAR_15 + VAR_17 * VAR_22; update(target, VAR_12, 1); } VAR_22 += VAR_9; VAR_22 += VAR_10; dst_data += VAR_11; } } } else { const uint8_t *VAR_22 = VAR_1->data[(VAR_7 + 1) % VAR_0->ncomp]; const uint8_t *VAR_22 = VAR_1->data[(VAR_7 + 2) % VAR_0->ncomp]; uint8_t *dst_data = VAR_2->data[VAR_7] + VAR_5; if (VAR_8)
dst_data += VAR_0->size - 1; for (VAR_16 = 0; VAR_16 < VAR_13; VAR_16++) { for (VAR_15 = 0; VAR_15 < VAR_14; VAR_15++) { const int VAR_22 = FFABS(VAR_22[VAR_15] - 128) + FFABS(VAR_22[VAR_15] - 128); uint8_t *target; int VAR_22; for (VAR_22 = 256 - VAR_22; VAR_22 < 256 + VAR_22; VAR_22++) { if (VAR_8)
target = dst_data - VAR_22; else
target = dst_data + VAR_22; update(target, VAR_12, 1); } } VAR_22 += VAR_9; VAR_22 += VAR_10; dst_data += VAR_11; } } envelope(VAR_0, VAR_2, VAR_7, (VAR_7 + 0) % VAR_0->ncomp); }