png_get_image_info

Applicability

Product

Supported/Unsupported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas training product

x

Atlas inference product

Atlas 200I/500 A2 inference product

Description

Obtains the width, height, and source format of the input PNG image, the width stride and height stride of the output image, as well as the required buffer size based on the input stream.

Prototype

  • C Prototype
    1
    hi_s32 hi_mpi_png_get_image_info(const hi_img_stream *png_stream, hi_img_info *img_info)
    
  • Python Function
    1
    img_info, ret = acl.himpi.png_get_image_info(png_stream)
    

Parameters

Parameter

Description

png_stream

Dict, input stream information. For details, see hi_img_stream.

In Ascend EP form, when this API is called on the host, the configured addr must be a buffer address on the host.

Return Value

Return Value

Description

img_info

Dict, image information dictionary. For details, see hi_img_info.

ret

Int, error code.

  • 0 indicates success.
  • Other values indicate failures. For details, see PNGD Return Codes.

Restrictions

This API is provided to calculate the size of the buffer occupied by the decoded output image. Currently, only PNG images can be parsed. The obtained width_stride and height_stride must be rounded up to the nearest multiples of 128 and 16, respectively.