Required for moving the function to libavcore. Originally committed as revision 25066 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -799,17 +799,26 @@ void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], · 798 unmodified lines | ||
| 799 | 799 | uint8_t *src_data[4], int src_linesize[4], |
| 800 | 800 | enum PixelFormat pix_fmt, int width, int height) |
| 801 | 801 | { |
| 802 | − int i; | |
| 803 | − const PixFmtInfo *pf = &pix_fmt_info[pix_fmt]; | |
| 804 | 802 | const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; |
| 805 | 803 | |
| 806 | − switch(pf->pixel_type) { | |
| 807 | − case FF_PIXEL_PACKED: | |
| 808 | − case FF_PIXEL_PLANAR: | |
| 809 | − for(i = 0; i < pf->nb_channels; i++) { | |
| 810 | − int h; | |
| 804 | + if (desc->flags & PIX_FMT_HWACCEL) | |
| 805 | + return; | |
| 806 | + | |
| 807 | + if (desc->flags & PIX_FMT_PAL) { | |
| 808 | + av_image_copy_plane(dst_data[0], dst_linesize[0], | |
| 809 | + src_data[0], src_linesize[0], | |
| 810 | + width, height); | |
| 811 | + /* copy the palette */ | |
| 812 | + memcpy(dst_data[1], src_data[1], 4*256); | |
| 813 | + } else { | |
| 814 | + int i, planes_nb = 0; | |
| 815 | + | |
| 816 | + for (i = 0; i < desc->nb_components; i++) | |
| 817 | + planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1); | |
| 818 | + | |
| 819 | + for (i = 0; i < planes_nb; i++) { | |
| 820 | + int h = height; | |
| 811 | 821 | int bwidth = av_image_get_linesize(pix_fmt, width, i); |
| 812 | − h = height; | |
| 813 | 822 | if (i == 1 || i == 2) { |
| 814 | 823 | h= -((-height)>>desc->log2_chroma_h); |
| 815 | 824 | } |
| @@ -817,14 +826,6 @@ void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], · 1 unmodified line | ||
| 817 | 826 | src_data[i], src_linesize[i], |
| 818 | 827 | bwidth, h); |
| 819 | 828 | } |
| 820 | − break; | |
| 821 | − case FF_PIXEL_PALETTE: | |
| 822 | − av_image_copy_plane(dst_data[0], dst_linesize[0], | |
| 823 | − src_data[0], src_linesize[0], | |
| 824 | − width, height); | |
| 825 | − /* copy the palette */ | |
| 826 | − memcpy(dst_data[1], src_data[1], 4*256); | |
| 827 | − break; | |
| 828 | 829 | } |
| 829 | 830 | } |
| 830 | 831 | |