summaryrefslogtreecommitdiff
path: root/libavfilter/vf_pad.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-07-27 10:58:24 +0200
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2011-07-30 18:27:24 +0200
commit61d55fda2b513caf18e37b27aba680a87840904a (patch)
tree4055c0c0c71dc4b12058e5af9b3d2ae71a6606af /libavfilter/vf_pad.c
parent0e29c4f761575d60c764e56ed1d07b432eaf0262 (diff)
lavfi: tweak display aspect ratio variables in pad and scale filters
Previously, "dar" and "a" were documented like "input display aspect ratio", but their actual value was "in_w/in_h". In order to avoid to break scripts which rely on the "a" variable, the patch keeps the same semantics but fixes the corresponding docs, and fixes the semantics of the recently added "dar" variable, which now correctly expresses the input Display Aspect Ratio value as "(inw_w/in_h)*sar".
Diffstat (limited to 'libavfilter/vf_pad.c')
-rw-r--r--libavfilter/vf_pad.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index e01a750d94..c4edc23cc5 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -45,8 +45,9 @@ static const char *var_names[] = {
"out_h", "oh",
"x",
"y",
- "a", "dar",
+ "a",
"sar",
+ "dar",
"hsub",
"vsub",
NULL
@@ -62,8 +63,9 @@ enum var_name {
VAR_OUT_H, VAR_OH,
VAR_X,
VAR_Y,
- VAR_A, VAR_DAR,
+ VAR_A,
VAR_SAR,
+ VAR_DAR,
VAR_HSUB,
VAR_VSUB,
VARS_NB
@@ -158,9 +160,10 @@ static int config_input(AVFilterLink *inlink)
var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h;
var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN;
var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN;
- var_values[VAR_DAR] = var_values[VAR_A] = (float) inlink->w / inlink->h;
+ var_values[VAR_A] = (float) inlink->w / inlink->h;
var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ?
(float) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1;
+ var_values[VAR_DAR] = var_values[VAR_A] * var_values[VAR_SAR];
var_values[VAR_HSUB] = 1<<pad->hsub;
var_values[VAR_VSUB] = 1<<pad->vsub;