Mercurial > libavcodec.hg
comparison imgconvert.c @ 12466:0a306a267dbf libavcodec
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
and deprecate the old function.
author | stefano |
---|---|
date | Tue, 07 Sep 2010 21:23:45 +0000 |
parents | ffb3668ff7af |
children | 94275c8cd57d |
comparison
equal
deleted
inserted
replaced
12465:1921e24d5886 | 12466:0a306a267dbf |
---|---|
779 if (loss_ptr) | 779 if (loss_ptr) |
780 *loss_ptr = avcodec_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha); | 780 *loss_ptr = avcodec_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha); |
781 return dst_pix_fmt; | 781 return dst_pix_fmt; |
782 } | 782 } |
783 | 783 |
784 #if LIBAVCODEC_VERSION_MAJOR < 53 | |
784 void ff_img_copy_plane(uint8_t *dst, int dst_wrap, | 785 void ff_img_copy_plane(uint8_t *dst, int dst_wrap, |
785 const uint8_t *src, int src_wrap, | 786 const uint8_t *src, int src_wrap, |
786 int width, int height) | 787 int width, int height) |
787 { | 788 { |
788 if (!dst || !src) | 789 av_image_copy_plane(dst, dst_wrap, src, src_wrap, width, height); |
789 return; | 790 } |
790 for(;height > 0; height--) { | 791 |
791 memcpy(dst, src, width); | |
792 dst += dst_wrap; | |
793 src += src_wrap; | |
794 } | |
795 } | |
796 | |
797 #if LIBAVCODEC_VERSION_MAJOR < 53 | |
798 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) |
799 { | 793 { |
800 return av_image_get_linesize(pix_fmt, width, plane); | 794 return av_image_get_linesize(pix_fmt, width, plane); |
801 } | 795 } |
802 #endif | 796 #endif |
817 int bwidth = av_image_get_linesize(pix_fmt, width, i); | 811 int bwidth = av_image_get_linesize(pix_fmt, width, i); |
818 h = height; | 812 h = height; |
819 if (i == 1 || i == 2) { | 813 if (i == 1 || i == 2) { |
820 h= -((-height)>>desc->log2_chroma_h); | 814 h= -((-height)>>desc->log2_chroma_h); |
821 } | 815 } |
822 ff_img_copy_plane(dst_data[i], dst_linesize[i], | 816 av_image_copy_plane(dst_data[i], dst_linesize[i], |
823 src_data[i], src_linesize[i], | 817 src_data[i], src_linesize[i], |
824 bwidth, h); | 818 bwidth, h); |
825 } | 819 } |
826 break; | 820 break; |
827 case FF_PIXEL_PALETTE: | 821 case FF_PIXEL_PALETTE: |
828 ff_img_copy_plane(dst_data[0], dst_linesize[0], | 822 av_image_copy_plane(dst_data[0], dst_linesize[0], |
829 src_data[0], src_linesize[0], | 823 src_data[0], src_linesize[0], |
830 width, height); | 824 width, height); |
831 /* copy the palette */ | 825 /* copy the palette */ |
832 memcpy(dst_data[1], src_data[1], 4*256); | 826 memcpy(dst_data[1], src_data[1], 4*256); |
833 break; | 827 break; |