hbVPJPEGDecode

int32_t hbVPCreateJPEGDecContext(hbVPJPEGContext *context, uint32_t outBufCount, uint8_t imageFormat);

Creates the decoder context API and initialize context to nullptr in advance before creation.

  • Parameter
    • [out] context The decoder context.
    • [in] outBufCount The count of JPU internal output buffers. The range of values is [1, 31], typically set to 5.
    • [in] imageFormat Output picture format. imageFormat supports HB_VP_IMAGE_FORMAT_NV12, HB_VP_IMAGE_FORMAT_YUV420, HB_VP_IMAGE_FORMAT_YUV444 and HB_VP_IMAGE_FORMAT_YUV444_P format.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.
  • Description of interface limitations
    • Due to hardware limitations, encoding requires alignment, and the decoded data will also follow the alignment requirements used during encoding. Specifically, the alignment method used during encoding (16x16 or 8x8) directly determines the decoded resolution, aligning it to multiples of 16x16 or 8x8.
    • JPU supports the creation of contexts for the highest 64-way encoding or decoding.
    • JPU only support 8bit data decoding.
int32_t hbVPReleaseJPEGDecContext(hbVPJPEGContext context);

Release the decoder context API.

  • Parameter
    • [in] context The decoder context.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.
int32_t hbVPJPEGDecode(hbUCPTaskHandle_t *taskHandle,
                       hbVPArray const *srcBuf,
                       hbVPJPEGContext context);

The API for calling the JPEG decoding.

  • Parameter
    • [out] taskHandle Task handles are responsible for the interaction of the operator with the UCP architecture.
    • [in] srcBuf Input JPEG file.
    • [in] context The decoder context.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.
  • Description of interface limitations
    • When JPEG decoding, if the decoding format is HB_VP_IMAGE_FORMAT_YUV444, the input JPEG data is required to be in the format of HB_VP_IMAGE_FORMAT_YUV444 or HB_VP_IMAGE_FORMAT_YUV444_P.
    • When decoding JPEG images, the supported resolution range is 32x32 to 8192x8192 pixels, and the input image size must fall within the range of [1024, 10 * 1024 * 1024] bytes.
    • Only asynchronous task creation is supported.
    • To avoid wasting system resources and improve JPU decoding performance, it is recommended to reuse input addresses.
int32_t hbVPGetJPEGDecOutputBuffer(hbVPImage *outImg, 
                                   hbUCPTaskHandle_t taskHandle);

The API for calling the JPEG decoding output buffer.

  • Parameter
    • [out] outImg Output YUV Image.
    • [in] taskHandle Task handles are responsible for the interaction of the operator with the UCP architecture.
  • Return Value
    • Return 0 means the API was successfully executed, otherwise the execution failed.
  • Description of interface limitations
    • The Image buffer outImg is allocated internally by the JPU.
    • The buffer contains valid data upon the task is successfully completed, and is released during the task release phase.