gavl: Video format definitions

# Video format definitions
[Video]

Definitions for several variations of video data. More...

## 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_PIXFMT_GRAY (1<<13)
#define | GAVL_PIXELFORMAT_1D_8 GAVL_GRAY_8
| Pixelformat for storing 1-dimensional integer data with 8 bits each.
#define | GAVL_PIXELFORMAT_2D_8 GAVL_GRAYA_16
| Pixelformat for storing 2-dimensional integer data with 8 bits each.
#define | GAVL_PIXELFORMAT_3D_8 GAVL_RGB_24
| Pixelformat for storing 3-dimensional integer data with 8 bits each.
#define | GAVL_PIXELFORMAT_4D_8 GAVL_RGBA_32
| Pixelformat for storing 4-dimensional integer data with 8 bits each.
#define | GAVL_PIXELFORMAT_1D_16 GAVL_GRAY_16
| Pixelformat for storing 1-dimensional integer data with 16 bits each.
#define | GAVL_PIXELFORMAT_2D_16 GAVL_GRAYA_32
| Pixelformat for storing 2-dimensional integer data with 16 bits each.
#define | GAVL_PIXELFORMAT_3D_16 GAVL_RGB_48
| Pixelformat for storing 3-dimensional integer data with 16 bits each.
#define | GAVL_PIXELFORMAT_4D_16 GAVL_RGBA_64
| Pixelformat for storing 4-dimensional integer data with 16 bits each.
#define | GAVL_PIXELFORMAT_1D_FLOAT GAVL_GRAY_FLOAT
| Pixelformat for storing 1-dimensional FLOAT data.
#define | GAVL_PIXELFORMAT_2D_FLOAT GAVL_GRAYA_FLOAT
| Pixelformat for storing 2-dimensional FLOAT data.
#define | GAVL_PIXELFORMAT_3D_FLOAT GAVL_RGB_FLOAT
| Pixelformat for storing 3-dimensional FLOAT data.
#define | GAVL_PIXELFORMAT_4D_FLOAT GAVL_RGBA_FLOAT
| Pixelformat for storing 4-dimensional FLOAT data.
#define | gavl_pixelformat_is_gray(fmt) ((fmt) & GAVL_PIXFMT_GRAY)
| Check if a pixelformat is grayscale.
#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_GRAY_8 = 1 | GAVL_PIXFMT_GRAY, GAVL_GRAY_16 = 2 | GAVL_PIXFMT_GRAY, GAVL_GRAY_FLOAT = 3 | GAVL_PIXFMT_GRAY, GAVL_GRAYA_16 = 1 | GAVL_PIXFMT_GRAY | GAVL_PIXFMT_ALPHA, GAVL_GRAYA_32 = 2 | GAVL_PIXFMT_GRAY | GAVL_PIXFMT_ALPHA, GAVL_GRAYA_FLOAT = 3 | GAVL_PIXFMT_GRAY | GAVL_PIXFMT_ALPHA, 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_RGB_48 = 10 | GAVL_PIXFMT_RGB, GAVL_RGBA_64 = 11 | GAVL_PIXFMT_RGB | GAVL_PIXFMT_ALPHA, GAVL_RGB_FLOAT = 12 | GAVL_PIXFMT_RGB, GAVL_RGBA_FLOAT = 13 | GAVL_PIXFMT_RGB | GAVL_PIXFMT_ALPHA, GAVL_YUY2 = 1 | GAVL_PIXFMT_YUV, GAVL_UYVY = 2 | GAVL_PIXFMT_YUV, GAVL_YUVA_32 = 3 | GAVL_PIXFMT_YUV | GAVL_PIXFMT_ALPHA, GAVL_YUVA_64 = 4 | GAVL_PIXFMT_YUV | GAVL_PIXFMT_ALPHA, GAVL_YUV_FLOAT = 5 | GAVL_PIXFMT_YUV, GAVL_YUVA_FLOAT = 6 | GAVL_PIXFMT_YUV | GAVL_PIXFMT_ALPHA, GAVL_YUV_420_P = 1 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV, GAVL_YUV_422_P = 2 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV, GAVL_YUV_444_P = 3 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV, GAVL_YUV_411_P = 4 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV, GAVL_YUV_410_P = 5 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV, GAVL_YUVJ_420_P = 6 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ, GAVL_YUVJ_422_P = 7 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ, GAVL_YUVJ_444_P = 8 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ, GAVL_YUV_444_P_16 = 9 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV, GAVL_YUV_422_P_16 = 10 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV }
| 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, const 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.

