Functions and Restrictions

For the Ascend 310 AI Processor, this function is not supported in the current version.

For the Ascend 910 AI Processor, this function is not supported in the current version.

Description

PNG Decoder (PNGD) decodes PNG images using hardware.

PNGD supports retaining the source image format during image decoding. That is, the image encoding formats before and after decoding remain consistent. For example, if the source format is RGB, the destination format is RGB888.

If the source format of the PNG image is unknown, you can preserve the source format in either of the following methods:

Resolution Restrictions

Restrictions on Image Formats, Width and Height Alignment, and Buffers

During image decoding, hi_mpi_dvpp_malloc and hi_mpi_dvpp_free are called to allocate and free the input and output buffers on the device. The buffer lifetime is managed by the user.

Table 1 Restrictions on the image format, width and height alignment, and buffer size

Input Image Format

Output Format

Output Width and Height

Output Width Stride, Height Stride, and Buffer Size

RGB

RGB888

No alignment requirement.

Width stride: Round up the width to the nearest multiple of 1, 16, or 128 and multiply the result by 3.

Value range of the height stride: [Height of the output image, Height of the output image rounded up to a multiple of 128]

Buffer size (in bytes) = Width stride x Height stride

GRAY

RGB888

RGBA

RGB888

Width stride: Round up the width to the nearest multiple of 1, 16, or 128 and multiply the result by 3.

Value range of the height stride: [Height of the output image, Height of the output image rounded up to a multiple of 128]

Buffer size (in bytes) = Width stride x Height stride

RGBA8888 8-bit

Width stride: Round up the width to the nearest multiple of 1, 16, or 128 and multiply the result by 4.

Value range of the height stride: [Height of the output image, Height of the output image rounded up to a multiple of 128]

Buffer size (in bytes) = Width stride x Height stride

AGRAY

RGB888

Width stride: Round up the width to the nearest multiple of 1, 16, or 128 and multiply the result by 3.

Value range of the height stride: [Height of the output image, Height of the output image rounded up to a multiple of 128]

Buffer size (in bytes) = Width stride x Height stride

RGBA8888 8-bit

Width stride: Round up the width to the nearest multiple of 1, 16, or 128 and multiply the result by 4.

Value range of the height stride: [Height of the output image, Height of the output image rounded up to a multiple of 128]

Buffer size (in bytes) = Width stride x Height stride

Other Restrictions

PNGD can decode only complete PNG images rather than data packets split from a PNG image.