acl.himpi.vpc_pyrdown

C Prototype

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

task_id, ret = acl.himpi.vpc_pyrdown(chn, source_pic, dest_pic, filter_level, gaussian_filter, divisor, make_border_info, milli_sec)

Function Usage

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

The Atlas 200/300/500 Inference Product does not support this API in the current version.

The Atlas Training Series Product does not support this API in the current version.

Input Description

chn: int, image processing channel ID.

Atlas inference products: The value range of this parameter 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, target image information. For details, see hi_vpc_pic_info. The length of this array is the same as that of the filter_level parameter.
  • 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: 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 paddidng 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 (ms).
  • -1: blocking mode.
  • 0: non-blocking mode.
  • > 0: timeout interval (timeout mode). The timeout interval varies with the operating system. The deviation is generally within a time slice of an operating system. For example, if the time slice of an operating system is 4 ms and the value of milli_sec is set to 1, the actual timeout interval ranges from 1 ms to 5 ms. When the CPU load is high, the timeout interval may fluctuate.

Return Value

ret: int, error code.

task_id: int, task ID, used to identify a task.