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 of 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;

Decode 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,
    NVTIFF_STATUS_NVJPEG_NOT_FOUND = 10,
    NVTIFF_STATUS_TAG_NOT_FOUND = 11,
    NVTIFF_STATUS_PARAMETER_OUT_OF_BOUNDS = 12,
} 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 nvcomp library.

NVTIFF_STATUS_NVJPEG_NOT_FOUND (10)

nvTiff is unable to load the nvjpeg library.

NVTIFF_STATUS_TAG_NOT_FOUND (11)

nvTiff is unable to find information about the provided tag

NVTIFF_STATUS_PARAMETER_OUT_OF_BOUNDS (12)

Provided parameter is outside the range of possible values

TIFF Tags

typedef enum nvtiffTag {
  NVTIFF_TAG_UNKNOWN = -1,
  NVTIFF_TAG_MODEL_PIXEL_SCALE = 33550,
  NVTIFF_TAG_MODEL_TIE_POINT =   33922,
  NVTIFF_TAG_MODEL_TRANSFORMATION = 34264
} nvtiffTag_t;

nvtiffTag_t corresponds to various TIFF tags listed in the TIFF specification. Currently only GeoTIFF relevant tags are supported. User can refer to the TIFF specification for additional details.

TIFF Tag Data Type

typedef enum nvtiffTagDataType {
    NVTIFF_TAG_TYPE_BYTE      =  1,
    NVTIFF_TAG_TYPE_ASCII     =  2,
    NVTIFF_TAG_TYPE_SHORT     =  3,
    NVTIFF_TAG_TYPE_LONG      =  4,
    NVTIFF_TAG_TYPE_RATIONAL  =  5,
    NVTIFF_TAG_TYPE_SBYTE     =  6,
    NVTIFF_TAG_TYPE_UNDEFINED =  7,
    NVTIFF_TAG_TYPE_SSHORT    =  8,
    NVTIFF_TAG_TYPE_SLONG     =  9,
    NVTIFF_TAG_TYPE_SRATIONAL = 10,
    NVTIFF_TAG_TYPE_FLOAT     = 11,
    NVTIFF_TAG_TYPE_DOUBLE    = 12,
    NVTIFF_TAG_TYPE_LONG8     = 16,
    NVTIFF_TAG_TYPE_SLONG8    = 17,
    NVTIFF_TAG_TYPE_IFD8      = 18,
} nvtiffTagDataType_t;

nvtiffTagDataType_t corresponds to the datatype for a TIFF tag.

GeoTIFF Keys

typedef enum nvtiffGeoKeys
{
    // GeoTIFF Configuration Keys
    NVTIFF_GEOKEY_GT_MODEL_TYPE                = 1024,
    NVTIFF_GEOKEY_GT_RASTER_TYPE               = 1025,
    NVTIFF_GEOKEY_GT_CITATION                  = 1026,

    // Geodetic CRS Parameter Keys
    NVTIFF_GEOKEY_GEODETIC_CRS                 = 2048,
    NVTIFF_GEOKEY_GEODETIC_CITATION            = 2049,
    NVTIFF_GEOKEY_GEODETIC_DATUM               = 2050,
    NVTIFF_GEOKEY_PRIME_MERIDIAN               = 2051,
    NVTIFF_GEOKEY_GEOG_LINEAR_UNITS            = 2052,
    NVTIFF_GEOKEY_GEOG_LINEAR_UNIT_SIZE        = 2053,
    NVTIFF_GEOKEY_GEOG_ANGULAR_UNITS           = 2054,
    NVTIFF_GEOKEY_GEOG_ANGULAR_UNIT_SIZE       = 2055,
    NVTIFF_GEOKEY_ELLIPSOID                    = 2056,
    NVTIFF_GEOKEY_ELLIPSOID_SEMI_MAJOR_AXIS    = 2057,
    NVTIFF_GEOKEY_ELLIPSOID_SEMI_MINOR_AXIS    = 2058,
    NVTIFF_GEOKEY_ELLIPSOID_INV_FLATTENING     = 2059,
    NVTIFF_GEOKEY_GEOG_AZIMUTH_UNITS           = 2060,
    NVTIFF_GEOKEY_PRIME_MERIDIAN_LONG          = 2061,

    // Projected CRS Parameter Keys
    NVTIFF_GEOKEY_PROJECTED_CRS                = 3072,
    NVTIFF_GEOKEY_PROJECTED_CITATION           = 3073,
    NVTIFF_GEOKEY_PROJECTION                   = 3074,
    NVTIFF_GEOKEY_PROJ_METHOD                  = 3075,
    NVTIFF_GEOKEY_PROJ_LINEAR_UNITS            = 3076,
    NVTIFF_GEOKEY_PROJ_LINEAR_UNIT_SIZE        = 3077,
    NVTIFF_GEOKEY_PROJ_STD_PARALLEL1           = 3078,
    NVTIFF_GEOKEY_PROJ_STD_PARALLEL            = 3078,
    NVTIFF_GEOKEY_PROJ_STD_PARALLEL2           = 3079,
    NVTIFF_GEOKEY_PROJ_NAT_ORIGIN_LONG         = 3080,
    NVTIFF_GEOKEY_PROJ_ORIGIN_LONG             = 3080,
    NVTIFF_GEOKEY_PROJ_NAT_ORIGIN_LAT          = 3081,
    NVTIFF_GEOKEY_PROJ_ORIGIN_LAT              = 3081,
    NVTIFF_GEOKEY_PROJ_FALSE_EASTING           = 3082,
    NVTIFF_GEOKEY_PROJ_FALSE_NORTHING          = 3083,
    NVTIFF_GEOKEY_PROJ_FALSE_ORIGIN_LONG       = 3084,
    NVTIFF_GEOKEY_PROJ_FALSE_ORIGIN_LAT        = 3085,
    NVTIFF_GEOKEY_PROJ_FALSE_ORIGIN_EASTING    = 3086,
    NVTIFF_GEOKEY_PROJ_FALSE_ORIGIN_NORTHING   = 3087,
    NVTIFF_GEOKEY_PROJ_CENTER_LONG             = 3088,
    NVTIFF_GEOKEY_PROJ_CENTER_LAT              = 3089,
    NVTIFF_GEOKEY_PROJ_CENTER_EASTING          = 3090,
    NVTIFF_GEOKEY_PROJ_CENTER_NORTHING         = 3091,
    NVTIFF_GEOKEY_PROJ_SCALE_AT_NAT_ORIGIN     = 3092,
    NVTIFF_GEOKEY_PROJ_SCALE_AT_ORIGIN         = 3092,
    NVTIFF_GEOKEY_PROJ_SCALE_AT_CENTER         = 3093,
    NVTIFF_GEOKEY_PROJ_AZIMUTH_ANGLE           = 3094,
    NVTIFF_GEOKEY_PROJ_STRAIGHT_VERT_POLE_LONG = 3095,

    // Vertical CRS Parameter Keys (4096-5119)
    NVTIFF_GEOKEY_VERTICAL                     = 4096,
    NVTIFF_GEOKEY_VERTICAL_CITATION            = 4097,
    NVTIFF_GEOKEY_VERTICAL_DATUM               = 4098,
    NVTIFF_GEOKEY_VERTICAL_UNITS               = 4099,

    NVTIFF_GEOKEY_BASE                         = 32768,
    NVTIFF_GEOKEY_END                          = 65535
} nvtiffGeoKey_t;

