]> git.sesse.net Git - ffmpeg/blobdiff - libavcore/imgutils.h
av_fill_image_linesizes -> av_image_fill_linesizes
[ffmpeg] / libavcore / imgutils.h
index cca0085d3a62ad854dbb64791d35063228d21931..8458fc6bb0b932734d5bbef39004363a49944443 100644 (file)
  * byte of the successive group in the same plane for the same
  * component.
  *
- * @param max_pixstep an array which is filled with the max pixel step
+ * @param max_pixsteps an array which is filled with the max pixel step
  * for each plane. Since a plane may contain different pixel
- * components, the computed max_pixstep[plane] is relative to the
+ * components, the computed max_pixsteps[plane] is relative to the
  * component in the plane with the max pixel step.
- * @param max_pixstep_comp an array which is filled with the component
+ * @param max_pixstep_comps an array which is filled with the component
  * for each plane which has the max pixel step. May be NULL.
  */
-static inline void av_fill_image_max_pixstep(int max_pixstep[4], int max_pixstep_comp[4],
-                                             const AVPixFmtDescriptor *pixdesc)
-{
-    int i;
-    memset(max_pixstep, 0, 4*sizeof(max_pixstep[0]));
-    if (max_pixstep_comp)
-        memset(max_pixstep_comp, 0, 4*sizeof(max_pixstep_comp[0]));
-
-    for (i = 0; i < 4; i++) {
-        const AVComponentDescriptor *comp = &(pixdesc->comp[i]);
-        if ((comp->step_minus1+1) > max_pixstep[comp->plane]) {
-            max_pixstep[comp->plane] = comp->step_minus1+1;
-            if (max_pixstep_comp)
-                max_pixstep_comp[comp->plane] = i;
-        }
-    }
-}
+void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
+                                const AVPixFmtDescriptor *pixdesc);
 
 /**
  * Compute the size of an image line with format pix_fmt and width
@@ -67,7 +52,7 @@ static inline void av_fill_image_max_pixstep(int max_pixstep[4], int max_pixstep
  *
  * @return the computed size in bytes
  */
-int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane);
+int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane);
 
 /**
  * Fill plane linesizes for an image with pixel format pix_fmt and
@@ -76,7 +61,7 @@ int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane);
  * @param linesizes array to be filled with the linesize for each plane
  * @return >= 0 in case of success, a negative error code otherwise
  */
-int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
+int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
 
 /**
  * Fill plane data pointers for an image with pixel format pix_fmt and
@@ -85,13 +70,36 @@ int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int widt
  * @param data pointers array to be filled with the pointer for each image plane
  * @param ptr the pointer to a buffer which will contain the image
  * @param linesizes[4] the array containing the linesize for each
- * plane, should be filled by av_fill_image_linesizes()
+ * plane, should be filled by av_image_fill_linesizes()
  * @return the size in bytes required for the image buffer, a negative
  * error code in case of failure
  */
-int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
+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);
+
+/**
+ * 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_linesizes[4],
+                   const uint8_t *src_data[4], const int src_linesizes[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.
@@ -102,6 +110,25 @@ int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int heigh
  * @param log_ctx the parent logging context, it may be NULL
  * @return >= 0 if valid, a negative error code otherwise
  */
+int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
+
+#if FF_API_OLD_IMAGE_NAMES
+attribute_deprecated
+void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
+                                const AVPixFmtDescriptor *pixdesc);
+
+attribute_deprecated
+int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane);
+
+attribute_deprecated
+int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
+
+attribute_deprecated
+int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
+                           uint8_t *ptr, const int linesizes[4]);
+
+attribute_deprecated
 int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
+#endif
 
 #endif /* AVCORE_IMGUTILS_H */