Color Models
- group NVCV_C_CORE_COLORSPEC
Defines color models. A color model gives meaning to each channel of an image format. They are specified in a canonical XYZW ordering that can then be swizzled to the desired ordering.
Defines
-
NVCV_MAKE_COLOR_SPEC
Creates a user-defined color spec constant.
Example:
NVCVColorSpec cspec = NVCV_MAKE_COLOR_SPEC(NVCV_COLOR_SPACE_BT709, NVCV_YCbCr_ENC_sRGB, NVCV_COLOR_XFER_sYCC, NVCV_COLOR_RANGE_FULL, NVCV_CHROMA_LOC_ODD, NVCV_CHROMA_LOC_EVEN);
- Parameters:
cspace – [in] Color Space.
encoding – [in] R’G’B’ <-> Y’CbCr encoding.
xferFunc – [in] Color transfer function.
range – [in] Color quantization range.
locHoriz – [in] Horizontal chroma location.
locVert – [in] Vertical chroma location.
- Returns:
The user-defined NVCVColorSpec constant.
Enums
-
enum NVCVColorModel
Values:
-
enumerator NVCV_COLOR_MODEL_UNDEFINED
Color model is undefined.
-
enumerator NVCV_COLOR_MODEL_YCbCr
Luma + chroma (blue-luma, red-luma).
-
enumerator NVCV_COLOR_MODEL_RGB
red, green, blue components.
-
enumerator NVCV_COLOR_MODEL_RAW
RAW color model, used for Bayer image formats.
-
enumerator NVCV_COLOR_MODEL_XYZ
CIE XYZ tristimulus color spec.
-
enumerator NVCV_COLOR_MODEL_HSV
hue, saturation, value components.
-
enumerator NVCV_COLOR_MODEL_CMYK
cyan, magenta, yellow, black components.
-
enumerator NVCV_COLOR_MODEL_YCCK
Luma + chroma (blue-luma, red-luma) and black components.
-
enumerator NVCV_COLOR_MODEL_UNDEFINED
-
enum NVCVColorSpace
Defines the color primaries and the white point of a NVCVColorSpec.
Values:
-
enumerator NVCV_COLOR_SPACE_BT601
Color primaries from ITU-R BT.601/625 lines standard, also known as EBU 3213-E.
-
enumerator NVCV_COLOR_SPACE_BT709
Color primaries from ITU-R BT.709 standard, D65 white point.
-
enumerator NVCV_COLOR_SPACE_BT2020
Color primaries from ITU-R BT.2020 standard, D65 white point.
-
enumerator NVCV_COLOR_SPACE_DCIP3
Color primaries from DCI-P3 standard, D65 white point.
-
enumerator NVCV_COLOR_SPACE_BT601
-
enum NVCVWhitePoint
Defines the white point associated with a NVCVColorSpace.
Values:
-
enumerator NVCV_WHITE_POINT_D65
D65 white point, K = 6504.
-
enumerator NVCV_WHITE_POINT_D65
-
enum NVCVYCbCrEncoding
Defines the YCbCr encoding used in a particular NVCVColorSpec.
Values:
-
enumerator NVCV_YCbCr_ENC_UNDEFINED
Encoding not defined. Usually used by non-YCbCr color specs.
-
enumerator NVCV_YCbCr_ENC_BT601
Encoding specified by ITU-R BT.601 standard.
-
enumerator NVCV_YCbCr_ENC_BT709
Encoding specified by ITU-R BT.709 standard.
-
enumerator NVCV_YCbCr_ENC_BT2020
Encoding specified by ITU-R BT.2020 standard.
-
enumerator NVCV_YCbCr_ENC_BT2020c
Encoding specified by ITU-R BT.2020 with constant luminance.
-
enumerator NVCV_YCbCr_ENC_SMPTE240M
Encoding specified by SMPTE 240M standard.
-
enumerator NVCV_YCbCr_ENC_UNDEFINED
-
enum NVCVColorTransferFunction
Defines the color transfer function in a particular NVCVColorSpec.
Values:
-
enumerator NVCV_COLOR_XFER_LINEAR
Linear color transfer function.
-
enumerator NVCV_COLOR_XFER_sRGB
Color transfer function specified by sRGB standard.
-
enumerator NVCV_COLOR_XFER_sYCC
Color transfer function specified by sYCC standard.
-
enumerator NVCV_COLOR_XFER_PQ
Perceptual quantizer color transfer function.
-
enumerator NVCV_COLOR_XFER_BT709
Color transfer function specified by ITU-R BT.709 standard.
-
enumerator NVCV_COLOR_XFER_BT2020
Color transfer function specified by ITU-R BT.2020 standard.
-
enumerator NVCV_COLOR_XFER_SMPTE240M
Color transfer function specified by SMPTE 240M standard.
-
enumerator NVCV_COLOR_XFER_LINEAR
-
enum NVCVColorRange
Defines the color range of a particular NVCVColorSpec.
Values:
-
enumerator NVCV_COLOR_RANGE_FULL
Values cover the full underlying type range.
-
enumerator NVCV_COLOR_RANGE_LIMITED
Values cover a limited range of the underlying type.
-
enumerator NVCV_COLOR_RANGE_FULL
-
enum NVCVChromaLocation
Chroma sampling location.
Values:
-
enumerator NVCV_CHROMA_LOC_BOTH
Sample chroma from even and odd coordinates. This is used when no sub-sampling is taking place.
-
enumerator NVCV_CHROMA_LOC_EVEN
Sample the chroma with even coordinate.
-
enumerator NVCV_CHROMA_LOC_CENTER
Sample the chroma exactly between the even and odd coordinate.
-
enumerator NVCV_CHROMA_LOC_ODD
Sample the chroma with odd coordinate.
-
enumerator NVCV_CHROMA_LOC_BOTH
-
enum NVCVColorSpec
Color spec definitions. These color specs define how color information is to be interpreted. It is defined by several parameters:
These parameters together defines how the color representation maps to its corresponding absolute color in a chromacity diagram.
Values:
-
enumerator NVCV_COLOR_SPEC_UNDEFINED
No color spec defined. Used when color spec isn’t relevant or is not defined. The color spec may be inferred from the context. If this isn’t possible, the values for each color spec component defined below will be used.
-
enumerator NVCV_COLOR_SPEC_BT601
Color spec defining ITU-R BT.601 standard, limited range, with BT.709 chrominancies and transfer function.
-
enumerator NVCV_COLOR_SPEC_BT601_ER
Color spec defining ITU-R BT.601 standard, full range, with BT.709 chrominancies and transfer function.
-
enumerator NVCV_COLOR_SPEC_BT709
Color spec defining ITU-R BT.709 standard, limited range.
-
enumerator NVCV_COLOR_SPEC_BT709_ER
Color spec defining ITU-R BT.709 standard, full range.
-
enumerator NVCV_COLOR_SPEC_BT709_LINEAR
Color spec defining ITU-R BT.709 standard, limited range and linear transfer function.
-
enumerator NVCV_COLOR_SPEC_BT2020
Color spec defining ITU-R BT.2020 standard, limited range.
-
enumerator NVCV_COLOR_SPEC_BT2020_ER
Color spec defining ITU-R BT.2020 standard, full range.
-
enumerator NVCV_COLOR_SPEC_BT2020_LINEAR
Color spec defining ITU-R BT.2020 standard, limited range and linear transfer function.
-
enumerator NVCV_COLOR_SPEC_BT2020_PQ
Color spec defining ITU-R BT.2020 standard, limited range and perceptual quantizer transfer function.
-
enumerator NVCV_COLOR_SPEC_BT2020_PQ_ER
Color spec defining ITU-R BT.2020 standard, full range and perceptual quantizer transfer function.
-
enumerator NVCV_COLOR_SPEC_BT2020c
Color spec defining ITU-R BT.2020 standard for constant luminance, limited range.
-
enumerator NVCV_COLOR_SPEC_BT2020c_ER
Color spec defining ITU-R BT.2020 standard for constant luminance, full range.
-
enumerator NVCV_COLOR_SPEC_MPEG2_BT601
Color spec defining MPEG2 standard using ITU-R BT.601 encoding.
-
enumerator NVCV_COLOR_SPEC_MPEG2_BT709
Color spec defining MPEG2 standard using ITU-R BT.709 encoding.
-
enumerator NVCV_COLOR_SPEC_MPEG2_SMPTE240M
Color spec defining MPEG2 standard using SMPTE 240M encoding.
-
enumerator NVCV_COLOR_SPEC_sRGB
Color spec defining sRGB standard.
-
enumerator NVCV_COLOR_SPEC_sYCC
Color spec defining sYCC standard.
-
enumerator NVCV_COLOR_SPEC_SMPTE240M
Color spec defining SMPTE 240M standard, limited range.
-
enumerator NVCV_COLOR_SPEC_DISPLAYP3
Color spec defining Display P3 standard, with sRGB color transfer function.
-
enumerator NVCV_COLOR_SPEC_DISPLAYP3_LINEAR
Color spec defining Display P3 standard, with linear color transfer function.
-
enum NVCVRawPattern
Defines Bayer patterns used by RAW color model. R,G,B represent the color primaries red, green, blue. C represent a clear channel, it lets all light pass.
Values:
-
enumerator NVCV_RAW_BAYER_RGGB
Bayer format with X channel mapped to samples as follows:
span 1: R G R G R G R G
span 2: G B G B G B G B (Y,Z,W are discarded)
-
enumerator NVCV_RAW_BAYER_BGGR
Bayer format with X channel mapped to samples as follows:
span 1: B G B G B G B G
span 2: G R G R G R G R
(Y,Z,W are discarded)
-
enumerator NVCV_RAW_BAYER_GRBG
Bayer format with X channel mapped to samples as follows:
span 1: G R G R G R G R
span 2: B G B G B G B G
(Y,Z,W are discarded)
-
enumerator NVCV_RAW_BAYER_GBRG
Bayer format with X channel mapped to samples as follows:
span 1: G B G B G B G B
span 2: R G R G R G R G
(Y,Z,W are discarded)
-
enumerator NVCV_RAW_BAYER_RCCB
Bayer format with X channel mapped to samples as follows:
span 1: R C R C R C R C
span 2: C B C B C B C B
(Y,Z,W are discarded)
-
enumerator NVCV_RAW_BAYER_BCCR
Bayer format with X channel mapped to samples as follows:
span 1: B C B C B C B C
span 2: C R C R C R C R
(Y,Z,W are discarded)
-
enumerator NVCV_RAW_BAYER_CRBC
Bayer format with X channel mapped to samples as follows:
span 1: C R C R C R C R
span 2: B C B C B C B C
(Y,Z,W are discarded)
-
enumerator NVCV_RAW_BAYER_CBRC
Bayer format with X channel mapped to samples as follows:
span 1: C B C B C B C B
span 2: R C R C R C R C
(Y,Z,W are discarded)
-
enumerator NVCV_RAW_BAYER_RCCC
Bayer format with X channel mapped to samples as follows:
span 1: R C R C R C R C
span 2: C C C C C C C C
(Y,Z,W are discarded)
-
enumerator NVCV_RAW_BAYER_CRCC
Bayer format with X channel mapped to samples as follows:
span 1: C R C R C R C R
span 2: C C C C C C C C
(Y,Z,W are discarded)
-
enumerator NVCV_RAW_BAYER_CCRC
Bayer format with X channel mapped to samples as follows:
span 1: C C C C C C C C
span 2: R C R C R C R C
(Y,Z,W are discarded)
-
enumerator NVCV_RAW_BAYER_CCCR
Bayer format with X channel mapped to samples as follows:
span 1: C C C C C C C C
span 2: C R C R C R C R
(Y,Z,W are discarded)
-
enumerator NVCV_RAW_BAYER_CCCC
Bayer format with X channel mapped to samples as follows:
span 1: C C C C C C C C
span 2: C C C C C C C C
(Y,Z,W are discarded)
-
enumerator NVCV_RAW_BAYER_RGGB
-
enum NVCVChromaSubsampling
Defines how chroma-subsampling is done. This is only applicable to image formats whose color model is YUV. Other image formats must use NVCV_CSS_NONE. Chroma subsampling is defined by 2 parameters:
Horizontal resolution relative to luma resolution.
Vertical resolution relative to luma resolution.
Values:
-
enumerator NVCV_CSS_NONE
Used when no chroma subsampling takes place, specially for color specs without chroma components.
-
enumerator NVCV_CSS_444
4:4:4 sub-sampling. Chroma has full horizontal and vertical resolution, meaning no chroma subsampling.
-
enumerator NVCV_CSS_422
4:2:2 BT.601 sub-sampling. Chroma has half horizontal and full vertical resolutions.
-
enumerator NVCV_CSS_422R
4:2:2R BT.601 sub-sampling. Chroma has full horizontal and half vertical resolutions.
-
enumerator NVCV_CSS_411
4:1:1 sub-sampling. Chroma has 1/4 horizontal and full vertical resolutions.
-
enumerator NVCV_CSS_411R
4:1:1 sub-sampling. Chroma has full horizontal and 1/4 vertical resolutions.
-
enumerator NVCV_CSS_420
4:2:0 sub-sampling. Chroma has half horizontal and vertical resolutions.
-
enumerator NVCV_CSS_440
4:4:0 sub-sampling. Chroma has full horizontal and half vertical resolutions
-
enumerator NVCV_CSS_410
4:1:0 sub-sampling. Chroma has 1/4 horizontal and half vertical resolutions.
-
enumerator NVCV_CSS_410R
4:1:0V sub-sampling. Chroma has half horizontal and 1/4 vertical resolutions.
Functions
- NVCV_PUBLIC NVCVStatus nvcvMakeColorSpec (NVCVColorSpec *outColorSpec, NVCVColorSpace cspace, NVCVYCbCrEncoding encoding, NVCVColorTransferFunction xferFunc, NVCVColorRange range, NVCVChromaLocation locHoriz, NVCVChromaLocation locVert)
Creates a user-defined NVCVColorSpec.
- Parameters:
outColorSpec – [out] Pointer to the output colorspec.
Cannot be NULL.
cspace – [in] Color space.
encoding – [in] R’G’B’ -> Y’CbCr encoding.
xferFunc – [in] Color transfer function.
range – [in] Color quantization range.
locHoriz – [in] Horizontal chroma location.
locVert – [in] Vertical chroma location.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some argument is outside its valid range.
NVCV_SUCCESS – Operation executed successfully.
- NVCV_PUBLIC NVCVStatus nvcvMakeChromaSubsampling (NVCVChromaSubsampling *outCSS, int32_t samplesHoriz, int32_t samplesVert)
Creates a NVCVChromaSubsampling given the horizontal and vertical sampling.
- Parameters:
outCSS – [out] Pointer to output color subsampling.
Cannot be NULL.
samplesHoriz – [in] Number of horizontal samples, 1, 2 or 4.
samplesVert – [in] Number of vertical samples, 1, 2 or 4.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some argument is outside its valid range.
NVCV_SUCCESS – Operation executed successfully.
- NVCV_PUBLIC NVCVStatus nvcvChromaSubsamplingGetNumSamples (NVCVChromaSubsampling css, int32_t *outSamplesHoriz, int32_t *outSamplesVert)
Get the number of chroma samples for each group of 4 horizontal/vertical luma samples.
- Parameters:
css – [in] Chroma subsampling to be queried.
css
must be valid.
outSamplesHoriz, outSamplesVert – [out] The number of chroma samples for each group of 4 horizontal/vertical luma samples. If NULL, corresponding value won’t be output.
Both cannot be NULL.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some argument is outside its valid range.
NVCV_SUCCESS – Operation executed successfully.
- NVCV_PUBLIC NVCVStatus nvcvColorSpecGetChromaLoc (NVCVColorSpec cspec, NVCVChromaLocation *outLocHoriz, NVCVChromaLocation *outLocVert)
Get the chroma sampling location of a given color spec.
- Parameters:
cspec – [in] Color spec to be queried.
Color spec must be valid.
outLocVert, outLocHoriz – [out] Chroma sample location with respect to luma horizontal/vertical coordinate. If NULL, corresponding value won’t be output.
Both cannot be NULL.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some argument is outside its valid range.
NVCV_SUCCESS – Operation executed successfully.
- NVCV_PUBLIC NVCVStatus nvcvColorSpecSetChromaLoc (NVCVColorSpec *cspec, NVCVChromaLocation locHoriz, NVCVChromaLocation locVert)
Set the chroma sample location of a given color spec
- Parameters:
cspec – [inout] Color spec to be updated.
Cannot be NULL.
cspec
must be valid.
locHoriz – [in] Horizontal chroma sampling location with respect to luma coordinate.
locVert – [in] Vertical chroma sampling location with respect to luma coordinate.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some argument is outside its valid range.
NVCV_SUCCESS – Operation executed successfully.
- NVCV_PUBLIC NVCVStatus nvcvColorSpecGetColorSpace (NVCVColorSpec cspec, NVCVColorSpace *outColorSpace)
Get the color space of a given color spec.
- Parameters:
cspec – [in] Color spec to be queried.
cspec
must be valid.
outColorSpace – [out] Pointer to the output color space associated with the color spec.
Cannot be NULL.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some argument is outside its valid range.
NVCV_SUCCESS – Operation executed successfully.
- NVCV_PUBLIC NVCVStatus nvcvColorSpecSetColorSpace (NVCVColorSpec *cspec, NVCVColorSpace cspace)
Set the color space of a given color spec.
- Parameters:
cspec – [inout] Color spec to be updated.
Cannot be NULL.
cspec
must be valid.
cspace – [in] The new color_space.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some argument is outside its valid range.
NVCV_SUCCESS – Operation executed successfully.
- NVCV_PUBLIC NVCVStatus nvcvColorSpecGetYCbCrEncoding (NVCVColorSpec cspec, NVCVYCbCrEncoding *outEncoding)
Get the R’G’B’ <-> Y’CbCr encoding scheme of a given color spec.
- Parameters:
cspec – [in] Color spec to be queried.
cspec
must be valid.
outEncoding – [out] The Y’CbCr encoding scheme associated with the color spec.
Cannot be NULL.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some argument is outside its valid range.
NVCV_SUCCESS – Operation executed successfully.
- NVCV_PUBLIC NVCVStatus nvcvColorSpecSetYCbCrEncoding (NVCVColorSpec *cspec, NVCVYCbCrEncoding encoding)
Set the R’G’B’ <-> Y’CbCr encoding scheme of a given color spec.
- Parameters:
cspec – [inout] Color spec to be updated.
Cannot be NULL.
encoding – [in] The new Y’CbCr encoding scheme.
encoding
cannot be NVCV_YCbCr_ENC_UNDEFINED.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some argument is outside its valid range.
NVCV_SUCCESS – Operation executed successfully.
- NVCV_PUBLIC NVCVStatus nvcvColorSpecGetColorTransferFunction (NVCVColorSpec cspec, NVCVColorTransferFunction *outXferFunc)
Get the color transfer function of a given color spec.
- Parameters:
cspec – [in] Color spec to be queried.
cspec
must be valid.
outXferFunc – [out] Pointer to the output color transfer function of the given colorspec.
Cannot be NULL.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some argument is outside its valid range.
NVCV_SUCCESS – Operation executed successfully.
- NVCV_PUBLIC NVCVStatus nvcvColorSpecSetColorTransferFunction (NVCVColorSpec *cspec, NVCVColorTransferFunction xferFunc)
Set the color transfer function of a given color spec.
- Parameters:
cspec – [inout] Color spec to be updated.
Cannot be NULL.
cspec
must be valid.
xferFunc – [in] The new color transfer function.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some argument is outside its valid range.
NVCV_SUCCESS – Operation executed successfully.
- NVCV_PUBLIC NVCVStatus nvcvColorSpecGetRange (NVCVColorSpec cspec, NVCVColorRange *outColorRange)
Get the color quantization range of a given color spec.
- Parameters:
cspec – [in] Color spec to be queried.
cspec
must be valid.
outColorRange – [out] The color quantization range of a given color spec.
Cannot be NULL.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some argument is outside its valid range.
NVCV_SUCCESS – Operation executed successfully.
- NVCV_PUBLIC NVCVStatus nvcvColorSpecSetRange (NVCVColorSpec *cspec, NVCVColorRange range)
Set the color quantization range of a given color spec.
- Parameters:
cspec – [inout] Color spec to be updated.
Cannot be NULL.
cspec
must be valid.
range – [in] The new color quantization range.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some argument is outside its valid range.
NVCV_SUCCESS – Operation executed successfully.
- const NVCV_PUBLIC char * nvcvColorSpecGetName (NVCVColorSpec cspec)
Returns a string representation of the color spec.
- Parameters:
cspec – [in] Color spec whose name is to be returned.
- Returns:
The string representation of the color spec. Returned string is valid until next call of this function from the same calling thread. Returned pointer must not be freed.
- NVCV_PUBLIC NVCVStatus nvcvColorModelNeedsColorspec (NVCVColorModel cmodel, int8_t *outBool)
Returns whether a given color model needs a colorspec.
- Parameters:
cmodel – [in] Color model to be queried
outBool – [out] Returns the boolean result. 0 if color model doesn’t need a colorspec, != 0 otherwise.
Cannot be NULL.
- Return values:
NVCV_ERROR_INVALID_ARGUMENT – Some argument is outside its valid range.
NVCV_SUCCESS – Operation executed successfully.
- const NVCV_PUBLIC char * nvcvColorModelGetName (NVCVColorModel cmodel)
Returns a string representation of the color model.
- Parameters:
cmodel – [in] Color model whose name is to be returned.
- Returns:
The string representation of the color model. Returned pointer must not be freed.
- const NVCV_PUBLIC char * nvcvColorSpaceGetName (NVCVColorSpace cspace)
Returns a string representation of the color space.
- Parameters:
cspace – [in] Color model whose name is to be returned.
- Returns:
The string representation of the color model. Returned pointer must not be freed.
- const NVCV_PUBLIC char * nvcvWhitePointGetName (NVCVWhitePoint wpoint)
Returns a string representation of the white point.
- Parameters:
wpoint – [in] White point whose name is to be returned.
- Returns:
The string representation of the white point. Returned pointer must not be freed.
- const NVCV_PUBLIC char * nvcvYCbCrEncodingGetName (NVCVYCbCrEncoding enc)
Returns a string representation of the YCbCr encoding.
- Parameters:
enc – [in] YCbCr encoding whose name is to be returned.
- Returns:
The string representation of the YCbCr encoding. Returned pointer must not be freed.
- const NVCV_PUBLIC char * nvcvColorTransferFunctionGetName (NVCVColorTransferFunction xfer)
Returns a string representation of the color transfer function.
- Parameters:
xfer – [in] Color transfer function whose name is to be returned.
- Returns:
The string representation of the color transfer function. Returned pointer must not be freed.
- const NVCV_PUBLIC char * nvcvColorRangeGetName (NVCVColorRange range)
Returns a string representation of the color range.
- Parameters:
range – [in] Color range whose name is to be returned.
- Returns:
The string representation of the color range. Returned pointer must not be freed.
- const NVCV_PUBLIC char * nvcvChromaLocationGetName (NVCVChromaLocation loc)
Returns a string representation of the chroma location.
- Parameters:
loc – [in] Chroma location whose name is to be returned.
- Returns:
The string representation of the chroma location. Returned pointer must not be freed.
- const NVCV_PUBLIC char * nvcvRawPatternGetName (NVCVRawPattern raw)
Returns a string representation of the raw pattern.
- Parameters:
raw – [in] Raw pattern whose name is to be returned.
- Returns:
The string representation of the raw pattern. Returned pointer must not be freed.
- const NVCV_PUBLIC char * nvcvChromaSubsamplingGetName (NVCVChromaSubsampling css)
Returns a string representation of the chroma subsampling.
- Parameters:
css – [in] Chroma subsampling whose name is to be returned.
- Returns:
The string representation of the chroma subsampling. Returned pointer must not be freed.
-
NVCV_MAKE_COLOR_SPEC