mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
vfilter/vf_tinterlace: Fix issues with linesize and cols
Based on patch by Vittorio Giovara <vittorio.giovara@gmail.com> from 696141e898193311c994b399a8dc60713709092f Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
f931b1ef45
commit
ac3f6429ba
@ -197,20 +197,17 @@ void copy_picture_field(TInterlaceContext *tinterlace,
|
|||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
|
||||||
|
int hsub = desc->log2_chroma_w;
|
||||||
int plane, vsub = desc->log2_chroma_h;
|
int plane, vsub = desc->log2_chroma_h;
|
||||||
int k = src_field == FIELD_UPPER_AND_LOWER ? 1 : 2;
|
int k = src_field == FIELD_UPPER_AND_LOWER ? 1 : 2;
|
||||||
int h;
|
int h;
|
||||||
|
|
||||||
for (plane = 0; plane < desc->nb_components; plane++) {
|
for (plane = 0; plane < desc->nb_components; plane++) {
|
||||||
int lines = plane == 1 || plane == 2 ? FF_CEIL_RSHIFT(src_h, vsub) : src_h;
|
int lines = plane == 1 || plane == 2 ? FF_CEIL_RSHIFT(src_h, vsub) : src_h;
|
||||||
int cols = plane == 1 || plane == 2 ? FF_CEIL_RSHIFT( w, desc->log2_chroma_w) : w;
|
int cols = plane == 1 || plane == 2 ? FF_CEIL_RSHIFT( w, hsub) : w;
|
||||||
int linesize = av_image_get_linesize(format, w, plane);
|
|
||||||
uint8_t *dstp = dst[plane];
|
uint8_t *dstp = dst[plane];
|
||||||
const uint8_t *srcp = src[plane];
|
const uint8_t *srcp = src[plane];
|
||||||
|
|
||||||
if (linesize < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
lines = (lines + (src_field == FIELD_UPPER)) / k;
|
lines = (lines + (src_field == FIELD_UPPER)) / k;
|
||||||
if (src_field == FIELD_LOWER)
|
if (src_field == FIELD_LOWER)
|
||||||
srcp += src_linesize[plane];
|
srcp += src_linesize[plane];
|
||||||
@ -234,7 +231,7 @@ void copy_picture_field(TInterlaceContext *tinterlace,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
av_image_copy_plane(dstp, dst_linesize[plane] * (interleave ? 2 : 1),
|
av_image_copy_plane(dstp, dst_linesize[plane] * (interleave ? 2 : 1),
|
||||||
srcp, src_linesize[plane]*k, linesize, lines);
|
srcp, src_linesize[plane]*k, cols, lines);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user