The APIs under this category are used to initialize the decoding parameters as part of the nvjpeg2kDecodeParams_t handle. Once initialized, the handle can be passed as an input to nvjpeg2kDecodeTile()

nvjpeg2kDecodeParamsSetDecodeArea()#

This function is used to set the decode area of interest. The coordinates are relative to the image origin and should be within the tile of interest. If the coordinates are set to 0, the entire tile will be decoded.

Signature:

nvjpeg2kStatus_t nvjpeg2kDecodeParamsSetDecodeArea(nvjpeg2kDecodeParams_t decode_params,
        uint32_t start_x,
        uint32_t end_x,
        uint32_t start_y,
        uint32_t end_y);

Parameters:

Parameter

Input/Output

Memory

Description

nvjpeg2kDecodeParams_t decode_params

Input/Output

Host

Decode output parameters handle

uint32_t start_x

Input

Host

Left coordinate of the decode area

uint32_t end_x

Input

Host

Right coordinate of the decode area

uint32_t start_y

Input

Host

Top coordinate of the decode area

uint32_t end_y

Input

Host

Bottom coordinate of the decode area

Returns:

nvjpeg2kStatus_t - An error code as specified in API Return Status Codes

nvjpeg2kDecodeParamsSetRGBOutput()#

This function enables RGB decode output for images with 422/420 chroma subsampling. It is ignored for other chroma subsampling values. YCC to RGB conversion is based on sYCC, Amendment 1 to IEC 61966-2-1. The color conversion is applied at a tile granularity due to which the chroma reconstruction may not be accurate for tiles with odd dimensions.

Signature:

nvjpeg2kStatus_t nvjpeg2kDecodeParamsSetRGBOutput(nvjpeg2kDecodeParams_t decode_params,
        int32_t enable_RGB);

Parameters:

Parameter

Input/Output

Memory

Description

nvjpeg2kDecodeParams_t decode_params

Input/Output

Host

Decode output parameters handle

int32_t enable_RGB

Input

Host

Set to 1 to enable RGB output

Returns:

nvjpeg2kStatus_t - An error code as specified in API Return Status Codes

nvjpeg2kDecodeParamsSetOutputFormat()#

This funtion can used to set the decode output format. The decode output buffer should be allocated in the following manner to support NVJPEG2K_FORMAT_INTERLEAVED.

nvjpeg2kImage_t decode_output;

When decode_output.pixel_type is set to NVJPEG2K_UINT8 bytes_per_sample = 1

When decode_output.pixel_type is set to NVJPEG2K_UINT16 or NVJPEG2K_INT16 bytes_per_sample = 2

decode_output.pitch_in_bytes[0] = image_width * num_components * bytes_per_sample;
decode_output.pixel_data[0]     = decode_output.decode_out.pitch_in_bytes[0] * info.image_height;
decode_output.num_components    = num_components;

For NVJPEG2K_FORMAT_INTERLEAVED to be supported by the decoder when the bitstream is compressed with 420/422 subsampling, RGB Output (nvjpeg2kDecodeParamsSetRGBOutput()) must also be enabled.

Signature:

nvjpeg2kStatus_t nvjpeg2kDecodeParamsSetOutputFormat(nvjpeg2kDecodeParams_t decode_params,
        nvjpeg2kImageFormat_t format);

Parameters:

Parameter

Input/Output

Memory

Description

nvjpeg2kDecodeParams_t decode_params

Input/Output

Host

Decode output parameters handle

nvjpeg2kImageFormat_t format

Input

Host

Defaults to NVJPEG2K_FORMAT_PLANAR

Returns:

nvjpeg2kStatus_t - An error code as specified in API Return Status Codes