HQ Resize

group NVCV_C_ALGORITHM_HQ_RESIZE

Defines

NVCV_HQ_RESIZE_MAX_RESIZED_NDIM

Functions

NVCVStatus cvcudaHQResizeCreate(NVCVOperatorHandle *handle)

Constructs an instance of the HQResize operator.

Parameters:

handle[out] Where the image instance handle will be written to.

  • Must not be NULL.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Handle is null.

  • NVCV_ERROR_OUT_OF_MEMORY – Not enough memory to create the operator.

  • NVCV_SUCCESS – Operation executed successfully.

NVCVStatus cvcudaHQResizeTensorGetWorkspaceRequirements(NVCVOperatorHandle handle, int batchSize, const HQResizeTensorShapeI inputShape, const HQResizeTensorShapeI outputShape, const NVCVInterpolationType minInterpolation, const NVCVInterpolationType magInterpolation, bool antialias, const HQResizeRoiF *roi, NVCVWorkspaceRequirements *reqOut)

Calculates the workspace requirements for Tensor input/ouput.

Parameters:
  • handle[in] Where the image instance handle will be written to.

    • Must not be NULL.

  • batchSize[in] The number of samples in the tensor (the size of N extent).

  • inputShape[in] The HW or DHW extents of the input tensor, the number of resized extents, and the number of channels. Supported number of resizes extents are 2 and 3. For ndim = 2, a tensor of layout (N)HW(C) is expected to be processed, for ndim = 3, a tensor of layout (N)DHW(C) is expected to be processed.

  • outputShape[in] The HW or DHW extents of the output tensor and the number of channels. The number of extents and channels must be the same as in inputShape.

  • minInterpolation[in] The type of interpolation to be used when downsampling an extent (i.e. when output extent is smaller than the corresponding input extent).

  • magInterpolation[in] The type of interpolation to be used when upsampling an extent (i.e. when output extent is bigger than the corresponding input extent).

  • antialias[in] Whether to use antialiasing when downsampling.

  • roi[in] Optional region of interest for the input, in (D)HW layout.

  • reqOut[out] The pointer for workspace requirements struct that will be filled by the call.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Handle is null or one of the arguments is out of range.

  • NVCV_SUCCESS – Operation executed successfully.

NVCVStatus cvcudaHQResizeTensorBatchGetWorkspaceRequirements(NVCVOperatorHandle handle, int batchSize, const HQResizeTensorShapesI inputShapes, const HQResizeTensorShapesI outputShapes, const NVCVInterpolationType minInterpolation, const NVCVInterpolationType magInterpolation, bool antialias, const HQResizeRoisF roi, NVCVWorkspaceRequirements *reqOut)

Calculates the workspace requirements for TensorBatch/ImageBatchVarShape input/ouput.

Parameters:
  • handle[in] Where the image instance handle will be written to.

    • Must not be NULL.

  • batchSize[in] The number of samples in the tensor batch/image batch.

  • inputShapes[in] The list of shapes (HW or DHW extents) in the input batch, the number of channels, and the number of extents to be resampled (2 or 3). The number of channels can be specified once for the whole batch or each sample separately.

  • outputShapes[in] The list of shapes (HW or DHW extents) in the output batch, the number of channels, and the number of extents to be resampled (2 or 3). The number of channels must match the number of channels in the input.

  • minInterpolation[in] The type of interpolation to be used when downsampling an extent (i.e. when output extent is smaller than the corresponding input extent).

  • magInterpolation[in] The type of interpolation to be used when upsampling an extent (i.e. when output extent is bigger than the corresponding input extent).

  • antialias[in] Whether to use antialiasing when downsampling.

  • roi[in] Optional region of interest for the input, in (D)HW layout. The roi can be described as a list for each sample or contain a single element to be used for all the samples in the batch.

  • reqOut[out] The pointer for workspace requirements struct that will be filled by the call.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Handle is null or one of the arguments is out of range.

  • NVCV_SUCCESS – Operation executed successfully.

NVCVStatus cvcudaHQResizeGetMaxWorkspaceRequirements(NVCVOperatorHandle handle, int maxBatchSize, const HQResizeTensorShapeI maxShape, NVCVWorkspaceRequirements *reqOut)

Calculates the upper bound for workspace requirements. The workspace that meets the returned requirements can be used with any call to the operator as long as: the input dimensionality (2 or 3) matches, the number of samples does not exceed the maxBatchSize, and all the input and output shapes do not exceed the maxShape in any extent (including number of channels).

