Functions and Restrictions

Description

JPEG Encoder (JPEGE) encodes YUV images into JPEG images, for example, .jpg images.

Resolution Restrictions

  • Input resolution range:

    Version

    Resolution Range

    Atlas training product

    Atlas inference product

    Atlas A2 training product/Atlas A2 inference product

    Atlas A3 training product/Atlas A3 inference product

    32 x 32 to 8192 x 8192

    Atlas 200I/500 A2 inference product

    32 x 32 to 16384 x 16384

  • Output resolution range:

    JPEGE only encodes 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

To implement JPEGE image encoding, you need to call the acl.media.dvpp_malloc API to allocate the input and output buffers on the device, and call the acl.media.dvpp_free API to free the input and output buffers. The lifecycle of the buffers is managed by the user.

  • For details about the input buffer size, see the formula in the following table.
  • The output buffer size is the actual size of space occupied by the encoded image, and can be predicted by calling acl.media.dvpp_jpeg_predict_enc_size.

For details about the input image format, see acldvppPixelFormat. For details about the width stride and height stride, see Terminology.

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

Input Format

Input Width and Height

Input Width Stride, Height Stride, and Buffer Size

Output Format

YUV420SP NV12 8-bit

Width: Must be a multiple of 2.

Height: Must be a multiple of 2.

Width stride: Round up the width to the nearest multiple of 16 or any multiple of 16, for example, 128 (which offers better performance).

The height stride supports the following configurations:

  • Set it to the height of the input image.
  • Round up the input height to the nearest multiple of 16 (at least 32),

    for example, when the JPEGE input comes from the JPEGD output whose height is rounded up to the nearest multiple of 16.

Buffer size (in bytes) = Width stride x Height stride x 3/2

JPEG, for example, .jpg.

Only Huffman coding is supported. Arithmetic coding and progressive coding are not supported.

YUV420SP NV21 8-bit

YUV422 Packed YUYV 8-bit

Width: Must be a multiple of 2.

Height: No alignment requirement.

Width stride: Double the width and then round up the result to the nearest multiple of 16.

The height stride supports the following configurations:

  • Set it to the height of the input image.
  • Round up the input height to the nearest multiple of 16 (at least 32),

    for example, when the JPEGE input comes from the JPEGD output whose height is rounded up to the nearest multiple of 16.

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

YUV422 Packed UYVY 8-bit

YUV422 Packed YVYU 8-bit

YUV422 Packed VYUY 8-bit