Mercurial > libavcodec.hg
comparison imgconvert.c @ 12469:9471234fb8ea libavcodec
Move av_picture_data_copy() to libavcore, and rename it
av_image_copy().
author | stefano |
---|---|
date | Tue, 07 Sep 2010 21:23:55 +0000 |
parents | 443f38ceeaad |
children | 319673d2bd4b |
comparison
equal
deleted
inserted
replaced
12468:443f38ceeaad | 12469:9471234fb8ea |
---|---|
791 | 791 |
792 int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane) | 792 int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane) |
793 { | 793 { |
794 return av_image_get_linesize(pix_fmt, width, plane); | 794 return av_image_get_linesize(pix_fmt, width, plane); |
795 } | 795 } |
796 #endif | |
797 | 796 |
798 void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], | 797 void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], |
799 uint8_t *src_data[4], int src_linesize[4], | 798 uint8_t *src_data[4], int src_linesize[4], |
800 enum PixelFormat pix_fmt, int width, int height) | 799 enum PixelFormat pix_fmt, int width, int height) |
801 { | 800 { |
802 const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; | 801 av_image_copy(dst_data, dst_linesize, src_data, src_linesize, |
803 | 802 pix_fmt, width, height); |
804 if (desc->flags & PIX_FMT_HWACCEL) | 803 } |
805 return; | 804 #endif |
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; | |
821 int bwidth = av_image_get_linesize(pix_fmt, width, i); | |
822 if (i == 1 || i == 2) { | |
823 h= -((-height)>>desc->log2_chroma_h); | |
824 } | |
825 av_image_copy_plane(dst_data[i], dst_linesize[i], | |
826 src_data[i], src_linesize[i], | |
827 bwidth, h); | |
828 } | |
829 } | |
830 } | |
831 | 805 |
832 void av_picture_copy(AVPicture *dst, const AVPicture *src, | 806 void av_picture_copy(AVPicture *dst, const AVPicture *src, |
833 enum PixelFormat pix_fmt, int width, int height) | 807 enum PixelFormat pix_fmt, int width, int height) |
834 { | 808 { |
835 av_picture_data_copy(dst->data, dst->linesize, src->data, | 809 av_image_copy(dst->data, dst->linesize, src->data, |
836 src->linesize, pix_fmt, width, height); | 810 src->linesize, pix_fmt, width, height); |
837 } | 811 } |
838 | 812 |
839 /* 2x2 -> 1x1 */ | 813 /* 2x2 -> 1x1 */ |
840 void ff_shrink22(uint8_t *dst, int dst_wrap, | 814 void ff_shrink22(uint8_t *dst, int dst_wrap, |