summaryrefslogtreecommitdiff
path: root/libavcodec/imgconvert.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-09-07 21:23:52 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-09-07 21:23:52 +0000
commite7eb2033ffcddfa38457cba96477e15e91fbb4d1 (patch)
tree6c3ef55f71c504d08de1107bc66ffa25ae4f0885 /libavcodec/imgconvert.c
parent03ff61167ed27d5f82355c3943b245200191357b (diff)
downloadffmpeg-e7eb2033ffcddfa38457cba96477e15e91fbb4d1.tar.gz
Reimplement av_picture_data_copy() avoiding the use of PixFmtInfo
information. Required for moving the function to libavcore. Originally committed as revision 25066 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/imgconvert.c')
-rw-r--r--libavcodec/imgconvert.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index e9288b1cfb..4c4bdb9212 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -799,17 +799,26 @@ 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];
const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
- switch(pf->pixel_type) {
- case FF_PIXEL_PACKED:
- case FF_PIXEL_PLANAR:
- for(i = 0; i < pf->nb_channels; i++) {
- int h;
+ if (desc->flags & PIX_FMT_HWACCEL)
+ return;
+
+ if (desc->flags & PIX_FMT_PAL) {
+ av_image_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);
+ } else {
+ int i, planes_nb = 0;
+
+ for (i = 0; i < desc->nb_components; i++)
+ planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1);
+
+ for (i = 0; i < planes_nb; i++) {
+ int h = height;
int bwidth = av_image_get_linesize(pix_fmt, width, i);
- h = height;
if (i == 1 || i == 2) {
h= -((-height)>>desc->log2_chroma_h);
}
@@ -817,14 +826,6 @@ void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],
src_data[i], src_linesize[i],
bwidth, h);
}
- break;
- case FF_PIXEL_PALETTE:
- av_image_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);
- break;
}
}