[FFmpeg-cvslog] r25067 - in trunk: ffplay.c libavcodec/avcodec.h libavcodec/imgconvert.c libavcore/avcore.h libavcore/imgutils.c libavcore/imgutils.h libavfilter/avfilter.h libavfilter/vsrc_buffer.c

stefano subversion
Tue Sep 7 23:23:56 CEST 2010


Author: stefano
Date: Tue Sep  7 23:23:55 2010
New Revision: 25067

Log:
Move av_picture_data_copy() to libavcore, and rename it
av_image_copy().

Modified:
   trunk/ffplay.c
   trunk/libavcodec/avcodec.h
   trunk/libavcodec/imgconvert.c
   trunk/libavcore/avcore.h
   trunk/libavcore/imgutils.c
   trunk/libavcore/imgutils.h
   trunk/libavfilter/avfilter.h
   trunk/libavfilter/vsrc_buffer.c

Modified: trunk/ffplay.c
==============================================================================
--- trunk/ffplay.c	Tue Sep  7 23:23:52 2010	(r25066)
+++ trunk/ffplay.c	Tue Sep  7 23:23:55 2010	(r25067)
@@ -28,6 +28,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/colorspace.h"
 #include "libavutil/pixdesc.h"
+#include "libavcore/imgutils.h"
 #include "libavcore/parseutils.h"
 #include "libavformat/avformat.h"
 #include "libavdevice/avdevice.h"
@@ -1734,7 +1735,7 @@ static int input_request_frame(AVFilterL
         picref = avfilter_ref_buffer(priv->frame->opaque, ~0);
     } else {
         picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h);
-        av_picture_data_copy(picref->data, picref->linesize,
+        av_image_copy(picref->data, picref->linesize,
                              priv->frame->data, priv->frame->linesize,
                              picref->format, link->w, link->h);
     }

Modified: trunk/libavcodec/avcodec.h
==============================================================================
--- trunk/libavcodec/avcodec.h	Tue Sep  7 23:23:52 2010	(r25066)
+++ trunk/libavcodec/avcodec.h	Tue Sep  7 23:23:55 2010	(r25067)
@@ -32,7 +32,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR 52
 #define LIBAVCODEC_VERSION_MINOR 87
-#define LIBAVCODEC_VERSION_MICRO  3
+#define LIBAVCODEC_VERSION_MICRO  4
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
@@ -3950,15 +3950,15 @@ void *av_fast_realloc(void *ptr, unsigne
  */
 void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size);
 
+#if LIBAVCODEC_VERSION_MAJOR < 53
 /**
- * Copy image data in src_data to dst_data.
- *
- * @param dst_linesize linesizes for the image in dst_data
- * @param src_linesize linesizes for the image in src_data
+ * @deprecated Deprecated in favor of av_image_copy().
  */
+attribute_deprecated
 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);
+#endif
 
 /**
  * Copy image src to dst. Wraps av_picture_data_copy() above.

Modified: trunk/libavcodec/imgconvert.c
==============================================================================
--- trunk/libavcodec/imgconvert.c	Tue Sep  7 23:23:52 2010	(r25066)
+++ trunk/libavcodec/imgconvert.c	Tue Sep  7 23:23:55 2010	(r25067)
@@ -793,46 +793,20 @@ int ff_get_plane_bytewidth(enum PixelFor
 {
     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);
 }
 

Modified: trunk/libavcore/avcore.h
==============================================================================
--- trunk/libavcore/avcore.h	Tue Sep  7 23:23:52 2010	(r25066)
+++ trunk/libavcore/avcore.h	Tue Sep  7 23:23:55 2010	(r25067)
@@ -27,7 +27,7 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVCORE_VERSION_MAJOR  0
-#define LIBAVCORE_VERSION_MINOR  8
+#define LIBAVCORE_VERSION_MINOR  9
 #define LIBAVCORE_VERSION_MICRO  0
 
 #define LIBAVCORE_VERSION_INT   AV_VERSION_INT(LIBAVCORE_VERSION_MAJOR, \

Modified: trunk/libavcore/imgutils.c
==============================================================================
--- trunk/libavcore/imgutils.c	Tue Sep  7 23:23:52 2010	(r25066)
+++ trunk/libavcore/imgutils.c	Tue Sep  7 23:23:55 2010	(r25067)
@@ -152,6 +152,40 @@ void av_image_copy_plane(uint8_t       *
     }
 }
 
+void av_image_copy(uint8_t *dst_data[4], int dst_linesize[4],
+                   const uint8_t *src_data[4], const 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);
+        }
+    }
+}
+
 #if FF_API_OLD_IMAGE_NAMES
 void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
                                 const AVPixFmtDescriptor *pixdesc)

Modified: trunk/libavcore/imgutils.h
==============================================================================
--- trunk/libavcore/imgutils.h	Tue Sep  7 23:23:52 2010	(r25066)
+++ trunk/libavcore/imgutils.h	Tue Sep  7 23:23:55 2010	(r25067)
@@ -91,6 +91,16 @@ void av_image_copy_plane(uint8_t       *
                          int bytewidth, int height);
 
 /**
+ * Copy image in src_data to dst_data.
+ *
+ * @param dst_linesize linesizes for the image in dst_data
+ * @param src_linesize linesizes for the image in src_data
+ */
+void av_image_copy(uint8_t *dst_data[4], int dst_linesize[4],
+                   const uint8_t *src_data[4], const int src_linesize[4],
+                   enum PixelFormat pix_fmt, int width, 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.
  *

Modified: trunk/libavfilter/avfilter.h
==============================================================================
--- trunk/libavfilter/avfilter.h	Tue Sep  7 23:23:52 2010	(r25066)
+++ trunk/libavfilter/avfilter.h	Tue Sep  7 23:23:55 2010	(r25067)
@@ -26,7 +26,7 @@
 
 #define LIBAVFILTER_VERSION_MAJOR  1
 #define LIBAVFILTER_VERSION_MINOR 38
-#define LIBAVFILTER_VERSION_MICRO  2
+#define LIBAVFILTER_VERSION_MICRO  3
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
                                                LIBAVFILTER_VERSION_MINOR, \

Modified: trunk/libavfilter/vsrc_buffer.c
==============================================================================
--- trunk/libavfilter/vsrc_buffer.c	Tue Sep  7 23:23:52 2010	(r25066)
+++ trunk/libavfilter/vsrc_buffer.c	Tue Sep  7 23:23:55 2010	(r25067)
@@ -25,7 +25,7 @@
 
 #include "avfilter.h"
 #include "vsrc_buffer.h"
-#include "libavutil/pixdesc.h"
+#include "libavcore/imgutils.h"
 
 typedef struct {
     int64_t           pts;
@@ -119,7 +119,7 @@ static int request_frame(AVFilterLink *l
                                        AV_PERM_REUSE2,
                                        link->w, link->h);
 
-    av_picture_data_copy(picref->data, picref->linesize,
+    av_image_copy(picref->data, picref->linesize,
                          c->frame.data, c->frame.linesize,
                          picref->format, link->w, link->h);
 



More information about the ffmpeg-cvslog mailing list