## Detailed Description

Definitions for several variations of video data.

## Define Documentation

#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_PIXFMT_GRAY (1<<13)

Flag for grayscale pixelformats

#define GAVL_PIXELFORMAT_1D_8 GAVL_GRAY_8

Pixelformat for storing 1-dimensional integer data with 8 bits each.

#define GAVL_PIXELFORMAT_2D_8 GAVL_GRAYA_16

Pixelformat for storing 2-dimensional integer data with 8 bits each.

#define GAVL_PIXELFORMAT_3D_8 GAVL_RGB_24

Pixelformat for storing 3-dimensional integer data with 8 bits each.

#define GAVL_PIXELFORMAT_4D_8 GAVL_RGBA_32

Pixelformat for storing 4-dimensional integer data with 8 bits each.

#define GAVL_PIXELFORMAT_1D_16 GAVL_GRAY_16

Pixelformat for storing 1-dimensional integer data with 16 bits each.

#define GAVL_PIXELFORMAT_2D_16 GAVL_GRAYA_32

Pixelformat for storing 2-dimensional integer data with 16 bits each.

#define GAVL_PIXELFORMAT_3D_16 GAVL_RGB_48

Pixelformat for storing 3-dimensional integer data with 16 bits each.

#define GAVL_PIXELFORMAT_4D_16 GAVL_RGBA_64

Pixelformat for storing 4-dimensional integer data with 16 bits each.

#define GAVL_PIXELFORMAT_1D_FLOAT GAVL_GRAY_FLOAT

Pixelformat for storing 1-dimensional FLOAT data.

#define GAVL_PIXELFORMAT_2D_FLOAT GAVL_GRAYA_FLOAT

Pixelformat for storing 2-dimensional FLOAT data.

#define GAVL_PIXELFORMAT_3D_FLOAT GAVL_RGB_FLOAT

Pixelformat for storing 3-dimensional FLOAT data.

#define GAVL_PIXELFORMAT_4D_FLOAT GAVL_RGBA_FLOAT

Pixelformat for storing 4-dimensional FLOAT data.

#define gavl_pixelformat_is_gray | ( | fmt |  | ) | ((fmt) & GAVL_PIXFMT_GRAY)

Check if a pixelformat is grayscale.

Parameters:

  | fmt | A pixelformat

Returns:
  1 if the pixelformat is grayscale, 0 else

#define gavl_pixelformat_is_rgb | ( | fmt |  | ) | ((fmt) & GAVL_PIXFMT_RGB)

Check if a pixelformat is RGB based.

Parameters:

  | fmt | A pixelformat

Returns:
  1 if the pixelformat is RGB based, 0 else

#define gavl_pixelformat_is_yuv | ( | fmt |  | ) | ((fmt) & GAVL_PIXFMT_YUV)

Check if a pixelformat is YUV based.

Parameters:

  | fmt | A pixelformat

Returns:
  1 if the pixelformat is YUV based, 0 else

#define gavl_pixelformat_is_jpeg_scaled | ( | fmt |  | ) | ((fmt) & GAVL_PIXFMT_YUVJ)

Check if a pixelformat is jpeg (full range) scaled.

Parameters:

  | fmt | A pixelformat

Returns:
  1 if the pixelformat is jpeg scaled, 0 else

#define gavl_pixelformat_has_alpha | ( | fmt |  | ) | ((fmt) & GAVL_PIXFMT_ALPHA)

