5.2. HBN Framework Description
5.2.1. Overview
The HBN framework is marked in red in the multimedia system software architecture diagram and covers most modules in the Camera Sensor capture pipeline, including VIN, ISP, VSE, GDC, and N2D.
The Camera API and OSD API (shown in green in the diagram) are not included within the HBN framework, but they can be attached to the HBN framework via corresponding attach functions.
In summary, the HBN framework encompasses all modules in the Camera Sensor capture pipeline and provides simple and flexible APIs.

5.2.2. Software Abstraction
In the HBN framework, each module—VIN, ISP, VSE, GDC, and N2D—is abstracted as a vnode. Multiple vnodes are connected to form a vflow (similar to a pipeline).
Since Camera and OSD use independent APIs, the HBN framework provides attach interfaces to bind Camera with VIN and OSD with VSE.
A vnode is an abstraction of a hardware acceleration unit. In the HBN framework, VIN, ISP, VSE, GDC, and N2D are all abstracted into the concept of vnode, which includes the following attributes:
Attributes of the hardware acceleration unit itself, e.g., isp_attr_t
Input channel attributes of the hardware acceleration unit, e.g., isp_ichn_attr_t
Output channel attributes of the hardware acceleration unit, e.g., isp_ochn_attr_t
Multiple vnodes are connected to form one vflow. It supports creating multiple vflows simultaneously, and different vflows are completely independent. The process of connecting vnodes is as follows:
Interface to create a vflow: hbn_vflow_create
Interface to add a vnode to a vflow: hbn_vflow_add_vnode
Interface to bind two vnodes in a vflow: hbn_vflow_bind_vnode
Interface to start a vflow: hbn_vflow_start
For modules in
HBN APIthat are not part ofHBN Framework API, such as Camera and OSD, the attach interface is supported to bind them into a vflowFor modules not in
HBN API, such as BPU and Display, video frames can be retrieved from the vflow via the interfacehbn_vnode_get_output_frame
The figure below shows examples of vflow in three scenarios (Recirculation in Scenario 1 means the data source comes from DDR):

Scenario 1: Single vflow (recirculation)
Scenario description: Video frames come from DDR (e.g., reading a video file into DDR), and VSE is used to scale the video frames
Data source: The data source is not included in the vflow; video frames from DDR must be actively fed into the vflow within a thread
The vflow must contain at least one vnode, and can contain multiple. When there is only one node, it does not need to be bound to the vflow. When multiple vnode nodes exist and need to be connected, they must be bound to the vflow
VSE, GDC, ISP, and N2D all support recirculation mode
Scenario 2: Single vflow
Scenario description: One Camera is connected, passing through VIN, ISP, GDC, and VSE. Three output channels are generated at VSE, processed as follows:
Channel 0: Sent to CODEC for encoding
Channel 1: Sent to Display for rendering
Channel 2: Sent to BPU for inference
Data source: Camera Sensor connected via MIPI interface
The data source is included in the vflow. After the vflow is started, the HBN framework automatically schedules data flow transmission, requiring no developer intervention
After the vflow starts, video frames can be continuously retrieved from the end node and passed to acceleration units outside the HBN API, such as the devices in the dashed box in the figure (Codec, Display, BPU)
Scenario 3: Multiple vflows
Scenario description: Two Cameras are connected, each passing through different processing pipelines
Data source: Each vflow connects one Camera
Two vflows are used to complete the capture of two video pipelines
The two vflows are completely independent
5.2.3. Vnode Connection Methods
vnodes are connected via input and output channels:
Each vnode has one input channel and multiple output channels
The output channel of an upstream vnode is connected to the input channel of a downstream vnode, linking multiple vnodes into one vflow
The output channel of the upstream vnode determines the connection method
The following describes three aspects: output channels, connection methods, and parameter configuration
5.2.3.1. Output Channels
The output channel determines the vnode connection method, supporting online and offline modes. See System Overview for details
Only VIN and ISP output channels support online mode; other modules support only offline mode
| Module | Output Channel ID | Channel Function |
|---|---|---|
| VIN | 0 | Offline channel, outputs camera frames to DDR |
| 1 | Online channel, connects to ISP | |
| 3 | Offline channel, outputs only emb data to DDR | |
| ISP | 0 | Offline channel, outputs ISP-processed frames to DDR |
| 1 | Online channel, connects to VSE | |
| VSE | 0 | Offline channel, 4K Downscale |
| 1 | Offline channel, 1080P0 Downscale | |
| 2 | Offline channel, 1080P1 Downscale | |
| 3 | Offline channel, 720P0 Downscale | |
| 4 | Offline channel, 720P1 Downscale | |
| 5 | Offline channel, 4K Upscale | |
| GDC | 0 | Offline channel, outputs GDC-processed frames to DDR |
5.2.3.2. Connection Methods
Only VIN and ISP output channels support online mode; other modules support only offline mode. Therefore, the combinations among VIN, ISP, and VSE are described as follows:
NOTE: When an HDR sensor is connected, the VIN-ISP connection must use online mode. Since online mode exclusively occupies the ISP resource, only 1 stream is supported.
| Module Combination | Connection Method | Description |
|---|---|---|
| VIN - ISP | VIN online to ISP, ISP in PASSTHROUGH_MODE | Hardware connection between VIN and ISP, bypassing DDR; supports up to one stream using this method |
| VIN online to ISP, ISP in MCM_MODE | Supports up to four streams using this method. Reserved mode, currently not recommended | |
| VIN offline to ISP, ISP in DDR_MODE | Requires passing through DDR; supports up to six streams using this method | |
| VIN - VSE | VIN offline to VSE | When Camera Sensor does not require ISP, bind VIN directly to VSE; supports only offline |
| ISP - VSE | ISP online to VSE | Hardware connection between ISP and VSE, bypassing DDR; supports up to four streams using this method |
| ISP offline to VSE | Requires passing through DDR |
5.2.3.3. Parameter Configuration
When binding two vnode nodes using the function hbn_vflow_bind_vnode, the connection method between modules is determined. However, the VIN and ISP nodes must be configured accordingly, as detailed below:
| Module Combination | Connection Method | hbn_vflow_bind_vnode function | vin_node_attr structure | isp_node_attr structure |
|---|---|---|---|---|
| VIN - ISP | Online (ISP in PASSTHROUGH_MODE) | 1. src_out_channel =1 2. dst_input_channel =0 |
cim_isp_flyby =1 | input_mode = 0 |
| VIN - ISP | Online (ISP in MCM_MODE) | 1. src_out_channel =1 2. dst_input_channel =0 |
cim_isp_flyby =1 | input_mode = 1 |
| VIN - ISP | Offline (ISP in DDR_MODE) | 1. src_out_channel =0 2. dst_input_channel =0 |
1. ddr_en =1 2. cim_isp_flyby =0 |
input_mode = 2 |
| VIN - VSE | Offline | 1. src_out_channel =0 2. dst_input_channel =0 |
- | - |
| ISP - VSE | Online | 1. src_out_channel =1 2. dst_input_channel =0 |
- | - |
| ISP - VSE | Offline | 1. src_out_channel =0 2. dst_input_channel =0 |
ddr_en =1 | - |
5.2.4. API List
| API Interface | Interface Function |
|---|---|
| hbn_vnode_open | Open vnode |
| hbn_vnode_close | Close vnode |
| hbn_vnode_set_attr | Set vnode attributes |
| hbn_vnode_get_attr | Get vnode attributes |
| hbn_vnode_set_attr_ex | Set vnode extended attributes |
| hbn_vnode_get_attr_ex | Get vnode extended attributes |
| hbn_vnode_set_ochn_attr | Set output channel attributes of the module |
| hbn_vnode_get_ochn_attr | Get output channel attributes of the module |
| hbn_vnode_set_ochn_attr_ex | Set extended output channel attributes of the module, can be dynamically set during application runtime |
| hbn_vnode_set_ichn_attr | Set input channel attributes of the module |
| hbn_vnode_get_ichn_attr | Get input channel attributes of the module |
| hbn_vnode_set_ichn_attr_ex | Set extended input channel attributes of the module, can be dynamically set during application runtime |
| hbn_vnode_set_ochn_buf_attr | Set output channel buffer attributes |
| hbn_vnode_start | Start vnode, module must be opened before starting |
| hbn_vnode_stop | Stop vnode |
| hbn_vnode_getframe | Get image from the module's output channel, blocking interface |
| hbn_vnode_releaseframe | Release image buffer, buffer is returned to the specified output channel |
| hbn_vnode_sendframe | Send image to the module's input channel, triggering module processing. Blocking interface, waits for hardware processing to complete before returning, default timeout is 1 second |
| hbn_vnode_sendframe_async | Send image to the module's input channel, triggers module processing. Non-blocking interface |
| hbn_vnode_set_output_frame | Set image buffer for the module's output channel, non-blocking interface, external buffer setting |
| hbn_vnode_get_output_frame | Get processed image buffer from the module, used with hbn_vnode_set_output_frame, non-blocking interface |
| hbn_vflow_create | Create a vflow, returns vflow handle |
| hbn_vflow_destroy | Destroy a vflow based on vflow handle |
| hbn_vflow_add_vnode | Add module to vflow, managed by vflow |
| hbn_vflow_bind_vnode | Bind two modules together, after binding data frames from src_vnode_fd automatically flow to dst_vnode_fd |
| hbn_vflow_unbind_vnode | Unbind src_vnode_fd and dst_vnode_fd modules |
| hbn_vflow_start | Start a vflow, all vnodes in the vflow will start |
| hbn_vflow_stop | Stop a vflow, all vnodes in the vflow will stop |
| hbn_vflow_get_vnode_handle | Get vnode handle via module ID and context ID |
| hbn_vflow_create_cfg | Create a vflow containing vnodes and their binding relationships from a configuration file |
| hbn_vflow_get_version | Get version information of hbn API |
5.2.5. API Call Flow
5.2.5.1. Creation Flow

