System module including base function such as Bind etc.
More...
System module including base function such as Bind etc.
1 Concept
System control is mainly responsible for the connection of each module, and the definition of data flow's function. There we have some important concepts:
1.1 Device
Device is to complete a set of (class) functions. Such as FrameSource generates Video source data output, Encoder realizes the function of video encoding or image encoding. FrameSouce and Encoder both are devices.
A Device is just a collection of concepts, and not a specific data flow node.
1.2 Group
Group is the smallest unit of data input. A Device can have several Groups. Each Group has only one input, but multiple outputs (1.3 Output). Group is also a specific function of the container, you can check about further explanation (1.5 Channel)
1.3 Output
Output is Group's smallest unit of data output. A Group can have several outputs, and each Output can only generate one way of data.
1.4 Cell
Cell is a combination of Device, Group and Output infomation. See IMPCell for further informations.
Cell is mainly to bind( ). According to the definition of Device, Group, and Output, Output is the output node and Group is the input node.
When Binding, the output node refers to the output Cell's Output, and the input node refers to the input Cell's Group (so Cell as a data entry, Output is a meaningless value).
1.5 Channel
Channel usually refers to a single function of the unit. Specific function needs to be appointed while creating a Channel.
For example, The Channnel of the Encoder is used for H264 encoding or JPEG encoding. The specific algorithm type parameters are appointed when the channel is created. For OSD, there is a similar concept with Channel, Region. A Region is a specific overlay area, it can be PIC (image), COVER (block), etc.
For FrameSource, one Channel outputs one single original image, Channel FrameSource is actually Group
Channel as a functional unit, usually requires Register to Group (except FrameSource), in order to receive data. The Channel once registered to Group, it will get the Group input. For different Group Device, the Register Channel number is also different.
2 Bind
After binding two Groups, the source Group data will be automaticly sent to the destination Group. Because the group is the smallest unit of data input and Output is the smallest unit of data output, therefore the srcCell's two parameters(deviceID, groupid) of IMP system bind (IMPCell *srcCell, IMPCell *dstCell) . OutputID is effective while dstCell only deviceID and groupID are valid, outputID is meaningless as a data entry.
the following figure is a simple example of Bind.
The image above, is the binding of one FrameSource's output to an Encoder's Group. in the Encoder's Group registers two Channels, so Encoder Group is a two-way output: H264 and JPEG.
Sample code in this situation:
if (ret < 0)
printf("Bind FrameSource Channel0 and Encoder Group0 failed\n");
Data streams are connected via Bind. So strategy may be different in different data-flow case. The following is a figure of typical case of dual-stream:
Sample code in this situation:
Bind the main stream:
if (ret < 0)
printf("Bind FrameSource Channel0 and OSD Group0 failed\n");
if (ret < 0)
printf("Bind OSD Group0 and Encoder Group0 failed\n");
Bind the second stream:
if (ret < 0)
printf("Bind FrameSource Channel1 and OSD Group1 failed\n");
if (ret < 0)
printf("Bind OSD Group1 and Encoder Group1 failed\n");
if (ret < 0)
printf("Bind FrameSource Channel1 Output1 and IVS failed\n");
- Attention
- It is recommended that all Bind operations are performed during system initialization.
-
After making the FrameSource enable, Bind and UnBind operation can not be dynamically called, you first need to disable FrameSource and then UnBind.
-
DestroyGroup can be processed after "UnBind".
Bind can be a tree structure, the following figure is an example
in the image above, the channel1(Group.1) of FrameSource's back-end binds two Groups, respectively from the Output.0 and Output.1 output data. In this case, the benefits of such binding is that IVS Group can work with OSD Group in parallel.
- Attention
- this kind of binding might have an impact on the ordinary mobile detection, so ordinary motion detection is not recommended by this way
Bind the source Cell and the destination Cell.
- Parameters
-
[in] | srcCell | The source Cell pointer. |
[in] | dstCell | The destination Cell pointer. |
- Return values
-
0 | Success. |
OtherValues | Failure. |
- Attention
- None.
int IMP_System_Exit |
( |
void |
| ) |
|
Deinitialize the IMP.
- Parameters
-
- Return values
-
0 | Success. |
OtherValues | Failure. |
- Attention
- After calling this API, if you want to use the IMP again, you need to reinitialize the IMP system
Gets the source Cell information that is bound to the destination Cell.
- Parameters
-
[in] | srcCell | The source Cell pointer. |
[in] | dstCell | The destination Cell pointer. |
- Return values
-
0 | Success. |
OtherValues | Failure. |
- Attention
- None.
const char * IMP_System_GetCPUInfo |
( |
void |
| ) |
|
Get the infomation of CPU.
- Parameters
-
- Return values
-
- Attention
- None.
int64_t IMP_System_GetTimeStamp |
( |
void |
| ) |
|
Get the current timestamp(unit is usec).
- Parameters
-
- Return values
-
- Attention
- None.
int IMP_System_GetVersion |
( |
IMPVersion * |
pstVersion | ) |
|
Get the version of IMP library.
- Parameters
-
- Return values
-
0 | Success. |
OtherValues | Failure. |
- Attention
- None.
int IMP_System_Init |
( |
void |
| ) |
|
Initialize the IMP.
- Parameters
-
- Return values
-
0 | Success. |
OtherValues | Failure. |
- Attention
- This interface must be initialized before any operation in IMP is required.
uint32_t IMP_System_ReadReg32 |
( |
uint32_t |
u32Addr | ) |
|
Read the register(32bit) value.
- Parameters
-
[in] | regAddr | Physical address register |
- Return values
-
Value | of the the register(32bit). |
- Attention
- None.
int IMP_System_RebaseTimeStamp |
( |
int64_t |
basets | ) |
|
Set the timestamp(usec).
- Parameters
-
[in] | basets | Base timestamp. |
- Return values
-
0 | Success. |
OtherValues | Failure. |
- Attention
- None.
UnBind source Cell and the destination Cell.
- Parameters
-
[in] | srcCell | The source Cell pointer. |
[in] | dstCell | The destination Cell pointer. |
- Return values
-
0 | Success. |
OtherValues | Failure. |
- Attention
- None.
void IMP_System_WriteReg32 |
( |
uint32_t |
regAddr, |
|
|
uint32_t |
value |
|
) |
| |
Write the value to register(32bit).
- Parameters
-
[in] | regAddr | Physical address |
[in] | value | Value to be written |
- Return values
-
- Attention
- If you are not clear on the meaning of the register, please call this API carefully, or you may cause a system error.