Revision 9b7269e3 libavcore/imgutils.c
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 |
Also available in: Unified diff