nvtiffGeoKey_t corresponds to various geo keys listed in the GeoTIFF specification. User can refer to the GeoTIFF specification for additional details.

GeoTIFF Key Datatype

typedef enum nvtiffGeoKeyDataType {
    NVTIFF_GEOKEY_TYPE_SHORT=1,
    NVTIFF_GEOKEY_TYPE_ASCII=2,
    NVTIFF_GEOKEY_TYPE_DOUBLE=3,
    NVTIFF_GEOKEY_TYPE_UNKNOWN=4
} nvtiffGeoKeyDataType_t;

nvtiffGeoKeyDataType_t corresponds to a datatype for a geo key.

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.

Image Type

typedef enum {
    NVTIFF_IMAGETYPE_REDUCED_IMAGE = 0b0001,
    NVTIFF_IMAGETYPE_PAGE          = 0b0010,
    NVTIFF_IMAGETYPE_MASK          = 0b0100,
    NVTIFF_IMAGETYPE_ENUM_FORCE_UINT32 =  0xFFFFFFFF,
} nvtiffImageType;
typedef uint32_t nvtiffImageType_t;

nvtiffImageType enum corresponds to the NewSubfiletype (254) tag defined in the TIFF specification.

Compression Type

typedef enum nvtiffCompression {
    NVTIFF_COMPRESSION_UNKNOWN = 0,
    NVTIFF_COMPRESSION_NONE = 1,
    NVTIFF_COMPRESSION_LZW = 5,
    NVTIFF_COMPRESSION_JPEG = 7,
    NVTIFF_COMPRESSION_ADOBE_DEFLATE = 8,
    NVTIFF_COMPRESSION_DEFLATE = 32946,
} nvtiffCompression_t;

nvtiffCompression_t enum corresponds to the Compression (259) tag defined in the TIFF specification.

Photometric Interpretation

typedef enum nvtiffPhotometricInt {
    NVTIFF_PHOTOMETRIC_UNKNOWN    = -1,
    NVTIFF_PHOTOMETRIC_MINISWHITE = 0,
    NVTIFF_PHOTOMETRIC_MINISBLACK = 1,
    NVTIFF_PHOTOMETRIC_RGB        = 2,
    NVTIFF_PHOTOMETRIC_PALETTE    = 3,
    NVTIFF_PHOTOMETRIC_MASK     = 4,
    NVTIFF_PHOTOMETRIC_SEPARATED  = 5,
    NVTIFF_PHOTOMETRIC_YCBCR      = 6,
}nvtiffPhotometricInt_t;

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

Planar Configuration

typedef enum nvtiffPlanarConfig {
  NVTIFF_PHOTOMETRIC_UNKNOWN    = -1,
  NVTIFF_PHOTOMETRIC_MINISWHITE = 0,
  NVTIFF_PHOTOMETRIC_MINISBLACK = 1,
  NVTIFF_PHOTOMETRIC_RGB        = 2,
  NVTIFF_PHOTOMETRIC_PALETTE    = 3,
  NVTIFF_PHOTOMETRIC_MASK       = 4,
  NVTIFF_PHOTOMETRIC_SEPARATED  = 5,
  NVTIFF_PHOTOMETRIC_YCBCR      = 6,
} nvtiffPlanarConfig_t;

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

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.

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.

TIFF Image Information

typedef struct nvtiffImageInfo {
    nvtiffImageType_t image_type;
    uint32_t image_width;
    uint32_t image_height;
    nvtiffCompression_t compression;
    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];
} nvtiffImageInfo_t;

nvtiffImageInfo_t contains some additional metadata of an image stored in a TIFF file.

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.