Type Declarations

nvTIFF Decode API Return Status Codes

The return codes of the nvTIFF Decode APIs are listed below:

#define NVTIFF_DECODE_SUCCESS       (0)
#define NVTIFF_DECODE_INVALID_CTX   (1)
#define NVTIFF_DECODE_INVALID_RANGE (2)

Description the Return Codes

Return Code

Description

NVTIFF_DECODE_SUCCESS (0)

The API call has finished successfully. Note that many of the calls are asynchronous and some of the errors may be seen only after synchronization.

NVTIFF_DECODE_INVALID_CTX (1)

Invalid CTX.

NVTIFF_DECODE_INVALID_RANGE (2)

Range of subfiles not valid

nvTIFF Encode API Return Status Codes

The return codes of the nvTIFF Encode APIs are listed below:

#define NVTIFF_ENCODE_SUCCESS             (0)
#define NVTIFF_ENCODE_INVALID_CTX         (1)
#define NVTIFF_ENCODE_INVALID_STRIP_NUM   (2)
#define NVTIFF_ENCODE_COMP_OVERFLOW       (3)
#define NVTIFF_ENCODE_COMP_STRIP_TOO_LONG (4)

Description the Return Codes

Return Code

Description

NVTIFF_ENCODE_SUCCESS (0)

The API call has finished successfully. Note that many of the calls are asynchronous and some of the errors may be seen only after synchronization.

NVTIFF_ENCODE_INVALID_CTX (1)

Invalid CTX.

NVTIFF_ENCODE_INVALID_STRIP_NUM (2)

Invalid strip number

NVTIFF_ENCODE_COMP_OVERFLOW (3)

overflow during compression

NVTIFF_ENCODE_COMP_STRIP_TOO_LONG (4)

Too long strip

nvTIFF Write API Return Status Codes

The return codes of the nvTIFF Write APIs are listed below:

#define NVTIFF_WRITE_SUCCESS                (0)
#define NVTIFF_WRITE_UNSUPP_PLANAR_CONF     (1)
#define NVTIFF_WRITE_UNSUPP_PHOTOMETRIC_INT (2)

Description the Return Codes

Return Code

Description

NVTIFF_WRITE_SUCCESS (0)

The API call has finished successfully. Note that many of the calls are asynchronous and some of the errors may be seen only after synchronization.

NVTIFF_WRITE_UNSUPP_PLANAR_CONF (1)

if the value of planarConf parameter is not equal to 1;.

NVTIFF_WRITE_UNSUPP_PHOTOMETRIC_INT (2)

if the value of photometricInt parameter is neither 1 nor 2;

Version 2 API Return Status Codes

The return codes of the nvTiff V2 Decode APIs are listed below:

typedef enum {
    NVTIFF_STATUS_SUCCESS = 0,
    NVTIFF_STATUS_NOT_INITIALIZED = 1,
    NVTIFF_STATUS_INVALID_PARAMETER = 2,
    NVTIFF_STATUS_BAD_TIFF = 3,
    NVTIFF_STATUS_TIFF_NOT_SUPPORTED = 4,
    NVTIFF_STATUS_ALLOCATOR_FAILURE = 5,
    NVTIFF_STATUS_EXECUTION_FAILED = 6,
    NVTIFF_STATUS_ARCH_MISMATCH = 7,
    NVTIFF_STATUS_INTERNAL_ERROR = 8,
    NVTIFF_STATUS_NVCOMP_NOT_FOUND = 9,
} nvtiffStatus_t;

Description the Return Codes

Return Code

Description

NVTIFF_STATUS_SUCCESS (0)

The API call has finished successfully. Note that many of the calls are asynchronous and some of the errors may be seen only after synchronization.

NVTIFF_STATUS_NOT_INITIALIZED (1)

The library handle was not initialized.

NVTIFF_STATUS_INVALID_PARAMETER (2)

Wrong parameter was passed. For example, a null pointer as input data, or an invalid enum value

NVTIFF_STATUS_BAD_TIFF (3)

Cannot parse the TIFF stream. Likely due to a corruption that cannot be handled

NVTIFF_STATUS_TIFF_NOT_SUPPORTED (4)

Attempting to decode a TIFF stream that is not supported by the nvTIFF library.

NVTIFF_STATUS_ALLOCATOR_FAILURE (5)

The user-provided allocator functions, for either memory allocation or for releasing the memory, returned a non-zero code.

NVTIFF_STATUS_EXECUTION_FAILED (6)

