Mercurial > libavcodec.hg
diff imgconvert.c @ 12384:e1ef713061ce libavcodec
Add av_picture_data_copy() and reimplement av_picture_copy() as a
wrapper of it.
The new function is more generic, and does not depend on the
definition of the AVPicture struct.
Patch by S.N. Hemanth Meenakshisundaram s + "meenakshisundaram".substr(0, 7) + "@ucsd.edu".
author | stefano |
---|---|
date | Wed, 11 Aug 2010 14:18:52 +0000 |
parents | 914f484bb476 |
children | b4b2f1006d9d |
line wrap: on
line diff
--- a/imgconvert.c Wed Aug 11 08:27:38 2010 +0000 +++ b/imgconvert.c Wed Aug 11 14:18:52 2010 +0000 @@ -845,8 +845,9 @@ return -1; } -void av_picture_copy(AVPicture *dst, const AVPicture *src, - enum PixelFormat pix_fmt, int width, int height) +void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], + uint8_t *src_data[4], int src_linesize[4], + enum PixelFormat pix_fmt, int width, int height) { int i; const PixFmtInfo *pf = &pix_fmt_info[pix_fmt]; @@ -862,21 +863,28 @@ if (i == 1 || i == 2) { h= -((-height)>>desc->log2_chroma_h); } - ff_img_copy_plane(dst->data[i], dst->linesize[i], - src->data[i], src->linesize[i], - bwidth, h); + ff_img_copy_plane(dst_data[i], dst_linesize[i], + src_data[i], src_linesize[i], + bwidth, h); } break; case FF_PIXEL_PALETTE: - ff_img_copy_plane(dst->data[0], dst->linesize[0], - src->data[0], src->linesize[0], - width, height); + ff_img_copy_plane(dst_data[0], dst_linesize[0], + src_data[0], src_linesize[0], + width, height); /* copy the palette */ - memcpy(dst->data[1], src->data[1], 4*256); + memcpy(dst_data[1], src_data[1], 4*256); break; } } +void av_picture_copy(AVPicture *dst, const AVPicture *src, + enum PixelFormat pix_fmt, int width, int height) +{ + av_picture_data_copy(dst->data, dst->linesize, src->data, + src->linesize, pix_fmt, width, height); +} + /* 2x2 -> 1x1 */ void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap,