Mercurial > libavcore.hg
annotate imgutils.h @ 23:478992775cf8 libavcore
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
and deprecate the old function.
author | stefano |
---|---|
date | Tue, 07 Sep 2010 21:23:45 +0000 |
parents | 0899fc09d43c |
children | c063c88b1309 |
rev | line source |
---|---|
8
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
1 /* |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
2 * This file is part of FFmpeg. |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
3 * |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
4 * FFmpeg is free software; you can redistribute it and/or |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
5 * modify it under the terms of the GNU Lesser General Public |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
6 * License as published by the Free Software Foundation; either |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
7 * version 2.1 of the License, or (at your option) any later version. |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
8 * |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
9 * FFmpeg is distributed in the hope that it will be useful, |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
12 * Lesser General Public License for more details. |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
13 * |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
14 * You should have received a copy of the GNU Lesser General Public |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
15 * License along with FFmpeg; if not, write to the Free Software |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
17 */ |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
18 |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
19 #ifndef AVCORE_IMGUTILS_H |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
20 #define AVCORE_IMGUTILS_H |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
21 |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
22 /** |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
23 * @file |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
24 * misc image utilities |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
25 */ |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
26 |
16
1a1faa090ff1
Implement inline function av_fill_image_max_pixstep() and use it for
stefano
parents:
15
diff
changeset
|
27 #include "libavutil/pixdesc.h" |
8
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
28 #include "avcore.h" |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
29 |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
30 /** |
16
1a1faa090ff1
Implement inline function av_fill_image_max_pixstep() and use it for
stefano
parents:
15
diff
changeset
|
31 * Compute the max pixel step for each plane of an image with a |
17
046c1e516605
Add missing period in av_fill_image_max_pixstep() doxy.
stefano
parents:
16
diff
changeset
|
32 * format described by pixdesc. |
16
1a1faa090ff1
Implement inline function av_fill_image_max_pixstep() and use it for
stefano
parents:
15
diff
changeset
|
33 * |
1a1faa090ff1
Implement inline function av_fill_image_max_pixstep() and use it for
stefano
parents:
15
diff
changeset
|
34 * The pixel step is the distance in bytes between the first byte of |
1a1faa090ff1
Implement inline function av_fill_image_max_pixstep() and use it for
stefano
parents:
15
diff
changeset
|
35 * the group of bytes which describe a pixel component and the first |
1a1faa090ff1
Implement inline function av_fill_image_max_pixstep() and use it for
stefano
parents:
15
diff
changeset
|
36 * byte of the successive group in the same plane for the same |
1a1faa090ff1
Implement inline function av_fill_image_max_pixstep() and use it for
stefano
parents:
15
diff
changeset
|
37 * component. |
1a1faa090ff1
Implement inline function av_fill_image_max_pixstep() and use it for
stefano
parents:
15
diff
changeset
|
38 * |
18
ebe3b7ce4cca
Rename av_fill_image_max_pixstep() to av_fill_image_max_pixsteps().
stefano
parents:
17
diff
changeset
|
39 * @param max_pixsteps an array which is filled with the max pixel step |
16
1a1faa090ff1
Implement inline function av_fill_image_max_pixstep() and use it for
stefano
parents:
15
diff
changeset
|
40 * for each plane. Since a plane may contain different pixel |
18
ebe3b7ce4cca
Rename av_fill_image_max_pixstep() to av_fill_image_max_pixsteps().
stefano
parents:
17
diff
changeset
|
41 * components, the computed max_pixsteps[plane] is relative to the |
16
1a1faa090ff1
Implement inline function av_fill_image_max_pixstep() and use it for
stefano
parents:
15
diff
changeset
|
42 * component in the plane with the max pixel step. |
18
ebe3b7ce4cca
Rename av_fill_image_max_pixstep() to av_fill_image_max_pixsteps().
stefano
parents:
17
diff
changeset
|
43 * @param max_pixstep_comps an array which is filled with the component |
16
1a1faa090ff1
Implement inline function av_fill_image_max_pixstep() and use it for
stefano
parents:
15
diff
changeset
|
44 * for each plane which has the max pixel step. May be NULL. |
1a1faa090ff1
Implement inline function av_fill_image_max_pixstep() and use it for
stefano
parents:
15
diff
changeset
|
45 */ |
22
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
46 void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], |
21
3b8eec1cfdaa
Make av_fill_image_max_pixsteps() non static non inline.
stefano
parents:
18
diff
changeset
|
47 const AVPixFmtDescriptor *pixdesc); |
16
1a1faa090ff1
Implement inline function av_fill_image_max_pixstep() and use it for
stefano
parents:
15
diff
changeset
|
48 |
1a1faa090ff1
Implement inline function av_fill_image_max_pixstep() and use it for
stefano
parents:
15
diff
changeset
|
49 /** |
15 | 50 * Compute the size of an image line with format pix_fmt and width |
51 * width for the plane plane. | |
52 * | |
53 * @return the computed size in bytes | |
54 */ | |
22
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
55 int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane); |
15 | 56 |
57 /** | |
8
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
58 * Fill plane linesizes for an image with pixel format pix_fmt and |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
59 * width width. |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
60 * |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
61 * @param linesizes array to be filled with the linesize for each plane |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
62 * @return >= 0 in case of success, a negative error code otherwise |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
63 */ |
22
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
64 int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width); |
8
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
65 |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
66 /** |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
67 * Fill plane data pointers for an image with pixel format pix_fmt and |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
68 * height height. |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
69 * |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
70 * @param data pointers array to be filled with the pointer for each image plane |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
71 * @param ptr the pointer to a buffer which will contain the image |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
72 * @param linesizes[4] the array containing the linesize for each |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
73 * plane, should be filled by av_fill_image_linesizes() |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
74 * @return the size in bytes required for the image buffer, a negative |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
75 * error code in case of failure |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
76 */ |
22
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
77 int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, |
8
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
78 uint8_t *ptr, const int linesizes[4]); |
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
79 |
13
97c3fe501477
Deprecate avcodec_check_dimensions() in favor of the new function
stefano
parents:
8
diff
changeset
|
80 /** |
23
478992775cf8
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
stefano
parents:
22
diff
changeset
|
81 * Copy image plane from src to dst. |
478992775cf8
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
stefano
parents:
22
diff
changeset
|
82 * That is, copy "height" number of lines of "bytewidth" bytes each. |
478992775cf8
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
stefano
parents:
22
diff
changeset
|
83 * The first byte of each successive line is separated by *_linesize |
478992775cf8
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
stefano
parents:
22
diff
changeset
|
84 * bytes. |
478992775cf8
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
stefano
parents:
22
diff
changeset
|
85 * |
478992775cf8
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
stefano
parents:
22
diff
changeset
|
86 * @param dst_linesize linesize for the image plane in dst |
478992775cf8
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
stefano
parents:
22
diff
changeset
|
87 * @param src_linesize linesize for the image plane in src |
478992775cf8
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
stefano
parents:
22
diff
changeset
|
88 */ |
478992775cf8
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
stefano
parents:
22
diff
changeset
|
89 void av_image_copy_plane(uint8_t *dst, int dst_linesize, |
478992775cf8
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
stefano
parents:
22
diff
changeset
|
90 const uint8_t *src, int src_linesize, |
478992775cf8
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
stefano
parents:
22
diff
changeset
|
91 int bytewidth, int height); |
478992775cf8
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
stefano
parents:
22
diff
changeset
|
92 |
478992775cf8
Reimplement ff_img_copy_plane() as av_image_copy_plane() in libavcore,
stefano
parents:
22
diff
changeset
|
93 /** |
13
97c3fe501477
Deprecate avcodec_check_dimensions() in favor of the new function
stefano
parents:
8
diff
changeset
|
94 * Check if the given dimension of an image is valid, meaning that all |
97c3fe501477
Deprecate avcodec_check_dimensions() in favor of the new function
stefano
parents:
8
diff
changeset
|
95 * bytes of the image can be addressed with a signed int. |
97c3fe501477
Deprecate avcodec_check_dimensions() in favor of the new function
stefano
parents:
8
diff
changeset
|
96 * |
97c3fe501477
Deprecate avcodec_check_dimensions() in favor of the new function
stefano
parents:
8
diff
changeset
|
97 * @param w the width of the picture |
97c3fe501477
Deprecate avcodec_check_dimensions() in favor of the new function
stefano
parents:
8
diff
changeset
|
98 * @param h the height of the picture |
97c3fe501477
Deprecate avcodec_check_dimensions() in favor of the new function
stefano
parents:
8
diff
changeset
|
99 * @param log_offset the offset to sum to the log level for logging with log_ctx |
97c3fe501477
Deprecate avcodec_check_dimensions() in favor of the new function
stefano
parents:
8
diff
changeset
|
100 * @param log_ctx the parent logging context, it may be NULL |
97c3fe501477
Deprecate avcodec_check_dimensions() in favor of the new function
stefano
parents:
8
diff
changeset
|
101 * @return >= 0 if valid, a negative error code otherwise |
97c3fe501477
Deprecate avcodec_check_dimensions() in favor of the new function
stefano
parents:
8
diff
changeset
|
102 */ |
22
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
103 int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
104 |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
105 #if FF_API_OLD_IMAGE_NAMES |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
106 attribute_deprecated |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
107 void av_fill_image_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
108 const AVPixFmtDescriptor *pixdesc); |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
109 |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
110 attribute_deprecated |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
111 int av_get_image_linesize(enum PixelFormat pix_fmt, int width, int plane); |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
112 |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
113 attribute_deprecated |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
114 int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width); |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
115 |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
116 attribute_deprecated |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
117 int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
118 uint8_t *ptr, const int linesizes[4]); |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
119 |
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
120 attribute_deprecated |
13
97c3fe501477
Deprecate avcodec_check_dimensions() in favor of the new function
stefano
parents:
8
diff
changeset
|
121 int av_check_image_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); |
22
0899fc09d43c
Adopt a hierarchical name scheme for the imgutils.h API. Simplify
stefano
parents:
21
diff
changeset
|
122 #endif |
13
97c3fe501477
Deprecate avcodec_check_dimensions() in favor of the new function
stefano
parents:
8
diff
changeset
|
123 |
8
f214f755f5de
Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff
changeset
|
124 #endif /* AVCORE_IMGUTILS_H */ |