From 6028728bb829c04cc68c66c846c75a70bf4c0613 Mon Sep 17 00:00:00 2001 From: Kyle Swanson Date: Thu, 5 Oct 2023 13:15:06 -0700 Subject: [PATCH] avfilter/libvmaf: remove deprecated options --- doc/filters.texi | 21 --------- libavfilter/vf_libvmaf.c | 97 ---------------------------------------- 2 files changed, 118 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index a729a08dce..f5032ddf74 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -16858,30 +16858,9 @@ The filter has following options: A `|` delimited list of vmaf models. Each model can be configured with a number of parameters. Default value: @code{"version=vmaf_v0.6.1"} -@item model_path -Deprecated, use model='path=...'. - -@item enable_transform -Deprecated, use model='enable_transform=true'. - -@item phone_model -Deprecated, use model='enable_transform=true'. - -@item enable_conf_interval -Deprecated, use model='enable_conf_interval=true'. - @item feature A `|` delimited list of features. Each feature can be configured with a number of parameters. -@item psnr -Deprecated, use feature='name=psnr'. - -@item ssim -Deprecated, use feature='name=ssim'. - -@item ms_ssim -Deprecated, use feature='name=ms_ssim'. - @item log_path Set the file path to be used to store log files. diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c index 2726b061ac..18196c6734 100644 --- a/libavfilter/vf_libvmaf.c +++ b/libavfilter/vf_libvmaf.c @@ -76,18 +76,11 @@ typedef struct LIBVMAFContext { #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM static const AVOption libvmaf_options[] = { - {"model_path", "use model='path=...'.", OFFSET(model_path), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS|AV_OPT_FLAG_DEPRECATED}, {"log_path", "Set the file path to be used to write log.", OFFSET(log_path), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS}, {"log_fmt", "Set the format of the log (csv, json, xml, or sub).", OFFSET(log_fmt), AV_OPT_TYPE_STRING, {.str="xml"}, 0, 1, FLAGS}, - {"enable_transform", "use model='enable_transform=true'.", OFFSET(enable_transform), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS|AV_OPT_FLAG_DEPRECATED}, - {"phone_model", "use model='enable_transform=true'.", OFFSET(phone_model), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS|AV_OPT_FLAG_DEPRECATED}, - {"psnr", "use feature='name=psnr'.", OFFSET(psnr), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS|AV_OPT_FLAG_DEPRECATED}, - {"ssim", "use feature='name=float_ssim'.", OFFSET(ssim), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS|AV_OPT_FLAG_DEPRECATED}, - {"ms_ssim", "use feature='name=float_ms_ssim'.", OFFSET(ms_ssim), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS|AV_OPT_FLAG_DEPRECATED}, {"pool", "Set the pool method to be used for computing vmaf.", OFFSET(pool), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS}, {"n_threads", "Set number of threads to be used when computing vmaf.", OFFSET(n_threads), AV_OPT_TYPE_INT, {.i64=0}, 0, UINT_MAX, FLAGS}, {"n_subsample", "Set interval for frame subsampling used when computing vmaf.", OFFSET(n_subsample), AV_OPT_TYPE_INT, {.i64=1}, 1, UINT_MAX, FLAGS}, - {"enable_conf_interval", "model='enable_conf_interval=true'.", OFFSET(enable_conf_interval), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS|AV_OPT_FLAG_DEPRECATED}, {"model", "Set the model to be used for computing vmaf.", OFFSET(model_cfg), AV_OPT_TYPE_STRING, {.str="version=vmaf_v0.6.1"}, 0, 1, FLAGS}, {"feature", "Set the feature to be used for computing vmaf.", OFFSET(feature_cfg), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS}, { NULL } @@ -440,92 +433,6 @@ static enum VmafLogLevel log_level_map(int log_level) } } -static int parse_deprecated_options(AVFilterContext *ctx) -{ - LIBVMAFContext *s = ctx->priv; - VmafModel *model = NULL; - VmafModelCollection *model_collection = NULL; - enum VmafModelFlags flags = VMAF_MODEL_FLAGS_DEFAULT; - int err = 0; - - VmafModelConfig model_cfg = { - .name = "vmaf", - .flags = flags, - }; - - if (s->enable_transform || s->phone_model) - flags |= VMAF_MODEL_FLAG_ENABLE_TRANSFORM; - - if (!s->model_path) - goto extra_metrics_only; - - if (s->enable_conf_interval) { - err = vmaf_model_collection_load_from_path(&model, &model_collection, - &model_cfg, s->model_path); - if (err) { - av_log(ctx, AV_LOG_ERROR, - "problem loading model file: %s\n", s->model_path); - goto exit; - } - - err = vmaf_use_features_from_model_collection(s->vmaf, model_collection); - if (err) { - av_log(ctx, AV_LOG_ERROR, - "problem loading feature extractors from model file: %s\n", - s->model_path); - goto exit; - } - } else { - err = vmaf_model_load_from_path(&model, &model_cfg, s->model_path); - if (err) { - av_log(ctx, AV_LOG_ERROR, - "problem loading model file: %s\n", s->model_path); - goto exit; - } - err = vmaf_use_features_from_model(s->vmaf, model); - if (err) { - av_log(ctx, AV_LOG_ERROR, - "problem loading feature extractors from model file: %s\n", - s->model_path); - goto exit; - } - } - -extra_metrics_only: - if (s->psnr) { - VmafFeatureDictionary *d = NULL; - vmaf_feature_dictionary_set(&d, "enable_chroma", "false"); - - err = vmaf_use_feature(s->vmaf, "psnr", d); - if (err) { - av_log(ctx, AV_LOG_ERROR, - "problem loading feature extractor: psnr\n"); - goto exit; - } - } - - if (s->ssim) { - err = vmaf_use_feature(s->vmaf, "float_ssim", NULL); - if (err) { - av_log(ctx, AV_LOG_ERROR, - "problem loading feature extractor: ssim\n"); - goto exit; - } - } - - if (s->ms_ssim) { - err = vmaf_use_feature(s->vmaf, "float_ms_ssim", NULL); - if (err) { - av_log(ctx, AV_LOG_ERROR, - "problem loading feature extractor: ms_ssim\n"); - goto exit; - } - } - -exit: - return err; -} - static av_cold int init(AVFilterContext *ctx) { LIBVMAFContext *s = ctx->priv; @@ -541,10 +448,6 @@ static av_cold int init(AVFilterContext *ctx) if (err) return AVERROR(EINVAL); - err = parse_deprecated_options(ctx); - if (err) - return err; - err = parse_models(ctx); if (err) return err;