[FFmpeg-devel] [PATCH]Double sar for tinterlace modes merge and pad

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Jun 2 01:48:54 CEST 2015


On Tuesday 02 June 2015 01:24:35 am Carl Eugen Hoyos wrote:
> Hi!
>
> Attached patch fixes aspect for the tinterlace modes merge and pad.
> Tested with the sample from ticket #4328.

New patch attached that works with ffplay and ffmpeg.

Carl Eugen
-------------- next part --------------
diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c
index 096a614..201bb5e 100644
--- a/libavfilter/vf_tinterlace.c
+++ b/libavfilter/vf_tinterlace.c
@@ -121,6 +121,9 @@ static int config_out_props(AVFilterLink *outlink)
     outlink->w = inlink->w;
     outlink->h = tinterlace->mode == MODE_MERGE || tinterlace->mode == MODE_PAD ?
         inlink->h*2 : inlink->h;
+    if (tinterlace->mode == MODE_MERGE || tinterlace->mode == MODE_PAD)
+        outlink->sample_aspect_ratio = av_mul_q(inlink->sample_aspect_ratio,
+                                                av_make_q(2, 1));
 
     if (tinterlace->mode == MODE_PAD) {
         uint8_t black[4] = { 16, 128, 128, 16 };
@@ -266,6 +269,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
         out->height = outlink->h;
         out->interlaced_frame = 1;
         out->top_field_first = 1;
+        out->sample_aspect_ratio = av_mul_q(cur->sample_aspect_ratio, av_make_q(2, 1)); 
 
         /* write odd frame lines into the upper field of the new frame */
         copy_picture_field(tinterlace, out->data, out->linesize,
@@ -295,6 +299,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
             return AVERROR(ENOMEM);
         av_frame_copy_props(out, cur);
         out->height = outlink->h;
+        out->sample_aspect_ratio = av_mul_q(cur->sample_aspect_ratio, av_make_q(2, 1)); 
 
         field = (1 + tinterlace->frame) & 1 ? FIELD_UPPER : FIELD_LOWER;
         /* copy upper and lower fields */


More information about the ffmpeg-devel mailing list