From c39637f36aa3a942efaa098854bd0c2ae612bcd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Sobala?= Date: Fri, 12 Jun 2015 18:38:05 +0200 Subject: libavcodec/imgconvert.c: support left band while cropping Signed-off-by: Michael Niedermayer --- libavcodec/imgconvert.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libavcodec/imgconvert.c') diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 8cb609946a..dc67560742 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -201,12 +201,14 @@ int av_picture_crop(AVPicture *dst, const AVPicture *src, const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); int y_shift; int x_shift; + int max_step[4]; if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) return -1; y_shift = desc->log2_chroma_h; x_shift = desc->log2_chroma_w; + av_image_fill_max_pixsteps(max_step, NULL, desc); if (is_yuv_planar(desc)) { dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band; @@ -215,9 +217,7 @@ int av_picture_crop(AVPicture *dst, const AVPicture *src, } else{ if(top_band % (1<data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band; + dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + (left_band * max_step[0]); } dst->linesize[0] = src->linesize[0]; -- cgit v1.2.3