Libav
pixdesc.h
Go to the documentation of this file.
1 /*
2  * pixel format descriptor
3  * Copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at>
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVUTIL_PIXDESC_H
23 #define AVUTIL_PIXDESC_H
24 
25 #include <inttypes.h>
26 
27 #include "attributes.h"
28 #include "pixfmt.h"
29 
30 typedef struct AVComponentDescriptor{
31  uint16_t plane :2;
32 
37  uint16_t step_minus1 :3;
38 
43  uint16_t offset_plus1 :3;
44  uint16_t shift :3;
45  uint16_t depth_minus1 :4;
47 
57 typedef struct AVPixFmtDescriptor{
58  const char *name;
60 
69 
79 
87 
91 #define AV_PIX_FMT_FLAG_BE (1 << 0)
92 
95 #define AV_PIX_FMT_FLAG_PAL (1 << 1)
96 
99 #define AV_PIX_FMT_FLAG_BITSTREAM (1 << 2)
100 
103 #define AV_PIX_FMT_FLAG_HWACCEL (1 << 3)
104 
107 #define AV_PIX_FMT_FLAG_PLANAR (1 << 4)
108 
111 #define AV_PIX_FMT_FLAG_RGB (1 << 5)
112 
117 #define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6)
118 
121 #define AV_PIX_FMT_FLAG_ALPHA (1 << 7)
122 
123 #if FF_API_PIX_FMT
124 
127 #define PIX_FMT_BE AV_PIX_FMT_FLAG_BE
128 #define PIX_FMT_PAL AV_PIX_FMT_FLAG_PAL
129 #define PIX_FMT_BITSTREAM AV_PIX_FMT_FLAG_BITSTREAM
130 #define PIX_FMT_HWACCEL AV_PIX_FMT_FLAG_HWACCEL
131 #define PIX_FMT_PLANAR AV_PIX_FMT_FLAG_PLANAR
132 #define PIX_FMT_RGB AV_PIX_FMT_FLAG_RGB
133 #define PIX_FMT_PSEUDOPAL AV_PIX_FMT_FLAG_PSEUDOPAL
134 #define PIX_FMT_ALPHA AV_PIX_FMT_FLAG_ALPHA
135 #endif
136 
137 #if FF_API_PIX_FMT_DESC
138 
142 #endif
143 
160 void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4],
161  const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component);
162 
177 void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesize[4],
178  const AVPixFmtDescriptor *desc, int x, int y, int c, int w);
179 
191 enum AVPixelFormat av_get_pix_fmt(const char *name);
192 
199 const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt);
200 
211 char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt);
212 
222 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc);
223 
229 
238 
244 
256  int *h_shift, int *v_shift);
257 
263 
264 
274 
275 
276 #endif /* AVUTIL_PIXDESC_H */