5.2.5.2. Destruction Flow
The destruction flow is the reverse of the creation flow, but note the following:
After calling hbn_vflow_destroy, there is no need to call hbn_vnode_close or hbn_vflow_unbind_vnode
After calling
hbn_camera_destroy, there is no need to callhbn_camera_detach_from_vin

5.2.6. API Interface Description
5.2.6.1. hbn_vnode_open
【Function Declaration】
hobot_status hbn_vnode_open(hb_vnode_type vnode_type, uint32_t hw_id, int32_t ctx_id, hbn_vnode_handle_t *vnode_fd)
【Parameter Description】
[IN] hb_vnode_type vnode_type: vnode type, each hardware module corresponds to one vnode type. Values are HB_VIN, HB_ISP, HB_VSE, HB_GDC, HB_N2D;
[IN] uint32_t hw_id: hardware ID of the module. For the VIN module, hw_id values are [0, 3], corresponding to SIF0~SIF3 respectively; other modules use only 0;
[IN] uint32_t ctx_id: context ID of the module, a software concept. A specific ctx_id value can be specified, or set to AUTO_ALLOC_ID for automatic allocation by the HNB framework;
[OUT] hbn_vnode_handle_t *vnode_fd: returns the vnode handle of the module;
【Return Value】
Success: HBN_STATUS_SUCCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Initializes a module and returns its handle hbn_vnode_handle_t.
Before using a module,
hbn_vnode_openmust be called first.The
hbn_vnode_openfunction opens the module’s device node (e.g.,/dev/vin0_cap).The
hbn_vnode_openfunction returns a pointer tohbn_vnode_handle_t(vnode_fd), identifying a specific software instance of the module.
For example, in the function hbn_vflow_bind_vnode, both parameters src_vnode_fd and dst_vnode_fd arehbn_vnode_handle_tpointers returned byhbn_vnode_open.The essence of
hbn_vnode_handle_tisint64_t. Thehbn_vnode_openfunction generates a system-unique integer value returned via*vnode_fd.
【Notes】
5.2.6.2. hbn_vnode_close
【Function Declaration】
void hbn_vnode_close(hbn_vnode_handle_t vnode_fd)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: vnode handle of the module;
【Return Value】
None
【Function Description】
Closes the module’s device node.
【Notes】
After calling hbn_vflow_destroy, there is no need to call hbn_vnode_close.
When a module is bound to a vflow: call hbn_vflow_destroy, no need to call hbn_vnode_close.
When a module is used independently (e.g., only ISP, VSE, GDC recirculation, not bound to a vflow): hbn_vnode_close must be called.
5.2.6.3. hbn_vnode_set_attr
【Function Declaration】
hobot_status hbn_vnode_set_attr(hbn_vnode_handle_t vnode_fd, void *attr)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: vnode handle of the module;
[IN] void *attr: pointer to the module’s basic attribute structure. The basic attribute structure can be vin_attr_t, isp_attr_t, vse_attr_t, etc., ending with module name +_attr_t;
【Return Value】
Success: HBN_STATUS_SUCCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Sets the basic attributes of the module.
【Notes】
None
5.2.6.4. hbn_vnode_get_attr
【Function Declaration】
hobot_status hbn_vnode_get_attr(hbn_vnode_handle_t vnode_fd, void *attr)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: vnode handle of the module;
[OUT] void *attr: pointer to the module’s basic attribute structure. The basic attribute structure can be vin_attr_t, isp_attr_t, vse_attr_t, etc., ending with module name +_attr_t;
【Return Value】
Success: HBN_STATUS_SUCCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Gets the basic attributes of the module.
【Notes】
None
5.2.6.5. hbn_vnode_set_attr_ex
【Function Declaration】
hobot_status hbn_vnode_set_attr_ex(hbn_vnode_handle_t vnode_fd, void *attr)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: vnode handle of the module;
[IN] void *attr: pointer to the module’s extended attribute structure. Extended attribute structures can be
vin_attr_ex_t, etc., ending with module name +_attr_ex_t;
【Return Value】
Success: HBN_STATUS_SUCCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Sets the extended attributes of the module, which can be dynamically set during application runtime.
【Notes】
None
5.2.6.6. hbn_vnode_get_attr_ex
【Function Declaration】
hobot_status hbn_vnode_get_attr_ex(hbn_vnode_handle_t vnode_fd, void *attr)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: vnode handle of the module;
[OUT] void *attr: pointer to the module’s extended attribute structure. Extended attribute structures can be
vin_attr_ex_t, etc., ending with module name +_attr_ex_t;
【Return Value】
Success: HBN_STATUS_SUCCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Gets the extended attributes of the module.
【Notes】
None
5.2.6.7. hbn_vnode_set_ochn_attr
【Function Declaration】
hobot_status hbn_vnode_set_ochn_attr(hbn_vnode_handle_t vnode_fd, uint32_t ochn_id, void *attr)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: vnode handle of the module;
[IN] uint32_t ochn_id: output channel ID of the module, channel IDs refer to: Module Channel Description;
[IN] void *attr: pointer to the module’s output channel attribute structure. Output channel attributes can be vin_ochn_attr_t, isp_ochn_attr_t, etc., ending with module name +_ochn_attr_t;
【Return Value】
Success: HBN_STATUS_SUCCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Sets the output channel attributes of the module.
【Notes】
None
5.2.6.8. hbn_vnode_get_ochn_attr
【Function Declaration】
hobot_status hbn_vnode_get_ochn_attr(hbn_vnode_handle_t vnode_fd, uint32_t ochn_id, void *attr)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: vnode handle of the module;
[IN] uint32_t ochn_id: output channel ID of the module, channel IDs refer to: Module Channel Description
[OUT] void *attr: pointer to the module’s output channel attribute structure. Output channel attributes can be vin_ochn_attr_t, isp_ochn_attr_t, etc., ending with module name +_ochn_attr_t;
【Return Value】
Success: HBN_STATUS_SUCCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Gets the output channel attributes of the module.
【Notes】
None
5.2.6.9. hbn_vnode_set_ochn_attr_ex
【Function Declaration】
hobot_status hbn_vnode_set_ochn_attr_ex(hbn_vnode_handle_t vnode_fd, uint32_t ochn_id, void *attr)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: vnode handle of the module;
[IN] uint32_t ochn_id: output channel ID of the module, channel IDs refer to: Module Channel Description
[IN] void *attr: pointer to the module’s extended output channel attribute structure. Extended output channel attributes can be
vse_ochn_attr_ex_t, etc., ending with module name +_ochn_attr_ex_t;
【Return Value】
Success: HBN_STATUS_SUCCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Sets the extended output channel attributes of the module, which can be dynamically set during application runtime.
【Notes】
None
5.2.6.10. hbn_vnode_set_ichn_attr
【Function Declaration】
hobot_status hbn_vnode_set_ichn_attr(hbn_vnode_handle_t vnode_fd, uint32_t ichn_id, void *attr)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: vnode handle of the module;
[IN] uint32_t ichn_id: input channel ID of the module, channel IDs refer to: Module Channel Description
[IN] void *attr: pointer to the module’s input channel attribute structure. Input channel attributes can be vin_ichn_attr_t, isp_ichn_attr_t, etc., ending with module name +_ichn_attr_t;
【Return Value】
Success: HBN_STATUS_SUCCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Sets the input channel attributes of the module.
【Notes】
None
5.2.6.11. hbn_vnode_get_ichn_attr
【Function Declaration】
hobot_status hbn_vnode_get_ichn_attr(hbn_vnode_handle_t vnode_fd, uint32_t ichn_id, void *attr)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: vnode handle of the module;
[IN] uint32_t ichn_id: input channel ID of the module, channel IDs refer to: Module Channel Description
[OUT] void *attr: pointer to the module’s input channel attribute structure. Input channel attributes can be vin_ichn_attr_t, isp_ichn_attr_t, etc., ending with module name +_ichn_attr_t;
【Return Value】
Success: HBN_STATUS_SUCCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Gets the input channel attributes of the module.
【Notes】
NoneNone
5.2.6.12. hbn_vnode_set_ichn_attr_ex
【Function Declaration】
hobot_status hbn_vnode_set_ichn_attr_ex(hbn_vnode_handle_t vnode_fd, uint32_t ichn_id, void *attr)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: The vnode handle of the module;
[IN] uint32_t ichn_id: Input channel ID of the module. See channel IDs in: Module Channel Description
[IN] void *attr: Pointer to the extended attribute structure for the input channel. Extended input channel attributes refer to structures ending with module name + _ichn_attr_ex_t;
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Set extended attributes for the module’s input channel, which can be dynamically configured during application runtime.
【Notes】
None
5.2.6.13. hbn_vnode_set_ochn_buf_attr
【Function Declaration】
hobot_status hbn_vnode_set_ochn_buf_attr(hbn_vnode_handle_t vnode_fd, uint32_t ochn_id, hbn_buf_alloc_attr_t *alloc_attr)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: The vnode handle of the module;
[IN] uint32_t ochn_id: Output channel ID of the module. See channel IDs in: Module Channel Description
[IN] hbn_buf_alloc_attr_t *alloc_attr: Buffer allocation attributes;
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Set buffer attributes for the output channel.
【Notes】
5.2.6.14. hbn_vnode_start
【Function Declaration】
hobot_status hbn_vnode_start(hbn_vnode_handle_t vnode_fd)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: The vnode handle of the module;
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Start the module.
【Notes】
The module must be opened before starting.
5.2.6.15. hbn_vnode_stop
【Function Declaration】
hobot_status hbn_vnode_stop(hbn_vnode_handle_t vnode_fd)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: The vnode handle of the module;
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Stop the module.
【Notes】
None
5.2.6.16. hbn_vnode_getframe
【Function Declaration】
hobot_status hbn_vnode_getframe(hbn_vnode_handle_t vnode_fd, uint32_t ochn_id, uint32_t millisecondTimeout, hbn_vnode_image_t *out_img)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: The vnode handle of the module;
[IN] uint32_t ochn_id: Output channel ID of the module. See channel IDs in: Module Channel Description
[IN] uint32_t millisecondTimeout: Timeout waiting time;
[OUT] hbn_vnode_image_t *out_img: Address of the output image buffer structure;
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Retrieve image from the module’s output channel. This is a blocking interface.
【Notes】
None
5.2.6.17. hbn_vnode_releaseframe
【Function Declaration】
hobot_status hbn_vnode_releaseframe(hbn_vnode_handle_t vnode_fd, uint32_t ochn_id, hbn_vnode_image_t *img)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: The vnode handle of the module;
[IN] uint32_t ochn_id: Output channel ID of the module. See channel IDs in: Module Channel Description
[IN] hbn_vnode_image_t *img: Address of the image buffer structure;
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Release the image buffer; the buffer will be returned to the specified output channel.
【Notes】
None
5.2.6.18. hbn_vnode_sendframe
【Function Declaration】
hobot_status hbn_vnode_sendframe(hbn_vnode_handle_t vnode_fd, uint32_t ichn_id, hbn_vnode_image_t *img)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: The vnode handle of the module;
[IN] uint32_t ichn_id: Input channel ID of the module. See channel IDs in: Module Channel Description
[IN] hbn_vnode_image_t *img: Address of the input image buffer;
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Send an image to the module’s input channel, triggering the module to process it. This is a blocking interface that waits for hardware processing to complete before returning, with a default timeout of 1 second.
【Notes】
None
5.2.6.19. hbn_vnode_sendframe_async
【Function Declaration】
hobot_status hbn_vnode_sendframe_async(hbn_vnode_handle_t vnode_fd, uint32_t ichn_id, hbn_vnode_image_t *img)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: The vnode handle of the module;
[IN] uint32_t ichn_id: Input channel ID of the module. See channel IDs in: Module Channel Description
[IN] hbn_vnode_image_t *img: Address of the input image buffer;
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Send an image to the module’s input channel, triggering the module to process it. This is a non-blocking interface.
【Notes】
None
5.2.6.20. hbn_vnode_set_output_frame
【Function Declaration】
hobot_status hbn_vnode_set_output_frame(hbn_vnode_handle_t vnode_fd, uint32_t ochn_id, hbn_vnode_image_t *img)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: The vnode handle of the module;
[IN] uint32_t ochn_id: Output channel ID of the module. See channel IDs in: Module Channel Description
[IN] hbn_vnode_image_t *img: Address of the output image buffer;
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Set the image buffer for the module’s output channel. This is a non-blocking interface. External setting of output buffer; usage refer to sample code.
【Notes】
Only supports VSE, GDC, and GDC bound with VSE, for use in three scenarios with feedback mode
Requires control over allocation, release, and cache management of output buffers
Output buffer must satisfy: Y and UV address spaces must be contiguous, use ION space, and fill in necessary bufferindex and share_id
Does not support simultaneous internal buffer control operations, i.e., internal buffer allocation via hbn_vnode_set_ochn_buf_attr
5.2.6.21. hbn_vnode_get_output_frame
【Function Declaration】
hobot_status hbn_vnode_get_output_frame(hbn_vnode_handle_t vnode_fd, uint32_t ochn_id, hbn_vnode_image_t *img)
【Parameter Description】
[IN] hbn_vnode_handle_t vnode_fd: The vnode handle of the module;
[IN] uint32_t ochn_id: Output channel ID of the module. See channel IDs in: Module Channel Description
[IN] hbn_vnode_image_t *img: Address of the output image buffer;
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Retrieve the processed image buffer from the module. Used in conjunction with hbn_vnode_set_output_frame, this is a non-blocking interface; usage refer to sample code.
【Notes】
Only supports VSE, GDC, and GDC bound with VSE, for use in three scenarios with feedback mode
Requires control over allocation, release, and cache management of output buffers
Output buffer must satisfy: Y and UV address spaces must be contiguous, use ION space, and fill in necessary bufferindex and share_id
Does not support simultaneous internal buffer control operations, i.e., internal buffer allocation via hbn_vnode_set_ochn_buf_attr
5.2.6.22. hbn_vflow_create
【Function Declaration】
hobot_status hbn_vflow_create(hbn_vflow_handle_t *vflow_fd)
【Parameter Description】
[OUT] hbn_vflow_handle_t *vflow_fd: vflow handle;
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Create a vflow and return the vflow handle.
【Notes】
None
5.2.6.23. hbn_vflow_destroy
【Function Declaration】
void hbn_vflow_destroy(hbn_vflow_handle_t vflow_fd)
【Parameter Description】
[IN] hbn_vflow_handle_t *vflow_fd: vflow handle;
【Return Value】
None
【Function Description】
Destroy a vflow based on the provided vflow handle.
【Notes】
None
5.2.6.24. hbn_vflow_add_vnode
【Function Declaration】
hobot_status hbn_vflow_add_vnode(hbn_vflow_handle_t vflow_fd, hbn_vnode_handle_t vnode_fd)
【Parameter Description】
[IN] hbn_vflow_handle_t *vflow_fd: vflow handle;
[IN] hbn_vnode_handle_t vnode_fd: The vnode handle of the module;
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Add a module to the vflow for management.
【Notes】
None
5.2.6.25. hbn_vflow_bind_vnode
【Function Declaration】
hobot_status hbn_vflow_bind_vnode(hbn_vflow_handle_t vflow_fd, hbn_vnode_handle_t src_vnode_fd, uint32_t out_chn, hbn_vnode_handle_t dst_vnode_fd, uint32_t in_chn)
【Parameter Description】
[IN] hbn_vflow_handle_t *vflow_fd: vflow handle;
[IN] hbn_vnode_handle_t src_vnode_fd: Source module’s vnode handle;
[IN] uint32_t out_chn: Output channel ID of the source module. See channel IDs in: Module Channel Description
[IN] hbn_vnode_handle_t dst_vnode_fd: Destination module’s vnode handle;
[IN] uint32_t in_chn: Input channel ID of the destination module. See channel IDs in: Module Channel Description
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Bind two modules together. After binding, data frames from the src_vnode_fd module will automatically flow to the dst_vnode_fd module.
【Notes】
The flow must be created and the modules must be opened.
5.2.6.26. hbn_vflow_unbind_vnode
【Function Declaration】
hobot_status hbn_vflow_unbind_vnode(hbn_vflow_handle_t vflow_fd, hbn_vnode_handle_t src_vnode_fd, uint32_t out_chn, hbn_vnode_handle_t dst_vnode_fd, uint32_t in_chn)
【Parameter Description】
[IN] hbn_vflow_handle_t *vflow_fd: vflow handle;
[IN] hbn_vnode_handle_t src_vnode_fd: Source module’s vnode handle;
[IN] uint32_t out_chn: Output channel ID of the source module. See channel IDs in: Module Channel Description
[IN] hbn_vnode_handle_t dst_vnode_fd: Destination module’s vnode handle;
[IN] uint32_t in_chn: Input channel ID of the destination module. See channel IDs in: Module Channel Description
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Unbind the src_vnode_fd and dst_vnode_fd modules.
【Notes】
No need to call hbn_vflow_unbind_vnode after calling hbn_vflow_destroy
5.2.6.27. hbn_vflow_start
【Function Declaration】
hobot_status hbn_vflow_start(hbn_vflow_handle_t vflow_fd)
【Parameter Description】
[IN] hbn_vflow_handle_t vflow_fd: vflow handle;
【Return Value】
Success: HBN_STATUS_SUCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Start a vflow. All vnodes contained within the vflow will be started.
【Notes】
Module vnode needs to be added to vflow in advance.
5.2.6.28. hbn_vflow_stop
【Function Declaration】
hobot_status hbn_vflow_stop(hbn_vflow_handle_t vflow_fd)
【Parameter Description】
[IN] hbn_vflow_handle_t vflow_fd: vflow handle;
【Return Value】
Success: HBN_STATUS_SUCCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Stop a vflow. All vnodes contained in the vflow will be stopped.
【Notes】
Should be used in pair with hbn_vflow_start.
5.2.6.29. hbn_vflow_get_vnode_handle
【Function Declaration】
hbn_vnode_handle_t hbn_vflow_get_vnode_handle(hbn_vflow_handle_t vflow_fd, hb_vnode_type vnode_type, uint32_t index)
【Parameter Description】
[IN] hbn_vflow_handle_t vflow_fd: vflow handle;
[IN] hb_vnode_type vnode_type: module ID;
[IN] uint32_t index: context ID, range [0, 7]
【Return Value】
Success: HBN_STATUS_SUCCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Obtain vnode handle via module ID and context ID.
【Notes】
The module must be opened in advance.
5.2.6.30. hbn_vflow_create_cfg
【Function Declaration】
hobot_status hbn_vflow_create_cfg(const char *cfg_file, hbn_vflow_handle_t *vflow_fd)
【Parameter Description】
[IN] const char *cfg_file: configuration file path;
[OUT] hbn_vflow_handle_t *vflow_fd: pointer to vflow handle array, which may contain multiple vflows;
【Return Value】
Success: HBN_STATUS_SUCCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Create a vflow containing vnodes and their binding relationships from a configuration file.
Operations inside the interface include: creating vflow, creating vnode, adding vnode to vflow, and binding vnodes.
【Notes】
None
5.2.6.31. hbn_vflow_get_version
【Function Declaration】
hobot_status hbn_vflow_get_version(hbn_version_t *version)
【Parameter Description】
[OUT] hbn_version_t *version: pointer to version information structure
【Return Value】
Success: HBN_STATUS_SUCCESS 0
Failure: Negative error code, refer to Return Value Description
【Function Description】
Obtain version information of hbn API.
【Notes】
Not supported yet.
5.2.7. Data Structures
5.2.7.1. Common Parameters
hbn_buf_alloc_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
flags |
int64_t |
- | - | - | buffer flag, refer to hbmem module | Yes |
buffers_num |
uint32_t |
- | - | - | number of buffers to allocate | Yes |
is_contig |
uint32_t |
- | - | - | whether multi-layer buffers are allocated as a contiguous block | Yes |
hbn_frame_info_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
frame_id |
uint32_t |
- | - | - | frame ID | - |
timestamps |
uint64_t |
- | - | - | timestamp obtained from kernel at sif framestart | - |
sys_timestamps |
uint64_t |
- | - | - | system timestamp obtained from kernel at sif framestart | - |
tv |
struct timeval |
- | - | - | hardware timestamp obtained at sif framestart | - |
trig_tv |
struct timeval |
- | - | - | hardware timestamp at sensor trigger exposure moment in trigger mode | - |
frame_done |
uint32_t |
- | - | - | temporarily unused | - |
bufferindex |
int32_t |
- | - | - | index of corresponding buffer |
hbn_vnode_image_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
info |
hbn_frame_info_t |
- | - | - | frame information | - |
buffer |
hb_mem_graphic_buf_t |
- | - | - | buffer information | - |
*metadata |
void |
- | - | - | metadata data | - |
hbn_version_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
major |
uint32_t |
- | - | - | major version number | - |
minor |
uint32_t |
- | - | - | minor version number | - |
5.2.7.2. MIPI Parameters
mipi_config_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
rx_enable |
uint32_t |
0 | 1 | 0 | RX device enable, enables corresponding MIPI RX port. | Yes |
rx_attr |
mipi_host_cfg_t |
- | - | - | RX device attributes, sets properties of corresponding MIPI RX port. | Yes |
rx_ex_mask |
uint64_t |
- | - | - | RX advanced attribute mask. | No |
rx_attr_ex |
mipi_host_param_t |
- | - | - | RX advanced attribute configuration | No |
*bypass |
mipi_bypass_t |
- | - | - | MIPI RX -> TX bypass enable, data received via MIPI RX is directly sent out via MIPI TX. | No |
mipi_host_cfg_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
phy |
uint16_t |
0 | 1 | 0 | 0: represents dphy, X5 only supports this protocol. | No |
lane |
uint16_t |
1 | 4 | - | number of mipi lanes; each MIPI RX currently supports 2 lanes by default; setting to 4 enables lane stitching. | Yes |
datatype |
uint16_t |
- | - | - | input data format of mipi, must match sensor configuration. | Yes |
fps |
uint16_t |
0 | 120 | 0 | frame rate, used for calculating MIPI configuration. | Yes |
mclk |
uint16_t |
0 | 65535 | 0 | sensor mclk configuration: | Yes |
| 0: use external mclk | ||||||
| 1: use chip-generated 24MHz mclk | ||||||
| 2~24: invalid and dropped | ||||||
| 25~636: invalid and error | ||||||
| 637~ : configured frequency = mclk*10KHz → 6.37MHz~655.35MHz | ||||||
mipiclk |
uint16_t |
0 | - | 0 | total MIPI transmission rate (all LANEs) | Yes |
width |
uint16_t |
0 | 8192 | - | input image width (in pixels) | Yes |
height |
uint16_t |
0 | 4096 | - | input image height (in pixels) | Yes |
linelenth |
uint16_t |
0 | - | - | total line length including hblank, used by RX for ipi parameter calculation, TX VPG mode can adjust frame rate | Yes |
framelenth |
uint16_t |
0 | - | - | total height including hblank, used by RX for ipi parameter calculation, TX VPG mode can adjust frame rate | Yes |
settle |
uint16_t |
0 | - | - | mipi settle time, phy settle time configuration, adjustable when phy error occurs | Yes |
ppi_pg |
uint16_t |
0 | - | - | mipi output test pattern, not functional, reserved for future use | No |
hsaTime |
uint16_t |
0 | - | - | ipi configuration, time of horizontal synchronism active | No |
hbpTime |
uint16_t |
0 | - | - | ipi configuration, time of horizontal back period | No |
hsdTime |
uint16_t |
0 | - | - | ipi configuration, time of horizontal sync porch delay period | No |
channel_num |
uint16_t |
0 | 4 | 0 | number of mipi virtual channels | Yes |
channel_sel[MIPIHOST_CHANNEL_NUM] |
uint16_t |
0 | 1 | 0 | ipi channel corresponding to mipi virtual channel | Yes |
5.2.7.3. SIF Parameters
vin_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
vin_node_attr |
vin_node_attr_t |
- | - | - | vin node attribute description | Yes |
vin_attr_ex |
vin_attr_ex_t |
- | - | - | enhanced vin node attribute description | Yes |
vin_ochn_attr[] |
vin_ochn_attr_t |
- | - | - | vin node output channel attribute description | Yes |
vin_ichn_attr |
vin_ichn_attr_t |
- | - | - | vin node input channel attribute description | Yes |
vin_ochn_buff_attr[] |
vin_ochn_buff_attr_t |
- | - | - | vin node output buffer attribute description | Yes |
vin_node_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
cim_attr |
cim_attr_t |
- | - | - | cim/sif attribute description | Yes |
lpwm_attr |
lpwm_attr_t |
- | - | - | lpwm attribute description, used for multi-sensor synchronization | No |
vcon_attr |
vcon_attr_t |
- | - | - | vcon attribute description | No |
flow_id |
uint32_t |
0 | - | - | pipeline ID, can be left unset | No |
cim_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
mipi_en |
uint32_t |
0 | 1 | 0 | enable mipi, reserved, currently not required | No |
mipi_rx |
uint32_t |
0 | 4 | 0 | mipi rx port number | Yes |
vc_index |
uint32_t |
0 | 4 | 0 | mipi virtual index | Yes |
ipi_channel |
uint32_t |
1 | 2 | 0 | ipi channel number, | Yes |
| 1 for linear mode, | ||||||
| 2 for hdr dol2 mode | ||||||
tpg_input |
cim_input_tpg_t |
- | - | - | reserved for future use | No |
func |
cim_func_desc_t |
- | - | - | cim/sif advanced functions | Yes |
cim_func_desc_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
enable_frame_id |
uint32_t |
0 | 1 | 0 | enable frame ID | No |
set_init_frame_id |
uint32_t |
0 | - | 0 | initial value for frame ID | No |
time_stamp_en |
uint32_t |
- | - | - | enable timestamp | No |
time_stamp_mode |
uint32_t |
1 | 8 | - | sif/cim timestamp latching type, select one of the following: | No |
| 0x01: latch tv at frame start | ||||||
| 0x02: latch trig_tv at sensor exposure trigger | ||||||
| 0x03: latch both tv and trig_tv, recommended | ||||||
| Others: reserved | ||||||
ts_src |
uint32_t |
0 | 12 | 0 | source that triggers SIF to latch timestamp | No |
| 0: trig_tv and tv timestamps not enabled | ||||||
| 1: LPWM0_CHN0 triggers high-level moment for SIF to latch tv and trig_tv | ||||||
| 2: LPWM0_CHN1 triggers high-level moment for SIF to latch tv and trig_tv | ||||||
| 3: LPWM0_CHN2 triggers high-level moment for SIF to latch tv and trig_tv | ||||||
| 4: LPWM0_CHN3 triggers high-level moment for SIF to latch tv and trig_tv | ||||||
| 5: LPWM1_CHN0 triggers high-level moment for SIF to latch tv and trig_tv | ||||||
| 6: LPWM1_CHN1 triggers high-level moment for SIF to latch tv and trig_tv | ||||||
| 7: LPWM1_CHN2 triggers high-level moment for SIF to latch tv and trig_tv | ||||||
| 8: LPWM1_CHN3 triggers high-level moment for SIF to latch tv and trig_tv | ||||||
| 9: ENET_PTP reserved, not used | ||||||
| 10: SW reserved, not used | ||||||
| 11: MCU reserved, not used | ||||||
| 12: GPS reserved, not used | ||||||
pps_src |
uint32_t |
- | - | - | reserved, not used | No |
enable_pattern |
uint32_t |
- | - | - | reserved, not used | No |
skip_frame |
cim_skip_type_e |
0 | 4 | 0 | software skip frame mode, takes effect during pipeline initialization | No |
0 (CIM_DISABLE_SKIP): skip frame disabled |
||||||
1 (CIM_IN_RATIO_SKIP): ratio-based skip frame, requires input_fps and output_fps |
||||||
2 (CIM_FIRST_FRAMES_SKIP): discard the first N frames |
||||||
3 (CIM_HW_SKIP): hardware skip frame |
||||||
input_fps |
uint32_t |
1 | - | 0 | input frame rate, i.e. actual sensor frame rate. Required when skip_frame = 1 |
No |
output_fps |
uint32_t |
1 | - | 0 | desired output frame rate, must be less than input_fps. Required when skip_frame = 1 |
No |
| Uses Bresenham algorithm to drop frames evenly in SIF DONE interrupt | ||||||
Example: input_fps=30, output_fps=1 means keeping only 1 frame out of 30fps |
||||||
skip_nums |
uint32_t |
- | - | - | reserved, not used | No |
hw_extract_m |
uint32_t |
- | - | - | reserved, not used | No |
hw_extract_n |
uint32_t |
- | - | - | reserved, not used | No |
hdr_mode |
enum hdr_mode |
0 | 2 | 0 | value set as enum hdr_mode: | Yes |
| 0: no multi-frame synthesis required by SoC ISP | ||||||
| 1: two-frame synthesis required by SoC | ||||||
| 2: three-frame synthesis required (reserved, not supported by X5) |
vin_attr_ex_t
Set VIN extended attributes via hbn_vnode_set_attr_ex, supporting both static configuration and runtime dynamic modification. Each call requires setting ex_attr_type to specify the operation type.
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
ex_attr_type |
vin_attr_ex_type_e |
- | - | - | extended attribute type, determines which field takes effect | Yes |
VIN_STATIC_CIM_ATTR (0): CIM static attributes |
||||||
VIN_DYNAMIC_FPS_CTRL (2): runtime dynamic frame rate control |
||||||
VIN_STATIC_MCLK_ATTR (7): MCLK frequency configuration |
||||||
cim_static_attr |
cim_static_attr_t |
- | - | - | CIM static attributes, effective when ex_attr_type = 0 |
No |
fps_ctrl |
dynamic_fps_t |
- | - | - | dynamic frame rate control, effective when ex_attr_type = 2 |
No |
mclk_ex_attr |
mclk_attr_ex_t |
- | - | - | MCLK extended attributes, effective when ex_attr_type = 7 |
No |
vin_attr_ex_mask |
uint64_t |
- | - | 0 | attribute mask during initialization, bit positions correspond to ex_attr_type enum values |
No |
dynamic_fps_t
Runtime frame rate control structure, used with hbn_vnode_set_attr_ex and ex_attr_type = VIN_DYNAMIC_FPS_CTRL. Frame rate can be modified at any time while the pipeline is running, taking effect on the next frame immediately.
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
skip_mode |
cim_skip_type_e |
0 | 4 | 0 | skip frame mode | Yes |
0 (CIM_DISABLE_SKIP): skip frame disabled, restore original sensor frame rate |
||||||
1 (CIM_IN_RATIO_SKIP): ratio-based skip frame |
||||||
in_fps |
uint32_t |
1 | - | 0 | input frame rate (actual sensor frame rate), required when skip_mode = 1 |
Yes |
out_fps |
uint32_t |
1 | - | 0 | desired output frame rate, must be less than in_fps, required when skip_mode = 1 |
Yes |
| Uses Bresenham algorithm to drop frames evenly in SIF DONE interrupt | ||||||
Example: in_fps=30, out_fps=10 means output 10fps |
Usage example (runtime dynamic frame rate modification):
vin_attr_ex_t vin_attr_ex = {0};
vin_attr_ex.ex_attr_type = VIN_DYNAMIC_FPS_CTRL;
vin_attr_ex.fps_ctrl.skip_mode = CIM_IN_RATIO_SKIP; // ratio-based skip frame
vin_attr_ex.fps_ctrl.in_fps = 30; // actual sensor frame rate
vin_attr_ex.fps_ctrl.out_fps = 10; // desired output 10fps
hbn_vnode_set_attr_ex(vin_node_handle, &vin_attr_ex);
// disable skip frame, restore original frame rate
vin_attr_ex.fps_ctrl.skip_mode = CIM_DISABLE_SKIP;
vin_attr_ex.fps_ctrl.in_fps = 0;
vin_attr_ex.fps_ctrl.out_fps = 0;
hbn_vnode_set_attr_ex(vin_node_handle, &vin_attr_ex);
vin_ochn_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
ddr_en |
uint32_t |
0 | 1 | 0 | whether data is written to DDR | Yes |
roi_en |
uint32_t |
- | - | - | reserved | No |
emb_en |
uint32_t |
- | - | - | reserved, whether sensor embedded data is written to DDR | No |
ochn_attr_type |
vin_ochn_attr_type_e |
- | - | - | vin ochn attribute VIN_BASIC_ATTR, // default, basic vin attribute VIN_EMB_ATTR, // sensor with emb output |
Yes |
vin_basic_attr |
vin_basic_attr_t |
- | - | - | vin basic attribute, required when writing to DDR | Yes |
rawds_attr |
vin_rawds_attr_t |
- | - | - | reserved | No |
roi_attr |
vpm_commn_roi_data_desc |
- | - | - | reserved | No |
emb_attr |
vin_emb_attr_t |
- | - | - | reserved, required when emb is enabled | No |
vin_basic_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
pack_mode |
uint32_t |
- | - | - | reserved | No |
wstride |
uint32_t |
0 | - | - | wide stride for cim/sif DDR output, 16-byte aligned. | Yes |
| width for raw8, 2*width for raw10~raw16 | ||||||
vstride |
uint32_t |
- | - | - | reserved | No |
format |
uint32_t |
- | - | - | required when writing to DDR | Yes |
vin_pdaf_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
| pdaf_en | uint32_t | - | - | 0 | whether PD info channel is enabled, 1: enabled, 0: disabled | Yes |
| pd_ipi_channel | uint32_t | 0 | 3 | - | specify which IPI channel PD info uses. RAW data uses IPI channel 0, PD info can use channel 1 |
Yes |
| pd_width | uint32_t | - | - | width of PD info | Yes | |
| pd_height | uint32_t | - | - | - | height of PD info | Yes |
| pd_format | uint32_t | - | - | - | format of PD info | Yes |
vin_ichn_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
format |
uint32_t |
- | - | - | vin format, sensor output format | Yes |
width |
uint32_t |
0 | 8192 | 0 | sensor output resolution width in pixels | Yes |
height |
uint32_t |
0 | 4096 | 0 | sensor output resolution height in pixels | Yes |
vin_ochn_buff_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
buffers_num |
uint32_t |
0 | - | 0 | number of buffers for cim/sif DDR output, typically set to 6 | Yes |
flags |
int64_t |
- | - | - | typically set in program as: | No |
| hbn_buf_alloc_attr_t.flags = HB_MEM_USAGE_CPU_READ_OFTEN OR | ||||||
| HB_MEM_USAGE_CPU_WRITE_OFTEN OR | ||||||
| HB_MEM_USAGE_CACHED |
lpwm_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
enable |
uint32_t |
0 | - | 0 | whether to enable LPWM | No |
lpwm_chn_attr_t lpwm_chn_attr[LPWM_CHN_NUM] |
- | - | - | - | LPWM channel attribute configuration | No |
| LPWM_CHN_NUM is 4 |
lpwm_chn_attr_t
| Name | Type | Min | Max | Default | Description | Required | Output 30Hz, high level 10us parameters |
|---|---|---|---|---|---|---|---|
trigger_source |
uint32_t |
0 | 10 | 0 | trigger source selection | No | |
| 0-3: pad_trigger_in, hardware IO input PPS | |||||||
| 4: enet_ptp_pps, reserved | |||||||
| 5: sw_trigger_in, software trigger | |||||||
| 6: gps_trigger_in (TIME_SYNC2), hardware IO input PPS | |||||||
| 7: mcu_trigger_in (TIME_SYNC1), hardware IO input PPS | |||||||
| 8: time_sync2_in (TIME_SYNC3), hardware IO input PPS | |||||||
| 9: time_sync3_in (TIME_SYNC4), hardware IO input PPS | |||||||
| 10: camera_1sec_pulse_out, reserved | |||||||
| Note: refer to pinlist document for corresponding hardware IO pins. | |||||||
trigger_mode |
uint32_t |
0 | 1 | 0 | trigger mechanism (1 - external hardware trigger, 0 - internal software trigger ) | No | |
| when trigger_mode is 0, automatically set to software trigger, trigger_source can be omitted | |||||||
period |
uint32_t |
2 us | 1000000 us | 0 | period, actual effective period is (period + 1)us | No | 33332 |
offset |
uint32_t |
0 | (1000000/period) us | 0 | after LPWM is triggered by source, LPWM outputs square wave after offset(us). | No | 11 |
| effective time: floor((1/24) * (offset * 24 + 3)) us | |||||||
duty_time |
uint32_t |
0 | (4096/period) us | 0 | high-level active time, actual effective time is (duty_time + 1)us | No | 9 |
threshold |
uint32_t |
0 | 65535 us | 0 | threshold for slow synchronization function | No | 0 |
adjust_step |
uint32_t |
0 | 15 | 0 | adjustment time per step: adjust_time = 2 ^ adjust_step | No | 0 |
5.2.7.4. ISP Parameters
isp_cfg_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
isp_attr |
isp_attr_t |
· | · | · | ISP basic attributes | Yes |
ochn_attr |
isp_ochn_attr_t |
· | · | · | ISP output channel attributes | Yes |
ichn_attr |
isp_ichn_attr_t |
· | · | · | ISP input channel attributes | Yes |
isp_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
input_mode |
uint32_t |
0 | 2 | 0 | upstream module input mode 0 - PASSTHROUGH_MODE 1 - MCM_MODE 2 - DDR_MODE Note: when input_mode is 0 or 1, sif must bind to isp using channel 1. when input_mode is 2, sif DDR function must be enabled, and sif binds to isp using channel 0. PASSTHROUGH_MODE supports single stream only, MCM_MODE supports up to four streams. |
Yes |
sched_mode |
uint32_t |
0 | 2 | 0 | image processing priority policy, currently not supported 0 - ROUND_ROBIN 1 - FIXED_SEQUENCE 2 - FIFO |
No |
tile_mode |
uint32_t |
0 | 1 | 0 | whether to enable tile_mode, must be enabled when input size exceeds 4096 | No |
sensor_mode |
isp_sensor_mode_e |
0 | 2 | 0 | corresponding sensor mode 0 - ISP_NORMAL_M 1 - ISP_DOL2_M 2 - ISP_PWL_M |
Yes |
crop |
common_rect_t |
· | · | · | crop region for input image | No |
isp_ichn_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
tpg_en |
cam_bool_e |
0 | 1 | 0 | enable tpg function, currently not supported | No |
width |
uint32_t |
0 | 5472 | 0 | input image width | Yes |
height |
uint32_t |
0 | 3076 | 0 | input image height | Yes |
fmt |
frame_format_e |
FRM_FMT_RAW | FRM_FMT_RAW | 0 | FRM_FMT_NULL - invalid, FRM_FMT_RAW - RAW format, FRM_FMT_NV12 - NV12 format, FRM_FMT_UYVY - UYVY format, currently only RAW format is supported | Yes |
bit_width |
uint32_t |
8 | 12 | 0 | bit width of input image data | Yes |
isp_ochn_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
ddr_en |
cam_bool_e |
0 | 1 | 0 | output image to DDR | Yes |
out |
common_rect_t |
· | · | · | output image size, post-crop not supported yet, so setting has no effect | No |
fmt |
frame_format_e |
FRM_FMT_NV12 | FRM_FMT_NV12 | 0 | FRM_FMT_NULL - invalid, FRM_FMT_RAW - RAW format, FRM_FMT_NV12 - NV12 format, FRM_FMT_UYVY - UYVY format, currently only NV12 format is supported | Yes |
bit_width |
uint32_t |
8 | 8 | 8 | bit width of output image data, currently only NV12 format, 8bit | Yes |
5.2.7.5. VSE Parameters
vse_ochn_type_e
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
VSE_DOWN_SCALE_4K |
- | - | - | - | downscale output channel, maximum 4K | - |
VSE_DOWN_SCALE_1080P0 |
- | - | - | - | downscale output channel, maximum 1080p-0 | - |
VSE_DOWN_SCALE_1080P1 |
- | - | - | - | downscale output channel, maximum 1080p-1 | - |
VSE_DOWN_SCALE_720P0 |
- | - | - | - | downscale output channel, maximum 720p-0 | - |
VSE_DOWN_SCALE_720P1 |
- | - | - | - | downscale output channel, maximum 720p-1 | - |
VSE_UP_SCALE_4K |
- | - | - | - | upscale output channel, up to 4x scaling, maximum output size 4096x3076 | - |
| Note: 4x of cropped size; width and height scaling ratios can be adjusted freely, total scaling factor up to 4 | ||||||
VSE_OCHN_MAX |
vse_cfg_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
vse_attr |
vse_attr_t |
- | - | - | vse basic attributes | Yes |
ochn_attr[VSE_OCHN_MAX] |
vse_ochn_attr_t |
- | - | - | vse output channel attributes | Yes |
ichn_attr |
vse_ichn_attr_t |
- | - | - | vse input channel attributes | Yes |
vse_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
fps |
frame_fps_ctrl_t |
- | - | 0 | configure fps of input image src, used for frame rate control | No |
vse_ichn_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
tpg_en |
cam_bool_e |
0 | 1 | 0 | enable tpg function, currently not supported | No |
width |
uint32_t |
0 | 5432 | 0 | original input image width | Yes |
height |
uint32_t |
0 | 3076 | 0 | original input image height | Yes |
fmt |
frame_format_e |
FRM_FMT_NV12 |
FRM_FMT_NV12 |
0 | image format, currently only NV12 format supported | Yes |
bit_width |
uint32_t |
8 | 8 | 0 | input image bit width | Yes |
vse_ochn_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
chn_en |
cam_bool_e |
0 | 1 | 0 | enable channel | Yes |
roi |
common_rect_t |
- | - | - | crop region for output image, all zeros means disabled | No |
target_w |
uint32_t |
0 | limited by channel capability | 0 | output image width, 0 means scale disabled | Yes |
target_h |
uint32_t |
0 | limited by channel capability | 0 | output image height, 0 means scale disabled | Yes |
y_stride |
uint32_t |
0 | - | 0 | y-plane stride of output image, currently not supported | No |
uv_stride |
uint32_t |
0 | - | 0 | uv-plane stride of output image, currently not supported | No |
fmt |
frame_format_e |
FRM_FMT_NV12 |
FRM_FMT_NV12 |
0 | output image format, currently only NV12 format supported | Yes |
bit_width |
uint32_t |
8 | 8 | 0 | output image bit width | Yes |
fps |
frame_fps_ctrl_t |
- | - | 0 | configure fps of output image dst, used for frame rate control | No |
Notes:
Fields such as width, height, format, etc., must comply with hardware capability limitations.
A default value of 0 may disable the corresponding function.
5.2.7.6. GDC Parameters
—
gdc_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
config_addr |
uint64_t |
- | - | - | Address of the GDC configuration file | Yes |
config_size |
uint32_t |
- | - | - | Size of the GDC configuration file | Yes |
div_width |
uint8_t |
8 | - | 0 | Reserved (not used for now) | Yes |
div_height |
uint8_t |
0 | - | 0 | Reserved (not used for now) | No |
total_planes |
uint32_t |
0 | - | 0 | Number of YUV layers | Yes |
binary_ion_id |
int32_t |
0 | - | 0 | Share ID of the physical address of the configuration file | Yes |
binary_offset |
uint64_t |
0 | - | 0 | Offset of the physical address where the configuration file resides | Yes |
gdc_ichn_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
input_width |
uint32_t |
0 | 4096 | 0 | Width of input image | Yes |
input_height |
uint32_t |
0 | 2160 | 0 | Height of input image | Yes |
input_stride |
uint32_t |
0 | - | 0 | Stride of input image | Yes |
n_in_one |
uint32_t |
0 | - | 0 | Feed n frames to compose 1 frame | Yes |
gdc_ochn_attr_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
output_width |
uint32_t |
0 | - | 0 | Width of output image | Yes |
output_height |
uint32_t |
0 | - | 0 | Height of output image | Yes |
output_stride |
uint32_t |
0 | - | 0 | Stride of output image | Yes |
Notes
The input and output width and height of GDC must be even numbers.
Input and output strides must be multiples of 16.
5.2.7.7. N2D Parameters
n2d_command_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
| scale | - | - | - | - | Indicates that scale (resizing) operation will be performed | Yes |
| overlay | - | - | - | - | Indicates that overlay (layering) operation will be performed | Yes |
| stitch | - | - | - | - | Indicates that stitch (image stitching) operation will be performed | Yes |
| csc | - | - | - | - | Indicates that csc (color space conversion) operation will be performed | Yes |
n2d_config_t
| Name | Type | Min | Max | Default | Description | Required |
|---|---|---|---|---|---|---|
| ninputs | uint32_t | 0 | 4 | - | Number of input channels | Yes |
| input_width[N2D_IN_MAX] | uint32_t | 0 | 4096 | - | Width of N2D input channels | Yes |
| input_height[N2D_IN_MAX] | uint32_t | 0 | 2160 | - | Height of N2D input channels | Yes |
| input_stride[N2D_IN_MAX] | uint32_t | - | - | - | Row stride of N2D input channels | Yes |
| output_width | uint32_t | 0 | 4096 | - | Width of N2D output channel | Yes |
| output_height | uint32_t | 0 | 2160 | - | Height of N2D output channel | Yes |
| output_stride | uint32_t | - | - | - | Row stride of N2D output channel | Yes |
| output_format | uint32_t | - | - | - | Format of N2D output channel | Yes |
| in_buffer_addr[N2D_IN_MAX][HBN_VIO_BUFFER_MAX_PLANES] | uint64_t | - | - | - | Data address of N2D input channels | Yes |
| out_buffer_addr[HBN_VIO_BUFFER_MAX_PLANES] | uint64_t | - | - | - | Data address of N2D output channel | Yes |
| command | n2d_command_t | - | - | - | Operation to be performed by this configuration | Yes |
5.2.8. Return Value Description
| Error Code | Macro Definition | Description | Common Causes and Solutions |
|---|---|---|---|
| 0 | HBN_STATUS_SUCESS | Success | |
| 1 | HBN_STATUS_INVALID_NODE | Invalid vnode, corresponding vnode not found | |
| 2 | HBN_STATUS_INVALID_NODETYPE | Invalid vnode type, corresponding vnode not found | For VSE, vnode type should be HB_VSE |
| 3 | HBN_STATUS_INVALID_HWID | Invalid hardware module ID | For VSE, hw_id should be 0 |
| 4 | HBN_STATUS_INVALID_CTXID | Invalid context ID | Can be set to AUTO_ALLOC_ID, automatically assigned by HNB framework |
| 5 | HBN_STATUS_INVALID_OCHNID | Invalid output channel ID | VSE output channel range is [0,5] |
| 6 | HBN_STATUS_INVALID_ICHNID | Invalid input channel ID | VSE supports only 1 input channel |
| 7 | HBN_STATUS_INVALID_FORMAT | Invalid format | |
| 8 | HBN_STATUS_INVALID_NULL_PTR | Null pointer | |
| 9 | HBN_STATUS_INVALID_PARAMETER | Invalid parameter, version check failed | |
| 10 | HBN_STATUS_ILLEGAL_ATTR | Invalid parameter | |
| 11 | HBN_STATUS_INVALID_FLOW | Invalid flow, corresponding flow not found | |
| 12 | HBN_STATUS_FLOW_EXIST | Flow already exists | |
| 13 | HBN_STATUS_FLOW_UNEXIST | Flow does not exist | |
| 14 | HBN_STATUS_NODE_EXIST | Node already exists | |
| 15 | HBN_STATUS_NODE_UNEXIST | Node does not exist | |
| 16 | HBN_STATUS_NOT_CONFIG | Reserved | |
| 17 | HBN_STATUS_CHN_NOT_ENABLED | Channel not enabled | |
| 18 | HBN_STATUS_CHN_ALREADY_ENABLED | Channel already enabled | |
| 19 | HBN_STATUS_ALREADY_BINDED | Node already bound | |
| 20 | HBN_STATUS_NOT_BINDED | Node not bound | |
| 21 | HBN_STATUS_TIMEOUT | Timeout | |
| 22 | HBN_STATUS_NOT_INITIALIZED | Not initialized | |
| 23 | HBN_STATUS_NOT_SUPPORT | Channel not supported or not activated | |
| 24 | HBN_STATUS_NOT_PERM | Operation not allowed | |
| 25 | HBN_STATUS_NOMEM | Insufficient memory | |
| 26 | HBN_STATUS_INVALID_VNODE_FD | Invalid node file descriptor | |
| 27 | HBN_STATUS_INVALID_ICHNID_FD | Invalid input channel file descriptor | |
| 28 | HBN_STATUS_INVALID_OCHNID_FD | Invalid output channel file descriptor | |
| 29 | HBN_STATUS_OPEN_OCHN_FAIL | Failed to open output channel | |
| 30 | HBN_STATUS_OPEN_ICHN_FAIL | Failed to open input channel | |
| 31 | HBN_STATUS_JSON_PARSE_FAIL | JSON parsing failed | |
| 32 | HBN_STATUS_REQ_BUF_FAIL | Failed to request buffer | |
| 33 | HBN_STATUS_QUERY_BUF_FAIL | Failed to query buffer information | |
| 34 | HBN_STATUS_SET_CONTROL_FAIL | Failed to set module control or adjustment parameters (e.g., ISP effect parameters) | |
| 35 | HBN_STATUS_GET_CONTROL_FAIL | Failed to get module control or adjustment parameters (e.g., ISP effect parameters) | |
| 36 | HBN_STATUS_NODE_START_FAIL | Failed to start node | |
| 37 | HBN_STATUS_NODE_STOP_FAIL | Failed to stop node | |
| 38 | HBN_STATUS_NODE_POLL_ERROR | Node channel poll error | |
| 39 | HBN_STATUS_NODE_POLL_TIMEOUT | Node channel poll timeout | |
| 40 | HBN_STATUS_NODE_POLL_FRAME_DROP | Frame drop occurred during node channel poll | |
| 41 | HBN_STATUS_NODE_POLL_HUP | Descriptor hang-up during node channel poll | |
| 42 | HBN_STATUS_NODE_ILLEGAL_EVENT | Illegal event during node channel poll | |
| 43 | HBN_STATUS_NODE_DEQUE_ERROR | Node channel dequeue buffer error | |
| 44 | HBN_STATUS_ILLEGAL_BUF_INDEX | Invalid buffer index | |
| 45 | HBN_STATUS_NODE_QUE_ERROR | Node channel queue buffer error | |
| 46 | HBN_STATUS_FLUSH_FRAME_ERROR | Node channel frame flush error | |
| 47 | HBN_STATUS_INIT_BIND_ERROR | Error occurred during JSON parsing and binding | |
| 48 | HBN_STATUS_ADD_NODE_FAIL | Failed to add node to flow | |
| 49 | HBN_STATUS_WRONG_CONFIG_ID | Node ID not supported by system | |
| 50 | HBN_STATUS_BIND_NODE_FAIL | Error occurred when binding node to flow | |
| 51 | HBN_STATUS_INVALID_VERSION | Mismatch between lower-level driver module and upper-layer library version | |
| 52 | HBN_STATUS_GET_VERSION_ERROR | Failed to get lower-level driver module version | |
| 53 | HBN_STATUS_MEM_INIT_FAIL | hbmem memory initialization failed | |
| 54 | HBN_STATUS_MEM_IMPORT_FAIL | hbmem memory import failed | |
| 55 | HBN_STATUS_MEM_FREE_FAIL | hbmem memory release failed | |
| 56 | HBN_STATUS_SYSFS_OPEN_FAIL | Failed to open system file | |
| 57 | HBN_STATUS_STRUCT_SIZE_NOT_MATCH | HAL layer structure size does not match kernel layer | |
| 58 | HBN_STATUS_RGN_UNEXIST | Unable to retrieve corresponding rgn data | |
| 59 | HBN_STATUS_RGN_INVALID_OPERATION | Invalid rgn operation | |
| 60 | HBN_STATUS_RGN_OPEN_FILE_FAIL | Failed to open file in rgn module | |
| 128 | HBN_STATUS_ERR_UNKNOW | Unknown error |