libquicktime

- Main Page
- Modules
- Data Structures
- Files

Macros | Functions
Color handling

## Macros
#define | BC_RGB565 2
#define | BC_BGR565 3
#define | BC_BGR888 4
#define | BC_BGR8888 5
#define | BC_RGB888 6
#define | BC_RGBA8888 7
#define | BC_RGB161616 8
#define | BC_RGBA16161616 9
#define | BC_YUVA8888 10
#define | BC_YUV422 13
#define | BC_YUV420P 14
#define | BC_YUV422P 15
#define | BC_YUV444P 16
#define | BC_YUV411P 17
#define | BC_YUVJ420P 18
#define | BC_YUVJ422P 19
#define | BC_YUVJ444P 20
#define | BC_YUV422P16 21
#define | BC_YUV444P16 22
#define | BC_YUV422P10 23
#define | BC_YUVJ422P10 24
#define | LQT_COLORMODEL_NONE -1

## Functions
const char * | lqt_colormodel_to_string (int colormodel)
| Convert a colormodel to a human readable string.
int | lqt_string_to_colormodel (const char *str)
| Convert a description string to a colormodel.
int | lqt_colormodel_is_planar (int colormodel)
| Check if a colormodel is planar.
int | lqt_colormodel_has_alpha (int colormodel)
| Check if a colormodel has an alpha (transperency) channel.
int | lqt_colormodel_is_rgb (int colormodel)
| Check, if a colormodel is RGB based.
int | lqt_colormodel_is_yuv (int colormodel)
| Check, if a colormodel is YUV based.
void | lqt_colormodel_get_chroma_sub (int colormodel, int *sub_h, int *sub_v)
| Get the chroma subsampling factors.
void | lqt_get_default_rowspan (int colormodel, int width, int *rowspan, int *rowspan_uv)
| Get the default row span for a colormodel and an image width.
int | lqt_colormodel_has_conversion (int in_cmodel, int out_cmodel)
| Check if a colormodel conversion is supported by libquicktime.
int | lqt_num_colormodels ()
| Get number of supported colormodels.
const char * | lqt_get_colormodel_string (int index)
| Get a colormodel string.
int | lqt_get_colormodel (int index)
| Get a colormodel.
int | lqt_get_best_source_colormodel (int const *source_options, int target)
| Select a source colormodel from a provided list that is best for conversion into a specified target colormodel.
int | lqt_get_best_target_colormodel (int source, int const *target_options)
| Select a target colormodel from a provided list that is best for conversion from a specified source colormodel.

## Detailed Description

Libquicktime has a built in colormodel converter, which can do implicit colormodel conversions while en-/decoding. It is, however, far from perfect: It is incomplete (i.e. not all conversions are present), slow and sometimes inaccurate. Therefore, there is a possibility to bypass internal colormodel conversions.

## Macro Definition Documentation

#define BC_RGB565 2

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

#define BC_BGR565 3

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

#define BC_BGR888 4

24 bit BGR. Each color is an uint8_t. Color order is BGR

#define BC_BGR8888 5

32 bit BGR. Each color is an uint8_t. Color order is BGRXBGRX, where X is unused

#define BC_RGB888 6

24 bit RGB. Each color is an uint8_t. Color order is RGB

#define BC_RGBA8888 7

32 bit RGBA. Each color is an uint8_t. Color order is RGBARGBA

#define BC_RGB161616 8

48 bit RGB. Each color is an uint16_t in native byte order. Color order is RGB

#define BC_RGBA16161616 9

64 bit RGBA. Each color is an uint16_t in native byte order. Color order is RGBA

#define BC_YUVA8888 10

Packed YCbCrA 4:4:4:4. Each component is an uint8_t. Component order is YUVA

#define BC_YUV422 13

Packed YCbCr 4:2:2. Each component is an uint8_t. Component order is Y1 U1 Y2 V1

#define BC_YUV420P 14

Planar YCbCr 4:2:0. Each component is an uint8_t. Chroma placement is defined by lqt_chroma_placement_t

#define BC_YUV422P 15

Planar YCbCr 4:2:2. Each component is an uint8_t

#define BC_YUV444P 16

Planar YCbCr 4:4:4. Each component is an uint8_t

#define BC_YUV411P 17

Planar YCbCr 4:1:1. Each component is an uint8_t

#define BC_YUVJ420P 18

Planar YCbCr 4:2:0. Each component is an uint8_t, luma and chroma values are full range (0x00 .. 0xff)

#define BC_YUVJ422P 19

Planar YCbCr 4:2:2. Each component is an uint8_t, luma and chroma values are full range (0x00 .. 0xff)

#define BC_YUVJ444P 20

Planar YCbCr 4:4:4. Each component is an uint8_t, luma and chroma values are full range (0x00 .. 0xff)

#define BC_YUV422P16 21

16 bit Planar YCbCr 4:2:2. Each component is an uint16_t in native byte order.

