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 {
34  int plane;
35 
40  int step;
41 
46  int offset;
47 
52  int shift;
53 
57  int depth;
58 
59 #if FF_API_PLUS1_MINUS1
60 
62 
65 
68 #endif
70 
80 typedef struct AVPixFmtDescriptor {
81  const char *name;
83 
92 
101 
105  uint64_t flags;
106 
120 
124  const char *alias;
126 
130 #define AV_PIX_FMT_FLAG_BE (1 << 0)
131 
134 #define AV_PIX_FMT_FLAG_PAL (1 << 1)
135 
138 #define AV_PIX_FMT_FLAG_BITSTREAM (1 << 2)
139 
142 #define AV_PIX_FMT_FLAG_HWACCEL (1 << 3)
143 
146 #define AV_PIX_FMT_FLAG_PLANAR (1 << 4)
147 
150 #define AV_PIX_FMT_FLAG_RGB (1 << 5)
151 
156 #define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6)
157 
160 #define AV_PIX_FMT_FLAG_ALPHA (1 << 7)
161 
178 void av_read_image_line(uint16_t *dst, const uint8_t *data[4],
179  const int linesize[4], const AVPixFmtDescriptor *desc,
180  int x, int y, int c, int w, int read_pal_component);
181 
196 void av_write_image_line(const uint16_t *src, uint8_t *data[4],
197  const int linesize[4], const AVPixFmtDescriptor *desc,
198  int x, int y, int c, int w);
199 
211 enum AVPixelFormat av_get_pix_fmt(const char *name);
212 
219 const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt);
220 
231 char *av_get_pix_fmt_string(char *buf, int buf_size,
232  enum AVPixelFormat pix_fmt);
233 
243 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc);
244 
250 
259 
265 
277  int *h_shift, int *v_shift);
278 
284 
294 
298 const char *av_color_range_name(enum AVColorRange range);
299 
303 const char *av_color_primaries_name(enum AVColorPrimaries primaries);
304 
308 const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer);
309 
313 const char *av_color_space_name(enum AVColorSpace space);
314 
318 const char *av_chroma_location_name(enum AVChromaLocation location);
319 
320 #endif /* AVUTIL_PIXDESC_H */
attribute_deprecated int offset_plus1
deprecated, use offset instead
Definition: pixdesc.h:67
int plane
Which of the 4 planes contains the component.
Definition: pixdesc.h:34
const char * alias
Alternative comma-separated names.
Definition: pixdesc.h:124
void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4], const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component)
Read a line from an image, and write the values of the pixel format component c to dst...
Definition: pixdesc.c:33
const char * desc
Definition: nvenc.c:101
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
Definition: pixdesc.c:1884
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:91
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition: pixfmt.h:315
Macro definitions for various function/variable attributes.
enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
Utility function to swap the endianness of a pixel format.
Definition: pixdesc.c:1821
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
Definition: pixdesc.c:1740
void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesize[4], const AVPixFmtDescriptor *desc, int x, int y, int c, int w)
Write the values from src to the pixel format component c of an image line.
Definition: pixdesc.c:81
uint8_t
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:343
const char data[16]
Definition: mxf.c:70
AVColorRange
MPEG vs JPEG YUV range.
Definition: pixfmt.h:362
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:293
const char * name
Definition: pixdesc.h:81
int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
Utility function to access log2_chroma_w log2_chroma_h from the pixel format AVPixFmtDescriptor.
Definition: pixdesc.c:1793
#define src
Definition: vp8dsp.c:254
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:100
const char * av_color_range_name(enum AVColorRange range)
Definition: pixdesc.c:1872
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
Definition: pixdesc.c:1878
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
Definition: pixdesc.h:105
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:82
const char * name
Definition: qsvenc.c:44
const AVPixFmtDescriptor * av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
Iterate over all pixel format descriptors known to libavutil.
Definition: pixdesc.c:1775
const char * av_color_space_name(enum AVColorSpace space)
Definition: pixdesc.c:1890
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:1768
enum AVPixelFormat pix_fmt
Definition: movenc.c:853
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:1805
char * av_get_pix_fmt_string(char *buf, int buf_size, enum AVPixelFormat pix_fmt)
Print in buf the string corresponding to the pixel format with number pix_fmt, or an header if pix_fm...
Definition: pixdesc.c:1753
attribute_deprecated int step_minus1
deprecated, use step instead
Definition: pixdesc.h:61
enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
Definition: pixdesc.c:1784
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:80
const char * av_chroma_location_name(enum AVChromaLocation location)
Definition: pixdesc.c:1896
int shift
Number of least significant bits that must be shifted away to get the value.
Definition: pixdesc.h:52
int offset
Number of elements before the component of the first pixel.
Definition: pixdesc.h:46
#define attribute_deprecated
Definition: attributes.h:80
attribute_deprecated int depth_minus1
deprecated, use depth instead
Definition: pixdesc.h:64
pixel format definitions
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
Definition: pixdesc.c:1704
static void comp(unsigned char *dst, int dst_stride, unsigned char *src, int src_stride, int add)
Definition: eamad.c:83
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:376
int depth
Number of bits in the component.
Definition: pixdesc.h:57
AVPixelFormat
Pixel format.
Definition: pixfmt.h:57
enum AVPixelFormat av_get_pix_fmt(const char *name)
Return the pixel format corresponding to name.
Definition: pixdesc.c:1716
int step
Number of elements between 2 horizontally consecutive pixels.
Definition: pixdesc.h:40