[FFmpeg-devel] [PATCH] Use hierarchical names for the imgutils.h API.
Stefano Sabatini
stefano.sabatini-lala
Tue Sep 7 00:06:24 CEST 2010
---
libavcore/avcore.h | 4 ++++
libavcore/imgutils.c | 43 ++++++++++++++++++++++++++++++++++++-------
libavcore/imgutils.h | 27 +++++++++++++++++++++++----
3 files changed, 63 insertions(+), 11 deletions(-)
diff --git a/libavcore/avcore.h b/libavcore/avcore.h
index 98c8651..278497a 100644
--- a/libavcore/avcore.h
+++ b/libavcore/avcore.h
@@ -55,4 +55,8 @@ const char *avcore_configuration(void);
*/
const char *avcore_license(void);
+#ifndef FF_API_OLD_IMAGE_NAMES
+#define FF_API_OLD_IMAGE_NAMES (LIBAVCORE_VERSION_MAJOR < 1)
+#endif
+
#endif /* AVCORE_AVCORE_H */
diff --git a/libavcore/imgutils.c b/libavcore/imgutils.c
index 2131f0a..b75413e 100644
--- a/libavcore/imgutils.c
+++ b/libavcore/imgutils.c
@@ -24,7 +24,7 @@
#include "imgutils.h"
#include "libavutil/pixdesc.h"
-void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
+void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
const AVPixFmtDescriptor *pixdesc)
{
int i;
@@ -42,7 +42,7 @@ void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
}
}
-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)
{
const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
int max_step [4]; /* max pixel step for each plane */
@@ -52,12 +52,12 @@ int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane)
if (desc->flags & PIX_FMT_BITSTREAM)
return (width * (desc->comp[0].step_minus1+1) + 7) >> 3;
- av_fill_image_max_pixsteps(max_step, max_step_comp, desc);
+ av_image_fill_max_pixsteps(max_step, max_step_comp, desc);
s = (max_step_comp[plane] == 1 || max_step_comp[plane] == 2) ? desc->log2_chroma_w : 0;
return max_step[plane] * (((width + (1 << s) - 1)) >> s);
}
-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)
{
int i;
const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
@@ -74,7 +74,7 @@ int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int widt
return 0;
}
- av_fill_image_max_pixsteps(max_step, max_step_comp, desc);
+ av_image_fill_max_pixsteps(max_step, max_step_comp, desc);
for (i = 0; i < 4; i++) {
int s = (max_step_comp[i] == 1 || max_step_comp[i] == 2) ? desc->log2_chroma_w : 0;
linesizes[i] = max_step[i] * (((width + (1 << s) - 1)) >> s);
@@ -83,7 +83,7 @@ int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int widt
return 0;
}
-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])
{
int i, total_size, size[4], has_plane[4];
@@ -128,7 +128,7 @@ typedef struct ImgUtils {
static const AVClass imgutils_class = { "IMGUTILS", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(ImgUtils, log_offset), offsetof(ImgUtils, log_ctx) };
-int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
+int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
{
ImgUtils imgutils = { &imgutils_class, log_offset, log_ctx };
@@ -138,3 +138,32 @@ int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *lo
av_log(&imgutils, AV_LOG_ERROR, "Picture size %ux%u is invalid\n", w, h);
return AVERROR(EINVAL);
}
+
+#if FF_API_OLD_IMAGE_NAMES
+void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
+ const AVPixFmtDescriptor *pixdesc)
+{
+ av_image_fill_max_pixsteps(max_pixsteps, max_pixstep_comps, pixdesc);
+}
+
+int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane)
+{
+ return av_image_get_linesize(pix_fmt, width, plane);
+}
+
+int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width)
+{
+ return av_image_fill_linesizes(linesizes, pix_fmt, width);
+}
+
+int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
+ uint8_t *ptr, const int linesizes[4])
+{
+ return av_image_fill_pointers(data, pix_fmt, height, ptr, linesizes);
+}
+
+int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
+{
+ return av_image_check_size(w, h, log_offset, log_ctx);
+}
+#endif
diff --git a/libavcore/imgutils.h b/libavcore/imgutils.h
index f42ffb5..291c872 100644
--- a/libavcore/imgutils.h
+++ b/libavcore/imgutils.h
@@ -43,7 +43,7 @@
* @param max_pixstep_comps an array which is filled with the component
* for each plane which has the max pixel step. May be NULL.
*/
-void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
+void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
const AVPixFmtDescriptor *pixdesc);
/**
@@ -52,7 +52,7 @@ void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
*
* @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
@@ -61,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
@@ -74,7 +74,7 @@ int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int widt
* @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]);
/**
@@ -87,6 +87,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 */
--
1.7.1
More information about the ffmpeg-devel
mailing list