annotate imgutils.h @ 11:dabaa2056109 libavcore

Reimplement av_fill_image_pointers() using the information stored in the pixdescs. The new implementation is more compact, and does not need to be updated at each pixel format addition.
author stefano
date Fri, 30 Jul 2010 08:42:19 +0000
parents f214f755f5de
children 97c3fe501477
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
27 #include "libavutil/pixfmt.h"
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 /**
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
31 * 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
32 * width width.
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
33 *
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
34 * @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
35 * @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
36 */
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
37 int av_fill_image_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width);
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
38
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
39 /**
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
40 * 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
41 * height height.
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
42 *
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
43 * @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
44 * @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
45 * @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
46 * plane, should be filled by av_fill_image_linesizes()
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
47 * @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
48 * error code in case of failure
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
49 */
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
50 int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height,
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
51 uint8_t *ptr, const int linesizes[4]);
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
52
f214f755f5de Move fill_image_linesize() and fill_image_data_ptr() from
stefano
parents:
diff changeset
53 #endif /* AVCORE_IMGUTILS_H */