~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavfilter/vf_scale.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:23:28 UTC
  • mfrom: (0.4.7 sid)
  • mto: This revision was merged to the branch mainline in revision 76.
  • Revision ID: package-import@ubuntu.com-20120112222328-8jqdyodym3p84ygu
Tags: 2:1.0~rc4.dfsg1+svn34540-1
* New upstream snapshot
* upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "avfilter.h"
27
27
#include "libavutil/avstring.h"
28
28
#include "libavutil/eval.h"
 
29
#include "libavutil/mathematics.h"
29
30
#include "libavutil/pixdesc.h"
30
31
#include "libswscale/swscale.h"
31
32
 
37
38
    "in_h",   "ih",
38
39
    "out_w",  "ow",
39
40
    "out_h",  "oh",
40
 
    "a",
 
41
    "a", "dar",
 
42
    "sar",
41
43
    "hsub",
42
44
    "vsub",
43
45
    NULL
51
53
    VAR_IN_H,   VAR_IH,
52
54
    VAR_OUT_W,  VAR_OW,
53
55
    VAR_OUT_H,  VAR_OH,
54
 
    VAR_A,
 
56
    VAR_A, VAR_DAR,
 
57
    VAR_SAR,
55
58
    VAR_HSUB,
56
59
    VAR_VSUB,
57
60
    VARS_NB
148
151
    var_values[VAR_IN_H]  = var_values[VAR_IH] = inlink->h;
149
152
    var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN;
150
153
    var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN;
151
 
    var_values[VAR_A]     = (float) inlink->w / inlink->h;
 
154
    var_values[VAR_DAR]   = var_values[VAR_A]  = (float) inlink->w / inlink->h;
 
155
    var_values[VAR_SAR]   = inlink->sample_aspect_ratio.num ?
 
156
        (float) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1;
152
157
    var_values[VAR_HSUB]  = 1<<av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
153
158
    var_values[VAR_VSUB]  = 1<<av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
154
159
 
205
210
 
206
211
    scale->input_is_pal = av_pix_fmt_descriptors[inlink->format].flags & PIX_FMT_PAL;
207
212
 
 
213
    if (scale->sws)
 
214
        sws_freeContext(scale->sws);
208
215
    scale->sws = sws_getContext(inlink ->w, inlink ->h, inlink ->format,
209
216
                                outlink->w, outlink->h, outlink->format,
210
217
                                scale->flags, NULL, NULL, NULL);
211
218
    if (!scale->sws)
212
219
        return AVERROR(EINVAL);
213
220
 
 
221
 
 
222
    if (inlink->sample_aspect_ratio.num)
 
223
        outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h*inlink->w,
 
224
                                                             outlink->w*inlink->h},
 
225
                                                inlink->sample_aspect_ratio);
 
226
    else
 
227
        outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
 
228
 
214
229
    return 0;
215
230
 
216
231
fail: