Commit d0ac6073 authored by Michael Niedermayer's avatar Michael Niedermayer

avfilter/vf_scale: add ov/hsub

Suggested-by: divVerent
Reviewed-by: Stefano
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent fb10b43f
...@@ -6820,7 +6820,12 @@ input display aspect ratio. Calculated from @code{(iw / ih) * sar}. ...@@ -6820,7 +6820,12 @@ input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
@item hsub @item hsub
@item vsub @item vsub
horizontal and vertical chroma subsample values. For example for the horizontal and vertical input chroma subsample values. For example for the
pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
@item ohsub
@item ovsub
horizontal and vertical output chroma subsample values. For example for the
pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
@end table @end table
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3 #define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 90 #define LIBAVFILTER_VERSION_MINOR 90
#define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_MICRO 101
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \ LIBAVFILTER_VERSION_MINOR, \
......
...@@ -51,6 +51,8 @@ static const char *const var_names[] = { ...@@ -51,6 +51,8 @@ static const char *const var_names[] = {
"dar", "dar",
"hsub", "hsub",
"vsub", "vsub",
"ohsub",
"ovsub",
NULL NULL
}; };
...@@ -64,6 +66,8 @@ enum var_name { ...@@ -64,6 +66,8 @@ enum var_name {
VAR_DAR, VAR_DAR,
VAR_HSUB, VAR_HSUB,
VAR_VSUB, VAR_VSUB,
VAR_OHSUB,
VAR_OVSUB,
VARS_NB VARS_NB
}; };
...@@ -227,6 +231,7 @@ static int config_props(AVFilterLink *outlink) ...@@ -227,6 +231,7 @@ static int config_props(AVFilterLink *outlink)
enum AVPixelFormat outfmt = outlink->format; enum AVPixelFormat outfmt = outlink->format;
ScaleContext *scale = ctx->priv; ScaleContext *scale = ctx->priv;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
const AVPixFmtDescriptor *out_desc = av_pix_fmt_desc_get(outlink->format);
int64_t w, h; int64_t w, h;
double var_values[VARS_NB], res; double var_values[VARS_NB], res;
char *expr; char *expr;
...@@ -242,6 +247,8 @@ static int config_props(AVFilterLink *outlink) ...@@ -242,6 +247,8 @@ static int config_props(AVFilterLink *outlink)
var_values[VAR_DAR] = var_values[VAR_A] * var_values[VAR_SAR]; var_values[VAR_DAR] = var_values[VAR_A] * var_values[VAR_SAR];
var_values[VAR_HSUB] = 1 << desc->log2_chroma_w; var_values[VAR_HSUB] = 1 << desc->log2_chroma_w;
var_values[VAR_VSUB] = 1 << desc->log2_chroma_h; var_values[VAR_VSUB] = 1 << desc->log2_chroma_h;
var_values[VAR_OHSUB] = 1 << out_desc->log2_chroma_w;
var_values[VAR_OVSUB] = 1 << out_desc->log2_chroma_h;
/* evaluate width and height */ /* evaluate width and height */
av_expr_parse_and_eval(&res, (expr = scale->w_expr), av_expr_parse_and_eval(&res, (expr = scale->w_expr),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment