示例#1
0
文件: ildetect.c 项目: AbhiDGamer/mpv
int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **argv)
{
    VF_DLOPEN_CHECK_VERSION(ctx);
    (void) argc;
    (void) argv;

    ildetect_data_t *il = malloc(sizeof(ildetect_data_t));
    memset(il, 0, sizeof(*il));

#define A(i,d) ((argc>(i) && *argv[i]) ? atof(argv[i]) : (d))
    il->method = A(0, 0);
    il->combing_threshold = A(1, 1);
    il->motion_threshold = A(2, 6);
    il->motion_amount = A(3, 0.1);
    il->yes_threshold = A(4, 0.1);
    il->no_threshold = A(5, 0.05);
    il->total_yes_threshold = A(6, 0.1);
    il->total_no_threshold = A(7, 0.05);
    il->tc_threshold = A(8, 0.1);
    il->decision_threshold = A(9, 0.2);
    il->tc_decision_threshold = A(10, 0.2);

    static struct vf_dlopen_formatpair map[] = {
        { "gray", "gray" },
        { NULL, NULL }
    };
    ctx->format_mapping = map;
    ctx->config = il_config;
    ctx->put_image = il_put_image;
    ctx->uninit = il_uninit;
    ctx->priv = il;
    return 1;
}
示例#2
0
文件: telecine.c 项目: kax4/mpv
int vf_dlopen_getcontext(struct vf_dlopen_context *ctx, int argc, const char **argv)
{
    VF_DLOPEN_CHECK_VERSION(ctx);

    const char *a0 = (argc < 1) ? "t" : argv[0];
    const char *a1 = (argc < 2) ? "23" : argv[1];

    if (!a0[0] || a0[1] || !a1[0] || argc > 2)
        return -1;

    tc_data_t *tc = malloc(sizeof(tc_data_t));
    memset(tc, 0, sizeof(*tc));

    if (a0[0] == 't')
        tc->firstfield = 0;
    else if (a0[0] == 'b')
        tc->firstfield = 1;
    else {
        printf("telecine: invalid first field\n");
        free(tc);
        return -1;
    }

    tc->pattern = a1;

    const char *p;
    for (p = tc->pattern; *p; ++p)
        if (*p < '0' || *p > '9') {
            printf("telecine: invalid pattern\n");
            free(tc);
            return -1;
        }

    ctx->priv = tc;
    ctx->format_mapping = NULL; // anything goes
    ctx->config = tc_config;
    ctx->put_image = tc_put_image;
    ctx->uninit = tc_uninit;

    return 1;
}