Error during the execution of the device tasks.

NVTIFF_STATUS_ARCH_MISMATCH (7)

The device capabilities are not enough for the set of input parameters provided.

NVTIFF_STATUS_INTERNAL_ERROR (8)

Unknown error occured in the library.

NVTIFF_STATUS_NVCOMP_NOT_FOUND (9)

nvTiff is unable to load the nvomp library.

Device Allocator Interface

typedef int (*nvtiffDeviceMallocAsync)(void* ctx, void **ptr, size_t size, cudaStream_t stream);

typedef int (*nvtiffDeviceFreeAsync)(void* ctx, void *ptr, size_t size, cudaStream_t stream);

typedef struct {
    nvtiffDeviceMallocAsync device_malloc;
    nvtiffDeviceFreeAsync device_free;
    void *device_ctx;
} nvtiffDeviceAllocator_t;

Custom device allocator supports stream ordered allocation and user defined context information *device_ctx. When invoking the device allocators, nvTiff will pass *device_ctx as input to the device allocator.

Pinned Allocator Interface

typedef int (*nvtiffPinnedMallocAsync)(void* ctx, void **ptr, size_t size, cudaStream_t stream);

typedef int (*nvtiffPinnedFreeAsync)(void* ctx, void *ptr, size_t size, cudaStream_t stream);

typedef struct {
    nvtiffPinnedMallocAsync pinned_malloc;
    nvtiffPinnedFreeAsync pinned_free;
    void *pinned_ctx;
} nvtiffPinnedAllocator_t;

Custom pinned allocator supports stream ordered allocation and user defined context information *pinned_ctx. When invoking the pinned allocators, nvTiff will pass *pinned_ctx as input to the pinned allocator.

Sample Format

typedef enum nvtiffSampleFormat {
    NVTIFF_SAMPLEFORMAT_UNKNOWN = 0,
    NVTIFF_SAMPLEFORMAT_UINT    = 1,
    NVTIFF_SAMPLEFORMAT_INT        = 2,
    NVTIFF_SAMPLEFORMAT_IEEEFP    = 3,
    NVTIFF_SAMPLEFORMAT_VOID        = 4,
    NVTIFF_SAMPLEFORMAT_COMPLEXINT    = 5,
    NVTIFF_SAMPLEFORMAT_COMPLEXIEEEFP    = 6
} nvtiffSampleFormat_t;

nvtiffSampleFormat_t enum corresponds to the SampleFormat(339) tag defined in the TIFF specification.

Photmetric Interpretation

typedef enum nvtiffPhotometricInt {
    NVTIFF_PHOTOMETRIC_MINISWHITE = 0,
    NVTIFF_PHOTOMETRIC_MINISBLACK    = 1,
    NVTIFF_PHOTOMETRIC_RGB        = 2,
}nvtiffPhotometricInt_t;

nvtiffPhotometricInt_t enum corresponds to the PhotometricInterpretation(262) tag defined in the TIFF specification.

Planar Configuration

typedef enum nvtiffPlanarConfig {
    PLANARCONFIG_CONTIG        = 1,
    PLANARCONFIG_SEPARATE    = 2
} nvtiffPlanarConfig_t;

nvtiffPhotometricInt_t enum corresponds to the PlanarConfiguration (284) tag defined in the TIFF specification.

Tiff File Information

typedef struct nvtiffFileInfo {
    uint32_t num_images;
    uint32_t image_width;
    uint32_t image_height;
    nvtiffPhotometricInt_t photometric_int;
    nvtiffPlanarConfig_t planar_config;
    uint16_t samples_per_pixel;
    uint16_t bits_per_pixel; // SUM(bits_per_sample)
    uint16_t bits_per_sample[MAX_NUM_SAMPLES];
    nvtiffSampleFormat_t sample_format[MAX_NUM_SAMPLES];
} nvtiffFileInfo_t;

nvtiffFileInfo_t enum is used to retrieve some of the TIFF file metadata. This information can be used for allocating decode output buffers.

Decoder Version 2 Types

Decoder Handle

struct nvtiffDecoder;
typedef struct nvtiffDecoder* nvtiffDecoder_t;

The nvtiffDecoder_t handle stores intermediate decode buffers used in decoding.

Bitstream/File Handle

struct nvtiffStream;
typedef struct nvtiffStream* nvtiffStream_t;

This handle is used for parsing a tiff file. Tiff metadata can be extracted using APIs defined in Parser API Reference.