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

Input and Output Memory

For details about the HIAI_DMalloc/HIAI_DFree and HIAI_DVPP_DMalloc/HIAI_DVPP_DFree APIs as well as the graph configuration file (receive_memory_without_dvpp parameter), see Matrix API Reference.

Table 1 Memory requirements

Module

Input Memory

Output Memory

VPC

Use the APIs provided by Matrix to allocate or free memory.

  • Use HIAI_DVPP_DMalloc to allocate memory, which must meet the DVPP requirement (the start address of the memory must be 16-byte aligned).
  • Use HIAI_DVPP_DFree to free memory.

Use the APIs provided by Matrix to allocate or free memory.

  • Use HIAI_DVPP_DMalloc to allocate memory, which must meet the DVPP requirement (the start address of the memory must be 16-byte aligned).
  • Use HIAI_DVPP_DFree to free memory.

JPEGE and JPEGD

Use the APIs provided by Matrix to allocate or free memory.

  • Use HIAI_DVPP_DMalloc to allocate memory, which must meet the DVPP requirement (the start address of the memory must be 128-byte aligned).
  • Use HIAI_DVPP_DFree to free memory.
  • If the output memory is specified by the user, it should also be freed by the user. Use the APIs provided by Matrix to allocate or free memory.
    • Use HIAI_DVPP_DMalloc to allocate memory, which must meet the DVPP requirement (the start address of the memory must be 128-byte aligned). Before memory allocation, call DvppGetOutParameter to obtain the output memory size.
    • Use HIAI_DVPP_DFree to free memory.
  • If the output memory is not specified by the user, DVPP allocates the memory internally. The cbFree() callback function in the JPEGE or JPEGD output parameter structure should be called to free the memory and set the memory address pointer to null.

PNGD

Use the APIs provided by Matrix to allocate or free memory.

  • Use HIAI_DVPP_DMalloc to allocate memory, which must meet the DVPP requirement (the start address of the memory must be 128-byte aligned).
  • Use HIAI_DVPP_DFree to free memory.
If the output memory is specified by the user, it should also be freed by the user. Use the APIs provided by Matrix to allocate or free memory.
  • Use HIAI_DVPP_DMalloc to allocate memory, which must meet the DVPP requirement (the start address of the memory must be 128-byte aligned). Before memory allocation, call DvppGetOutParameter to obtain the output memory size.
  • Use HIAI_DVPP_DFree to free memory.

VDEC and VENC

There is no requirement on the memory. Native APIs such as malloc/free and new/delete can be called to allocate or free the memory. The HIAI_DMalloc/HIAI_DFree and HIAI_DVPP_DMalloc/HIAI_DVPP_DFree APIs provided by Matrix can also be called to allocate or free the memory. The receive_memory_without_dvpp parameter provided by Matrix can be used to control whether the memory is used by DVPP.

The HFBC data output by the VDEC is directly used as the input of the VPC.

The VENC output memory is internally managed by the DVPP. You can copy the data in the output memory when using the VENC.