libavcodec/imgconvert.c: support left band while cropping
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
d0061e77cd
commit
c39637f36a
@ -201,12 +201,14 @@ int av_picture_crop(AVPicture *dst, const AVPicture *src,
|
|||||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
|
||||||
int y_shift;
|
int y_shift;
|
||||||
int x_shift;
|
int x_shift;
|
||||||
|
int max_step[4];
|
||||||
|
|
||||||
if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
|
if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
y_shift = desc->log2_chroma_h;
|
y_shift = desc->log2_chroma_h;
|
||||||
x_shift = desc->log2_chroma_w;
|
x_shift = desc->log2_chroma_w;
|
||||||
|
av_image_fill_max_pixsteps(max_step, NULL, desc);
|
||||||
|
|
||||||
if (is_yuv_planar(desc)) {
|
if (is_yuv_planar(desc)) {
|
||||||
dst->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;
|
||||||
@ -215,9 +217,7 @@ int av_picture_crop(AVPicture *dst, const AVPicture *src,
|
|||||||
} else{
|
} else{
|
||||||
if(top_band % (1<<y_shift) || left_band % (1<<x_shift))
|
if(top_band % (1<<y_shift) || left_band % (1<<x_shift))
|
||||||
return -1;
|
return -1;
|
||||||
if(left_band) //FIXME add support for this too
|
dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + (left_band * max_step[0]);
|
||||||
return -1;
|
|
||||||
dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dst->linesize[0] = src->linesize[0];
|
dst->linesize[0] = src->linesize[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user