[FFmpeg-cvslog] vf_interlace: use image width rather than linesize
Vittorio Giovara
git at videolan.org
Tue Jan 6 23:40:21 CET 2015
ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Tue Dec 2 14:58:38 2014 +0000| [696141e898193311c994b399a8dc60713709092f] | committer: Vittorio Giovara
vf_interlace: use image width rather than linesize
Based on a patch by Michael Niedermayer <michaelni at gmx.at>.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=696141e898193311c994b399a8dc60713709092f
---
libavfilter/vf_interlace.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/libavfilter/vf_interlace.c b/libavfilter/vf_interlace.c
index 3c36568..3e2a044 100644
--- a/libavfilter/vf_interlace.c
+++ b/libavfilter/vf_interlace.c
@@ -131,16 +131,17 @@ static void copy_picture_field(InterlaceContext *s,
int lowpass)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
+ int hsub = desc->log2_chroma_w;
int vsub = desc->log2_chroma_h;
int plane, j;
for (plane = 0; plane < desc->nb_components; plane++) {
+ int cols = (plane == 1 || plane == 2) ? -(-inlink->w) >> hsub : inlink->w;
int lines = (plane == 1 || plane == 2) ? -(-inlink->h) >> vsub : inlink->h;
- ptrdiff_t linesize = av_image_get_linesize(inlink->format, inlink->w, plane);
uint8_t *dstp = dst_frame->data[plane];
const uint8_t *srcp = src_frame->data[plane];
- av_assert0(linesize >= 0);
+ av_assert0(cols >= 0);
lines = (lines + (field_type == FIELD_UPPER)) / 2;
if (field_type == FIELD_LOWER)
@@ -157,14 +158,14 @@ static void copy_picture_field(InterlaceContext *s,
srcp_above = srcp; // there is no line above
if (j == 1)
srcp_below = srcp; // there is no line below
- s->lowpass_line(dstp, linesize, srcp, srcp_above, srcp_below);
+ s->lowpass_line(dstp, cols, srcp, srcp_above, srcp_below);
dstp += dstp_linesize;
srcp += srcp_linesize;
}
} else {
av_image_copy_plane(dstp, dst_frame->linesize[plane] * 2,
srcp, src_frame->linesize[plane] * 2,
- linesize, lines);
+ cols, lines);
}
}
}
More information about the ffmpeg-cvslog
mailing list