Miam-Player  0.8.0
A nice music player
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 FFmpeg.
6  *
7  * FFmpeg 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  * FFmpeg 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 FFmpeg; 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 #include "version.h"
30 
31 typedef struct AVComponentDescriptor {
35  int plane;
36 
41  int step;
42 
47  int offset;
48 
53  int shift;
54 
58  int depth;
59 
60 #if FF_API_PLUS1_MINUS1
61 
63 
66 
69 #endif
71 
81 typedef struct AVPixFmtDescriptor {
82  const char *name;
83  uint8_t nb_components;
84 
92  uint8_t log2_chroma_w;
93 
101  uint8_t log2_chroma_h;
102 
106  uint64_t flags;
107 
118 
122  const char *alias;
124 
128 #define AV_PIX_FMT_FLAG_BE (1 << 0)
129 
132 #define AV_PIX_FMT_FLAG_PAL (1 << 1)
133 
136 #define AV_PIX_FMT_FLAG_BITSTREAM (1 << 2)
137 
140 #define AV_PIX_FMT_FLAG_HWACCEL (1 << 3)
141 
144 #define AV_PIX_FMT_FLAG_PLANAR (1 << 4)
145 
148 #define AV_PIX_FMT_FLAG_RGB (1 << 5)
149 
158 #define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6)
159 
173 #define AV_PIX_FMT_FLAG_ALPHA (1 << 7)
174 
184 int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc);
185 
191 
197 
206 
212 
229  int *h_shift, int *v_shift);
230 
235 int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt);
236 
240 const char *av_color_range_name(enum AVColorRange range);
241 
245 const char *av_color_primaries_name(enum AVColorPrimaries primaries);
246 
250 const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer);
251 
255 const char *av_color_space_name(enum AVColorSpace space);
256 
260 const char *av_chroma_location_name(enum AVChromaLocation location);
261 
273 enum AVPixelFormat av_get_pix_fmt(const char *name);
274 
281 const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt);
282 
293 char *av_get_pix_fmt_string(char *buf, int buf_size,
294  enum AVPixelFormat pix_fmt);
295 
312 void av_read_image_line(uint16_t *dst, const uint8_t *data[4],
313  const int linesize[4], const AVPixFmtDescriptor *desc,
314  int x, int y, int c, int w, int read_pal_component);
315 
330 void av_write_image_line(const uint16_t *src, uint8_t *data[4],
331  const int linesize[4], const AVPixFmtDescriptor *desc,
332  int x, int y, int c, int w);
333 
343 
344 #define FF_LOSS_RESOLUTION 0x0001
345 #define FF_LOSS_DEPTH 0x0002
346 #define FF_LOSS_COLORSPACE 0x0004
347 #define FF_LOSS_ALPHA 0x0008
348 #define FF_LOSS_COLORQUANT 0x0010
349 #define FF_LOSS_CHROMA 0x0020
369 int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt,
370  enum AVPixelFormat src_pix_fmt,
371  int has_alpha);
372 
391 enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
392  enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
393 
394 #endif /* AVUTIL_PIXDESC_H */
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)
int shift
Definition: pixdesc.h:53
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
AVColorTransferCharacteristic
Definition: pixfmt.h:410
uint8_t log2_chroma_w
Definition: pixdesc.h:92
const char * alias
Definition: pixdesc.h:122
enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
attribute_deprecated int offset_plus1
Definition: pixdesc.h:68
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
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)
AVColorSpace
Definition: pixfmt.h:436
struct AVComponentDescriptor AVComponentDescriptor
AVColorRange
Definition: pixfmt.h:457
AVColorPrimaries
Definition: pixfmt.h:389
int depth
Definition: pixdesc.h:58
int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
uint8_t log2_chroma_h
Definition: pixdesc.h:101
const char * av_color_range_name(enum AVColorRange range)
uint64_t flags
Definition: pixdesc.h:106
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
struct AVPixFmtDescriptor AVPixFmtDescriptor
int plane
Definition: pixdesc.h:35
const AVPixFmtDescriptor * av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
const char * av_color_space_name(enum AVColorSpace space)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:83
char * av_get_pix_fmt_string(char *buf, int buf_size, enum AVPixelFormat pix_fmt)
enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
int step
Definition: pixdesc.h:41
int offset
Definition: pixdesc.h:47
const char * av_chroma_location_name(enum AVChromaLocation location)
const char * name
Definition: pixdesc.h:82
Definition: pixdesc.h:31
#define attribute_deprecated
Definition: attributes.h:98
attribute_deprecated int step_minus1
Definition: pixdesc.h:62
Definition: pixdesc.h:81
attribute_deprecated int depth_minus1
Definition: pixdesc.h:65
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
AVChromaLocation
Definition: pixfmt.h:479
AVPixelFormat
Definition: pixfmt.h:60
enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr)
enum AVPixelFormat av_get_pix_fmt(const char *name)