Check if a pixelformat has a transparency channel.

Parameters:

  | fmt | A pixelformat

Returns:
  1 if the pixelformat has a transparency channel, 0 else

#define gavl_pixelformat_is_planar | ( | fmt |  | ) | ((fmt) & GAVL_PIXFMT_PLANAR)

Check if a pixelformat is planar.

Parameters:

  | fmt | A pixelformat

Returns:
  1 if the pixelformat is planar, 0 else

## Typedef Documentation

typedef struct gavl_video_format_s gavl_video_format_t

Video format.

## Enumeration Type Documentation

enum gavl_pixelformat_t

Pixelformat definition.

Enumerator:

  GAVL_PIXELFORMAT_NONE | Undefined.
  GAVL_GRAY_8 | 8 bit gray, scaled 0x00..0xff
  GAVL_GRAY_16 | 16 bit gray, scaled 0x0000..0xffff
  GAVL_GRAY_FLOAT | floating point gray, scaled 0.0..1.0
  GAVL_GRAYA_16 | 8 bit gray + alpha, scaled 0x00..0xff
  GAVL_GRAYA_32 | 16 bit gray + alpha, scaled 0x0000..0xffff
  GAVL_GRAYA_FLOAT | floating point gray + alpha, scaled 0.0..1.0
  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_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
  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 YUVA. Luma and chroma are video scaled, alpha is 0..255.
  GAVL_YUVA_64 | Packed YCbCrA 4:4:4:4. Each component is an uint16_t. Component order is YUVA. Luma and chroma are video scaled, alpha is 0..65535.
  GAVL_YUV_FLOAT | Packed YCbCr 4:4:4. Each component is a float. Luma is scaled 0.0..1.0, chroma is -0.5..0.5
  GAVL_YUVA_FLOAT | Packed YCbCrA 4:4:4:4. Each component is a float. Luma is scaled 0.0..1.0, chroma is -0.5..0.5
  GAVL_YUV_420_P | Packed YCbCrA 4:4:4:4. Each component is an uint16_t. Component order is YUVA. Luma and chroma are video scaled, alpha is 0..65535.
  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.

enum gavl_chroma_placement_t

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.

Enumerator:

  GAVL_CHROMA_PLACEMENT_DEFAULT | MPEG-1/JPEG
  GAVL_CHROMA_PLACEMENT_MPEG2 | MPEG-2
  GAVL_CHROMA_PLACEMENT_DVPAL | DV PAL

enum gavl_framerate_mode_t

Framerate mode.

Enumerator:

  GAVL_FRAMERATE_CONSTANT | Constant framerate
  GAVL_FRAMERATE_VARIABLE | Variable framerate
  GAVL_FRAMERATE_STILL | Still image

enum gavl_interlace_mode_t

Interlace mode.

Enumerator:

  GAVL_INTERLACE_NONE | Progressive
  GAVL_INTERLACE_TOP_FIRST | Top field first
  GAVL_INTERLACE_BOTTOM_FIRST | Bottom field first
  GAVL_INTERLACE_MIXED | Use interlace_mode of the frames

## Function Documentation

int gavl_pixelformat_num_planes | ( | gavl_pixelformat_t | pixelformat | ) |

Get the number of planes.

Parameters:

  | pixelformat | A pixelformat

Returns:
  The number of planes (1 for packet formats)

void gavl_pixelformat_chroma_sub | ( | gavl_pixelformat_t | pixelformat,
|  | int * | sub_h,
|  | int * | sub_v |
| ) |  |  |

Get the horizontal and vertical subsampling factors.

Parameters:

  | pixelformat | A pixelformat
  | sub_h | returns the horizontal subsampling factor
  | sub_v | returns the vertical subsampling factor

E.g. for 4:2:0 subsampling: sub_h = 2, sub_v = 2

int gavl_pixelformat_bytes_per_component | ( | gavl_pixelformat_t | pixelformat | ) |

Get bytes per component for planar formats.

Parameters:

  | pixelformat | A pixelformat

