]> git.sesse.net Git - ffmpeg/commitdiff
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
authorStefano Sabatini <stefano.sabatini-lala@poste.it>
Tue, 7 Sep 2010 21:23:45 +0000 (21:23 +0000)
committerStefano Sabatini <stefano.sabatini-lala@poste.it>
Tue, 7 Sep 2010 21:23:45 +0000 (21:23 +0000)
and deprecate the old function.

Originally committed as revision 25064 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/avcodec.h
libavcodec/dsputil.c
libavcodec/dsputil.h
libavcodec/imgconvert.c
libavcore/avcore.h
libavcore/imgutils.c
libavcore/imgutils.h

index 879eb7f136bf4998d3fcf489b677a423d03d1753..102663151327ff7ca54d29923673f4e09390e467 100644 (file)
@@ -32,7 +32,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR 52
 #define LIBAVCODEC_VERSION_MINOR 87
-#define LIBAVCODEC_VERSION_MICRO  2
+#define LIBAVCODEC_VERSION_MICRO  3
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
index 2b6cd162c5736c83ae5f0473ad52057c1666a7b1..29ddb4d6ce3f011f79396909280633a79e88f67a 100644 (file)
@@ -27,6 +27,7 @@
  * DSP utils
  */
 
+#include "libavcore/imgutils.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "simple_idct.h"
@@ -4454,7 +4455,7 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
     c->sv_fmul_scalar[0] = sv_fmul_scalar_2_c;
     c->sv_fmul_scalar[1] = sv_fmul_scalar_4_c;
 
-    c->shrink[0]= ff_img_copy_plane;
+    c->shrink[0]= av_image_copy_plane;
     c->shrink[1]= ff_shrink22;
     c->shrink[2]= ff_shrink44;
     c->shrink[3]= ff_shrink88;
index 3b5ca122fed86aec32c40ac967c0870669c087f1..d88efaf3c64f16068422955e7d13cef9fe0ad6cc 100644 (file)
@@ -105,7 +105,14 @@ void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
 void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
 
 /* 1/2^n downscaling functions from imgconvert.c */
+#if LIBAVCODEC_VERSION_MAJOR < 53
+/**
+ * @deprecated Use av_image_copy_plane() instead.
+ */
+attribute_deprecated
 void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
+#endif
+
 void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
 void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
 void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
index ee4a4d284dc2b9e7cf052096d758486c4c55c854..f8095b94feba68cf19daabeba11b3bcd8d5bb6d9 100644 (file)
@@ -781,20 +781,14 @@ enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelForma
     return dst_pix_fmt;
 }
 
+#if LIBAVCODEC_VERSION_MAJOR < 53
 void ff_img_copy_plane(uint8_t *dst, int dst_wrap,
                            const uint8_t *src, int src_wrap,
                            int width, int height)
 {
-    if (!dst || !src)
-        return;
-    for(;height > 0; height--) {
-        memcpy(dst, src, width);
-        dst += dst_wrap;
-        src += src_wrap;
-    }
+    av_image_copy_plane(dst, dst_wrap, src, src_wrap, width, height);
 }
 
-#if LIBAVCODEC_VERSION_MAJOR < 53
 int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane)
 {
     return av_image_get_linesize(pix_fmt, width, plane);
@@ -819,13 +813,13 @@ void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],
             if (i == 1 || i == 2) {
                 h= -((-height)>>desc->log2_chroma_h);
             }
-            ff_img_copy_plane(dst_data[i], dst_linesize[i],
+            av_image_copy_plane(dst_data[i], dst_linesize[i],
                               src_data[i], src_linesize[i],
                               bwidth, h);
         }
         break;
     case FF_PIXEL_PALETTE:
-        ff_img_copy_plane(dst_data[0], dst_linesize[0],
+        av_image_copy_plane(dst_data[0], dst_linesize[0],
                           src_data[0], src_linesize[0],
                           width, height);
         /* copy the palette */
index d11ae3866ef1ad672f999cede562e4526211face..57ac487b9937a174e338262e59a67a5b73c0303c 100644 (file)
@@ -27,7 +27,7 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVCORE_VERSION_MAJOR  0
-#define LIBAVCORE_VERSION_MINOR  7
+#define LIBAVCORE_VERSION_MINOR  8
 #define LIBAVCORE_VERSION_MICRO  0
 
 #define LIBAVCORE_VERSION_INT   AV_VERSION_INT(LIBAVCORE_VERSION_MAJOR, \
index b75413eb6728de59182d8df04966b4eb63a5fbca..c89121200998c06107562d2b6936ffc66cbed4d8 100644 (file)
@@ -139,6 +139,19 @@ int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *lo
     return AVERROR(EINVAL);
 }
 
+void av_image_copy_plane(uint8_t       *dst, int dst_linesize,
+                         const uint8_t *src, int src_linesize,
+                         int bytewidth, int height)
+{
+    if (!dst || !src)
+        return;
+    for (;height > 0; height--) {
+        memcpy(dst, src, bytewidth);
+        dst += dst_linesize;
+        src += src_linesize;
+    }
+}
+
 #if FF_API_OLD_IMAGE_NAMES
 void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
                                 const AVPixFmtDescriptor *pixdesc)
index 291c87241950a48d24659eeffbcb391acb86785a..879281d0c90d5c6cad3b9dc0829de915f9e2b7e4 100644 (file)
@@ -77,6 +77,19 @@ int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int widt
 int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
                            uint8_t *ptr, const int linesizes[4]);
 
+/**
+ * Copy image plane from src to dst.
+ * That is, copy "height" number of lines of "bytewidth" bytes each.
+ * The first byte of each successive line is separated by *_linesize
+ * bytes.
+ *
+ * @param dst_linesize linesize for the image plane in dst
+ * @param src_linesize linesize for the image plane in src
+ */
+void av_image_copy_plane(uint8_t       *dst, int dst_linesize,
+                         const uint8_t *src, int src_linesize,
+                         int bytewidth, int height);
+
 /**
  * Check if the given dimension of an image is valid, meaning that all
  * bytes of the image can be addressed with a signed int.