nvjpeg2kEncodeParamsSetEncodeConfig()#

Sets the JPEG2000 header parameters that are defined in nvjpeg2kEncodeConfig_t. This function should always be called during the encode process.

Signature:

nvjpeg2kStatus_t nvjpeg2kEncodeParamsSetEncodeConfig(
        nvjpeg2kEncodeParams_t encode_params,
        nvjpeg2kEncodeConfig_t* encode_config);

Parameters:

Parameter

Input/Output

Memory

Description

nvjpeg2kEncodeParams_t encode_params

Input/Output

Host

encode parameters handle

nvjpeg2kEncodeConfig_t* encode_config

Input

Host

pointer to nvjpeg2kEncodeConfig_t

Returns:

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

nvjpeg2kEncodeParamsSetQuality()#

Danger

Deprecated, use nvjpeg2kEncodeParamsSpecifyQuality() instead.

This function allows the application to set the target PSNR value when lossy encode is required. Will overwrite any existing quality setting.

Signature:

nvjpeg2kStatus_t nvjpeg2kEncodeParamsSetQuality(
        nvjpeg2kEncodeParams_t encode_params,
        double target_psnr);

Parameters:

Parameter

Input/Output

Memory

Description

nvjpeg2kEncodeParams_t encode_params

Input/Output

Host

encode parameters handle

double target_psnr

Input

Host

target PSNR value in db

Returns:

nvjpeg2kStatus_t - An error code as specified in API Return Status Codes. Will return NVJPEG2K_STATUS_INVALID_PARAMETER if:

  • target_psnr is negative,

  • HT encoder is enabled

nvjpeg2kEncodeParamsSpecifyQuality()#

This function allows the application to set quality type (algorithm) and quality value, which controls how good encoded image should image look. Refer to the Quality Type for the allowed values for each quality type. Will overwrite any existing quality setting.

Signature:

nvjpeg2kStatus_t nvjpeg2kEncodeParamsSpecifyQuality(
        nvjpeg2kEncodeParams_t encode_params,
        nvjpeg2kQualityType quality_type,
        double quality_value);

Parameters:

Parameter

Input/Output

Memory

Description

nvjpeg2kEncodeParams_t encode_params

Input/Output

Host

encode parameters handle

nvjpeg2kQualityType quality_type

Input

Host

quality type (algorithm) to use

double quality_value

Input

Host

controls how good image should look. Refer to the Quality Type for allowed values for each quality type.

Returns:

nvjpeg2kStatus_t - An error code as specified in API Return Status Codes. Will return NVJPEG2K_STATUS_INVALID_PARAMETER if:

  • reversible encode mode is used,

  • requirements are not met (refer to Quality Type),

  • nvjpeg2kEncodeParamsSetEncodeConfig was not yet called.

nvjpeg2kEncodeParamsSetInputFormat()#

This function can be used to set the encode input format. The encode input buffer should be allocated in the following manner to support NVJPEG2K_FORMAT_INTERLEAVED.

nvjpeg2kImage_t encode_input;

When encode_input.pixel_type is set to NVJPEG2K_UINT8 bytes_per_sample = 1

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

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

NVJPEG2K_FORMAT_INTERLEAVED is supported by encoder only when all component dimensions are the same.

Signature:

nvjpeg2kStatus_t nvjpeg2kEncodearamsSetInputFormat(nvjpeg2kEncodeParams_t encode_params,
        nvjpeg2kImageFormat_t format);

Parameters:

Parameter

Input/Output

Memory

Description

nvjpeg2kEncodeParams_t encode_params

Input/Output

Host

encode 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