Revision 34017fd9 libavcodec/imgconvert.c

View differences:

libavcodec/imgconvert.c
793 793
{
794 794
    return av_image_get_linesize(pix_fmt, width, plane);
795 795
}
796
#endif
797 796

  
798 797
void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],
799 798
                          uint8_t *src_data[4], int src_linesize[4],
800 799
                          enum PixelFormat pix_fmt, int width, int height)
801 800
{
802
    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
803

  
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;
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
    }
801
    av_image_copy(dst_data, dst_linesize, src_data, src_linesize,
802
                  pix_fmt, width, height);
830 803
}
804
#endif
831 805

  
832 806
void av_picture_copy(AVPicture *dst, const AVPicture *src,
833 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 810
                         src->linesize, pix_fmt, width, height);
837 811
}
838 812

  

Also available in: Unified diff