Functions and Restrictions

Function Description

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

Resolution Restrictions

Input image resolution range

Model

Resolution Range

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas inference products

Atlas training products

32 × 32 to 8192 × 8192

Atlas 200I/500 A2 inference products

32 × 32 to 16384 × 16384

Output image resolution range

JPEGE encodes images without changing the image resolution. Therefore, the output image resolution is the same as the input image resolution.

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

To implement the JPEGE function:

  • Call acldvppMalloc and acldvppFree to allocate and free the input and output buffers on the device. The buffer lifetime is managed by the user.
    • The input buffer size refers to the size of the buffer used for storing the input image. For details, see the formulas in the table below.
    • The output buffer size is the actual size of space occupied by the encoded image, and can be predicted by calling acldvppJpegPredictEncSize.
  • The table below lists the supported input image formats.

    For details about the definitions of the input image formats, see acldvppPixelFormat.

  • The table below lists the requirements on the input width stride and height stride.

    For details about the width stride and height stride, see Terminology.

  • The output image is in JPEG format, for example, .jpg. Only Huffman coding is supported. Arithmetic coding and progressive coding are not supported.
Table 1 Restrictions on the input image format, width and height alignment, and buffer size

Input Image Format

Input Width and Height Alignment

Input Width Stride and Height Stride

Input Buffer Size

YUV420SP NV12 8-bit

YUV420SP NV21 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).

Height stride: Retain the input height. Alternatively, round up the input height to the nearest multiple of 16 (at least 32), which can be used when the JPEGD output image is directly used as the JPEGE input (the height of the JPEGD output image is rounded up to the nearest multiple of 16).

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

YUV422 Packed YUYV 8-bit

YUV422 Packed UYVY 8-bit

YUV422 Packed YVYU 8-bit

YUV422 Packed VYUY 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.

Height stride: Retain the input height. Alternatively, round up the input height to the nearest multiple of 16 (at least 32), which can be used when the JPEGD output image is directly used as the JPEGE input (the height of the JPEGD output image is rounded up to the nearest multiple of 16).

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