Parameters:
  • handle[in] Where the image instance handle will be written to.

    • Must not be NULL.

  • maxBatchSize[in] The maximal number of samples in the tensor/tensor batch/image batch.

  • maxShape[in] The maximal shape of any input or output sample. The number of channels must be an upper bound for number of channels in any sample.

  • reqOut[out] The pointer for workspace requirements struct that will be filled by the call.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Handle is null or one of the arguments is out of range.

  • NVCV_SUCCESS – Operation executed successfully.

NVCVStatus cvcudaHQResizeSubmit(NVCVOperatorHandle handle, cudaStream_t stream, const NVCVWorkspace *workspace, NVCVTensorHandle in, NVCVTensorHandle out, const NVCVInterpolationType minInterpolation, const NVCVInterpolationType magInterpolation, bool antialias, const HQResizeRoiF *roi)

Executes the HQResize operation on the given cuda stream. This operation does not wait for completion.

Limitations:

Input, Output: Data Layout: NVCV_TENSOR_[N][D]HW[C]

Number of channels: Positive integer

Data Type

Allowed

8bit Unsigned

Yes

8bit Signed

No

16bit Unsigned

Yes

16bit Signed

Yes

32bit Unsigned

No

32bit Signed

No

32bit Float

Yes

64bit Float

No

Input/Output dependency

Property

Input == Output

Data Layout

Yes

Data Type

No (output can be the same or float32).

Channels

Yes

Width

No

Height

No

Samples

Yes

Parameters:
  • handle[in] Handle to the operator.

    • Must not be NULL.

  • stream[in] Handle to a valid CUDA stream.

  • workspace[in] The workspace with memory for intermediate results. The requirements for a given input can be acquired with a call to cvcudaHQResizeTensorGetWorkspaceRequirements or cvcudaHQResizeGetMaxWorkspaceRequirements.

  • in[in] The input tensor with (N)(D)HW(C) layout.

  • out[in] The output tensor with the same layout, number of samples and channels as the in tensor.

  • minInterpolation[in] The type of interpolation to be used when downsampling an extent (i.e. when output extent is smaller than the corresponding input extent). Supported interpolation formats are: NVCV_INTERP_NEAREST, NVCV_INTERP_LINEAR, NVCV_INTERP_CUBIC, NVCV_INTERP_LANCZOS, and NVCV_INTERP_GAUSSIAN.

  • magInterpolation[in] The type of interpolation to be used when upsampling an extent (i.e. when output extent is bigger than the corresponding input extent). Supported interpolation formats are: NVCV_INTERP_NEAREST, NVCV_INTERP_LINEAR, NVCV_INTERP_CUBIC, NVCV_INTERP_LANCZOS, and NVCV_INTERP_GAUSSIAN.

  • antialias[in] Whether to use antialiasing when downsampling. The value is ignored for minInterpolation = NVCV_INTERP_NEAREST.

  • roi[in] Optional region of interest for the input, in (D)HW layout. If, for some axis, the low bound is bigger than the high bound, the image is flipped in that dimension.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Some parameter is outside valid range.

  • NVCV_ERROR_INTERNAL – Internal error in the operator, invalid types passed in.

  • NVCV_SUCCESS – Operation executed successfully.

NVCVStatus cvcudaHQResizeImageBatchSubmit(NVCVOperatorHandle handle, cudaStream_t stream, const NVCVWorkspace *workspace, NVCVImageBatchHandle in, NVCVImageBatchHandle out, const NVCVInterpolationType minInterpolation, const NVCVInterpolationType magInterpolation, bool antialias, const HQResizeRoisF roi)

Executes the HQResize operation on the given cuda stream. This operation does not wait for completion.

Limitations:

Input, Output: Data Layout: NVCV_TENSOR_HWC

Number of channels: [1, 2, 3, 4]

Data Type

Allowed

8bit Unsigned

Yes

8bit Signed

No

16bit Unsigned

Yes

16bit Signed

Yes

32bit Unsigned

No

32bit Signed

No

32bit Float

Yes

64bit Float

No

Input/Output dependency

Property

Input == Output

Data Layout

Yes

Data Type

No (output can be the same or float32).

Channels

Yes

Width

No

Height

No

Samples

Yes