Returns:
  The number of bytes per component for planar formats, 0 for packed formats

int gavl_pixelformat_bytes_per_pixel | ( | gavl_pixelformat_t | pixelformat | ) |

Get bytes per pixel for packed formats.

Parameters:

  | pixelformat | A pixelformat

Returns:
  The number of bytes per pixel for packed formats, 0 for planar formats

int gavl_pixelformat_bits_per_pixel | ( | gavl_pixelformat_t | pixelformat | ) |

Get the effective number of bits for one pixel.

Parameters:

  | pixelformat | A pixelformat

Returns:
  Number of bits per pixel

int gavl_pixelformat_conversion_penalty | ( | gavl_pixelformat_t | src,
|  | gavl_pixelformat_t | dst |
| ) |  |  |

Get the conversion penalty for pixelformat conversions.

Parameters:

  | src | Source pixelformat
  | dst | Destination pixelformat

Returns:
  A number denoting the "cost" of the conversion

The number (the larger the worse) is calculated from several criteria and considers both speed and quality issues. Don't ever rely on specific absolute values, since they can change from version to version (except 0, which is returned when and only when src and dst are equal). Instead, only compare values returned for different combinations among each other.

gavl_pixelformat_t gavl_pixelformat_get_best | ( | gavl_pixelformat_t | src,
|  | const gavl_pixelformat_t * | dst_supported,
|  | int * | penalty |
| ) |  |  |

Get the best destination format for a given source format.

Parameters:

  | src | Source pixelformat
  | dst_supported | List of supported destination format
  | penalty | If non-null, returns the conversion penalty

Returns:
  The best supported destination pixelformat

This function takes a source format and a list of supported destination formats (terminated with GAVL_PIXELFORMAT_NONE) and returns the format, which will result in the cheapest conversion (see gavl_pixelformat_conversion_penalty).

const char* gavl_pixelformat_to_string | ( | gavl_pixelformat_t | pixelformat | ) |

Translate a pixelformat into a human readable string.

Parameters:

  | pixelformat | A pixelformat

Returns:
  A string describing the pixelformat

gavl_pixelformat_t gavl_string_to_pixelformat | ( | const char * | name | ) |

Translate a pixelformat name into a pixelformat.

Parameters:

  | name | A string describing the pixelformat (returnd by gavl_pixelformat_to_string)

Returns:
  The pixelformat or GAVL_PIXELFORMAT_NONE if no match.

int gavl_num_pixelformats | ( |  | ) |

Get total number of supported pixelformats.

Returns:
  total number of supported pixelformats

gavl_pixelformat_t gavl_get_pixelformat | ( | int | index | ) |

Get the pixelformat from index.

Parameters:

  | index | index (must be between 0 and the result of gavl_num_pixelformats)

Returns:
  The pixelformat corresponding to index or GAVL_PIXELFORMAT_NONE.

const char* gavl_chroma_placement_to_string | ( | gavl_chroma_placement_t | mode | ) |

Translate a chroma placement into a human readable string.

Parameters:

  | mode | A chroma placement

Returns:
  A string describing the chroma placement

const char* gavl_interlace_mode_to_string | ( | gavl_interlace_mode_t | mode | ) |

Translate an interlace mode into a human readable string.

Parameters:

  | mode | An interlace mode

Returns:
  A string describing the interlace mode

void gavl_video_format_copy | ( | gavl_video_format_t * | dst,
|  | const gavl_video_format_t * | src |
| ) |  |  |

Copy one video format to another.

Parameters:

  | 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.

Parameters:

  | format_1 | First format
  | format_2 | Second format

Returns:
  1 if the formats are equal, 0 else

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.

Parameters:

  | 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.

Parameters:

  | 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.

Parameters:

  | dst | Destination format
  | src | Source format

Sets the image size of dst according src. Before you call this function, you must set the pixel_width and pixel_height of dst. This function will preserve the display aspect ratio, i.e. when the pixel aspect ratios are different in source and destination, the images will be scaled.