示例#1
0
static int64_t scene_sad16(FrameRateContext *s, const uint16_t *p1, int p1_linesize, const uint16_t* p2, int p2_linesize, const int width, const int height)
{
    int64_t sad;
    int x, y;
    for (sad = y = 0; y < height - 7; y += 8) {
        for (x = 0; x < width - 7; x += 8) {
            sad += sad_8x8_16(p1 + y * p1_linesize + x,
                              p1_linesize,
                              p2 + y * p2_linesize + x,
                              p2_linesize);
        }
    }
    return sad;
}
示例#2
0
static double get_scene_score16(AVFilterContext *ctx, AVFrame *crnt, AVFrame *next)
{
    FrameRateContext *s = ctx->priv;
    double ret = 0;

    ff_dlog(ctx, "get_scene_score16()\n");

    if (crnt &&
        crnt->height == next->height &&
        crnt->width  == next->width) {
        int x, y;
        int64_t sad;
        double mafd, diff;
        const uint16_t *p1 = (const uint16_t *)crnt->data[0];
        const uint16_t *p2 = (const uint16_t *)next->data[0];
        const int p1_linesize = crnt->linesize[0] / 2;
        const int p2_linesize = next->linesize[0] / 2;

        ff_dlog(ctx, "get_scene_score16() process\n");

        for (sad = y = 0; y < crnt->height; y += 8) {
            for (x = 0; x < p1_linesize; x += 8) {
                sad += sad_8x8_16(p1 + y * p1_linesize + x,
                                  p1_linesize,
                                  p2 + y * p2_linesize + x,
                                  p2_linesize);
            }
        }
        mafd = sad / (crnt->height * crnt->width * 3);
        diff = fabs(mafd - s->prev_mafd);
        ret  = av_clipf(FFMIN(mafd, diff), 0, 100.0);
        s->prev_mafd = mafd;
    }
    ff_dlog(ctx, "get_scene_score16() result is:%f\n", ret);
    return ret;
}