static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples)

{

    AVFilterContext *ctx = inlink->dst;

    AVFilterLink *outlink = ctx->outputs[0];

    ShowSpectrumContext *s = ctx->priv;

    AVFrame *outpicref = s->outpicref;

    int ret, plane, x, y, z = s->orientation == VERTICAL ? s->h : s->w;



    /* fill a new spectrum column */

    /* initialize buffer for combining to black */

    clear_combine_buffer(s, z);



    ctx->internal->execute(ctx, plot_channel, NULL, NULL, s->nb_display_channels);



    for (y = 0; y < z * 3; y++) {

        s->combine_buffer[y] += s->color_buffer[0][y];

        for (x = 1; x < s->nb_display_channels; x++) {

            s->combine_buffer[y] += s->color_buffer[x][y];

        }

    }



    av_frame_make_writable(s->outpicref);

    /* copy to output */

    if (s->orientation == VERTICAL) {

        if (s->sliding == SCROLL) {

            for (plane = 0; plane < 3; plane++) {

                for (y = 0; y < s->h; y++) {

                    uint8_t *p = outpicref->data[plane] +

                                 y * outpicref->linesize[plane];

                    memmove(p, p + 1, s->w - 1);

                }

            }

            s->xpos = s->w - 1;

        } else if (s->sliding == RSCROLL) {

            for (plane = 0; plane < 3; plane++) {

                for (y = 0; y < s->h; y++) {

                    uint8_t *p = outpicref->data[plane] +

                                 y * outpicref->linesize[plane];

                    memmove(p + 1, p, s->w - 1);

                }

            }

            s->xpos = 0;

        }

        for (plane = 0; plane < 3; plane++) {

            uint8_t *p = outpicref->data[plane] + s->start_x +

                         (outlink->h - 1 - s->start_y) * outpicref->linesize[plane] +

                         s->xpos;

            for (y = 0; y < s->h; y++) {

                *p = lrintf(av_clipf(s->combine_buffer[3 * y + plane], 0, 255));

                p -= outpicref->linesize[plane];

            }

        }

    } else {

        if (s->sliding == SCROLL) {

            for (plane = 0; plane < 3; plane++) {

                for (y = 1; y < s->h; y++) {

                    memmove(outpicref->data[plane] + (y-1) * outpicref->linesize[plane],

                            outpicref->data[plane] + (y  ) * outpicref->linesize[plane],

                            s->w);

                }

            }

            s->xpos = s->h - 1;

        } else if (s->sliding == RSCROLL) {

            for (plane = 0; plane < 3; plane++) {

                for (y = s->h - 1; y >= 1; y--) {

                    memmove(outpicref->data[plane] + (y  ) * outpicref->linesize[plane],

                            outpicref->data[plane] + (y-1) * outpicref->linesize[plane],

                            s->w);

                }

            }

            s->xpos = 0;

        }

        for (plane = 0; plane < 3; plane++) {

            uint8_t *p = outpicref->data[plane] + s->start_x +

                         (s->xpos + s->start_y) * outpicref->linesize[plane];

            for (x = 0; x < s->w; x++) {

                *p = lrintf(av_clipf(s->combine_buffer[3 * x + plane], 0, 255));

                p++;

            }

        }

    }



    if (s->sliding != FULLFRAME || s->xpos == 0)

        outpicref->pts = insamples->pts;



    s->xpos++;

    if (s->orientation == VERTICAL && s->xpos >= s->w)

        s->xpos = 0;

    if (s->orientation == HORIZONTAL && s->xpos >= s->h)

        s->xpos = 0;

    if (!s->single_pic && (s->sliding != FULLFRAME || s->xpos == 0)) {

        ret = ff_filter_frame(outlink, av_frame_clone(s->outpicref));

        if (ret < 0)

            return ret;

    }



    return s->win_size;

}

static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples)

