Data Structures | |
struct | gavl_video_format_s |
Video format. More... | |
Defines | |
#define | GAVL_PIXFMT_PLANAR (1<<8) |
#define | GAVL_PIXFMT_RGB (1<<9) |
#define | GAVL_PIXFMT_YUV (1<<10) |
#define | GAVL_PIXFMT_YUVJ (1<<11) |
#define | GAVL_PIXFMT_ALPHA (1<<12) |
#define | gavl_pixelformat_is_rgb(fmt) ((fmt) & GAVL_PIXFMT_RGB) |
Check if a pixelformat is RGB based. | |
#define | gavl_pixelformat_is_yuv(fmt) ((fmt) & GAVL_PIXFMT_YUV) |
Check if a pixelformat is YUV based. | |
#define | gavl_pixelformat_is_jpeg_scaled(fmt) ((fmt) & GAVL_PIXFMT_YUVJ) |
Check if a pixelformat is jpeg (full range) scaled. | |
#define | gavl_pixelformat_has_alpha(fmt) ((fmt) & GAVL_PIXFMT_ALPHA) |
Check if a pixelformat has a transparency channel. | |
#define | gavl_pixelformat_is_planar(fmt) ((fmt) & GAVL_PIXFMT_PLANAR) |
Check if a pixelformat is planar. | |
Typedefs | |
typedef struct gavl_video_format_s | gavl_video_format_t |
Video format. | |
Enumerations | |
enum | gavl_pixelformat_t { GAVL_PIXELFORMAT_NONE = 0, GAVL_RGB_15 = 1 | GAVL_PIXFMT_RGB, GAVL_BGR_15 = 2 | GAVL_PIXFMT_RGB, GAVL_RGB_16 = 3 | GAVL_PIXFMT_RGB, GAVL_BGR_16 = 4 | GAVL_PIXFMT_RGB, GAVL_RGB_24 = 5 | GAVL_PIXFMT_RGB, GAVL_BGR_24 = 6 | GAVL_PIXFMT_RGB, GAVL_RGB_32 = 7 | GAVL_PIXFMT_RGB, GAVL_BGR_32 = 8 | GAVL_PIXFMT_RGB, GAVL_RGBA_32 = 9 | GAVL_PIXFMT_RGB | GAVL_PIXFMT_ALPHA, GAVL_YUY2 = 10 | GAVL_PIXFMT_YUV, GAVL_UYVY = 11 | GAVL_PIXFMT_YUV, GAVL_YUVA_32 = 26 | GAVL_PIXFMT_YUV | GAVL_PIXFMT_ALPHA, GAVL_YUV_420_P = 12 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV, GAVL_YUV_422_P = 13 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV, GAVL_YUV_444_P = 14 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV, GAVL_YUV_411_P = 15 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV, GAVL_YUV_410_P = 16 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV, GAVL_YUVJ_420_P = 17 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ, GAVL_YUVJ_422_P = 18 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ, GAVL_YUVJ_444_P = 19 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ, GAVL_YUV_444_P_16 = 20 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV, GAVL_YUV_422_P_16 = 21 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV, GAVL_RGB_48 = 22 | GAVL_PIXFMT_RGB, GAVL_RGBA_64 = 23 | GAVL_PIXFMT_RGB | GAVL_PIXFMT_ALPHA, GAVL_RGB_FLOAT = 24 | GAVL_PIXFMT_RGB, GAVL_RGBA_FLOAT = 25 | GAVL_PIXFMT_RGB | GAVL_PIXFMT_ALPHA } |
Pixelformat definition. More... | |
enum | gavl_chroma_placement_t { GAVL_CHROMA_PLACEMENT_DEFAULT = 0, GAVL_CHROMA_PLACEMENT_MPEG2, GAVL_CHROMA_PLACEMENT_DVPAL } |
Chroma placement. More... | |
enum | gavl_framerate_mode_t { GAVL_FRAMERATE_CONSTANT = 0, GAVL_FRAMERATE_VARIABLE = 1, GAVL_FRAMERATE_STILL = 2 } |
Framerate mode. More... | |
enum | gavl_interlace_mode_t { GAVL_INTERLACE_NONE = 0, GAVL_INTERLACE_TOP_FIRST, GAVL_INTERLACE_BOTTOM_FIRST, GAVL_INTERLACE_MIXED } |
Interlace mode. More... | |
Functions | |
int | gavl_pixelformat_num_planes (gavl_pixelformat_t pixelformat) |
Get the number of planes. | |
void | gavl_pixelformat_chroma_sub (gavl_pixelformat_t pixelformat, int *sub_h, int *sub_v) |
Get the horizontal and vertical subsampling factors. | |
int | gavl_pixelformat_bytes_per_component (gavl_pixelformat_t pixelformat) |
Get bytes per component for planar formats. | |
int | gavl_pixelformat_bytes_per_pixel (gavl_pixelformat_t pixelformat) |
Get bytes per pixel for packed formats. | |
int | gavl_pixelformat_bits_per_pixel (gavl_pixelformat_t pixelformat) |
Get the effective number of bits for one pixel. | |
int | gavl_pixelformat_conversion_penalty (gavl_pixelformat_t src, gavl_pixelformat_t dst) |
Get the conversion penalty for pixelformat conversions. | |
gavl_pixelformat_t | gavl_pixelformat_get_best (gavl_pixelformat_t src, gavl_pixelformat_t *dst_supported, int *penalty) |
Get the best destination format for a given source format. | |
const char * | gavl_pixelformat_to_string (gavl_pixelformat_t pixelformat) |
Translate a pixelformat into a human readable string. | |
gavl_pixelformat_t | gavl_string_to_pixelformat (const char *name) |
Translate a pixelformat name into a pixelformat. | |
int | gavl_num_pixelformats () |
Get total number of supported pixelformats. | |
gavl_pixelformat_t | gavl_get_pixelformat (int index) |
Get the pixelformat from index. | |
const char * | gavl_chroma_placement_to_string (gavl_chroma_placement_t mode) |
Translate a chroma placement into a human readable string. | |
const char * | gavl_interlace_mode_to_string (gavl_interlace_mode_t mode) |
Translate an interlace mode into a human readable string. | |
void | gavl_video_format_copy (gavl_video_format_t *dst, const gavl_video_format_t *src) |
Copy one video format to another. | |
int | gavl_video_formats_equal (const gavl_video_format_t *format_1, const gavl_video_format_t *format_2) |
Compare 2 video formats. | |
void | gavl_video_format_get_chroma_offset (const gavl_video_format_t *format, int field, int plane, float *off_x, float *off_y) |
Get the chroma offsets relative to the luma samples. | |
void | gavl_video_format_dump (const gavl_video_format_t *format) |
Dump a video format to stderr. | |
void | gavl_video_format_fit_to_source (gavl_video_format_t *dst, const gavl_video_format_t *src) |
Set the image size of a destination format from a source format. |
#define GAVL_PIXFMT_PLANAR (1<<8) |
Flag for planar pixelformats
#define GAVL_PIXFMT_RGB (1<<9) |
Flag for rgb pixelformats
#define GAVL_PIXFMT_YUV (1<<10) |
Flag for yuv pixelformats
#define GAVL_PIXFMT_YUVJ (1<<11) |
Flag for yuvj pixelformats
#define GAVL_PIXFMT_ALPHA (1<<12) |
Alpha flag
#define gavl_pixelformat_is_rgb | ( | fmt | ) | ((fmt) & GAVL_PIXFMT_RGB) |
Check if a pixelformat is RGB based.
fmt | A pixelformat |
#define gavl_pixelformat_is_yuv | ( | fmt | ) | ((fmt) & GAVL_PIXFMT_YUV) |
Check if a pixelformat is YUV based.
fmt | A pixelformat |
#define gavl_pixelformat_is_jpeg_scaled | ( | fmt | ) | ((fmt) & GAVL_PIXFMT_YUVJ) |
Check if a pixelformat is jpeg (full range) scaled.
fmt | A pixelformat |
#define gavl_pixelformat_has_alpha | ( | fmt | ) | ((fmt) & GAVL_PIXFMT_ALPHA) |
Check if a pixelformat has a transparency channel.
fmt | A pixelformat |
#define gavl_pixelformat_is_planar | ( | fmt | ) | ((fmt) & GAVL_PIXFMT_PLANAR) |
Check if a pixelformat is planar.
fmt | A pixelformat |
typedef struct gavl_video_format_s gavl_video_format_t |
Video format.
enum gavl_pixelformat_t |
Pixelformat definition.
GAVL_PIXELFORMAT_NONE | Undefined. |
GAVL_RGB_15 | 15 bit RGB. Each pixel is a uint16_t in native byte order. Color masks are: for red: 0x7C00, for green: 0x03e0, for blue: 0x001f |
GAVL_BGR_15 | 15 bit BGR. Each pixel is a uint16_t in native byte order. Color masks are: for red: 0x001f, for green: 0x03e0, for blue: 0x7C00 |
GAVL_RGB_16 | 16 bit RGB. Each pixel is a uint16_t in native byte order. Color masks are: for red: 0xf800, for green: 0x07e0, for blue: 0x001f |
GAVL_BGR_16 | 16 bit BGR. Each pixel is a uint16_t in native byte order. Color masks are: for red: 0x001f, for green: 0x07e0, for blue: 0xf800 |
GAVL_RGB_24 | 24 bit RGB. Each color is an uint8_t. Color order is RGBRGB |
GAVL_BGR_24 | 24 bit BGR. Each color is an uint8_t. Color order is BGRBGR |
GAVL_RGB_32 | 32 bit RGB. Each color is an uint8_t. Color order is RGBXRGBX, where X is unused |
GAVL_BGR_32 | 32 bit BGR. Each color is an uint8_t. Color order is BGRXBGRX, where X is unused |
GAVL_RGBA_32 | 32 bit RGBA. Each color is an uint8_t. Color order is RGBARGBA |
GAVL_YUY2 | Packed YCbCr 4:2:2. Each component is an uint8_t. Component order is Y1 U1 Y2 V1 |
GAVL_UYVY | Packed YCbCr 4:2:2. Each component is an uint8_t. Component order is U1 Y1 V1 Y2 |
GAVL_YUVA_32 | Packed YCbCrA 4:4:4:4. Each component is an uint8_t. Component order is YUVAYUVA |
GAVL_YUV_420_P | Planar YCbCr 4:2:0. Each component is an uint8_t. Chroma placement is defined by gavl_chroma_placement_t |
GAVL_YUV_422_P | Planar YCbCr 4:2:2. Each component is an uint8_t |
GAVL_YUV_444_P | Planar YCbCr 4:4:4. Each component is an uint8_t |
GAVL_YUV_411_P | Planar YCbCr 4:1:1. Each component is an uint8_t |
GAVL_YUV_410_P | Planar YCbCr 4:1:0. Each component is an uint8_t |
GAVL_YUVJ_420_P | Planar YCbCr 4:2:0. Each component is an uint8_t, luma and chroma values are full range (0x00 .. 0xff) |
GAVL_YUVJ_422_P | Planar YCbCr 4:2:2. Each component is an uint8_t, luma and chroma values are full range (0x00 .. 0xff) |
GAVL_YUVJ_444_P | Planar YCbCr 4:4:4. Each component is an uint8_t, luma and chroma values are full range (0x00 .. 0xff) |
GAVL_YUV_444_P_16 | 16 bit Planar YCbCr 4:4:4. Each component is an uint16_t in native byte order. |
GAVL_YUV_422_P_16 | 16 bit Planar YCbCr 4:2:2. Each component is an uint16_t in native byte order. |
GAVL_RGB_48 | 48 bit RGB. Each color is an uint16_t in native byte order. Color order is RGBRGB |
GAVL_RGBA_64 | 64 bit RGBA. Each color is an uint16_t in native byte order. Color order is RGBARGBA |
GAVL_RGB_FLOAT | float RGB. Each color is a float (0.0 .. 1.0) in native byte order. Color order is RGBRGB |
GAVL_RGBA_FLOAT | float RGBA. Each color is a float (0.0 .. 1.0) in native byte order. Color order is RGBARGBA |
Chroma placement.
Specification of the 3 variants of 4:2:0 YCbCr as described at http://www.mir.com/DMG/chroma.html . For other pixelformats, it's meaningless and should be set to GAVL_CHROMA_PLACEMENT_DEFAULT.
int gavl_pixelformat_num_planes | ( | gavl_pixelformat_t | pixelformat | ) |
Get the number of planes.
pixelformat | A pixelformat |
void gavl_pixelformat_chroma_sub | ( | gavl_pixelformat_t | pixelformat, | |
int * | sub_h, | |||
int * | sub_v | |||
) |
Get the horizontal and vertical subsampling factors.
pixelformat | A pixelformat | |
sub_h | returns the horizontal subsampling factor | |
sub_v | returns the vertical subsampling factor |
int gavl_pixelformat_bytes_per_component | ( | gavl_pixelformat_t | pixelformat | ) |
Get bytes per component for planar formats.
pixelformat | A pixelformat |
int gavl_pixelformat_bytes_per_pixel | ( | gavl_pixelformat_t | pixelformat | ) |
Get bytes per pixel for packed formats.
pixelformat | A pixelformat |
int gavl_pixelformat_bits_per_pixel | ( | gavl_pixelformat_t | pixelformat | ) |
Get the effective number of bits for one pixel.
pixelformat | A pixelformat |
int gavl_pixelformat_conversion_penalty | ( | gavl_pixelformat_t | src, | |
gavl_pixelformat_t | dst | |||
) |
Get the conversion penalty for pixelformat conversions.
src | Source pixelformat | |
dst | Destination pixelformat |
gavl_pixelformat_t gavl_pixelformat_get_best | ( | gavl_pixelformat_t | src, | |
gavl_pixelformat_t * | dst_supported, | |||
int * | penalty | |||
) |
Get the best destination format for a given source format.
src | Source pixelformat | |
dst_supported | List of supported destination format | |
penalty | If non-null, returns the conversion penalty |
const char* gavl_pixelformat_to_string | ( | gavl_pixelformat_t | pixelformat | ) |
Translate a pixelformat into a human readable string.
pixelformat | A pixelformat |
gavl_pixelformat_t gavl_string_to_pixelformat | ( | const char * | name | ) |
Translate a pixelformat name into a pixelformat.
name | A string describing the pixelformat (returnd by gavl_pixelformat_to_string) |
int gavl_num_pixelformats | ( | ) |
Get total number of supported pixelformats.
gavl_pixelformat_t gavl_get_pixelformat | ( | int | index | ) |
Get the pixelformat from index.
index | index (must be between 0 and the result of gavl_num_pixelformats) |
const char* gavl_chroma_placement_to_string | ( | gavl_chroma_placement_t | mode | ) |
Translate a chroma placement into a human readable string.
mode | A chroma placement |
const char* gavl_interlace_mode_to_string | ( | gavl_interlace_mode_t | mode | ) |
Translate an interlace mode into a human readable string.
mode | An interlace mode |
void gavl_video_format_copy | ( | gavl_video_format_t * | dst, | |
const gavl_video_format_t * | src | |||
) |
Copy one video format to another.
dst | Destination format | |
src | Source format |
int gavl_video_formats_equal | ( | const gavl_video_format_t * | format_1, | |
const gavl_video_format_t * | format_2 | |||
) |
Compare 2 video formats.
format_1 | First format | |
format_2 | Second format |
void gavl_video_format_get_chroma_offset | ( | const gavl_video_format_t * | format, | |
int | field, | |||
int | plane, | |||
float * | off_x, | |||
float * | off_y | |||
) |
Get the chroma offsets relative to the luma samples.
format | A video format | |
field | Index of the field (0 = top, 1 = bottom). For progressive format, this is unused | |
plane | Index of the plane (1 = Cb, 2 = Cr) | |
off_x | Returns the offset in x-direction | |
off_y | Returns the offset in y-direction |
void gavl_video_format_dump | ( | const gavl_video_format_t * | format | ) |
Dump a video format to stderr.
format | A video format |
void gavl_video_format_fit_to_source | ( | gavl_video_format_t * | dst, | |
const gavl_video_format_t * | src | |||
) |
Set the image size of a destination format from a source format.
dst | Destination format | |
src | Source format |