diff options
author | Gyan Doshi <ffmpeg@gyani.pro> | 2019-12-02 21:11:21 +0530 |
---|---|---|
committer | Gyan Doshi <ffmpeg@gyani.pro> | 2019-12-08 16:12:31 +0530 |
commit | 1b4f473d181abaa0ff4e2d63862f61763a5a6860 (patch) | |
tree | 5422676836648b8e68264bf35c236e4442363610 /libavfilter/vf_scale_npp.c | |
parent | ff2b75d94cee65e47db7a56f3924497016e5b420 (diff) | |
download | ffmpeg-1b4f473d181abaa0ff4e2d63862f61763a5a6860.tar.gz |
avfilter/scale.c: factorize ff_scale_eval_dimensions
Adjustment of evaluated values shifted to ff_adjust_scale_dimensions
Shifted code for force_original_aspect_ratio and force_divisble_by from
vf_scale so it is now available for scale_cuda, scale_npp and
scale_vaapi as well.
Diffstat (limited to 'libavfilter/vf_scale_npp.c')
-rw-r--r-- | libavfilter/vf_scale_npp.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavfilter/vf_scale_npp.c b/libavfilter/vf_scale_npp.c index a3e085764a..09c3d51727 100644 --- a/libavfilter/vf_scale_npp.c +++ b/libavfilter/vf_scale_npp.c @@ -98,6 +98,9 @@ typedef struct NPPScaleContext { char *h_expr; ///< height expression string char *format_str; + int force_original_aspect_ratio; + int force_divisible_by; + int interp_algo; } NPPScaleContext; @@ -347,6 +350,9 @@ static int nppscale_config_props(AVFilterLink *outlink) &w, &h)) < 0) goto fail; + ff_scale_adjust_dimensions(inlink, &w, &h, + s->force_original_aspect_ratio, s->force_divisible_by); + if (((int64_t)h * inlink->w) > INT_MAX || ((int64_t)w * inlink->h) > INT_MAX) av_log(ctx, AV_LOG_ERROR, "Rescaled value for width or height is too big.\n"); @@ -552,6 +558,11 @@ static const AVOption options[] = { { "cubic2p_b05c03", "2-parameter cubic (B=1/2, C=3/10)", 0, AV_OPT_TYPE_CONST, { .i64 = NPPI_INTER_CUBIC2P_B05C03 }, 0, 0, FLAGS, "interp_algo" }, { "super", "supersampling", 0, AV_OPT_TYPE_CONST, { .i64 = NPPI_INTER_SUPER }, 0, 0, FLAGS, "interp_algo" }, { "lanczos", "Lanczos", 0, AV_OPT_TYPE_CONST, { .i64 = NPPI_INTER_LANCZOS }, 0, 0, FLAGS, "interp_algo" }, + { "force_original_aspect_ratio", "decrease or increase w/h if necessary to keep the original AR", OFFSET(force_original_aspect_ratio), AV_OPT_TYPE_INT, { .i64 = 0}, 0, 2, FLAGS, "force_oar" }, + { "disable", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 0, FLAGS, "force_oar" }, + { "decrease", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 0, FLAGS, "force_oar" }, + { "increase", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 2 }, 0, 0, FLAGS, "force_oar" }, + { "force_divisible_by", "enforce that the output resolution is divisible by a defined integer when force_original_aspect_ratio is used", OFFSET(force_divisible_by), AV_OPT_TYPE_INT, { .i64 = 1}, 1, 256, FLAGS }, { NULL }, }; |