Adv Cvt Color

group Adv Cvt Color

Functions

NVCVStatus cvcudaAdvCvtColorCreate(NVCVOperatorHandle *handle)

Constructs and an instance of the AdvCvtColor operator.

Parameters:

handle – [out] Where the image instance handle will be written to.

  • Must not be NULL.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Handle is null.

  • NVCV_ERROR_OUT_OF_MEMORY – Not enough memory to create the operator.

  • NVCV_SUCCESS – Operation executed successfully.

NVCVStatus cvcudaAdvCvtColorSubmit(NVCVOperatorHandle handle, cudaStream_t stream, NVCVTensorHandle in, NVCVTensorHandle out, NVCVColorConversionCode code, NVCVColorSpec spec)

Executes the AdvCvtColor operation on the given cuda stream. This operation does not wait for completion. Advanced color conversion from one color space to another from YUV420(NV12/21)YUV to RGB.

Limitations:

 Color Range:    Limited-range sample scaling is not supported. Corresponding BT.601, BT.709, and BT.2020
                 base and _ER specifications are bit-identical: YUV input passed with a base specification
                 is interpreted as full range, and YUV output requested with a base specification is emitted
                 as full range rather than the encoded limited range.

Input: Data Layout: [kNHWC, kHWC, kNCHW, kCHW] Channels: [1, 3, 4] kNHWC/kHWC/kNCHW/kCHW semi planar 420 tensors are allowed (2-channel tensors are not supported)

Data Type

Allowed

8bit Unsigned

Yes

8bit Signed

No

16bit Unsigned

No

16bit Signed

No

32bit Unsigned

No

32bit Signed

No

16bit Float

No

32bit Float

No

64bit Float

No

Output: Data Layout: [kNHWC, kHWC, kNCHW, kCHW] Channels: [1, 3, 4] kNHWC/kHWC/kNCHW/kCHW semi planar 420 tensors are allowed (2-channel tensors are not supported)

Data Type

Allowed

8bit Unsigned

Yes

8bit Signed

No

16bit Unsigned

No

16bit Signed

No

32bit Unsigned

No

32bit Signed

No

16bit Float

No

32bit Float

No

64bit Float

No

Input/Output dependency

 Property      |  Input == Output
-------------- | -------------
 Data Layout   | Yes
 Data Type     | Yes
 Number        | Yes
 Channels      | Yes (No for semi planar 420 tensors conversion)
 Width         | Yes
 Height        | Yes (No for semi planar 420 tensors conversion)

Packed 4:4:4 Y,U,V <-> R,G,B tensors use kNHWC/kHWC with C = 3. Planar 4:4:4 tensors use kNCHW/kCHW with C = 3, one color component per channel plane. The output keeps the input layout. NVCV_COLOR_YUV2BGR NVCV_COLOR_YUV2RGB NVCV_COLOR_BGR2YUV NVCV_COLOR_RGB2YUV

Semi planar Y,U,V <-> R,G,B tensors use kNHWC/kHWC with C = 3 or C = 4 for RGB/BGR(A), or kNCHW/kCHW with C = 3 or C = 4 for planar RGB/BGR(A). NV12/21 tensors are single-channel tensors in the same layout family. For NV12/21, H = (pixel height) * 3/2, W = pixel width, and the bottom 1/3 of the tensor contains interleaved UV/VU data. NVCV_COLOR_YUV2RGB_NV12 NVCV_COLOR_YUV2BGR_NV12 NVCV_COLOR_YUV2RGB_NV21 NVCV_COLOR_YUV2BGR_NV21 NVCV_COLOR_RGB2YUV_NV12 NVCV_COLOR_BGR2YUV_NV12 NVCV_COLOR_RGB2YUV_NV21 NVCV_COLOR_BGR2YUV_NV21

Parameters:
  • handle – [in] Handle to the operator.

    • Must not be NULL.

  • stream – [in] Handle to a valid CUDA stream.

  • in – [in] input tensor.

  • out – [out] output tensor.

  • code – [in] color conversion code see NVCVColorConversionCode group. The following conversion codes are available for this operator:

  • spec – [in] color conversion spec see NVCVColorSpec group. The following spec codes are available for this operator: NVCV_COLOR_SPEC_BT601 // BT.601 for SDTV NVCV_COLOR_SPEC_BT601_ER // Full-range BT.601 for SDTV NVCV_COLOR_SPEC_BT709 // BT.709 for HDTV NVCV_COLOR_SPEC_BT709_ER // Full-range BT.709 for HDTV NVCV_COLOR_SPEC_BT2020 // BT.2020 for UHDTV NVCV_COLOR_SPEC_BT2020_ER // Full-range BT.2020 for UHDTV Use an _ER specification to describe the operator’s full-sample-range output explicitly.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Some parameter is outside valid range.

  • NVCV_ERROR_INTERNAL – Internal error in the operator, invalid types passed in.

  • NVCV_SUCCESS – Operation executed successfully.