Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGyan Doshi <ffmpeg@gyani.pro>2019-12-02 18:41:21 +0300
committerGyan Doshi <ffmpeg@gyani.pro>2019-12-08 13:42:31 +0300
commit1b4f473d181abaa0ff4e2d63862f61763a5a6860 (patch)
tree5422676836648b8e68264bf35c236e4442363610 /libavfilter/vf_scale_vaapi.c
parentff2b75d94cee65e47db7a56f3924497016e5b420 (diff)
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_vaapi.c')
-rw-r--r--libavfilter/vf_scale_vaapi.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c
index c32395ac09..88642cbe73 100644
--- a/libavfilter/vf_scale_vaapi.c
+++ b/libavfilter/vf_scale_vaapi.c
@@ -40,6 +40,9 @@ typedef struct ScaleVAAPIContext {
char *w_expr; // width expression string
char *h_expr; // height expression string
+ int force_original_aspect_ratio;
+ int force_divisible_by;
+
char *colour_primaries_string;
char *colour_transfer_string;
char *colour_matrix_string;
@@ -81,6 +84,9 @@ static int scale_vaapi_config_output(AVFilterLink *outlink)
&vpp_ctx->output_width, &vpp_ctx->output_height)) < 0)
return err;
+ ff_scale_adjust_dimensions(inlink, &vpp_ctx->output_width, &vpp_ctx->output_height,
+ ctx->force_original_aspect_ratio, ctx->force_divisible_by);
+
err = ff_vaapi_vpp_config_output(outlink);
if (err < 0)
return err;
@@ -247,6 +253,11 @@ static const AVOption scale_vaapi_options[] = {
{ "out_chroma_location", "Output chroma sample location",
OFFSET(chroma_location_string), AV_OPT_TYPE_STRING,
{ .str = NULL }, .flags = FLAGS },
+ { "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 },
};