Note
The APIs in this section are deprecated from v 0.3.0
nvTiffOpen()¶
Open a TIFF file and returns a pointer to a nvTiffFile_t object containing the file data.
Signature:
nvTiffFile_t NVTIFFAPI *nvTiffOpen(int dev,
const char *fname,
int hostMemType=NVTIFF_MEM_REG);
Parameters:
Parameter |
Input/Output |
Memory |
Description |
---|---|---|---|
int dev |
Input |
device to use for CUDA calls |
|
const char *fname |
Input |
Host |
path to TIFF file to open. |
int hostMemType=NVTIFF_MEM_REG |
Input |
specifies whether pinned or pageable memory should be used for the buffer allocated to read the content of the TIFF file “fname”. Possible values are NVTIFF_MEM_PIN or NVTIFF_MEM_REG. If pageable memory is used, then the file content is also copied in a device buffer before the function returns. In case of pinned memory instead, no Host2Device copy is performed. |
nvTiffClose()¶
Closes an opened TIFF file read into a nvTiffFile_t object, freeing all the allocated memory (on both the host and the device).
Signature:
void nvTiffClose(nvTiffFile_t *tiffFile);
Parameters:
Parameter |
Input/Output |
Memory |
Description |
---|---|---|---|
nvTiffFile_t *tiffFile |
Input |
Closes an opened TIFF file read into a nvTiffFile_t object |
nvTiffH2DAsync()¶
Copies the file data read by nvTiffOpen() from the internal host buffer to the internal device buffer.
This function is fully asynchronous.
This function is useful when nvTiffOpen() is called withhostMemType=NVTIFF_MEM_PIN in order to overlap the copy of the data with something else before calling the decoding functions nvTiffDecode() or nvTiffDecodeRange(). Please note that in case the file buffer is allocated with pinned memory, if this function is not called, then the decode functions will directly read the pinned host buffer via zero-copy.
This function as no effect in case nvTiffOpen() is called with hostMemType=NVTIFF_MEM_REG.
Signature:
void NVTIFFAPI nvTiffH2DAsync(nvTiffFile_t *tiffFile,
cudaStream_t stream=0);
Parameters:
Parameter |
Input/Output |
Memory |
Description |
---|---|---|---|
nvTiffFile_t *tiffFile |
Input |
nvtiff file |
nvTiffDecode()¶
Perform the decoding of the image data on the GPU specified in “tiffFile” using a specified stream. Each image in the TIFF file is copied into the respective buffer pointed to by “imageOut_d”. This function is fully asynchronous.
Signature:
int nvTiffDecode(nvTiffFile_t *tiffFile,
unsigned char **imageOut_d,
cudaStream_t stream=0);
Parameters:
Parameter |
Input/Output |
Memory |
Description |
---|---|---|---|
nvTiffFile_t *tiffFile |
Input |
The nvTiffFile_t object in which the TIFF file has been read. |
|
unsigned char **imageOut_d |
Output |
Host |
host array (of size tiffData->nSubFiles) of pointers to device buffers. Each device buffer is expected to have size at least: tiffData->subFiles[0].nrow * tiffData->subFiles[0].ncol * (tiffData->subFiles[0].bitsPerPixel/8) |
cudaStream_t stream |
Input |
the stream to use for the kernel launches. |
Returns:
NVTIFF_DECODE_SUCCESS
- on success.
NVTIFF_DECODE_INVALID_CTX
- if tiffFile is invalid.
nvTiffDecodeRange()¶
This function is similar to nvTiffDecode() with the difference that it allows to specify a range of images to be decoded (instead of decoding all images in the file).
Signature:
int nvTiffDecodeRange(nvTiffFile_t *tiffFile,
unsigned int subFileStart,
unsigned int subFileNum,
unsigned char **imageOut_d,
cudaStream_t stream=0);
Parameters:
Parameter |
Input/Output |
Memory |
Description |
---|---|---|---|
nvTiffFile_t *tiffFile |
Input |
The nvTiffFile_t object in which the TIFF file has been read. |
|
unsigned int subFileStart |
Input |
index of the first image to decode, in [0, tiffData->nSubFiles). |
|
unsigned int subFileNum |
Input |
number of images to decode starting from “subFileStart”, in (0, tiffData->nSubFiles] |
|
unsigned char **imageOut_d |
Output |
Host |
host array (of size tiffData->nSubFiles) of pointers to device buffers. Each device buffer is expected to have size at least: tiffData->subFiles[0].nrow * tiffData->subFiles[0].ncol * (tiffData->subFiles[0].bitsPerPixel/8) |
cudaStream_t stream |
Input |
the stream to use for the kernel launches. |
Returns:
NVTIFF_DECODE_SUCCESS
- on success.
NVTIFF_DECODE_INVALID_CTX
- if tiffFile is invalid.
NVTIFF_DECODE_INVALID_RANGE
- if (subFileStart, subFileNum) specify and invalid range of images.