Updated on 2022-03-13 GMT+08:00

JPEGD Parameters

Input Parameter: JpegdIn

Table 1 Input parameter JpegdIn

Member Variable

Description

unsigned char* jpegData

JPG input image data. The start address is 128-byte aligned and the buffer is allocated by using the 2 MB huge page table. In the same task, the virtual addresses of the input and output buffers must be in the same 4 GB space.

You are advised to allocate the buffer by calling HIAI_DVPP_DMalloc provided by Matrix. The allocated buffer must meet the DVPP requirements, that is, the buffer addresses of the input and output images must be in the same 4 GB space, and the start addresses must be 128-pixel aligned. For details about HIAI_DVPP_DMalloc, see Matrix API Reference.

NOTICE:

When HIAI_DVPP_DMalloc is used to allocate memory, ensure that the size of the allocated memory is the same as the value of the input parameter jpegDataSize.

uint32_t jpegDataSize

Length of the input buffer.

Use HIAI_DVPP_DMalloc provided by Matrix to allocate the buffer. The size of the allocated buffer is (Actual data size + 8 bytes). 8 bytes is the hardware restriction requirement.

bool isYUV420Need

Whether to output data in YUV420 semi-planar format.

  • true: Yes
  • false: No. The output is in original format.

The JPEGD supports raw format output (including YUV420SP, YUV422SP, and YUV444SP) and down-sampling YUV420 semi-planar output. YUV420 grayscale image output is in fake420 format.

bool isVBeforeU

Reserved. This parameter must be set to true. The V component is before the U component.

Output Parameter: JpegdOut

Table 2 Output parameter JpegdOut

Member Variable

Description

unsigned char* yuvData

Buffer for the output YUV data. The width and height of the image are values after alignment based on 128 x 16.

You are advised to allocate the buffer by calling HIAI_DVPP_DMalloc provided by Matrix. The allocated buffer must meet the DVPP requirements, that is, the buffer addresses of the input and output images must be in the same 4 GB space, and the start addresses must be 128-pixel aligned. For details about HIAI_DVPP_DMalloc, see Matrix API Reference.

NOTICE:

When HIAI_DVPP_DMalloc is used to allocate a buffer, ensure that the size of the allocated buffer is the same as the value of the input parameter yuvDataSize.

uint32_t yuvDataSize

Length of the output YUV data. The data length is calculated based on the aligned width and height or can be obtained by calling DvppGetOutParameter.

uint32_t imgWidth

Width of the output YUV image

uint32_t imgHeight

Height of the output YUV image

uint32_t imgWidthAligned

Width of the output image, which is 128-pixel aligned

uint32_t imgHeightAligned

Height of the output image, which is 16-pixel aligned

JpegCalBackFree cbFree

Callback function for freeing the output buffer

  • If the output buffer is specified by the user, it should also be freed by the user.
  • If the output buffer is not specified by the user, DVPP allocates the buffer internally. The cbFree() callback function should be called to free the buffer, and yuvData needs to be set to a null pointer. For details about the calling example, see Implementing the JPEGD Function.

jpegd_color_space outFormat

Format of the output YUV data.

enum jpegd_color_space{

DVPP_JPEG_DECODE_OUT_UNKNOWN = -1,

DVPP_JPEG_DECODE_OUT_YUV444 = 0,

DVPP_JPEG_DECODE_OUT_YUV422_H2V1 = 1,

/* YUV422 */

DVPP_JPEG_DECODE_OUT_YUV422_H1V2 = 2,

/* YUV440 */

DVPP_JPEG_DECODE_OUT_YUV420 = 3,

DVPP_JPEG_DECODE_OUT_YUV400 = 4,

DVPP_JPEG_DECODE_OUT_FORMAT_MAX,

};

Input Parameter: jpegd_raw_data_info

Table 3 Input parameter jpegd_raw_data_info

Member Variable

Description

unsigned char* jpeg_data

Data of the input JPG image. The start address is 128-byte aligned, and the 2 MB huge page table is used for allocation.

You are advised to allocate the buffer by calling HIAI_DVPP_DMalloc provided by Matrix. The allocated buffer must meet the DVPP requirements, that is, the buffer addresses of the input and output images must be in the same 4 GB space, and the start addresses must be 128-pixel aligned. For details about HIAI_DVPP_DMalloc, see Matrix API Reference.

NOTICE:

When HIAI_DVPP_DMalloc is used to allocate a buffer, ensure that the size of the allocated buffer is the same as the value of the input parameter jpeg_data_size.

uint32_t jpeg_data_size

Length of the input buffer.

Use HIAI_DVPP_DMalloc provided by Matrix to allocate the buffer. The size of the allocated buffer is (Actual data size + 8 bytes). 8 bytes is the hardware restriction requirement.

jpegd_raw_format in_format

YUV sampling format of the input image. Retain the default value.

enum jpegd_raw_format{

DVPP_JPEG_DECODE_RAW_YUV_UNSUPPORT = -1,

DVPP_JPEG_DECODE_RAW_YUV444 = 0,

DVPP_JPEG_DECODE_RAW_YUV422_H2V1 = 1, // 422

// YUV440 is not supported anymore. This field is reserved.

DVPP_JPEG_DECODE_RAW_YUV422_H1V2 = 2, // 440

DVPP_JPEG_DECODE_RAW_YUV420 = 3,

DVPP_JPEG_DECODE_RAW_MAX,

};

bool IsYUV420Need

Whether to output data in YUV420 semi-planar format.

  • true: Yes
  • false: No. The output is in original format.

The JPEGD supports raw format output (including YUV420SP, YUV422SP, and YUV444SP) and down-sampling YUV420 semi-planar output. YUV420 grayscale image output is in fake420 format.

bool isVBeforeU

Reserved. This parameter must be set to true. The V component is before the U component.

Output Parameter: jpegd_yuv_data_info

Table 4 Output parameter jpegd_yuv_data_info

Member Variable

Description

unsigned char* yuv_data

Buffer for the output YUV data. The width and height of the image are aligned values.

NOTICE:

The buffer is allocated and managed by DVPP and cannot be specified by users.

uint32_t yuv_data_size

Length of the output YUV data. The data length is calculated based on the aligned width and height.

uint32_t img_width

Width of the output YUV image

uint32_t img_height

Height of the output YUV image

uint32_t img_width_aligned

Width of the output image, which is 128-pixel aligned

uint32_t img_height_aligned

Height of the output image, which is 16-pixel aligned

JpegCalBackFree cbFree

Callback function for freeing the output buffer

DVPP internally allocates buffers. You need to call the cbFree() callback function to free buffers and set yuv_data to a null pointer. For details about the calling example, see Implementing the JPEGD Function.

enum jpegd_color_space out_format

Format of the output YUV data.

enum jpegd_color_space {

DVPP_JPEG_DECODE_OUT_UNKNOWN = -1,

DVPP_JPEG_DECODE_OUT_YUV444 = 0,

DVPP_JPEG_DECODE_OUT_YUV422_H2V1 = 1,// 422

// YUV440 is not supported anymore. This field is reserved.

DVPP_JPEG_DECODE_OUT_YUV422_H1V2 = 2,// 440

DVPP_JPEG_DECODE_OUT_YUV420 = 3,

DVPP_JPEG_DECODE_OUT_YUV400 = 4,

DVPP_JPEG_DECODE_OUT_FORMAT_MAX,

};