static double get_scene_score(AVFilterContext *ctx, AVFilterBufferRef *picref)

{

    double ret = 0;

    SelectContext *select = ctx->priv;

    AVFilterBufferRef *prev_picref = select->prev_picref;



    if (prev_picref &&

        picref->video->h    == prev_picref->video->h &&

        picref->video->w    == prev_picref->video->w &&

        picref->linesize[0] == prev_picref->linesize[0]) {

        int x, y;

        int64_t sad = 0;

        double mafd, diff;

        uint8_t *p1 =      picref->data[0];

        uint8_t *p2 = prev_picref->data[0];

        const int linesize = picref->linesize[0];



        for (y = 0; y < picref->video->h; y += 8)

            for (x = 0; x < linesize; x += 8)

                sad += select->c.sad[1](select,

                                        p1 + y * linesize + x,

                                        p2 + y * linesize + x,

                                        linesize, 8);

        emms_c();

        mafd = sad / (picref->video->h * picref->video->w * 3);

        diff = fabs(mafd - select->prev_mafd);

        ret  = av_clipf(FFMIN(mafd, diff) / 100., 0, 1);

        select->prev_mafd = mafd;

        avfilter_unref_buffer(prev_picref);

    }

    select->prev_picref = avfilter_ref_buffer(picref, ~0);

    return ret;

}

static double get_scene_score(AVFilterContext *ctx, AVFilterBufferRef *picref)

{

    double ret = 0;

    SelectContext *select = ctx->priv;

    AVFilterBufferRef *prev_picref = select->prev_picref;



    if (prev_picref &&

        picref->video->h    == prev_picref->video->h &&

        picref->video->w    == prev_picref->video->w &&

        picref->linesize[0] == prev_picref->linesize[0]) {

        int x, y;

        int64_t sad = 0;

        double mafd, diff;

        uint8_t *p1 =      picref->data[0];

        uint8_t *p2 = prev_picref->data[0];

        const int linesize = picref->linesize[0];



        for (y = 0; y < picref->video->h; y += 8)

            for (x = 0; x < linesize; x += 8)

                sad += select->c.sad[1](select,

                                        p1 + y * linesize + x,

                                        p2 + y * linesize + x,

                                        linesize, 8);

        emms_c();

        mafd = sad / (picref->video->h * picref->video->w * 3);

        diff = fabs(mafd - select->prev_mafd);

        ret  = av_clipf(FFMIN(mafd, diff) / 100., 0, 1);

        select->prev_mafd = mafd;

        avfilter_unref_buffer(prev_picref);

    }

    select->prev_picref = avfilter_ref_buffer(picref, ~0);

    return ret;

}

        int x, y;         for (y = 0; y < picref->video->h; y += 8)             for (x = 0; x < linesize; x += 8)         mafd = sad / (picref->video->h * picref->video->w * 3);
static double FUNC_0(AVFilterContext *VAR_0, AVFilterBufferRef *VAR_1)

{

    double VAR_2 = 0;

    SelectContext *select = VAR_0->priv;

    AVFilterBufferRef *prev_picref = select->prev_picref;



    if (prev_picref &&

        VAR_1->video->h    == prev_picref->video->h &&

        VAR_1->video->w    == prev_picref->video->w &&

        VAR_1->VAR_7[0] == prev_picref->VAR_7[0]) {

        int VAR_3, VAR_4;

        int64_t sad = 0;

        double VAR_5, VAR_6;

        uint8_t *p1 =      VAR_1->data[0];

        uint8_t *p2 = prev_picref->data[0];

        const int VAR_7 = VAR_1->VAR_7[0];



        for (VAR_4 = 0; VAR_4 < VAR_1->video->h; VAR_4 += 8)

            for (VAR_3 = 0; VAR_3 < VAR_7; VAR_3 += 8)

                sad += select->c.sad[1](select,

                                        p1 + VAR_4 * VAR_7 + VAR_3,

                                        p2 + VAR_4 * VAR_7 + VAR_3,

                                        VAR_7, 8);

        emms_c();

        VAR_5 = sad / (VAR_1->video->h * VAR_1->video->w * 3);

        VAR_6 = fabs(VAR_5 - select->prev_mafd);

        VAR_2  = av_clipf(FFMIN(VAR_5, VAR_6) / 100., 0, 1);

        select->prev_mafd = VAR_5;

        avfilter_unref_buffer(prev_picref);

    }

    select->prev_picref = avfilter_ref_buffer(VAR_1, ~0);

    return VAR_2;

}

static double FUNC_0(AVFilterContext *VAR_0, AVFilterBufferRef *VAR_1)
{ double VAR_2 = 0; SelectContext *select = VAR_0->priv; AVFilterBufferRef *prev_picref = select->prev_picref; if (prev_picref &&
VAR_1->video->h    == prev_picref->video->h &&
VAR_1->video->w    == prev_picref->video->w &&
VAR_1->VAR_7[0] == prev_picref->VAR_7[0]) { int VAR_3, VAR_4; int64_t sad = 0; double VAR_5, VAR_6; uint8_t *p1 =      VAR_1->data[0]; uint8_t *p2 = prev_picref->data[0]; const int VAR_7 = VAR_1->VAR_7[0]; for (VAR_4 = 0; VAR_4 < VAR_1->video->h; VAR_4 += 8) for (VAR_3 = 0; VAR_3 < VAR_7; VAR_3 += 8) sad += select->c.sad[1](select,
p1 + VAR_4 * VAR_7 + VAR_3,
p2 + VAR_4 * VAR_7 + VAR_3,
VAR_7, 8); emms_c(); VAR_5 = sad / (VAR_1->video->h * VAR_1->video->w * 3); VAR_6 = fabs(VAR_5 - select->prev_mafd); VAR_2  = av_clipf(FFMIN(VAR_5, VAR_6) / 100., 0, 1); select->prev_mafd = VAR_5; avfilter_unref_buffer(prev_picref); } select->prev_picref = avfilter_ref_buffer(VAR_1, ~0); return VAR_2; }