{

    AVFilterContext *ctx = inlink->dst;

    AVFilterLink *outlink = ctx->outputs[0];

    ShowSpectrumContext *s = ctx->priv;

    AVFrame *outpicref = s->outpicref;

    int ret, plane, x, y, z = s->orientation == VERTICAL ? s->h : s->w;



    

    

    clear_combine_buffer(s, z);



    ctx->internal->execute(ctx, plot_channel, NULL, NULL, s->nb_display_channels);



    for (y = 0; y < z * 3; y++) {

        s->combine_buffer[y] += s->color_buffer[0][y];

        for (x = 1; x < s->nb_display_channels; x++) {

            s->combine_buffer[y] += s->color_buffer[x][y];

        }

    }



    av_frame_make_writable(s->outpicref);

    

    if (s->orientation == VERTICAL) {

        if (s->sliding == SCROLL) {

            for (plane = 0; plane < 3; plane++) {

                for (y = 0; y < s->h; y++) {

                    uint8_t *p = outpicref->data[plane] +

                                 y * outpicref->linesize[plane];

                    memmove(p, p + 1, s->w - 1);

                }

            }

            s->xpos = s->w - 1;

        } else if (s->sliding == RSCROLL) {

            for (plane = 0; plane < 3; plane++) {

                for (y = 0; y < s->h; y++) {

                    uint8_t *p = outpicref->data[plane] +

                                 y * outpicref->linesize[plane];

                    memmove(p + 1, p, s->w - 1);

                }

            }

            s->xpos = 0;

        }

        for (plane = 0; plane < 3; plane++) {

            uint8_t *p = outpicref->data[plane] + s->start_x +

                         (outlink->h - 1 - s->start_y) * outpicref->linesize[plane] +

                         s->xpos;

            for (y = 0; y < s->h; y++) {

                *p = lrintf(av_clipf(s->combine_buffer[3 * y + plane], 0, 255));

                p -= outpicref->linesize[plane];

            }

        }

    } else {

        if (s->sliding == SCROLL) {

            for (plane = 0; plane < 3; plane++) {

                for (y = 1; y < s->h; y++) {

                    memmove(outpicref->data[plane] + (y-1) * outpicref->linesize[plane],

                            outpicref->data[plane] + (y  ) * outpicref->linesize[plane],

                            s->w);

                }

            }

            s->xpos = s->h - 1;

        } else if (s->sliding == RSCROLL) {

            for (plane = 0; plane < 3; plane++) {

                for (y = s->h - 1; y >= 1; y--) {

                    memmove(outpicref->data[plane] + (y  ) * outpicref->linesize[plane],

                            outpicref->data[plane] + (y-1) * outpicref->linesize[plane],

                            s->w);

                }

            }

            s->xpos = 0;

        }

        for (plane = 0; plane < 3; plane++) {

            uint8_t *p = outpicref->data[plane] + s->start_x +

                         (s->xpos + s->start_y) * outpicref->linesize[plane];

            for (x = 0; x < s->w; x++) {

                *p = lrintf(av_clipf(s->combine_buffer[3 * x + plane], 0, 255));

                p++;

            }

        }

    }



    if (s->sliding != FULLFRAME || s->xpos == 0)

        outpicref->pts = insamples->pts;



    s->xpos++;

    if (s->orientation == VERTICAL && s->xpos >= s->w)

        s->xpos = 0;

    if (s->orientation == HORIZONTAL && s->xpos >= s->h)

        s->xpos = 0;

    if (!s->single_pic && (s->sliding != FULLFRAME || s->xpos == 0)) {

        ret = ff_filter_frame(outlink, av_frame_clone(s->outpicref));

        if (ret < 0)

            return ret;

    }



    return s->win_size;

}

        s->combine_buffer[y] += s->color_buffer[0][y];         for (x = 1; x < s->nb_display_channels; x++) {
static int FUNC_0(AVFilterLink *VAR_0, AVFrame *VAR_1)

{

    AVFilterContext *ctx = VAR_0->dst;

    AVFilterLink *outlink = ctx->outputs[0];

    ShowSpectrumContext *s = ctx->priv;

    AVFrame *outpicref = s->outpicref;

    int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6 = s->orientation == VERTICAL ? s->h : s->w;



    

    

    clear_combine_buffer(s, VAR_6);



    ctx->internal->execute(ctx, plot_channel, NULL, NULL, s->nb_display_channels);



    for (VAR_5 = 0; VAR_5 < VAR_6 * 3; VAR_5++) {

        s->combine_buffer[VAR_5] += s->color_buffer[0][VAR_5];

        for (VAR_4 = 1; VAR_4 < s->nb_display_channels; VAR_4++) {

            s->combine_buffer[VAR_5] += s->color_buffer[VAR_4][VAR_5];

        }

    }



    av_frame_make_writable(s->outpicref);

    

    if (s->orientation == VERTICAL) {

        if (s->sliding == SCROLL) {

            for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {

                for (VAR_5 = 0; VAR_5 < s->h; VAR_5++) {

                    uint8_t *p = outpicref->data[VAR_3] +

                                 VAR_5 * outpicref->linesize[VAR_3];

                    memmove(p, p + 1, s->w - 1);

                }

            }

            s->xpos = s->w - 1;

        } else if (s->sliding == RSCROLL) {

            for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {

                for (VAR_5 = 0; VAR_5 < s->h; VAR_5++) {

                    uint8_t *p = outpicref->data[VAR_3] +

                                 VAR_5 * outpicref->linesize[VAR_3];

                    memmove(p + 1, p, s->w - 1);

                }

            }

            s->xpos = 0;

        }

        for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {

            uint8_t *p = outpicref->data[VAR_3] + s->start_x +

                         (outlink->h - 1 - s->start_y) * outpicref->linesize[VAR_3] +

                         s->xpos;

            for (VAR_5 = 0; VAR_5 < s->h; VAR_5++) {

                *p = lrintf(av_clipf(s->combine_buffer[3 * VAR_5 + VAR_3], 0, 255));

                p -= outpicref->linesize[VAR_3];

            }

        }

    } else {

        if (s->sliding == SCROLL) {

            for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {

                for (VAR_5 = 1; VAR_5 < s->h; VAR_5++) {

                    memmove(outpicref->data[VAR_3] + (VAR_5-1) * outpicref->linesize[VAR_3],

                            outpicref->data[VAR_3] + (VAR_5  ) * outpicref->linesize[VAR_3],

                            s->w);

                }

            }

            s->xpos = s->h - 1;

        } else if (s->sliding == RSCROLL) {

            for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {

                for (VAR_5 = s->h - 1; VAR_5 >= 1; VAR_5--) {

                    memmove(outpicref->data[VAR_3] + (VAR_5  ) * outpicref->linesize[VAR_3],

                            outpicref->data[VAR_3] + (VAR_5-1) * outpicref->linesize[VAR_3],

                            s->w);

                }

            }

            s->xpos = 0;

        }

        for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {

            uint8_t *p = outpicref->data[VAR_3] + s->start_x +

                         (s->xpos + s->start_y) * outpicref->linesize[VAR_3];

            for (VAR_4 = 0; VAR_4 < s->w; VAR_4++) {

                *p = lrintf(av_clipf(s->combine_buffer[3 * VAR_4 + VAR_3], 0, 255));

                p++;

            }

        }

    }



    if (s->sliding != FULLFRAME || s->xpos == 0)

        outpicref->pts = VAR_1->pts;



    s->xpos++;

    if (s->orientation == VERTICAL && s->xpos >= s->w)

        s->xpos = 0;

    if (s->orientation == HORIZONTAL && s->xpos >= s->h)

        s->xpos = 0;

    if (!s->single_pic && (s->sliding != FULLFRAME || s->xpos == 0)) {

        VAR_2 = ff_filter_frame(outlink, av_frame_clone(s->outpicref));

        if (VAR_2 < 0)

            return VAR_2;

    }



    return s->win_size;

}

static int FUNC_0(AVFilterLink *VAR_0, AVFrame *VAR_1)
{ AVFilterContext *ctx = VAR_0->dst; AVFilterLink *outlink = ctx->outputs[0]; ShowSpectrumContext *s = ctx->priv; AVFrame *outpicref = s->outpicref; int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6 = s->orientation == VERTICAL ? s->h : s->w; clear_combine_buffer(s, VAR_6); ctx->internal->execute(ctx, plot_channel, NULL, NULL, s->nb_display_channels); for (VAR_5 = 0; VAR_5 < VAR_6 * 3; VAR_5++) { s->combine_buffer[VAR_5] += s->color_buffer[0][VAR_5]; for (VAR_4 = 1; VAR_4 < s->nb_display_channels; VAR_4++) { s->combine_buffer[VAR_5] += s->color_buffer[VAR_4][VAR_5]; } } av_frame_make_writable(s->outpicref); if (s->orientation == VERTICAL) { if (s->sliding == SCROLL) { for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { for (VAR_5 = 0; VAR_5 < s->h; VAR_5++) { uint8_t *p = outpicref->data[VAR_3] +
VAR_5 * outpicref->linesize[VAR_3]; memmove(p, p + 1, s->w - 1); } } s->xpos = s->w - 1; } else if (s->sliding == RSCROLL) { for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { for (VAR_5 = 0; VAR_5 < s->h; VAR_5++) { uint8_t *p = outpicref->data[VAR_3] +
VAR_5 * outpicref->linesize[VAR_3]; memmove(p + 1, p, s->w - 1); } } s->xpos = 0; } for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { uint8_t *p = outpicref->data[VAR_3] + s->start_x +
(outlink->h - 1 - s->start_y) * outpicref->linesize[VAR_3] +
s->xpos; for (VAR_5 = 0; VAR_5 < s->h; VAR_5++) { *p = lrintf(av_clipf(s->combine_buffer[3 * VAR_5 + VAR_3], 0, 255)); p -= outpicref->linesize[VAR_3]; } } } else { if (s->sliding == SCROLL) { for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { for (VAR_5 = 1; VAR_5 < s->h; VAR_5++) { memmove(outpicref->data[VAR_3] + (VAR_5-1) * outpicref->linesize[VAR_3],
outpicref->data[VAR_3] + (VAR_5  ) * outpicref->linesize[VAR_3],
s->w); } } s->xpos = s->h - 1; } else if (s->sliding == RSCROLL) { for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { for (VAR_5 = s->h - 1; VAR_5 >= 1; VAR_5--) { memmove(outpicref->data[VAR_3] + (VAR_5  ) * outpicref->linesize[VAR_3],
outpicref->data[VAR_3] + (VAR_5-1) * outpicref->linesize[VAR_3],
s->w); } } s->xpos = 0; } for (VAR_3 = 0; VAR_3 < 3; VAR_3++) { uint8_t *p = outpicref->data[VAR_3] + s->start_x +
(s->xpos + s->start_y) * outpicref->linesize[VAR_3]; for (VAR_4 = 0; VAR_4 < s->w; VAR_4++) { *p = lrintf(av_clipf(s->combine_buffer[3 * VAR_4 + VAR_3], 0, 255)); p++; } } } if (s->sliding != FULLFRAME || s->xpos == 0)
outpicref->pts = VAR_1->pts; s->xpos++; if (s->orientation == VERTICAL && s->xpos >= s->w)
s->xpos = 0; if (s->orientation == HORIZONTAL && s->xpos >= s->h)
s->xpos = 0; if (!s->single_pic && (s->sliding != FULLFRAME || s->xpos == 0)) { VAR_2 = ff_filter_frame(outlink, av_frame_clone(s->outpicref)); if (VAR_2 < 0)
return VAR_2; } return s->win_size; }