nvtiffEncode()#

Performs asynchronous TIFF encoding of one or more images. We assume parameters have been set using the nvtiffEncodeParamsSetImageInfo and nvtiffEncodeParamsSetInputs functions. If the input images have different dimensions or encode parameters, multiple nvtiffEncodeParams_t objects can be used (that’s why this function takes an array of encode parameters). However, as of the current version (0.5), we only support one encode params object (nParams==1).

If the provided compression method (LZW by default) results in a bitstream larger than the raw input image data, we automatically disable compression.

Signature:

nvtiffStatus_t nvtiffEncode(nvtiffEncoder_t encoder,
    nvtiffEncodeParams_t* params,
    uint32_t nParams,
    cudaStream_t stream)

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffEncoder_t encoder

Input

Host

Encoder handle

nvtiffEncodeParams_t* params

Input

Host

Array of nParams encode parameters

uint32_t nParams

Input

Host

Number of encode parameters in params array. Must be 1 for now.

cudaStream_t stream

Input

Host

CUDA stream

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffEncodeFinalize()#

Finalizes asynchronous TIFF encoding operation started by nvtiffEncode. This function must be called before the encoded bitstream can be written to host memory or file with nvtiffWriteTiffBuffer or nvtiffWriteTiffFile. The nvtiffWrite* functions perform stream synchronization to make sure the bitstreams are ready, so there is no need for explicit stream synchronization from the user after calling this function.

Signature:

nvtiffStatus_t nvtiffEncodeFinalize(nvtiffEncoder_t encoder,
    nvtiffEncodeParams_t* params,
    uint32_t nParams,
    cudaStream_t stream)

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffEncoder_t encoder

Input

Host

Encoder handle

nvtiffEncodeParams_t* params

Input

Host

Array of nParams encode parameters

uint32_t nParams

Input

Host

Number of encode parameters in params array. Must be 1 for now.

cudaStream_t stream

Input

Host

CUDA stream

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffGetBitstreamSize()#

Calculates the size of the TIFF metadata and/or compressed bitstream. This function is useful for the user to allocate external buffers to store the encoded TIFF data with nvtiffWriteTiffBuffer. Either of those two output parameters (metadataSize or bitstreamSize) can be NULL, in which case we only calculate the other parameter. metadataSize can be calculated as soon as all parameters are set (even before calling nvtiffEncode), but bitstreamSize can only be calculated after nvtiffEncodeFinalize is called.

Signature:

nvtiffStatus_t nvtiffGetBitstreamSize(nvtiffEncoder_t encoder,
    nvtiffEncodeParams_t* params,
    uint32_t nParams,
    size_t* metadataSize,
    size_t* bitstreamSize)

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffEncoder_t encoder

Input

Host

Encoder handle

nvtiffEncodeParams_t* params

Input

Host

Array of nParams encode parameters

uint32_t nParams

Input

Host

Number of encode parameters in params array. Must be 1 for now.

size_t* metadataSize

Output

Host

Size of TIFF metadata in bytes (can be NULL)

size_t* bitstreamSize

Output

Host

Size of compressed data in bytes (can be NULL)

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffWriteTiffBuffer()#

Writes complete TIFF data including metadata to a host memory buffer. This function performs stream synchronization internally to make sure the bitstream is ready before writing.

Signature:

nvtiffStatus_t nvtiffWriteTiffBuffer(nvtiffEncoder_t encoder,
    nvtiffEncodeParams_t* params,
    uint32_t nParams,
    uint8_t* buffer,
    size_t size,
    cudaStream_t stream)

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffEncoder_t encoder

Input

Host

Encoder handle

nvtiffEncodeParams_t* params

Input

Host

Array of nParams encode parameters

uint32_t nParams

Input

Host

Number of encode parameters in the params array. Must be 1 for now.

uint8_t* buffer

Output

Host

Buffer to write TIFF data to

size_t size

Input

Host

Size of output buffer in bytes

cudaStream_t stream

Input

Host

CUDA stream

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffWriteTiffFile()#

Writes complete TIFF data including metadata to a file. This function performs stream synchronization internally to make sure the bitstream is ready before writing.

Signature:

nvtiffStatus_t nvtiffWriteTiffFile(nvtiffEncoder_t encoder,
    nvtiffEncodeParams_t* params,
    uint32_t nParams,
    const char* fname,
    cudaStream_t stream)

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffEncoder_t encoder

Input

Host

Encoder handle

nvtiffEncodeParams_t* params

Input

Host

Array of nParams encode parameters

uint32_t nParams

Input

Host

Number of encode parameters in params array. Must be 1 for now.

const char* fname

Input

Host

Output file

cudaStream_t stream

Input

Host

CUDA stream

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes