PNGD Functions and Restrictions

Function Description

PNG Decoder (PNGD) decodes PNG images.

PNGD can decode images based on the source image format. That is, the image encoding formats before and after decoding must be the same. For example, if the input image format is RGB, the output image format is RGB888. When the PNGD decoding API is called, the output image format is set to PIXEL_FORMAT_UNKNOWN. By default, the output format is the same as the source image format.

Source picture format decoding refers to.

Resolution Restrictions

  • Input resolution range

    32 × 32 to 4096 × 4096

  • Output resolution range:

    PNGD only decodes images and does not change the image resolution. Therefore, the resolution of the output image is the same as that of the input image.

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

When the image decoding function is implemented, the acldvppMalloc API needs to be called to allocate the input and output buffers on the device, and the acldvppFree API needs to be called to release the input and output buffers. The lifecycle of the buffers is managed by the user.

  • The size of the input buffer is the size of space occupied by the input image.
  • The size of the output buffer can be estimated by calling the acldvppPngPredictDecSize API.

For details about the definition of the output image format, see acldvppPixelFormat. For details about the concepts such as width stride and height stride, see Terminology.

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

Input formats:

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 128 and multiply the result by 3.

Height stride: Round up the height to the nearest multiple of 16.

The size of the output buffer can be estimated by calling the acldvppPngPredictDecSize API.

GRAY

RGB888

No alignment requirement.

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

Height stride: Round up the height to the nearest multiple of 16.

The size of the output buffer can be estimated by calling the acldvppPngPredictDecSize API.

RGBA

RGB888

No alignment requirement.

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

Height stride: Round up the height to the nearest multiple of 16.

The size of the output buffer can be estimated by calling the acldvppPngPredictDecSize API.

RGBA

RGBA8888 8bit

No alignment requirement.

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

Height stride: Round up the height to the nearest multiple of 16.

The size of the output buffer can be estimated by calling the acldvppPngPredictDecSize API.

AGRAY

RGB888

No alignment requirement.

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

Height stride: Round up the height to the nearest multiple of 16.

The size of the output buffer can be estimated by calling the acldvppPngPredictDecSize API.

AGRAY

RGBA8888 8bit

No alignment requirement.

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

Height stride: Round up the height to the nearest multiple of 16.

The size of the output buffer can be estimated by calling the acldvppPngPredictDecSize API.