History

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

Stefano Sabatini committed 16 years ago

Commit e7eb2031 parent 03ff6111 file · +17 −16Browse files

Unified · Split

libavcodec/imgconvert.c+17−16
@@ -799,17 +799,26 @@ void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], · 798 unmodified lines
799 uint8_t *src_data[4], int src_linesize[4],799 uint8_t *src_data[4], int src_linesize[4],
800 enum PixelFormat pix_fmt, int width, int height)800 enum PixelFormat pix_fmt, int width, int height)
801{801{
802 int i;
803 const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
804 const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];802 const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
805 803
806 switch(pf->pixel_type) {804 if (desc->flags & PIX_FMT_HWACCEL)
807 case FF_PIXEL_PACKED:805 return;
808 case FF_PIXEL_PLANAR:806
809 for(i = 0; i < pf->nb_channels; i++) {807 if (desc->flags & PIX_FMT_PAL) {
810 int h;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 int bwidth = av_image_get_linesize(pix_fmt, width, i);821 int bwidth = av_image_get_linesize(pix_fmt, width, i);
812 h = height;
813 if (i == 1 || i == 2) {822 if (i == 1 || i == 2) {
814 h= -((-height)>>desc->log2_chroma_h);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 src_data[i], src_linesize[i],826 src_data[i], src_linesize[i],
818 bwidth, h);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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t