K230 System Control API Reference#
Overview#
Overview#
System control performs the reset and basic initialization of various hardware components according to the characteristics of the K230 chip, and is also responsible for the initialization and de-initialization of the MPP (Media Process Platform) system memory management, log management, binding management, and other modules.
Feature Description#
Video Buffer Pool#
The video buffer pool is a group of buffers (rather than a single one), mainly provided for multimedia hardware devices and circulated between multimedia hardware devices. Buffer pools are divided into public buffer pools and private buffer pools. Public buffer pools are mainly for VI. Before use, the size of the buffer block must be determined according to the VI image parameters, and then a certain number of buffer blocks are requested to form a buffer pool. In general, for the original image input by VI, the size of one frame corresponds to the size of one buffer block, and multiple buffer blocks provide a multi-frame buffer mechanism for VI. At the same time, these public buffer blocks can also be used by VO or VENC. Private buffer pools often represent that the data stored in memory is closely related to the multimedia device itself. For example, the encoded stream data is quite different from the video stream composed of actual image pixels. These streams are only available to the codec, and VB provides dedicated buffer pools for these devices. The figure below shows the process of virtual VI and virtual VO using VB for buffer block circulation.

System Binding#
System binding establishes an association between a data receiver and a data source by binding the data source (only the data receiver is allowed to bind the data source). After binding, the data generated by the data source will be automatically sent to the receiver. The main voice and video processing of K230 is divided into several major modules as follows:
Voice: Audio Input (AI for short), Audio Encoder (AENC for short), Audio Decoder (ADEC for short), Audio Output (AO for short)
Image: Video Input (VI for short), Video Encoder (VENC for short), Image Rotation (completed by GSDMA, DMA for short), Depth Process Unit (DPU for short), Video Decoder (VDEC for short), Video Output (VO for short), Virtual Video Input (VVI for short), Virtual Video Output (VVO for short)
The binding relationships supported by K230 are as follows
Table 1-1 System Binding Relationships
Video Binding Relationships
Data Source \ Data Receiver |
GSDMA |
VO |
DPU |
VENC |
Description |
|---|---|---|---|---|---|
VI (Video Input) |
✓ |
✓ |
✓ |
✓ |
VI data can be sent to GSDMA for rotation, VO for display, DPU for processing, VENC for encoding |
GSDMA (Image Rotation) |
✗ |
✓ |
✓ |
✓ |
GSDMA processed data can be sent to VO for display, DPU for processing, VENC for encoding |
VDEC (Video Decoder) |
✓ |
✓ |
✗ |
✗ |
VDEC data can be sent to GSDMA for rotation, VO for display (local playback) |
DPU (Depth Process Unit) |
✗ |
✗ |
✗ |
✗ |
DPU is the endpoint of video data, binding relationship is not supported |
VENC (Video Encoder) |
✗ |
✗ |
✗ |
✗ |
Binding relationship is not supported |
VO (Video Display) |
✗ |
✗ |
✗ |
✗ |
VO is the endpoint of video data, binding relationship is not supported |
VVI (Virtual Video Input) |
✓ |
✓ |
✓ |
✓ |
Virtual video input supports the same binding relationships as VI |
VVO (Virtual Video Output) |
✗ |
✗ |
✗ |
✗ |
VVO is the endpoint of virtual video data, binding relationship is not supported |
Audio Binding Relationships
Data Source \ Data Receiver |
AREC |
AENC |
AO |
Description |
|---|---|---|---|---|
AI (Audio Input) |
✓ |
✓ |
✓ |
AI data can be sent to AREC for speech recognition, AENC for audio encoding, AO for playback |
ADEC (Audio Decoder) |
✗ |
✗ |
✓ |
ADEC processed data can be played directly |
AENC (Audio Encoder) |
✗ |
✗ |
✗ |
Binding relationship is not supported |
AO (Audio Output) |
✗ |
✗ |
✗ |
AO is the endpoint of audio data, binding relationship is not supported |
API Reference#
Multimedia Memory Management#
This function module provides the following APIs:
kd_mpi_sys_mmz_alloc#
【Description】
Allocate MMZ memory in user space.
【Syntax】
k_s32 kd_mpi_sys_mmz_alloc(k_u64* phy_addr, void** virt_addr, const k_char* mmb, const k_char* zone, k_u32 len);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
phy_addr |
Physical address pointer. |
Output |
virt_addr |
Pointer to a virtual address pointer. |
Output |
mmb |
String pointer of the Mmb name. |
Input |
zone |
String pointer of the MMZ zone name. |
Input |
len |
Memory block size. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None.
【Requirements】
Header file: mpi_sys_api.h
Library file: libsys.a
【Note】
MMZ consists of multiple zones, and each zone has multiple MMBs. You can call this MPI to allocate a memory block of size len in the MMZ of *zone named *mmb. In this case, pointers to the physical address and user-mode virtual address are returned. If there is an anonymous region in the MMZ, set *zone to null. If *mmb is set to null, the created MMB is named null.
【Example】
None
【Related Topics】
None
kd_mpi_sys_mmz_alloc_cached#
【Description】
Allocate MMZ memory with cache in user space.
【Syntax】
k_s32 kd_mpi_sys_mmz_alloc_cached(k_u64* phy_addr, void** virt_addr, const k_char* mmb, const k_char* zone, k_u32 len);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
phy_addr |
Physical address pointer. |
Output |
virt_addr |
Pointer to a virtual address pointer. |
Output |
mmb |
String pointer of the Mmb name. |
Input |
zone |
String pointer of the MMZ zone name. |
Input |
len |
Memory block size. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h
Library file: libsys.a
【Note】
The difference between kd_mpi_sys_mmz_alloc_cached and kd_mpi_sys_mmz_alloc: the memory allocated by calling kd_mpi_sys_mmz_alloc_cached supports caching. If the memory to be allocated will be frequently used, it is recommended to use kd_mpi_sys_mmz_alloc_cached. This can improve CPU read/write efficiency and system performance.
When the CPU accesses the memory allocated by this interface, the data in the memory will be placed in the cache. If the hardware device can only access the physical memory instead of the cache, in this case kd_mpi_sys_mmz_flush_cache needs to be called to synchronize the data.
【Example】
None
【Related Topics】
None
kd_mpi_sys_mmap#
【Description】
Memory mapping interface.
【Syntax】
void *kd_mpi_sys_mmap(k_u64 phy_addr, k_u32 size);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
phy_addr |
Start address of the memory unit to be mapped. |
Input |
size |
Number of bytes to map. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Invalid address |
Non-0 |
Valid address |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h
Library file: libsys.a
【Note】
Only the physical address obtained by applying through MMZ can be mapped using this API.
If the address range belongs to a VB, the mapping size needs to be smaller than the VB pool size.
【Example】
None
【Related Topics】
kd_mpi_sys_mmap_cached#
【Description】
Memory mapping interface with cache.
【Syntax】
void *kd_mpi_sys_mmap_cached(k_u64 phy_addr, k_u32 size);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
phy_addr |
Start address of the memory unit to be mapped. |
Input |
size |
Number of bytes to map. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Invalid address |
Non-0 |
Valid address |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h
Library file: libsys.a
【Note】
Only the physical address obtained by applying through MMZ can be mapped using this API.
If the address range belongs to a VB, the mapping size needs to be smaller than the VB pool size.
【Example】
None
【Related Topics】
None
kd_mpi_sys_munmap#
【Description】
Memory mapping unmapping interface.
【Syntax】
void *kd_mpi_sys_munmap(void *virt_addr, k_u32 size);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
virt_addr |
Virtual address returned by mmap. |
Input |
size |
Number of bytes to map. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h
Library file: libsys.a
【Note】
None
【Example】
None
【Related Topics】
kd_mpi_sys_mmz_flush_cache#
【Description】
Flush the contents in the cache to memory and invalidate the contents in the cache.
【Syntax】
k_s32 kd_mpi_sys_mmz_flush_cache(k_u64 phy_addr, void* virt_addr, k_u32 size);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
phy_addr |
Start physical address of the data to be operated. |
Input |
virt_addr |
Start virtual address pointer of the data to be operated. Cannot be NULL. |
Input |
size |
Size of the data to be operated. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h
Library file: libsys.a
【Note】
If the data in the cache is the latest data, you need to call this MPI to synchronize the data to memory. This can ensure that hardware that cannot directly access the cache can obtain correct data.
kd_mpi_sys_mmz_alloc_cached must be called first, and then this MPI can be used.
If phy_addr is set to 0, it means to operate on the entire cache area. (Not yet supported)
You need to ensure that the transferred parameters are valid.
Make sure not to call kd_mpi_sys_mmz_free to release the memory being flushed during the flush operation. Otherwise, unpredictable exceptions may occur.
【Example】
None
【Related Topics】
kd_mpi_sys_mmz_free#
【Description】
Release MMZ memory in user mode.
【Syntax】
k_s32 kd_mpi_sys_mmz_free(k_u64 phy_addr, void* virt_addr);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
phy_addr |
Physical address. |
Input |
virt_addr |
Virtual address pointer. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h
Library file: libsys.a
【Note】
The input address must be a valid physical address, and the virtual address pointer can be set to NULL.
The memory being flushed cannot be released, otherwise unpredictable exceptions will occur.
【Example】
None
【Related Topics】
kd_mpi_sys_get_virmem_info#
【Description】
Obtain the corresponding memory information according to the virtual address, including physical address and cached attribute.
【Syntax】
k_s32 kd_mpi_sys_get_virmem_info(const void* virt_addr, k_sys_virmem_info* mem_info);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
virt_addr |
Virtual address pointer. |
Input |
mem_info |
Memory information corresponding to the virtual address, including physical address, cached attribute, etc. |
Output |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h k_mmz_comm.h
Library file: libsys.a
【Note】
The input must be a user-mode virtual address.
Cross-process use is not supported.
【Example】
None
【Related Topics】
kd_mpi_vb_set_config#
【Description】
Set MPP video buffer pool attributes.
【Syntax】
k_s32 kd_mpi_vb_set_config(const k_vb_config *config);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
config |
Pointer to video buffer pool attributes. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
The buffer pool attributes can only be set when the system is in an uninitialized state; otherwise, it will return failure.
The size of each buffer block in the public buffer pool should vary according to the current image pixel format and whether the image is compressed. For the specific allocation size, refer to the description in the k_vb_config structure.
【Example】
None
【Related Topics】
kd_mpi_vb_get_config#
【Description】
Obtain MPP video buffer pool attributes.
【Syntax】
k_s32 kd_mpi_vb_get_config(const k_vb_config *config);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
config |
Pointer to video buffer pool attributes. |
Output |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
kd_mpi_vb_set_config must be called first to set the MPP video buffer pool attributes, and then the attributes can be obtained.
【Example】
None
【Related Topics】
kd_mpi_vb_init#
【Description】
Initialize the MPP video buffer pool.
【Syntax】
k_s32 kd_mpi_vb_init(void);
【Parameters】
None
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
kd_mpi_vb_set_config must be called first to set the MPP video buffer pool attributes, and then the buffer pool can be initialized; otherwise, it will fail.
Initialization can be repeated without returning failure.
【Example】
None
【Related Topics】
kd_mpi_vb_exit#
【Description】
Deinitialize the MPP video buffer pool.
【Syntax】
k_s32 kd_mpi_vb_exit(void);
【Parameters】
None
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
Deinitialization will not clear the previous configuration of the buffer pool.
Deinitialization can be repeated without returning failure.
Before exiting the VB pool, please ensure that no VB in the VB pool is occupied; otherwise, it cannot be exited.
【Example】
None
【Related Topics】
kd_mpi_vb_create_pool#
【Description】
Create a video buffer pool.
【Syntax】
k_s32 kd_mpi_vb_create_pool(k_vb_pool_config *config);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
config |
Pointer to the buffer pool configuration attribute parameter. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
Non VB_INVALID_POOLID |
Valid buffer pool ID number. |
VB_INVALID_POOLID |
Buffer pool creation failed; the parameter may be illegal or the reserved memory is insufficient. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
None
【Example】
None
【Related Topics】
kd_mpi_vb_destory_pool#
【Description】
Destroy a video buffer pool.
【Syntax】
k_s32 kd_mpi_vb_destory_pool(k_u32 pool_id);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
pool_id |
Buffer pool ID number. Value range: [0, VB_MAX_POOLS). |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success. |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
Destroying a non-existent buffer pool will return the K_ERR_VB_UNEXIST error code.
Only buffer pools created by kd_mpi_vb_create_pool can be destroyed.
【Example】
None
【Related Topics】
kd_mpi_vb_get_block#
【Description】
Obtain a buffer block in user mode.
【Syntax】
k_vb_blk_handle kd_mpi_vb_get_block(k_u32 pool_id, k_u64 blk_size, const k_char *mmz_name);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
pool_id |
Buffer pool ID number. Value range: [0, VB_MAX_POOLS). |
Input |
blk_size |
Buffer block size. Value range: full data type range, in bytes. |
Input |
mmz_name |
Name of the DDR where the buffer pool is located. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
Non VB_INVALID_HANDLE |
Valid buffer block handle. |
VB_INVALID_HANDLE |
Failed to obtain buffer block. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
After creating a buffer pool, the user can call this interface to obtain a buffer block from the pool; that is, set the first parameter Pool to the created buffer pool ID. When obtaining a buffer block from the specified buffer pool, the parameter mmz_name is invalid.
If the user needs to obtain a buffer block of a specified size from any public buffer pool, the first parameter Pool can be set to an invalid ID number (VB_INVALID_POOLID), the second parameter blk_size can be set to the required buffer block size, and specify which DDR’s public buffer pool to obtain the buffer block from. If there is no public buffer pool on the specified DDR, the buffer block cannot be obtained. If mmz_name is equal to NULL, it means to obtain the buffer block from the public buffer pool on the anonymous DDR.
【Example】
None
【Related Topics】
kd_mpi_vb_release_block#
【Description】
Release a buffer block in user mode.
【Syntax】
k_s32 kd_mpi_vb_release_block(k_vb_blk_handle block);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
block |
VB block handle |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success. |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
After the obtained buffer block is used up, this interface should be called to release the buffer block.
【Example】
None
【Related Topics】
kd_mpi_vb_phyaddr_to_handle#
【Description】
Obtain the handle of a buffer block through its physical address in user mode.
【Syntax】
k_vb_blk_handle kd_mpi_vb_phyaddr_to_handle(k_u64 phys_addr);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
phys_addr |
Physical address |
Input |
【Return Value】
Return Value |
Description |
|---|---|
Non VB_INVALID_HANDLE |
Valid buffer block handle. |
VB_INVALID_HANDLE |
Failed to obtain buffer block handle. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
The physical address should be the address of a valid buffer block obtained from the MPP video buffer pool.
【Example】
None
【Related Topics】
None
kd_mpi_vb_handle_to_phyaddr#
【Description】
Obtain the physical address of a buffer block in user mode.
【Syntax】
k_u64 kd_mpi_vb_handle_to_phyaddr(k_vb_blk_handle block);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
block |
VB block handle |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Invalid return value, the buffer block handle is illegal. |
Non-0 |
Valid physical address. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
The specified buffer block should be a valid buffer block obtained from the MPP video buffer pool.
【Example】
None
【Related Topics】
None
kd_mpi_vb_handle_to_pool_id#
【Description】
Obtain the ID of the buffer pool where a frame buffer block resides in user mode.
【Syntax】
k_s32 kd_mpi_vb_handle_to_pool_id(k_vb_blk_handle block);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
block |
VB block handle |
Input |
【Return Value】
Return Value |
Description |
|---|---|
Non VB_INVALID_POOLID |
Valid buffer pool ID number. |
VB_INVALID_POOLID |
Failed to obtain the buffer pool ID. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
The specified buffer block should be a valid buffer block obtained from the MPP video buffer pool.
【Example】
None
【Related Topics】
None
kd_mpi_vb_inquire_user_cnt#
【Description】
Query the usage count information of a buffer block.
【Syntax】
k_s32 kd_mpi_vb_inquire_user_cnt(k_vb_blk_handle block);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
block |
VB block handle |
Input |
【Return Value】
Return Value |
Description |
|---|---|
K_FAILED |
Query failed. |
Other values |
Buffer block usage count value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
None.
【Example】
None
【Related Topics】
None
kd_mpi_vb_get_supplement_attr#
【Description】
Obtain the supplement information of VB Block memory.
【Syntax】
k_s32 kd_mpi_vb_get_supplement_attr(k_vb_blk_handle block, k_video_supplement *supplement);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
block |
VB block handle. |
Input |
supplement |
Supplement information of VB block memory, such as ISP information, DCF information, etc. |
Output |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
The DCF and ISP virtual address information saved in Supplement are kernel-mode virtual addresses.
【Example】
None
【Related Topics】
None
kd_mpi_vb_set_supplement_config#
【Description】
Set the supplement information of VB memory.
Description
Some information needs to be appended to the end of VB memory. For example, DCF information, ISP statistics information, some real-time parameters of ISP, etc. These supplement information can be passed along with VB memory in each MPP module. When the user mode obtains VB memory, it can also obtain this information.
【Syntax】
k_s32 kd_mpi_vb_get_supplement_config(k_vb_supplement_config *supplement_config);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
supplement_config |
VB memory supplement information control structure. Used to allocate memory for supplement information. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
Currently, 2 types of VB memory supplement information are supported:
DCF information, corresponding to the structure k_jpeg_dcf. The corresponding MASK is VB_SUPPLEMENT_JPEG_MASK.
ISP information, corresponding to the structure k_isp_frame_info. The corresponding MASK is VB_SUPPLEMENT_ISPINFO_MASK.
This interface needs to be called before kd_mpi_vb_init, otherwise the supplement information will not take effect.
【Example】
None
【Related Topics】
kd_mpi_vb_get_supplement_config#
【Description】
Obtain the supplement information of VB memory.
【Syntax】
k_s32 kd_mpi_vb_set_supplement_config(const k_vb_supplement_config *supplement_config);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
supplement_config |
VB memory supplement information control structure. Used to allocate memory for supplement information. |
Output |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
None
【Example】
None
【Related Topics】
kd_mpi_vb_set_supplement_config
kd_mpi_vb_set_mod_pool_config#
【Description】
Set the attributes of the module public video buffer pool.
【Syntax】
k_s32 kd_mpi_vb_set_mod_pool_config(k_vb_uid vb_uid, const k_vb_config *config);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
vb_uid |
Module ID that uses the module public video buffer pool. |
Input |
config |
Pointer to video buffer pool attributes. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
The configuration of the module public video buffer should be configured according to actual needs; otherwise, memory will be wasted.
If the module VB has been created, reconfiguring will return the error code KD_ERR_VB_BUSY.
【Example】
None
【Related Topics】
kd_mpi_vb_get_mod_pool_config#
【Description】
Obtain the attributes of the module public video buffer pool.
【Syntax】
k_s32 kd_mpi_vb_get_mod_pool_config(k_vb_uid vb_uid, k_vb_config *config);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
vb_uid |
Module ID that uses the module public video buffer pool. |
Input |
config |
Pointer to video buffer pool attributes. |
Output |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
kd_mpi_vb_set_mod_pool_config must be called first to set the module public video buffer pool attributes, and then the attributes can be obtained.
【Example】
None
【Related Topics】
kd_mpi_vb_init_mod_common_pool#
【Description】
Initialize the module public video buffer pool.
【Syntax】
k_s32 kd_mpi_vb_init_mod_common_pool(k_vb_uid vb_uid);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
vb_uid |
Module ID that uses the module public video buffer pool. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
kd_mpi_vb_init must be called first to initialize the public video buffer pool.
kd_mpi_vb_set_mod_pool_config must be called first to configure the buffer pool attributes, and then the buffer pool can be initialized; otherwise, it will fail.
Initialization can be repeated without returning failure.
【Example】
None
【Related Topics】
kd_mpi_vb_exit_mod_common_pool#
【Description】
Exit the module public video buffer pool.
【Syntax】
k_s32 kd_mpi_vb_exit_mod_common_pool(k_vb_uid vb_uid);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
vb_uid |
Module ID that uses the module public video buffer pool. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value. |
【Chip Differences】
None
【Requirements】
Header file: mpi_vb_api.h k_vb_comm.h
Library file: libvb.a
【Note】
This interface must be called before calling kd_mpi_vb_exit; otherwise, it will return failure.
After exiting, the previous configuration of the module public video buffer pool will be cleared.
Exiting can be repeated without returning failure.
Before exiting the VB pool, please ensure that no VB in the VB pool is occupied; otherwise, it cannot be exited.
【Example】
None
【Related Topics】
System Binding#
This function module provides the following APIs:
kd_mpi_sys_bind#
【Description】
Data source to data receiver binding interface
【Syntax】
k_s32 kd_mpi_sys_bind(k_mpp_chn *src_chn, k_mpp_chn *dest_chn);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
src_chn |
Source channel pointer. |
Input |
dest_chn |
Destination channel pointer. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for the value |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h k_module.h
Library file: libsys.a
【Notes】
For the binding relationships currently supported by the system, please refer to Table 1-1.
The same data receiver can only be bound to one data source.
Binding refers to establishing an association between the data source and the data receiver. After binding, the data generated by the data source will be automatically sent to the receiver.
【Example】
None/xx.
【Related Topics】
kd_mpi_sys_unbind#
【Description】
Data source to data receiver unbinding interface.
【Syntax】
k_s32 kd_mpi_sys_unbind(k_mpp_chn *src_chn, k_mpp_chn *dest_chn);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
src_chn |
Source channel pointer. |
Input |
dest_chn |
Destination channel pointer. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for the value |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h k_module.h
Library file: libsys.a
【Notes】
If pstDestChn cannot find the bound source channel, it will directly return success. If the bound source channel is found, but the bound source channel does not match pstSrcChn, it will return failure.
【Example】
None/xx.
【Related Topics】
kd_mpi_sys_get_bind_by_dest#
【Description】
Get the information of the source channel bound to this channel.
【Syntax】
k_s32 kd_mpi_sys_get_bind_by_dest(k_mpp_chn *dest_chn, k_mpp_chn *src_chn);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
src_chn |
Source channel pointer. |
Output |
dest_chn |
Destination channel pointer. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for the value |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h k_module.h
Library file: libsys.a
【Notes】
None
【Example】
None/xx.
【Related Topics】
Log Management#
This function module provides the following APIs:
kd_mpi_log_set_level_conf#
【Description】
Sets the log level.
【Syntax】
k_s32 kd_mpi_log_set_level_conf(const k_log_level_conf *conf);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
conf |
Log level information structure. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h k_module.h k_log_comm.h
Library file: libsys.a
【Note】
When the member mod_name in conf is set to the string “all”, the log level of all modules will be set. Otherwise, only the log level of the module specified by mod_id will be set.
【Example】
None
【Related Topics】
kd_mpi_log_get_level_conf#
【Description】
Sets the log level.
【Syntax】
k_s32 kd_mpi_log_get_level_conf(k_log_level_conf *conf);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
conf->mod_id |
Module ID for which the log level needs to be obtained. |
Input |
conf->level |
The obtained log level |
Output |
conf->mod_name |
Name of the module |
Output |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h k_module.h k_log_comm.h
Library file: libsys.a
【Note】
None
【Example】
None
【Related Topics】
kd_mpi_log_set_wait_flag#
【Description】
Sets the wait flag when reading logs.
【Syntax】
k_s32 kd_mpi_log_set_wait_flag(k_bool is_wait);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
is_wait |
Flag indicating whether to wait when reading logs. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h k_module.h k_log_comm.h
Library file: libsys.a
【Note】
None
【Example】
None
【Related Topics】
None
kd_mpi_log_read#
【Description】
Reads logs.
【Syntax】
k_s32 kd_mpi_log_read(k_char *buf, k_u32 size);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
buf |
Memory pointer for storing logs. |
Output |
size |
Size of the logs to read. |
Input |
【Return Value】
Return Value |
Description |
|---|---|
Greater than or equal to 0 |
Size of the logs successfully read. |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h k_module.h k_log_comm.h
Library file: libsys.a
【Note】
None
【Example】
None
【Related Topics】
None
kd_mpi_log_close#
【Description】
Closes the log file.
【Syntax】
void kd_mpi_log_close(void);
【Parameters】
None
【Return Value】
None
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h k_module.h k_log_comm.h
Library file: libsys.a
【Note】
None
【Example】
None
【Related Topics】
None
kd_mpi_log_set_console#
【Description】
Configures whether logs are printed directly through the console.
【Syntax】
k_s32 kd_mpi_log_get_console(k_bool *is_console);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
is_console |
Whether to print through the console |
Input |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h k_module.h k_log_comm.h
Library file: libsys.a
【Note】
None
【Example】
None
【Related Topics】
kd_mpi_log_get_console#
【Description】
Gets whether logs are printed directly through the console.
【Syntax】
k_s32 kd_mpi_log_set_console(k_bool is_console);
【Parameters】
Parameter Name |
Description |
Input/Output |
|---|---|---|
is_console |
Whether to print through the console |
Output |
【Return Value】
Return Value |
Description |
|---|---|
0 |
Success |
Non-0 |
Failure, see Error Code for its value |
【Chip Differences】
None
【Requirements】
Header file: mpi_sys_api.h k_module.h k_log_comm.h
Library file: libsys.a
【Note】
None
【Example】
None
【Related Topics】
Data Types#
Public Data Types#
This module has the following data types
k_mod_id#
【Description】
Defines the module ID enumeration type.
【Definition】
typedef enum {
K_ID_CMPI = 0, /*< common module platform interface */
K_ID_LOG = 1, /*< mpi device log */
K_ID_MMZ = 2, /*< media memory zone */
K_ID_MMZ_USER_DEV = 3, /*< media memory zone user used */
K_ID_VB = 4, /*< video buffer device */
K_ID_SYS = 5, /*< system contrl device */
K_ID_VI = 6, /*< video in device */
K_ID_VPROC = 7, /*< video proc device */
K_ID_VREC = 8, /*< video recognize device */
K_ID_VENC = 9, /*< video encoding device */
K_ID_VDEC = 10, /*< video decoding device */
K_ID_VO = 11, /*< video output device */
K_ID_AI = 12, /*< audio input device */
K_ID_AREC = 13, /*< audio recognize device */
K_ID_AENC = 14, /*< audio encoding device */
K_ID_ADEC = 15, /*< audio decoding device */
K_ID_AO = 16, /*< audio output device */
K_ID_DPU = 17, /*< depth Process Unit */
K_ID_V_VI, /*< virtual video input device */
K_ID_V_VO, /*< virtual video output device */
K_ID_DMA, /*< dma device */
K_ID_BUTT, /*< Invalid */
} k_mod_id;
【Members】
Enum Value |
Value |
Description |
|---|---|---|
K_ID_CMPI |
0 |
Common module platform interface |
K_ID_LOG |
1 |
MPI device log |
K_ID_MMZ |
2 |
Media memory zone |
K_ID_MMZ_USER_DEV |
3 |
Media memory zone (user used) |
K_ID_VB |
4 |
Video buffer device |
K_ID_SYS |
5 |
System control device |
K_ID_VI |
6 |
Video input device |
K_ID_VPROC |
7 |
Video processing device |
K_ID_VREC |
8 |
Video recognition device |
K_ID_VENC |
9 |
Video encoding device |
K_ID_VDEC |
10 |
Video decoding device |
K_ID_VO |
11 |
Video output device |
K_ID_AI |
12 |
Audio input device |
K_ID_AREC |
13 |
Audio recognition device |
K_ID_AENC |
14 |
Audio encoding device |
K_ID_ADEC |
15 |
Audio decoding device |
K_ID_AO |
16 |
Audio output device |
K_ID_DPU |
17 |
Depth process unit |
K_ID_V_VI |
18 |
Virtual video input device |
K_ID_V_VO |
19 |
Virtual video output device |
K_ID_DMA |
20 |
DMA device |
K_ID_BUTT |
21 |
Invalid value (boundary marker) |
k_mpp_chn#
【Description】
Defines the module ID enumeration type.
【Definition】
typedef struct {
k_mod_id mod_id; /*< Module ID */
k_s32 dev_id; /*< Device ID */
k_s32 chn_id; /*< Channel ID */
} k_mpp_chn;
【Members】
Member Name |
Description |
|---|---|
mod_id |
Module ID |
dev_id |
Device ID |
chn_id |
Channel ID |
【Notes】
None
【Related Data Types and Interfaces】
Multimedia Memory Management#
This module has the following data types
VB_MAX_POOLS#
【Description】
Maximum number of video buffer pools.
【Definition】
#define VB_SINGLE_MAX_BLKS 256
【Notes】
None
【Related Data Types and Interfaces】
None
k_vb_uid#
【Description】
Defines the module ID enumeration type.
【Definition】
typedef enum {
VB_UID_VI = 0,
VB_UID_VPROC = 1,
VB_UID_VREC = 2,
VB_UID_VENC = 3,
VB_UID_VDEC = 4,
VB_UID_VO = 5,
VB_UID_USER = 6,
VB_UID_AI = 7,
VB_UID_AREC = 8,
VB_UID_AENC = 9,
VB_UID_ADEC = 10,
VB_UID_AO = 11,
VB_UID_V_VI = 12,
VB_UID_V_VO = 13,
VB_UID_DMA = 14,
VB_UID_BUTT = 15,
}k_vb_uid;
【Notes】
None
【Related Data Types and Interfaces】
None
k_vb_config#
【Description】
Defines the video buffer pool attribute structure.
【Definition】
typedef struct {
k_u32 max_pool_cnt;
k_vb_pool_config comm_pool[VB_MAX_COMM_POOLS];
} k_vb_config;
【Members】
Member Name |
Description |
|---|---|
max_pool_cnt |
Number of buffer pools that can be accommodated in the entire system. Value range: (0, VB_MAX_POOLS] |
comm_pool |
Common buffer pool attribute structure. Static attribute. |
【Notes】
If blk_size equals 0 or blk_cnt equals 0, the corresponding buffer pool will not be created.
It is recommended to first memset the entire structure to 0, then assign values as needed.
【Related Data Types and Interfaces】
kd_mpi_vb_get_config
k_vb_pool_config#
【Description】
Defines the video buffer pool attribute structure.
【Definition】
typedef struct
{
k_u64 blk_size; /*< Size of each VB block*/
k_u32 blk_cnt; /*< Number of blocks*/
k_vb_remap_mode mode; /*< Mapping mode of the kernel mode virtual addresses of the VB*/
char mmz_name[MAX_MMZ_NAME_LEN];/*< Name of the MMZ that allocates the memory for the current VB pool*/
}k_vb_pool_config;
【Members】
Member Name |
Description |
|---|---|
blk_size |
Buffer block size, in Bytes. |
blk_cnt |
Number of buffer blocks per buffer pool. 0 ~ VB_SINGLE_MAX_BLKS |
mode |
Mapping mode of the kernel mode virtual addresses of the VB |
mmz_name |
Which MMZ region the current buffer pool allocates memory from. |
【Notes】
The size of each buffer block u64BlkSize should be calculated based on the current image width and height, pixel format, data bit width, whether it is compressed, etc.
This buffer pool is allocated from the free MMZ memory, and a buffer pool contains several buffer blocks of the same size. If the size of the buffer pool exceeds the free space in the reserved memory, creating the buffer pool will fail.
The user needs to ensure that the input DDR name already exists. If a non-existent DDR name is entered, memory allocation will fail. If the array mmz_name is memset to 0, it means the buffer pool is created in an unnamed DDR.
【Related Data Types and Interfaces】
k_vb_remap_mode#
【Description】
Defines the VB kernel mode virtual address mapping mode.
【Definition】
typedef enum {
VB_REMAP_MODE_NONE = 0, /*< no remap */
VB_REMAP_MODE_NOCACHE = 1, /*< no cache remap */
VB_REMAP_MODE_CACHED = 2, /*< cache remap, if you use this mode, you should flush cache by yourself */
VB_REMAP_MODE_BUTT
} k_vb_remap_mode;
【Members】
Member Name |
Description |
|---|---|
VB_REMAP_MODE_NONE |
No remapping. |
VB_REMAP_MODE_NOCACHE |
Mapped as nocache |
VB_REMAP_MODE_CACHED |
Mapped as cache |
【Notes】
None
【Related Data Types and Interfaces】
None
k_vb_supplement_config#
【Description】
Defines the VB supplementary information structure.
【Definition】
typedef struct
{
k_u32 supplement_config; /*<Control of the auxiliary information*/
}k_vb_supplement_config;
【Members】
Member Name |
Description |
|---|---|
supplement_config |
Supplementary information control |
【Notes】
Currently, 2 types of supplementary information are supported. For details, please refer to the description of the interface kd_mpi_vb_set_supplement_config.
【Related Data Types and Interfaces】
Video Common Data Types#
This module has the following data types
k_video_frame_info#
【Description】
Defines the video picture frame information structure.
【Definition】
typedef struct {
k_video_frame v_frame; /*< Video picture frame */
k_u32 pool_id; /*< VB pool ID */
k_mod_id mod_id; /*< Logical unit for generating video frames */
} k_video_frame_info;
【Members】
Member Name |
Description |
|---|---|
v_frame |
Video picture frame. |
pool_id |
Video buffer pool ID. |
mod_id |
The hardware logical module that wrote the current frame data. |
【Notes】
Currently, 2 types of supplementary information are supported. For details, please refer to the description of the interface kd_mpi_vb_set_supplement_config.
【Related Data Types and Interfaces】
k_video_frame#
【Description】
Defines the video picture frame information structure.
【Definition】
typedef struct {
k_u32 width; /*< Picture width */
k_u32 height; /*< Picture height */
k_video_field field; /*< video frame filed*/
k_pixel_format pixel_format; /*< Pixel format of a picture */
k_video_format video_format;
k_dynamic_range dynamic_range;
k_compress_mode compress_mode;
k_color_gamut color_gamut;
k_u32 header_stride;
k_u32 stride;
k_u64 header_phys_addr;
k_u64 header_virt_addr;
k_u64 phys_addr;
k_u64 virt_addr;
k_s16 offset_top; /* top offset of show area */
k_s16 offset_bottom; /* bottom offset of show area */
k_s16 offset_left; /* left offset of show area */
k_s16 offset_right; /* right offset of show area */
k_u32 time_ref;
k_u64 pts;
k_u64 priv_data;
k_video_supplement supplement; /*< Supplementary information about images */
} k_video_frame;
【Members】
Member Name |
Description |
|---|---|
width |
Picture width |
height |
Picture height |
filed |
Frame field mode. |
pixel_format |
Video picture pixel format. |
video_format |
Video picture format. |
dynamic_range |
Dynamic range. |
compress_mode |
Video compression mode. |
color_gamut |
Color gamut range. |
header_stride |
Stride of the image compression header. |
stride |
Stride of the image data. |
header_phys_addr |
Physical address of the compression header |
header_virt_addr |
Virtual address of the compression header (kernel virtual address) |
phys_addr |
Physical address of the image data |
virt_addr |
Virtual address of the image data (kernel virtual address) |
offset_top |
Top clipping width of the image. |
offset_bottom |
Bottom clipping width of the image. |
offset_left |
Left clipping width of the image |
offset_right |
Right clipping width of the image |
time_ref |
Image frame sequence number |
pts |
Image timestamp |
priv_data |
Private data |
supplement |
Supplementary information of the image |
【Notes】
None
【Related Data Types and Interfaces】
None
k_video_supplement#
【Description】
Defines the supplementary information of a video picture frame.
【Definition】
typedef struct {
k_u64 jpeg_dcf_phy_addr;
k_u64 isp_info_phy_addr;
void jpeg_dcf_kvirt_addr; /*< jpeg_dcf, used in JPEG DCF */
void isp_info_kvirt_addr; /*< isp_frame_info, used in ISP debug, when get raw and send raw */
} k_video_supplement;
【Members】
Member Name |
Description |
|---|---|
jpeg_dcf_phy_addr |
Physical address of the Jpeg DCF information. |
isp_info_phy_addr |
Physical address of the ISP auxiliary information. |
jpeg_dcf_kvirt_addr |
Virtual address of the Jpeg DCF information (kernel virtual address) |
isp_info_kvirt_addr |
Virtual address of the ISP auxiliary information. (kernel virtual address) |
【Notes】
None
【Related Data Types and Interfaces】
k_isp_frame_info#
【Description】
Real-time information of the ISP.
【Definition】
typedef struct {
k_u32 iso; /*< ISP internal ISO : again\*dgain\*is_pgain */
k_u32 exposure_time; /*< exposure time (reciprocal of shutter speed),unit is us */
k_u32 isp_dgain;
k_u32 again;
k_u32 dgain;
k_u32 ratio;
k_u32 isp_nr_strength;
k_u32 f_number; /*< the actual F-number (F-stop) of lens when the image was taken */
k_u32 sensor_id; /*< which sensor is used */
k_u32 sensor_mode;
k_u32 hmax_times; /*< sensor hmax_times,unit is ns */
k_u32 vmax; /*< sensor vmax,unit is line */
k_u32 vc_num; /*< when dump wdr frame, which is long or short exposure frame. */
} k_isp_frame_info;
【Members】
Member Name |
Description |
|---|---|
iso |
Current sensor analog gain * sensor digital gain * ISP digital gain * 100. |
exposure_time |
Exposure time, unit is microsecond (us). |
isp_dgain |
ISP digital gain. |
again |
Sensor analog gain. |
dgain |
Sensor digital gain. |
ratio |
Default exposure ratio between two adjacent frames in multi-frame composite WDR. |
isp_nr_strength |
NR strength of the ISP. Not currently supported, default value is 0. |
f_number |
The F-number of the currently used lens. |
sensor_id |
The currently used sensor ID. |
sensor_mode |
The currently used sensor sequence mode. |
hmax_times |
The time for the currently used sensor to read out one line, unit is nanosecond (ns). |
vmax |
The number of lines in a frame |
vc_num |
The sequence number of the currently captured frame. |
【Notes】
None
【Related Data Types and Interfaces】
None
k_jpeg_dcf#
【Description】
DCF information used by JPEG images.
【Definition】
typedef struct {
k_u8 capture_time [DCF_CAPTURE_TIME_LENGTH]; /*< the date and time when the picture data was generated*/
k_u32 flash; /*< whether the picture is captured when a flash lamp is on*/
k_u32 digital_zoom_ratio; /*< indicates the digital zoom ratio when the image was shot.*
*if the numerator of the recorded value is 0, this indicates that digital zoom was not used.*/
k_isp_dcf_info isp_dcf_info;
} k_jpeg_dcf;
【Members】
Member Name |
Description |
|---|---|
capture_time |
The time when the Jpeg image was captured |
flash |
Whether the flash lamp was on when the Jpeg photo was captured |
digital_zoom_ratio |
The digital zoom ratio when the Jpeg photo was captured |
isp_dcf_info |
Other DCF information |
【Notes】
None
【Related Data Types and Interfaces】
None
k_isp_dcf_info#
The detailed information of this data type is not updated in the current version.
k_isp_dcf_update_info#
The detailed information of this data type is not updated in the current version.
k_isp_dcf_const_info#
The detailed information of this data type is not updated in the current version.
k_compress_mode#
【Description】
Defines the video compressed data format structure.
【Definition】
typedef enum
{
COMPRESS_MODE_NONE = 0, /* no compress */
COMPRESS_MODE_SEG, /* compress unit is 256x1 bytes as a segment.*/
COMPRESS_MODE_TILE, /* compress unit is a tile.*/
COMPRESS_MODE_LINE, /* compress unit is the whole line. raw for VI */
COMPRESS_MODE_FRAME, /* compress unit is the whole frame. YUV for VI), RGB for VO(read) */
COMPRESS_MODE_BUTT
} k_compress_mode;
【Members】
Member Name |
Description |
|---|---|
COMPRESS_MODE_NONE |
Uncompressed video format. |
COMPRESS_MODE_SEG |
Segment-compressed video format |
COMPRESS_MODE_TILE |
Tile-compressed video format, compressed in tiles. |
COMPRESS_MODE_LINE |
Line-compressed video format, compressed in units of one line. |
COMPRESS_MODE_FRAME |
Frame-compressed video format, compressed in units of one frame. |
【Notes】
None
【Related Data Types and Interfaces】
None
k_color_gamut#
【Description】
Defines the color gamut range enumeration.
【Definition】
typedef enum {
COLOR_GAMUT_BT601 = 0,
COLOR_GAMUT_BT709,
COLOR_GAMUT_BT2020,
COLOR_GAMUT_USER,
COLOR_GAMUT_BUTT
} k_color_gamut;
【Members】
Member Name |
Description |
|---|---|
COLOR_GAMUT_BT601 |
BT601 color gamut range |
COLOR_GAMUT_BT709 |
BT709 color gamut range |
COLOR_GAMUT_BT2020 |
BT2020 color gamut range |
COLOR_GAMUT_USER |
User-defined color gamut, non-standard color gamut |
【Notes】
The blue, green, red, and white point coordinates of each color gamut range are as follows
ColorGamut |
Primary |
|||
|---|---|---|---|---|
Green |
Blue |
Red |
White |
|
BT601 |
(0.29, 0.60) |
(0.15, 0.06) |
(0.64, 0.33) |
(0.3127, 0.3290) |
BT709 |
(0.300, 0.600) |
(0.150, 0.060) |
(0.640, 0.330) |
(0.3127, 0.3290) |
BT2020 |
(0.170, 0.797) |
(0.131, 0.046) |
(0.708, 0.292) |
(0.3127, 0.3290) |
【Related Data Types and Interfaces】
None
k_dynamic_range#
【Description】
Defines the dynamic range enumeration.
【Definition】
typedef enum {
DYNAMIC_RANGE_SDR8 = 0,
DYNAMIC_RANGE_SDR10,
DYNAMIC_RANGE_HDR10,
DYNAMIC_RANGE_HLG,
DYNAMIC_RANGE_SLF,
DYNAMIC_RANGE_XDR,
DYNAMIC_RANGE_BUTT
} k_dynamic_range;
【Members】
Member Name |
Description |
|---|---|
DYNAMIC_RANGE_SDR8 |
Standard dynamic range for 8bit data. |
DYNAMIC_RANGE_SDR10 |
Standard dynamic range for 10bit data. |
DYNAMIC_RANGE_HDR10 |
High dynamic range for 10bit data. |
DYNAMIC_RANGE_HLG |
High dynamic range for 10bit data. |
DYNAMIC_RANGE_SLF |
Invalid |
DYNAMIC_RANGE_XDR |
Invalid |
【Notes】
The curves corresponding to each dynamic range are as follows:
Dynamic Range |
Transfer Characteristic |
|---|---|
SDR8/ SDR10 |
V = α * Lc0.45 - (α - 1) for 1 >= Lc >= β V = 4.500 * Lcfor β > Lc >= 0 |
HDR10 |
V = ( ( c1 + c2 * Lc n ) ÷ ( 1 + c3 * Lc n ) )m for all values of Lc c1 = c3 - c2 + 1 = 3424 ÷ 4096 = 0.8359375 c2 = 32 * 2413 ÷ 4096 = 18.8515625 c3 = 32 * 2392 ÷ 4096 = 18.6875 m = 128 * 2523 ÷ 4096 = 78.84375 n = 0.25 * 2610 ÷ 4096 = 0.1593017578125 for which Lc equal to 1 for peak white is ordinarily intended to correspond to a reference output luminance level of 10000 candelas per square metre |
HLG |
V = a * Ln( 12 * Lc - b ) + c for 1 >= Lc > 1 ÷ 12 V = Sqrt( 3 ) * Lc0.5 for 1 ÷ 12 >= Lc >= 0 a = 0.17883277, b = 0.28466892, c = 0.55991073 |
【Related Data Types and Interfaces】
None
k_video_format#
【Description】
Defines the video format structure.
【Definition】
typedef enum
{
VIDEO_FORMAT_LINEAR = 0, /* nature video line */
VIDEO_FORMAT_TILE_64x16, /* tile cell: 64pixel x 16line */
VIDEO_FORMAT_TILE_16x8, /* tile cell: 16pixel x 8line */
VIDEO_FORMAT_LINEAR_DISCRETE, /* The data bits are aligned in bytes */
VIDEO_FORMAT_BUTT
} k_video_format;
【Members】
Member Name |
Description |
|---|---|
VIDEO_FORMAT_LINEAR |
Video format stored in linear mode. |
VIDEO_FORMAT_TILE_64x16 |
Video format stored in TILE mode, where the tile block size is 64 pixels wide and 16 pixels high. |
VIDEO_FORMAT_TILE_16x8 |
Video format stored in TILE mode, where the tile block size is 16 pixels wide and 8 pixels high, also known as small TILE format. |
VIDEO_FORMAT_LINEAR_DISCRETE |
Linear discrete natural line storage data format, the data bit width is aligned by byte, the low bits are valid and the high bits are invalid. |
【Notes】
None
【Related Data Types and Interfaces】
None
k_video_field#
【Description】
Defines the field type of a video picture frame.
【Definition】
typedef enum
{
VIDEO_FIELD_TOP = 0x1, /* even field */
VIDEO_FIELD_BOTTOM = 0x2, /* odd field */
VIDEO_FIELD_INTERLACED = 0x3, /* two interlaced fields */
VIDEO_FIELD_FRAME = 0x4, /* frame */
VIDEO_FIELD_BUTT
} k_video_field;
【Members】
Member Name |
Description |
|---|---|
VIDEO_FIELD_TOP |
Top field type |
VIDEO_FIELD_BOTTOM |
Bottom field type |
VIDEO_FIELD_INTERLACED |
Two-field interlaced type |
VIDEO_FIELD_FRAME |
Frame type |
【Notes】
None
【Related Data Types and Interfaces】
k_pixel_format#
【Description】
Defines the pixel format type.
【Definition】
typedef enum {
PIXEL_FORMAT_RGB_444 = 0,
PIXEL_FORMAT_RGB_555,
PIXEL_FORMAT_RGB_565,
PIXEL_FORMAT_RGB_888,
PIXEL_FORMAT_BGR_444,
PIXEL_FORMAT_BGR_555,
PIXEL_FORMAT_BGR_565,
PIXEL_FORMAT_BGR_888,
PIXEL_FORMAT_ARGB_1555,
PIXEL_FORMAT_ARGB_4444,
PIXEL_FORMAT_ARGB_8565,
PIXEL_FORMAT_ARGB_8888,
PIXEL_FORMAT_ARGB_2BPP,
PIXEL_FORMAT_ABGR_1555,
PIXEL_FORMAT_ABGR_4444,
PIXEL_FORMAT_ABGR_8565,
PIXEL_FORMAT_ABGR_8888,
PIXEL_FORMAT_RGB_MONOCHROME_8BPP,
PIXEL_FORMAT_RGB_BAYER_8BPP,
PIXEL_FORMAT_RGB_BAYER_10BPP,
PIXEL_FORMAT_RGB_BAYER_12BPP,
PIXEL_FORMAT_RGB_BAYER_14BPP,
PIXEL_FORMAT_RGB_BAYER_16BPP,
PIXEL_FORMAT_YVU_PLANAR_422,
PIXEL_FORMAT_YVU_PLANAR_420,
PIXEL_FORMAT_YVU_PLANAR_444,
PIXEL_FORMAT_YVU_SEMIPLANAR_422,
PIXEL_FORMAT_YVU_SEMIPLANAR_420,
PIXEL_FORMAT_YVU_SEMIPLANAR_444,
PIXEL_FORMAT_YUV_SEMIPLANAR_422,
PIXEL_FORMAT_YUV_SEMIPLANAR_420,
PIXEL_FORMAT_YUV_SEMIPLANAR_444,
PIXEL_FORMAT_YUYV_PACKAGE_422,
PIXEL_FORMAT_YVYU_PACKAGE_422,
PIXEL_FORMAT_UYVY_PACKAGE_422,
PIXEL_FORMAT_VYUY_PACKAGE_422,
PIXEL_FORMAT_YYUV_PACKAGE_422,
PIXEL_FORMAT_YYVU_PACKAGE_422,
PIXEL_FORMAT_UVYY_PACKAGE_422,
PIXEL_FORMAT_VUYY_PACKAGE_422,
PIXEL_FORMAT_VY1UY0_PACKAGE_422,
PIXEL_FORMAT_YUV_400,
PIXEL_FORMAT_UV_420,
/* SVP data format */
PIXEL_FORMAT_BGR_888_PLANAR,
PIXEL_FORMAT_HSV_888_PACKAGE,
PIXEL_FORMAT_HSV_888_PLANAR,
PIXEL_FORMAT_LAB_888_PACKAGE,
PIXEL_FORMAT_LAB_888_PLANAR,
PIXEL_FORMAT_S8C1,
PIXEL_FORMAT_S8C2_PACKAGE,
PIXEL_FORMAT_S8C2_PLANAR,
PIXEL_FORMAT_S8C3_PLANAR,
PIXEL_FORMAT_S16C1,
PIXEL_FORMAT_U8C1,
PIXEL_FORMAT_U16C1,
PIXEL_FORMAT_S32C1,
PIXEL_FORMAT_U32C1,
PIXEL_FORMAT_U64C1,
PIXEL_FORMAT_S64C1,
PIXEL_FORMAT_BUTT
} k_pixel_format;
【Members】
None
【Notes】
None
【Related Data Types and Interfaces】
Omitted
Multimedia Log Management#
This module has the following data structure
k_log_level_conf#
【Description】
Defines the log level information structure.
【Definition】
typedef struct {
k_mod_id mod_id;
k_s32 level;
k_char mod_name[16];
} k_log_level_conf;
【Members】
Member Name |
Description |
|---|---|
mod_id |
Module ID |
level |
Log level |
mod_name |
Module name |
【Notes】
None
【Related Data Types and Interfaces】
Error Codes#
Multimedia Memory Management Error Codes#
Video Buffer Pool Error Codes#
Table 41
Error Code |
Macro Definition |
Description |
|---|---|---|
0xa0048006 |
K_ERR_VB_NULL_PTR |
Null pointer parameter error |
0xa004800c |
K_ERR_VB_NOMEM |
Failed to allocate memory |
0xa004800d |
K_ERR_VB_NOBUF |
Failed to allocate buffer |
0xa0048005 |
K_ERR_VB_UNEXIST |
Video buffer does not exist |
0xa0048003 |
K_ERR_VB_ILLEGAL_PARAM |
Invalid parameter setting |
0xa0048010 |
K_ERR_VB_NOTREADY |
Buffer pool not ready yet |
0xa0048012 |
K_ERR_VB_BUSY |
System busy |
0xa0048009 |
K_ERR_VB_NOT_PERM |
Operation not permitted |
0xa0048040 |
K_ERR_VB_2MPOOLS |
Too many buffer pools created |
Multimedia Memory Zone Error Codes#
Table 42
Error Code |
Macro Definition |
Description |
|---|---|---|
0xa0038003 |
K_ERR_MMZ_USERDEV_ILLEGAL_PARAM |
Minor parameter setting |
0xa0038006 |
K_ERR_MMZ_USERDEV_NULL_PTR |
Null pointer parameter error |
0xa0038008 |
K_ERR_MMZ_USERDEV_NOT_SUPPORT |
Unsupported operation |
0xa0038009 |
K_ERR_MMZ_USERDEV_NOT_PERM |
Operation not permitted |
0xa003800c |
K_ERR_MMZ_USERDEV_NOMEM |
Failed to allocate memory |
0xa0038010 |
K_ERR_MMZ_USERDEV_NOTREADY |
System not ready |
0xa0038011 |
K_ERR_MMZ_USERDEV_BADADDR |
Bad address |
0xa0038012 |
K_ERR_MMZ_USERDEV_BUSY |
System busy |
System Binding Error Codes#
Table 43
Error Code |
Macro Definition |
Description |
|---|---|---|
0xa0058003 |
K_ERR_SYS_ILLEGAL_PARAM |
Parameter error |
0xa0058006 |
K_ERR_SYS_NULL_PTR |
Null pointer error |
0xa0058008 |
K_ERR_SYS_NOT_SUPPORT |
Unsupported feature |
0xa0058009 |
K_ERR_SYS_NOT_PERM |
Operation not permitted |
0xa0058010 |
K_ERR_SYS_NOTREADY |
System control attribute not configured |
0xa0058011 |
K_ERR_SYS_BADADDR |
Bad address |
0xa005800c |
K_ERR_SYS_NOMEM |
Memory allocation failed, e.g., insufficient system memory |
Log Management Error Codes#
Table 44
Error Code |
Macro Definition |
Description |
|---|---|---|
0xa0018003 |
K_ERR_LOG_ILLEGAL_PARAM |
Parameter error |
0xa0018006 |
K_ERR_LOG_NULL_PTR |
Null pointer error |
0xa0018009 |
K_ERR_LOG_NOT_PERM |
Operation not permitted |
0xa0018010 |
K_ERR_LOG_NOTREADY |
Log device not ready |
0xa001800c |
K_ERR_LOG_NOMEM |
Memory allocation failed, e.g., insufficient system memory |
Debug Information#
Overview#
The debug information adopts the proc file system, which can reflect the running status of the current system in real time. The recorded information can be used for problem locating and analysis.
【File Directory】
/proc/
【File List】
File Name |
Description |
|---|---|
umap/sysbind |
Records the current system binding status. |
umap/vb |
Records the buffer usage of the current VB module. |
mem-media |
Records the current multimedia memory usage. |
Multimedia Memory Management#
Video Cache Pool Debug Information#
【Debug Information】
-----VB PUB CONFIG--------------------------------------------------------------
MaxPoolCnt
10
-----VB SUPPLEMENT ATTR---------------------------------------------------------
Config Size VbCnt
1 204 21
-----COMMON POOL CONFIG---------------------------------------------------------
PoolConfId BlkSize Count RemapMode
0 8294400 5 CACHED
1 8192 3 NONE
2 4096 5 NOCACHE
-----MODULE COMMON MOD POOL CONFIG of [2]---------------------------------------
PoolConfId BlkSize Count RemapMode
0 4096 5 CACHED
1 8192 3 NONE
-------------------------------------------------------------------------------------
PoolId PhysAddr VirtAddr IsComm Owner BlkSz BlkCnt Free MinFree
0 0x18001000 0xc00d1000 1 -1 8294400 5 2 2
BLK VI VENC VDEC VO USER AI AREC AENC ADEC AO V_VI V_VO DMA DPU
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
1 0 0 0 0 1 0 0 0 0 0 0 0 0 0
2 0 0 0 0 1 0 0 0 0 0 0 0 0 0
Sum 0 0 0 0 3 0 0 0 0 0 0 0 0 0
-------------------------------------------------------------------------------------
PoolId PhysAddr VirtAddr IsComm Owner BlkSz BlkCnt Free MinFree
1 0x1a78f000 0x0 1 -1 8192 3 3 3
-------------------------------------------------------------------------------------
PoolId PhysAddr VirtAddr IsComm Owner BlkSz BlkCnt Free MinFree
2 0x1a796000 0xc2860000 1 -1 4096 5 5 5
-------------------------------------------------------------------------------------
PoolId PhysAddr VirtAddr IsComm Owner BlkSz BlkCnt Free MinFree
3 0x1a79c000 0xc2866000 1 2 4096 5 5 5
-------------------------------------------------------------------------------------
PoolId PhysAddr VirtAddr IsComm Owner BlkSz BlkCnt Free MinFree
4 0x1a7a2000 0x0 1 2 8192 3 3 3
【Debug Information Analysis】
Records the block usage of the current VB module.
【Parameter Description】
Name |
Parameter |
Description |
|---|---|---|
VB PUB CONFIG |
MaxPoolCnt |
Maximum number of cache pools. |
VB SUPPLEMENT ATTR |
Config |
Video frame supplement information configuration. |
Size |
Memory space occupied by video frame supplement information. |
|
VbCnt |
Total number of VB blocks contained in all VB pools (public, private). |
|
COMMON POOL CONFIG |
PoolId |
Handle of the public cache pool. |
Size |
Size of blocks in the cache pool. |
|
Count |
Number of blocks in the cache pool. |
|
MODULE COMMON POOL CONFIG of VB_UID (module-allocated public VB) |
PoolId |
Handle of the public cache pool. |
Size |
Size of blocks in the cache pool. |
|
Count |
Number of blocks in the cache pool. |
|
NULL (indicates empty, i.e., anonymous DDR) |
PoolId |
Handle of the public/private cache pool. |
PhysAddr |
Start physical address of the public/private cache pool. |
|
VirtAddr |
Start virtual address of the public/private cache pool. |
|
IsComm |
Whether it is a public cache pool. Value: {0, 1}. |
|
Owner |
Owner of the cache pool. -2: private pool. -1: public pool. ≥0: module VB. |
|
BlkSz |
Size of cache blocks in the cache pool. |
|
BlkCnt |
Number of cache blocks in the cache pool. |
|
Free |
Number of free cache blocks in the cache pool. |
|
MinFree |
The minimum remaining number of free cache blocks since the program started running. If this count is 0, it may indicate that frames are being dropped due to insufficient cache blocks. |
|
BLK |
Handle of cache blocks in the cache pool. |
|
VI/VPROC/VREC/VENC/VDEC/VO/USER/AI/AREC/AENC/ADEC/AO/V_VI/V_VO/DMA |
Module name. The corresponding number below indicates how many places the current module occupies the cache block in the cache pool. 0: not occupied. Non-zero: number of times occupied. |
Multimedia Memory Zone Debug Information#
【Debug Information】
msh /bin\>cat /proc/media-mem
+---ZONE: PHYS(0x18000000, 0x1FEFFFFF), GFP=0, nBYTES=130048KB, NAME="anonymous"
|-MMB: phys(0x18000000, 0x18000FFF), kvirt=0xC00D0000, flags=0x00000001, length=4KB, name="sup_nc"
|-MMB: phys(0x18001000, 0x1A78DFFF), kvirt=0xC00D1000, flags=0x00000003, length=40500KB, name="vb_pool"
|-MMB: phys(0x1A78E000, 0x1A78EFFF), kvirt=0xC285E000, flags=0x00000001, length=4KB, name="sup_nc"
|-MMB: phys(0x1A78F000, 0x1A794FFF), kvirt=0x00000000, flags=0x00000000, length=24KB, name="vb_pool"
|-MMB: phys(0x1A795000, 0x1A795FFF), kvirt=0xC285F000, flags=0x00000001, length=4KB, name="sup_nc"
|-MMB: phys(0x1A796000, 0x1A79AFFF), kvirt=0xC2860000, flags=0x00000001, length=20KB, name="vb_pool"
|-MMB: phys(0x1A79B000, 0x1A79BFFF), kvirt=0xC2865000, flags=0x00000001, length=4KB, name="sup_nc"
|-MMB: phys(0x1A79C000, 0x1A7A0FFF), kvirt=0xC2866000, flags=0x00000003, length=20KB, name="vb_mod_pool"
|-MMB: phys(0x1A7A1000, 0x1A7A1FFF), kvirt=0xC286B000, flags=0x00000001, length=4KB, name="sup_nc"
|-MMB: phys(0x1A7A2000, 0x1A7A7FFF), kvirt=0x00000000, flags=0x00000000, length=24KB, name="vb_mod_pool"
---MMZ_USE_INFO:
total size=130048KB(127MB),used=40608KB(39MB + 672KB),remain=89440KB(87MB + 352KB),zone_number=1,block_number=10
【Debug Information Analysis】
Records the current usage of multimedia memory
【Parameter Description】
None
System Binding#
System Binding Debug Information#
【Debug Information】
msh /bin\>cat /proc/umap/sysbind
\-----BIND RELATION TABLE--------------------------------------------------------
FirMod FirDev FirChn SecMod SecDev SecChn TirMod TirDev TirChn SendCnt rstCnt
vvi 0 0 vvo 0 0 null 0 0 42 0
vvi 0 0 vvo 1 1 null 0 0 42 0
【Debug Information Analysis】
Records the current system binding status
【Parameter Description】
Parameter |
Description |
|---|---|
FirMod |
Data source module number |
FirDev |
Data source device number |
FirChn |
Data source channel number |
SecMod |
Second module number (bound to data source) |
SecDev |
Second module device number (bound to data source) |
SecChn |
Second module channel number (bound to data source) |
ThrMod |
Third module number (bound to second module) |
ThrDev |
Third module device number (bound to second module) |
ThrChn |
Third module channel number (bound to second module) |
Sendcnt |
Number of data sends |
Rstcnt |
Number of resets |
