Mercurial > libavcodec.hg
comparison imgconvert.c @ 12384:e1ef713061ce libavcodec
Add av_picture_data_copy() and reimplement av_picture_copy() as a
wrapper of it.
The new function is more generic, and does not depend on the
definition of the AVPicture struct.
Patch by S.N. Hemanth Meenakshisundaram s + "meenakshisundaram".substr(0, 7) + "@ucsd.edu".
author | stefano |
---|---|
date | Wed, 11 Aug 2010 14:18:52 +0000 |
parents | 914f484bb476 |
children | b4b2f1006d9d |
comparison
equal
deleted
inserted
replaced
12383:6a59d8a22c57 | 12384:e1ef713061ce |
---|---|
843 } | 843 } |
844 | 844 |
845 return -1; | 845 return -1; |
846 } | 846 } |
847 | 847 |
848 void av_picture_copy(AVPicture *dst, const AVPicture *src, | 848 void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4], |
849 enum PixelFormat pix_fmt, int width, int height) | 849 uint8_t *src_data[4], int src_linesize[4], |
850 enum PixelFormat pix_fmt, int width, int height) | |
850 { | 851 { |
851 int i; | 852 int i; |
852 const PixFmtInfo *pf = &pix_fmt_info[pix_fmt]; | 853 const PixFmtInfo *pf = &pix_fmt_info[pix_fmt]; |
853 const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; | 854 const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; |
854 | 855 |
860 int bwidth = ff_get_plane_bytewidth(pix_fmt, width, i); | 861 int bwidth = ff_get_plane_bytewidth(pix_fmt, width, i); |
861 h = height; | 862 h = height; |
862 if (i == 1 || i == 2) { | 863 if (i == 1 || i == 2) { |
863 h= -((-height)>>desc->log2_chroma_h); | 864 h= -((-height)>>desc->log2_chroma_h); |
864 } | 865 } |
865 ff_img_copy_plane(dst->data[i], dst->linesize[i], | 866 ff_img_copy_plane(dst_data[i], dst_linesize[i], |
866 src->data[i], src->linesize[i], | 867 src_data[i], src_linesize[i], |
867 bwidth, h); | 868 bwidth, h); |
868 } | 869 } |
869 break; | 870 break; |
870 case FF_PIXEL_PALETTE: | 871 case FF_PIXEL_PALETTE: |
871 ff_img_copy_plane(dst->data[0], dst->linesize[0], | 872 ff_img_copy_plane(dst_data[0], dst_linesize[0], |
872 src->data[0], src->linesize[0], | 873 src_data[0], src_linesize[0], |
873 width, height); | 874 width, height); |
874 /* copy the palette */ | 875 /* copy the palette */ |
875 memcpy(dst->data[1], src->data[1], 4*256); | 876 memcpy(dst_data[1], src_data[1], 4*256); |
876 break; | 877 break; |
877 } | 878 } |
879 } | |
880 | |
881 void av_picture_copy(AVPicture *dst, const AVPicture *src, | |
882 enum PixelFormat pix_fmt, int width, int height) | |
883 { | |
884 av_picture_data_copy(dst->data, dst->linesize, src->data, | |
885 src->linesize, pix_fmt, width, height); | |
878 } | 886 } |
879 | 887 |
880 /* 2x2 -> 1x1 */ | 888 /* 2x2 -> 1x1 */ |
881 void ff_shrink22(uint8_t *dst, int dst_wrap, | 889 void ff_shrink22(uint8_t *dst, int dst_wrap, |
882 const uint8_t *src, int src_wrap, | 890 const uint8_t *src, int src_wrap, |