Parameters:
  • handle[in] Handle to the operator.

    • Must not be NULL.

  • stream[in] Handle to a valid CUDA stream.

  • workspace[in] The workspace with memory for intermediate results. The requirements for a given input can be acquired with a call to cvcudaHQResizeTensorBatchGetWorkspaceRequirements or cvcudaHQResizeGetMaxWorkspaceRequirements.

  • in[in] The ImageBatchVarShape batch of input samples.

  • out[in] The ImageBatchVarShape batch of output samples.

  • minInterpolation[in] The type of interpolation to be used when downsampling an extent (i.e. when output extent is smaller than the corresponding input extent). Supported interpolation formats are: NVCV_INTERP_NEAREST, NVCV_INTERP_LINEAR, NVCV_INTERP_CUBIC, NVCV_INTERP_LANCZOS, and NVCV_INTERP_GAUSSIAN.

  • magInterpolation[in] The type of interpolation to be used when upsampling an extent (i.e. when output extent is bigger than the corresponding input extent). Supported interpolation formats are: NVCV_INTERP_NEAREST, NVCV_INTERP_LINEAR, NVCV_INTERP_CUBIC, NVCV_INTERP_LANCZOS, and NVCV_INTERP_GAUSSIAN.

  • antialias[in] Whether to use antialiasing when downsampling. The value is ignored for minInterpolation = NVCV_INTERP_NEAREST.

  • roi[in] Optional region of interest for the input, in (D)HW layout. The roi can be described as a list of elements for each sample or a list containing a single element to be used for all the samples in the batch. If, for some axis, the low bound is bigger than the high bound, the image is flipped in that dimension.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Some parameter is outside valid range.

  • NVCV_ERROR_INTERNAL – Internal error in the operator, invalid types passed in.

  • NVCV_SUCCESS – Operation executed successfully.

NVCVStatus cvcudaHQResizeTensorBatchSubmit(NVCVOperatorHandle handle, cudaStream_t stream, const NVCVWorkspace *workspace, NVCVTensorBatchHandle in, NVCVTensorBatchHandle out, const NVCVInterpolationType minInterpolation, const NVCVInterpolationType magInterpolation, bool antialias, const HQResizeRoisF roi)

Executes the HQResize operation on the given cuda stream. This operation does not wait for completion.

Limitations:

Input, Output: Data Layout: NVCV_TENSOR_[D]HW[C]

Number of channels: Positive integer

Data Type

Allowed

8bit Unsigned

Yes

8bit Signed

No

16bit Unsigned

Yes

16bit Signed

Yes

32bit Unsigned

No

32bit Signed

No

32bit Float

Yes

64bit Float

No

Input/Output dependency

Property

Input == Output

Data Layout

Yes

Data Type

No (output can be the same or float32).

Channels

Yes

Width

No

Height

No

Samples

Yes

Parameters:
  • handle[in] Handle to the operator.

    • Must not be NULL.

  • stream[in] Handle to a valid CUDA stream.

  • workspace[in] The workspace with memory for intermediate results. The requirements for a given input can be acquired with a call to cvcudaHQResizeTensorBatchGetWorkspaceRequirements or cvcudaHQResizeGetMaxWorkspaceRequirements.

  • in[in] The TensorBatch of input samples.

  • out[in] The TensorBatch batch of output samples.

  • minInterpolation[in] The type of interpolation to be used when downsampling an extent (i.e. when output extent is smaller than the corresponding input extent). Supported interpolation formats are: NVCV_INTERP_NEAREST, NVCV_INTERP_LINEAR, NVCV_INTERP_CUBIC, NVCV_INTERP_LANCZOS, and NVCV_INTERP_GAUSSIAN.

  • magInterpolation[in] The type of interpolation to be used when upsampling an extent (i.e. when output extent is bigger than the corresponding input extent). Supported interpolation formats are: NVCV_INTERP_NEAREST, NVCV_INTERP_LINEAR, NVCV_INTERP_CUBIC, NVCV_INTERP_LANCZOS, and NVCV_INTERP_GAUSSIAN.

  • antialias[in] Whether to use antialiasing when downsampling. The value is ignored for minInterpolation = NVCV_INTERP_NEAREST.

  • roi[in] Optional region of interest for the input, in (D)HW layout. The roi can be described as a list of elements for each sample or a list containing a single element to be used for all the samples in the batch. If, for some axis, the low bound is bigger than the high bound, the image is flipped in that dimension.

Return values:
  • NVCV_ERROR_INVALID_ARGUMENT – Some parameter is outside valid range.

  • NVCV_ERROR_INTERNAL – Internal error in the operator, invalid types passed in.

  • NVCV_SUCCESS – Operation executed successfully.

Variables

int32_t extent[(3)]
int32_t ndim
int32_t numChannels
HQResizeTensorShapeI *shape
int32_t size
int32_t ndim
int32_t numChannels
float lo[(3)]
float hi[(3)]
int32_t size
int32_t ndim
HQResizeRoiF *roi
struct HQResizeTensorShapeI
#include <OpHQResize.h>
struct HQResizeTensorShapesI
#include <OpHQResize.h>
struct HQResizeRoiF
#include <OpHQResize.h>
struct HQResizeRoisF
#include <OpHQResize.h>