summaryrefslogtreecommitdiff
path: root/libavfilter/vf_scale.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-10-06 13:29:37 +0200
committerAnton Khirnov <anton@khirnov.net>2012-10-12 12:45:39 +0200
commit59ee9f78b0cc4fb84ae606fa317d8102ad32a627 (patch)
tree253bd434e8b7416d62d8d5f16f1f443cf05c7bd4 /libavfilter/vf_scale.c
parent50ba57e0ce63d9904269ea0728936a0c79f8bfb5 (diff)
lavfi: do not use av_pix_fmt_descriptors directly.
Diffstat (limited to 'libavfilter/vf_scale.c')
-rw-r--r--libavfilter/vf_scale.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 5425bbd9bc..cbc1081cd9 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -155,6 +155,7 @@ static int config_props(AVFilterLink *outlink)
AVFilterContext *ctx = outlink->src;
AVFilterLink *inlink = outlink->src->inputs[0];
ScaleContext *scale = ctx->priv;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
int64_t w, h;
double var_values[VARS_NB], res;
char *expr;
@@ -170,8 +171,8 @@ static int config_props(AVFilterLink *outlink)
var_values[VAR_DAR] = var_values[VAR_A] = (double) inlink->w / inlink->h;
var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ?
(double) 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;
+ var_values[VAR_HSUB] = 1 << desc->log2_chroma_w;
+ var_values[VAR_VSUB] = 1 << desc->log2_chroma_h;
/* evaluate width and height */
av_expr_parse_and_eval(&res, (expr = scale->w_expr),
@@ -220,12 +221,12 @@ static int config_props(AVFilterLink *outlink)
/* TODO: make algorithm configurable */
av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d fmt:%s -> w:%d h:%d fmt:%s flags:0x%0x\n",
- inlink ->w, inlink ->h, av_pix_fmt_descriptors[ inlink->format].name,
- outlink->w, outlink->h, av_pix_fmt_descriptors[outlink->format].name,
+ inlink ->w, inlink ->h, av_get_pix_fmt_name(inlink->format),
+ outlink->w, outlink->h, av_get_pix_fmt_name(outlink->format),
scale->flags);
- scale->input_is_pal = av_pix_fmt_descriptors[inlink->format].flags & PIX_FMT_PAL ||
- av_pix_fmt_descriptors[inlink->format].flags & PIX_FMT_PSEUDOPAL;
+ scale->input_is_pal = desc->flags & PIX_FMT_PAL ||
+ desc->flags & PIX_FMT_PSEUDOPAL;
if (scale->sws)
sws_freeContext(scale->sws);
@@ -261,6 +262,7 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
ScaleContext *scale = link->dst->priv;
AVFilterLink *outlink = link->dst->outputs[0];
AVFilterBufferRef *outpicref, *for_next_filter;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
int ret = 0;
if (!scale->sws) {
@@ -270,8 +272,8 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
return ff_start_frame(outlink, outpicref);
}
- scale->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w;
- scale->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
+ scale->hsub = desc->log2_chroma_w;
+ scale->vsub = desc->log2_chroma_h;
outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
if (!outpicref)