#define BC_YUV444P16 22

16 bit Planar YCbCr 4:4:4. Each component is an uint16_t in native byte order.

#define BC_YUV422P10 23

10 bit values in uint16_t native byte order containers, planar YCbCr 4:2:2.

#define BC_YUVJ422P10 24

10 bit values in uint16_t native byte order containers, planar YCbCr 4:2:2. Luma and chroma values are full range (0 .. 1023)

#define LQT_COLORMODEL_NONE -1

This value is used for termination of colormodel arrays

## Function Documentation

const char* lqt_colormodel_to_string | ( | int | colormodel | ) |

Convert a colormodel to a human readable string.

Parameters:

  colormodel | A colormodel

Returns:
  A description of the colormodel

int lqt_string_to_colormodel | ( | const char * | str | ) |

Convert a description string to a colormodel.

Parameters:

  str | A colormodel description (as returned by lqt_colormodel_to_string)

Returns:
  The corresponding colormodel or LQT_COLORMODEL_NONE

int lqt_colormodel_is_planar | ( | int | colormodel | ) |

Check if a colormodel is planar.

Parameters:

  colormodel | A colormodel

Returns:
  1 if the colormodel is planar, 0 else

int lqt_colormodel_has_alpha | ( | int | colormodel | ) |

Check if a colormodel has an alpha (transperency) channel.

Parameters:

  colormodel | A colormodel

Returns:
  1 if the colormodel has an alpha channel, 0 else

int lqt_colormodel_is_rgb | ( | int | colormodel | ) |

Check, if a colormodel is RGB based.

Parameters:

  colormodel | A colormodel

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

int lqt_colormodel_is_yuv | ( | int | colormodel | ) |

Check, if a colormodel is YUV based.

Parameters:

  colormodel | A colormodel

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

void lqt_colormodel_get_chroma_sub | ( | int | colormodel,
|  | int * | sub_h,
|  | int * | sub_v
| ) |  |

Get the chroma subsampling factors.

Parameters:

  colormodel | A colormodel
  sub_h | Returns the horizontal subsampling factor
  sub_v | Returns the vertical subsampling factor

void lqt_get_default_rowspan | ( | int | colormodel,
|  | int | width,
|  | int * | rowspan,
|  | int * | rowspan_uv
| ) |  |

Get the default row span for a colormodel and an image width.

Parameters:

  colormodel | A colormodel
  width | Image width
  rowspan | Returns the rowspan for the luminance (Y) plane
  rowspan_uv | Returns the rowspan for the chrominance (U/V) planes

The rowspan is the byte offset between scanlines. It can be calculated from the colormodel and the image width. Some APIs however, padd the scanlines to certain boundaries, so the rowspans might become larger here (see lqt_set_row_span and lqt_set_row_span_uv).

int lqt_colormodel_has_conversion | ( | int | in_cmodel,
|  | int | out_cmodel
| ) |  |

Check if a colormodel conversion is supported by libquicktime.

Parameters:

  in_cmodel | Input colormodel
  out_cmodel | Output colormodel

Returns:
  1 if the requested conversion is possible, 0 else

As noted before, the colormodel converter is not complete, and this function checks it. As a fallback, conversions from and to BC_RGB888 are always supported. If you need a converison, which is not present, contact the authors for hints how to write it :)

int lqt_num_colormodels | ( |  | ) |

Get number of supported colormodels.

Returns:
  The number of colormodels known to your version of libquicktime

const char* lqt_get_colormodel_string | ( | int | index | ) |

Get a colormodel string.

Parameters:

  index | Index of the colormodel (between 0 and the return value of lqt_num_colormodels - 1)

Returns:
  A description of the colormodel according to index or NULL.

int lqt_get_colormodel | ( | int | index | ) |

Get a colormodel.

Parameters:

  index | Index of the colormodel (between 0 and the return value of lqt_num_colormodels - 1)

Returns:
  The colormodel according to index or LQT_COLORMODEL_NONE

int lqt_get_best_source_colormodel | ( | int const * | source_options,
|  | int | target
| ) |  |

Select a source colormodel from a provided list that is best for conversion into a specified target colormodel.

Parameters:

  source_options | An array of source colormodels to select from. Must be terminated with LQT_COLORMODEL_NODE.
  target | The target colormodel.

Returns:
  A colormodel from `source_options` or LQT_COLORMODEL_NONE, if none of the source colormodels can be converted to the target one.

int lqt_get_best_target_colormodel | ( | int | source,
|  | int const * | target_options
| ) |  |

Select a target colormodel from a provided list that is best for conversion from a specified source colormodel.

Parameters:

  source | The source colormodel.
  target_options | An array of target colormodels to select from. Must be terminated with LQT_COLORMODEL_NODE.

Returns:
  A colormodel from `target_options` or LQT_COLORMODEL_NONE, if the source colormodel can't be converted to any of the target ones.