vpc_pyrdown

Applicability

Product

Supported

Atlas 350 Accelerator Card

x

Atlas A3 training product/Atlas A3 inference product

x

Atlas A2 training product/Atlas A2 inference product

x

Atlas training product

x

Atlas inference product

Atlas 200I/500 A2 inference product

x

Description

Downsamples an image using a pyramid. Only YUV400 format images are supported. This API is asynchronous.

Prototype

  • C Prototype
    1
    hi_s32 hi_mpi_vpc_pyrdown(hi_vpc_chn chn,  const hi_vpc_pic_info *source_pic, hi_vpc_pic_info dest_pic[], hi_u32 filter_level, hi_s8 gaussian_filter[][5], hi_u16 divisor, hi_vpc_make_border_info make_border_info, hi_u32 *task_id, hi_s32 milli_sec);
    
  • Python Function
    1
    task_id, ret = acl.himpi.vpc_pyrdown(chn, source_pic, dest_pic, filter_level, gaussian_filter, divisor, make_border_info, milli_sec)
    

Parameters

Parameter

Description

chn

Int, channel ID for image processing.

Atlas inference product: The value range is [0, 256). The maximum number of channels is 256.

source_pic

Dict, input image information. For details, see hi_vpc_pic_info. Only YUV400 format images are supported. The allowed maximum resolution is 2048 x 2048. The allowed minimum resolution varies with filter_level as follows:
  • If filter_level = 1, the allowed minimum resolution is 20 x 12.
  • If filter_level = 2, the allowed minimum resolution is 40 x 24.
  • If filter_level = 3, the allowed minimum resolution is 80 x 48.
  • If filter_level = 4, the allowed minimum resolution is 160 x 96.

dest_pic

dict, destination image information. For details, see hi_vpc_pic_info. The length of this array must be the same as the value of filter_level.
  • dest_pic[0] stores the image whose width and height are reduced to 1/2 of the original image.
  • dest_pic[1] stores the image whose width and height are reduced to 1/4 of the original image.
  • dest_pic[2] stores the image whose width and height are reduced to 1/8 of the original image.
  • dest_pic[3] stores the image whose width and height are reduced to 1/16 of the original image.

filter_level

Int, number of layers in the pyramid. Must be in the range of [1, 4].

gaussian_filter

List, Gaussian filtering parameter. A 5 x 5 list needs to be passed. You can pass None to use the default value. For details, see the following.
gaussian_filter = [
    [1, 4,  6,  4,  1],
    [4, 16, 24, 16, 4],
    [6, 24, 36, 24, 6],
    [4, 16, 24, 16, 4],
    [1, 4,  6,  4,  1]
]

divisor

Int, a divisor of the filter. Must be a power of 2.

make_border_info

Dict, border information. For details, see hi_vpc_make_border_info. A border with a length of 2 pixels is created. The supported border types are HI_BORDER_CONSTANT, HI_BOARD_REPLICATE, and HI_BOARD_REFLECT.

milli_sec

Int, timeout interval, in milliseconds.

Return Value

Return Value

Description

ret

Int, error code.
  • 0 indicates success.
  • Other values indicate failure. For details, see VPC Return Codes.

task_id

Int, task ID, used to identify a task.