summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-07-02 17:27:31 +0200
committerAnton Khirnov <anton@khirnov.net>2011-09-28 08:03:24 +0200
commit46b29397a658805118e920167dcfe1bf60573e53 (patch)
tree3879613b0b5f0eac8784c73ef0234538443fa311
parent0ec56d1144fa4ea36950295987bb5f49c9747046 (diff)
vf_scale: add a "sar" variable
Also create a "dar" alias for the "a" variable, for avoiding possible confusion between dar/sar. Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r--doc/filters.texi5
-rw-r--r--libavfilter/avfilter.h2
-rw-r--r--libavfilter/vf_scale.c10
3 files changed, 12 insertions, 5 deletions
diff --git a/doc/filters.texi b/doc/filters.texi
index 2967db14d2..228c1f087f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1013,9 +1013,12 @@ the output (cropped) width and heigth
@item ow, oh
same as @var{out_w} and @var{out_h}
-@item a
+@item dar, a
input display aspect ratio, same as @var{iw} / @var{ih}
+@item sar
+input sample aspect ratio
+
@item hsub, vsub
horizontal and vertical chroma subsample values. For example for the
pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index ee42585d6d..c46dd1f5dd 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 7
-#define LIBAVFILTER_VERSION_MICRO 1
+#define LIBAVFILTER_VERSION_MICRO 2
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 5217bd07f7..5e7285cda8 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -38,7 +38,8 @@ static const char *var_names[] = {
"in_h", "ih",
"out_w", "ow",
"out_h", "oh",
- "a",
+ "a", "dar",
+ "sar",
"hsub",
"vsub",
NULL
@@ -52,7 +53,8 @@ enum var_name {
VAR_IN_H, VAR_IH,
VAR_OUT_W, VAR_OW,
VAR_OUT_H, VAR_OH,
- VAR_A,
+ VAR_A, VAR_DAR,
+ VAR_SAR,
VAR_HSUB,
VAR_VSUB,
VARS_NB
@@ -149,7 +151,9 @@ static int config_props(AVFilterLink *outlink)
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_A] = (float) inlink->w / inlink->h;
+ var_values[VAR_DAR] = 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_HSUB] = 1<<av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
var_values[VAR_VSUB] = 1<<av_pix_fmt_descriptors[inlink->format].log2_chroma_h;