diff 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
line wrap: on
line diff
--- a/imgconvert.c	Tue Sep 07 21:23:52 2010 +0000
+++ b/imgconvert.c	Tue Sep 07 21:23:55 2010 +0000
@@ -793,46 +793,20 @@
 {
     return av_image_get_linesize(pix_fmt, width, plane);
 }
-#endif
 
 void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],
                           uint8_t *src_data[4], int src_linesize[4],
                           enum PixelFormat pix_fmt, int width, int height)
 {
-    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
-
-    if (desc->flags & PIX_FMT_HWACCEL)
-        return;
-
-    if (desc->flags & PIX_FMT_PAL) {
-        av_image_copy_plane(dst_data[0], dst_linesize[0],
-                            src_data[0], src_linesize[0],
-                            width, height);
-        /* copy the palette */
-        memcpy(dst_data[1], src_data[1], 4*256);
-    } else {
-        int i, planes_nb = 0;
-
-        for (i = 0; i < desc->nb_components; i++)
-            planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1);
-
-        for (i = 0; i < planes_nb; i++) {
-            int h = height;
-            int bwidth = av_image_get_linesize(pix_fmt, width, i);
-            if (i == 1 || i == 2) {
-                h= -((-height)>>desc->log2_chroma_h);
-            }
-            av_image_copy_plane(dst_data[i], dst_linesize[i],
-                                src_data[i], src_linesize[i],
-                                bwidth, h);
-        }
-    }
+    av_image_copy(dst_data, dst_linesize, src_data, src_linesize,
+                  pix_fmt, width, height);
 }
+#endif
 
 void av_picture_copy(AVPicture *dst, const AVPicture *src,
                      enum PixelFormat pix_fmt, int width, int height)
 {
-    av_picture_data_copy(dst->data, dst->linesize, src->data,
+    av_image_copy(dst->data, dst->linesize, src->data,
                          src->linesize, pix_fmt, width, height);
 }