Function: dvpp_vpc_batch_crop_resize_make_border_async

Applicable Products

Product

Supported (√/x)

Ascend 950PR&950DT products

x

Atlas A3 products

√

Atlas A2 products

√

Atlas training products

x

Atlas inference products

√

Atlas 200I/500 A2 inference products

√

Description

Crops one or more ROIs from one or more input images, resizes each cropped image, pads each resized image, and loads each padded image to the output buffer. This API is asynchronous.

Prototype

  • C Prototype
    1
    aclError acldvppVpcBatchCropResizeMakeBorderAsync(acldvppChannelDesc *channelDesc, acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums, uint32_t size, acldvppBatchPicDesc *dstBatchPicDescs, acldvppRoiConfig *cropAreas[], acldvppBorderConfig *borderCfgs[], acldvppResizeConfig *resizeConfig, aclrtStream stream)
    
  • Python Function
    1
    ret = acl.media.dvpp_vpc_batch_crop_resize_make_border_async(dvpp_channel_desc, src_batch_pic_descs, roi_nums_list, dst_batch_pic_descs, crop_area_list, border_cfgs_list, resize_config, stream)
    

Parameters

Parameter

Description

dvpp_channel_desc

Int, pointer address of the channel description. The value must be the same as that of dvpp_channel_desc specified when a channel is created by calling acl.media.dvpp_create_channel.

src_batch_pic_descs

Int, pointer address of the description of batch input images.

  • Call acl.media.dvpp_create_batch_pic_desc to create the description of batch images.
  • Call acl.media.dvpp_get_pic_desc to obtain the description of a specified image.
  • Call the acl.media.dvpp_set_pic_desc APIs to set the image description (including the memory address, memory size, image format, and image resolution).

roi_nums_list

List, list of number of cropped images, up to 256.

The value of roi_nums_list is less than or equal to 256, which is the same as the value of batch_size in dst_batch_pic_descs. (roi_nums_list[0] + ... + roi_nums_list[size - 1] <= 256)

dst_batch_pic_descs

Int, pointer address of the description of batch output images.

  • Call acl.media.dvpp_create_batch_pic_desc to create the description of batch images.
  • Call acl.media.dvpp_get_pic_desc to obtain the description of a specified image.
  • Call the acl.media.dvpp_set_pic_desc APIs to set the image description (including the memory address, memory size, image format, and image resolution).

crop_area_list

List, list of the position of the cropping area.

  • Call acl.media.dvpp_create_roi_config to create an ROI configuration.
  • The number of elements in crop_area and paste_area is the same as that of batch_size in dst_batch_pic_descs.

border_cfgs_list

List, border configuration list.

  • The elements in the border_cfgs array match those in crop_areas with ordering preserved.
  • The border_type member can only be set to BORDER_CONSTANT or BORDER_REPLICATE.

resize_config

Int, pointer address of the image resizing configuration data.

Call acl.media.dvpp_create_resize_config to create the image resizing configuration in advance.

stream

Int, stream object.

Return Values

Return Value

Description

ret

Int, error code: 0 on success; else, failure.

Constraints

Version

Restrictions

Atlas inference products

  • Input image size and format:
    • When the input image size is in the range of [10 x 6, 4096 x 4096], the input image formats described in Restrictions on Image Formats, Width and Height Alignment, and Buffers are supported.
    • When the width or height of the input image is in the range of (4096, 8192], the supported formats are as follows:
      The following enum values of acldvppPixelFormat are supported:
      PIXEL_FORMAT_YUV_400 = 0,               // YUV400 8bit
      PIXEL_FORMAT_YUV_SEMIPLANAR_420 = 1,    // YUV420SP NV12 8bit   
      PIXEL_FORMAT_YVU_SEMIPLANAR_420 = 2,    // YUV420SP NV21 8bit 
      PIXEL_FORMAT_YUV_SEMIPLANAR_422 = 3,    // YUV422SP 8bit
      PIXEL_FORMAT_YVU_SEMIPLANAR_422 = 4,    // YVU422SP 8bit
      PIXEL_FORMAT_YUV_SEMIPLANAR_444 = 5,    // YUV444SP 8bit
      PIXEL_FORMAT_YVU_SEMIPLANAR_444 = 6,    // YVU444SP 8bit
      PIXEL_FORMAT_YUYV_PACKED_422 = 7,       // YUV422Packed YUYV 8bit
      PIXEL_FORMAT_UYVY_PACKED_422 = 8,       // YUV422Packed UYVY 8bit
      PIXEL_FORMAT_YVYU_PACKED_422 = 9,       // YUV422Packed YVYU 8bit
      PIXEL_FORMAT_VYUY_PACKED_422 = 10,      // YUV422Packed VYUY 8bit
  • For details about the output image resolution and format, see Restrictions on Image Formats, Width and Height Alignment, and Buffers.
  • For details about the constraints on the width and height alignment, buffer size, and image format, see Restrictions on Image Formats, Width and Height Alignment, and Buffers.
  • When the input and output images are in ARGB8888, ABGR8888, RGBA8888, or BGRA8888 format, the A component value changes to 0 after being resized by this API.
  • For details about the description and constraints on calling this API to implement proportional resizing, see Restrictions on Image Cropping and Pasting.
  • Due to constraints on downsampling of YUV images, when the output image format is YUV420SP or YUV422SP, note the following:
    • For the YUV420SP output format, it is recommended that the border lengths at the top, bottom, left, and right of the image be even numbers.
    • For the YUV422SP output format, it is recommended that the border lengths at the left and right of the image be even numbers.

Atlas A2 products

Atlas 200I/500 A2 inference products

Atlas A3 products

  • For details about the constraints on the image resolution, image format, width and height alignment, and buffer size, see Restrictions on Image Formats, Width and Height Alignment, and Buffers.
  • When the input and output images are in ARGB8888, ABGR8888, RGBA8888, or BGRA8888 format, the A component value changes to 0 after being resized by this API.
  • For details about the description and constraints on calling this API to implement proportional resizing, see Restrictions on Image Cropping and Pasting.
  • Due to constraints on downsampling of YUV images, when the output image format is YUV420SP or YUV422SP, note the following:
    • For the YUV420SP output format, it is recommended that the border lengths at the top, bottom, left, and right of the image be even numbers.
    • For the YUV422SP output format, it is recommended that the border lengths at the left and right of the image be even numbers.