acldvppWarpAffine
Applicability
|
Product |
Supported |
|---|---|
|
|
√ |
|
|
√ |
|
|
x |
|
|
x |
|
|
x |
Function Usage
Description: performs affine transformation on images.
Prototype
Each operator has two-phase API calls. First, acldvppWarpAffineGetWorkspaceSize is called to calculate the required workspace size based on the computation process. Then, acldvppWarpAffine is called to perform computation. The two-phase APIs are as follows:
- First-phase API:
1acldvppStatus acldvppWarpAffineGetWorkspaceSize(const aclTensor *self, const aclFloatArray* matrix, uint32_t interpolationMode, uint32_t paddingMode, const aclFloatArray* fill, aclTensor *out, uint64_t *workspaceSize, aclOpExecutor **executor)
- Second-phase API:
1acldvppStatus acldvppWarpAffine(void* workspace, uint64_t workspaceSize, aclOpExecutor* executor, aclrtStream stream)
acldvppWarpAffineWorkspaceSize
- Parameters:
- self: input tensor of the operator, which is of the aclTensor type created by calling aclCreateTensor (the tensor data is stored on the device). The value of dataType of the input tensor can be UINT8 or FLOAT, the value of Format can be NCHW or NHWC, and non-contiguous tensors are not supported. The value of N can be 1 or left empty, and the value of C can be 1 or 3 (1: input GRAY image; 3: input RGB image).
- matrix: a one-dimensional array whose length is 6. The array stores 2 x 3 affine transformation matrix data in sequence.
A data storage example is as follows:

- interpolationMode: resizing algorithm. The options are as follows:
- 0: bilinear
- 1: nearest neighbour
- paddingMode: padding mode. The options are as follows:
- 0: CONSTANT, indicating that a constant pad value will be used.
- 1: EDGE, indicating repeating of the last element. For example, aaaaaa|a*****h|hhhhhhh, where * indicates any image element.
- fill: an array with the length of 3, used to set the value to be filled in each channel. This parameter is of the aclFloatArray type created by calling aclCreateFloatArray. This parameter is valid only when paddingMode is set to CONSTANT. If C is set to 1 (indicating a GRAY image), set fill[0]. If C is set to 3 (indicating an RGB image), set fill[0] for color red, fill[1] for color green, and fill[2] for color blue.
- out: output tensor of the operator, which is of the aclTensor type created by calling aclCreateTensor (the tensor data is stored on the device). The value of dataType of the output tensor can be UINT8 or FLOAT, the value of Format can be NCHW or NHWC, and non-contiguous tensors are not supported. The value of N can only be 1, the value of C can be 1 or 3 (1: GRAY image; 3: RGB image), the values of dataType and Format must be the same as those of self, and the sizes of the C axis and N axis in Shape must be the same as those of self.
- workspaceSize: size of the workspace to be allocated on the device.
- executor: operator executor, containing the operator computation process.
- Returns:
acldvppStatus status code. For details, see acldvpp Return Codes.
acldvppWarpAffine
- Parameters:
- workspace: address of the device memory allocated by calling aclrtMalloc. The size of the device memory is specified by workspaceSize.
- workspaceSize: The value must be the same as that obtained by calling acldvppWarpAffineGetWorkspaceSize.
- executor: op executor, which contains the operator computation process and is the same as the executor of the acldvppWarpAffineGetWorkspaceSize API.
- stream: stream for executing a task, which can be a created stream for saving resources or newly created by calling aclrtCreateStream.
- Returns:
acldvppStatus status code. For details, see acldvpp Return Codes.
Constraints
- The supported image resolution ranges from 6 x 4 to 32768 x 32768.
- The size of the transformation matrix is 2 x 3.
- The width and height of the input must be the same as those of the output.