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
799799 uint8_t *src_data[4], int src_linesize[4],
800800 enum PixelFormat pix_fmt, int width, int height)
801801 {
802− int i;
803− const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
804802 const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
805803
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;
811821 int bwidth = av_image_get_linesize(pix_fmt, width, i);
812− h = height;
813822 if (i == 1 || i == 2) {
814823 h= -((-height)>>desc->log2_chroma_h);
815824 }
@@ -817,14 +826,6 @@ void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], · 1 unmodified line
817826 src_data[i], src_linesize[i],
818827 bwidth, h);
819828 }
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;
828829 }
829830 }
830831

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