Revision 9b7269e3
libavcore/avcore.h | ||
---|---|---|
27 | 27 |
#include "libavutil/avutil.h" |
28 | 28 |
|
29 | 29 |
#define LIBAVCORE_VERSION_MAJOR 0 |
30 |
#define LIBAVCORE_VERSION_MINOR 6
|
|
30 |
#define LIBAVCORE_VERSION_MINOR 7
|
|
31 | 31 |
#define LIBAVCORE_VERSION_MICRO 0 |
32 | 32 |
|
33 | 33 |
#define LIBAVCORE_VERSION_INT AV_VERSION_INT(LIBAVCORE_VERSION_MAJOR, \ |
... | ... | |
55 | 55 |
*/ |
56 | 56 |
const char *avcore_license(void); |
57 | 57 |
|
58 |
/** |
|
59 |
* Those FF_API_* defines are not part of public API. |
|
60 |
* They may change, break or disappear at any time. |
|
61 |
*/ |
|
62 |
#ifndef FF_API_OLD_IMAGE_NAMES |
|
63 |
#define FF_API_OLD_IMAGE_NAMES (LIBAVCORE_VERSION_MAJOR < 1) |
|
64 |
#endif |
|
65 |
|
|
58 | 66 |
#endif /* AVCORE_AVCORE_H */ |
libavcore/imgutils.c | ||
---|---|---|
24 | 24 |
#include "imgutils.h" |
25 | 25 |
#include "libavutil/pixdesc.h" |
26 | 26 |
|
27 |
void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
|
|
27 |
void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
|
|
28 | 28 |
const AVPixFmtDescriptor *pixdesc) |
29 | 29 |
{ |
30 | 30 |
int i; |
... | ... | |
42 | 42 |
} |
43 | 43 |
} |
44 | 44 |
|
45 |
int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane)
|
|
45 |
int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane)
|
|
46 | 46 |
{ |
47 | 47 |
const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; |
48 | 48 |
int max_step [4]; /* max pixel step for each plane */ |
... | ... | |
52 | 52 |
if (desc->flags & PIX_FMT_BITSTREAM) |
53 | 53 |
return (width * (desc->comp[0].step_minus1+1) + 7) >> 3; |
54 | 54 |
|
55 |
av_fill_image_max_pixsteps(max_step, max_step_comp, desc);
|
|
55 |
av_image_fill_max_pixsteps(max_step, max_step_comp, desc);
|
|
56 | 56 |
s = (max_step_comp[plane] == 1 || max_step_comp[plane] == 2) ? desc->log2_chroma_w : 0; |
57 | 57 |
return max_step[plane] * (((width + (1 << s) - 1)) >> s); |
58 | 58 |
} |
59 | 59 |
|
60 |
int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width)
|
|
60 |
int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width)
|
|
61 | 61 |
{ |
62 | 62 |
int i; |
63 | 63 |
const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; |
... | ... | |
74 | 74 |
return 0; |
75 | 75 |
} |
76 | 76 |
|
77 |
av_fill_image_max_pixsteps(max_step, max_step_comp, desc);
|
|
77 |
av_image_fill_max_pixsteps(max_step, max_step_comp, desc);
|
|
78 | 78 |
for (i = 0; i < 4; i++) { |
79 | 79 |
int s = (max_step_comp[i] == 1 || max_step_comp[i] == 2) ? desc->log2_chroma_w : 0; |
80 | 80 |
linesizes[i] = max_step[i] * (((width + (1 << s) - 1)) >> s); |
... | ... | |
83 | 83 |
return 0; |
84 | 84 |
} |
85 | 85 |
|
86 |
int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
|
|
86 |
int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
|
|
87 | 87 |
uint8_t *ptr, const int linesizes[4]) |
88 | 88 |
{ |
89 | 89 |
int i, total_size, size[4], has_plane[4]; |
... | ... | |
128 | 128 |
|
129 | 129 |
static const AVClass imgutils_class = { "IMGUTILS", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(ImgUtils, log_offset), offsetof(ImgUtils, log_ctx) }; |
130 | 130 |
|
131 |
int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
|
|
131 |
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
|
|
132 | 132 |
{ |
133 | 133 |
ImgUtils imgutils = { &imgutils_class, log_offset, log_ctx }; |
134 | 134 |
|
... | ... | |
138 | 138 |
av_log(&imgutils, AV_LOG_ERROR, "Picture size %ux%u is invalid\n", w, h); |
139 | 139 |
return AVERROR(EINVAL); |
140 | 140 |
} |
141 |
|
|
142 |
#if FF_API_OLD_IMAGE_NAMES |
|
143 |
void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], |
|
144 |
const AVPixFmtDescriptor *pixdesc) |
|
145 |
{ |
|
146 |
av_image_fill_max_pixsteps(max_pixsteps, max_pixstep_comps, pixdesc); |
|
147 |
} |
|
148 |
|
|
149 |
int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane) |
|
150 |
{ |
|
151 |
return av_image_get_linesize(pix_fmt, width, plane); |
|
152 |
} |
|
153 |
|
|
154 |
int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width) |
|
155 |
{ |
|
156 |
return av_image_fill_linesizes(linesizes, pix_fmt, width); |
|
157 |
} |
|
158 |
|
|
159 |
int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, |
|
160 |
uint8_t *ptr, const int linesizes[4]) |
|
161 |
{ |
|
162 |
return av_image_fill_pointers(data, pix_fmt, height, ptr, linesizes); |
|
163 |
} |
|
164 |
|
|
165 |
int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx) |
|
166 |
{ |
|
167 |
return av_image_check_size(w, h, log_offset, log_ctx); |
|
168 |
} |
|
169 |
#endif |
libavcore/imgutils.h | ||
---|---|---|
43 | 43 |
* @param max_pixstep_comps an array which is filled with the component |
44 | 44 |
* for each plane which has the max pixel step. May be NULL. |
45 | 45 |
*/ |
46 |
void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
|
|
46 |
void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
|
|
47 | 47 |
const AVPixFmtDescriptor *pixdesc); |
48 | 48 |
|
49 | 49 |
/** |
... | ... | |
52 | 52 |
* |
53 | 53 |
* @return the computed size in bytes |
54 | 54 |
*/ |
55 |
int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane);
|
|
55 |
int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane);
|
|
56 | 56 |
|
57 | 57 |
/** |
58 | 58 |
* Fill plane linesizes for an image with pixel format pix_fmt and |
... | ... | |
61 | 61 |
* @param linesizes array to be filled with the linesize for each plane |
62 | 62 |
* @return >= 0 in case of success, a negative error code otherwise |
63 | 63 |
*/ |
64 |
int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
|
|
64 |
int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
|
|
65 | 65 |
|
66 | 66 |
/** |
67 | 67 |
* Fill plane data pointers for an image with pixel format pix_fmt and |
... | ... | |
74 | 74 |
* @return the size in bytes required for the image buffer, a negative |
75 | 75 |
* error code in case of failure |
76 | 76 |
*/ |
77 |
int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
|
|
77 |
int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
|
|
78 | 78 |
uint8_t *ptr, const int linesizes[4]); |
79 | 79 |
|
80 | 80 |
/** |
... | ... | |
87 | 87 |
* @param log_ctx the parent logging context, it may be NULL |
88 | 88 |
* @return >= 0 if valid, a negative error code otherwise |
89 | 89 |
*/ |
90 |
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); |
|
91 |
|
|
92 |
#if FF_API_OLD_IMAGE_NAMES |
|
93 |
attribute_deprecated |
|
94 |
void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], |
|
95 |
const AVPixFmtDescriptor *pixdesc); |
|
96 |
|
|
97 |
attribute_deprecated |
|
98 |
int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane); |
|
99 |
|
|
100 |
attribute_deprecated |
|
101 |
int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width); |
|
102 |
|
|
103 |
attribute_deprecated |
|
104 |
int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, |
|
105 |
uint8_t *ptr, const int linesizes[4]); |
|
106 |
|
|
107 |
attribute_deprecated |
|
90 | 108 |
int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); |
109 |
#endif |
|
91 | 110 |
|
92 | 111 |
#endif /* AVCORE_IMGUTILS_H */ |
Also available in: Unified diff