Ticket #325: aspect_variable.patch

File aspect_variable.patch, 1.9 KB (added by Pae8uuW5, 8 years ago)

patch to add "d" variable containing the source sample aspect ratio

  • libavfilter/vf_pad.c

    diff -ru ../clean/ffmpeg-0.8/libavfilter/vf_pad.c libavfilter/vf_pad.c
    old new  
    4545    "x",
    4646    "y",
    4747    "a",
     48    "d",
    4849    "hsub",
    4950    "vsub",
    5051    NULL
     
    6162    VAR_X,
    6263    VAR_Y,
    6364    VAR_A,
     65    VAR_D,
    6466    VAR_HSUB,
    6567    VAR_VSUB,
    6668    VARS_NB
     
    156158    var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN;
    157159    var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN;
    158160    var_values[VAR_A]     = (float) inlink->w / inlink->h;
     161    var_values[VAR_D]     = (float) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den;
     162    if ((inlink->sample_aspect_ratio.num < 1) || (inlink->sample_aspect_ratio.den < 1)) var_values[VAR_D] = 1;
    159163    var_values[VAR_HSUB]  = 1<<pad->hsub;
    160164    var_values[VAR_VSUB]  = 2<<pad->vsub;
    161165
  • libavfilter/vf_scale.c

    diff -ru ../clean/ffmpeg-0.8/libavfilter/vf_scale.c libavfilter/vf_scale.c
    old new  
    3939    "out_w",  "ow",
    4040    "out_h",  "oh",
    4141    "a",
     42    "d",
    4243    "hsub",
    4344    "vsub",
    4445    NULL
     
    5354    VAR_OUT_W,  VAR_OW,
    5455    VAR_OUT_H,  VAR_OH,
    5556    VAR_A,
     57    VAR_D,
    5658    VAR_HSUB,
    5759    VAR_VSUB,
    5860    VARS_NB
     
    158160    var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN;
    159161    var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN;
    160162    var_values[VAR_A]     = (float) inlink->w / inlink->h;
     163    var_values[VAR_D]     = (float) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den;
     164    if ((inlink->sample_aspect_ratio.num < 1) || (inlink->sample_aspect_ratio.den < 1)) var_values[VAR_D] = 1;
     165
    161166    var_values[VAR_HSUB]  = 1<<av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
    162167    var_values[VAR_VSUB]  = 1<<av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
    163168