ISVP-SDK  3.12.0
Ingenic Smart Video Platform SDK
Data Structures | Functions

System module including base function such as Bind etc. More...

Collaboration diagram for IMP_System:

Data Structures

struct  IMPVersion
 IMP Version definition. More...
 

Functions

int IMP_System_Init (void)
 Initialize the IMP. More...
 
int IMP_System_Exit (void)
 Deinitialize the IMP. More...
 
int64_t IMP_System_GetTimeStamp (void)
 Get the current timestamp(unit is usec). More...
 
int IMP_System_RebaseTimeStamp (int64_t basets)
 Set the timestamp(usec). More...
 
uint32_t IMP_System_ReadReg32 (uint32_t regAddr)
 Read the register(32bit) value. More...
 
void IMP_System_WriteReg32 (uint32_t regAddr, uint32_t value)
 Write the value to register(32bit). More...
 
int IMP_System_GetVersion (IMPVersion *pstVersion)
 Get the version of IMP library. More...
 
const char * IMP_System_GetCPUInfo (void)
 Get the infomation of CPU. More...
 
int IMP_System_Bind (IMPCell *srcCell, IMPCell *dstCell)
 Bind the source Cell and the destination Cell. More...
 
int IMP_System_UnBind (IMPCell *srcCell, IMPCell *dstCell)
 UnBind source Cell and the destination Cell. More...
 
int IMP_System_GetBindbyDest (IMPCell *dstCell, IMPCell *srcCell)
 Gets the source Cell information that is bound to the destination Cell. More...
 

Detailed Description

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.

system_bind0.jpg

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:

IMPCell fs_chn0 = {DEV_ID_FS, 0, 0}; //FrameSource deviceID:DEV_ID_FS groupID:0 outputID:0
IMPCell enc_grp0 = {DEV_ID_ENC, 0, 0}; //ENC deviceID:DEV_ID_ENC groupID:0 outputID:0, enc_grp0 here is meaningless.
int ret = IMP_System_Bind(&fs_chn0, &enc_grp0);
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:

system_bind2.png

Sample code in this situation:
Bind the main stream:

IMPCell fs_chn0 = {DEV_ID_FS, 0, 0};
IMPCell osd_grp0 = {DEV_ID_OSD, 0, 0};
IMPCell enc_grp0 = {DEV_ID_ENC, 0, 0};
int ret = IMP_System_Bind(&fs_chn0, &osd_grp0);
if (ret < 0)
printf("Bind FrameSource Channel0 and OSD Group0 failed\n");
int ret = IMP_System_Bind(&osd_grp0, &enc_grp0);
if (ret < 0)
printf("Bind OSD Group0 and Encoder Group0 failed\n");

Bind the second stream:

IMPCell fs_chn1_output0 = {DEV_ID_FS, 1, 0};
IMPCell osd_grp1 = {DEV_ID_OSD, 1, 0};
IMPCell enc_grp1 = {DEV_ID_ENC, 1, 0};
IMPCell fs_chn1_output1 = {DEV_ID_FS, 1, 1};
IMPCell ivs_grp0 = {DEV_ID_IVS, 0, 0};
int ret = IMP_System_Bind(&fs_chn1_output0, &osd_grp1);
if (ret < 0)
printf("Bind FrameSource Channel1 and OSD Group1 failed\n");
int ret = IMP_System_Bind(&osd_grp1, &enc_grp1);
if (ret < 0)
printf("Bind OSD Group1 and Encoder Group1 failed\n");
int ret = IMP_System_Bind(&fs_chn1_output1, &ivs_grp0);
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

different_output.png

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

Function Documentation

int IMP_System_Bind ( IMPCell srcCell,
IMPCell dstCell 
)

Bind the source Cell and the destination Cell.

Parameters
[in]srcCellThe source Cell pointer.
[in]dstCellThe destination Cell pointer.
Return values
0Success.
OtherValuesFailure.
Remarks
According to the concepts of Device, Group and Output, Every Device might have several Groups, every Group several Outputs, Group is the Device input interface, Output is the output interface, so Binding will be the process of linking the Device's Outputs to the Device's inputs.
After Bindding successfully the source Cell will deliver the data to the destination Cell automatically.
Attention
None.
int IMP_System_Exit ( void  )

Deinitialize the IMP.

Parameters
None.
Return values
0Success.
OtherValuesFailure.
Remarks
Memory and handlers will be freed after calling this API, also hardware will be closed.
Attention
After calling this API, if you want to use the IMP again, you need to reinitialize the IMP system
int IMP_System_GetBindbyDest ( IMPCell dstCell,
IMPCell srcCell 
)

Gets the source Cell information that is bound to the destination Cell.

Parameters
[in]srcCellThe source Cell pointer.
[in]dstCellThe destination Cell pointer.
Return values
0Success.
OtherValuesFailure.
Remarks
None.
Attention
None.
const char * IMP_System_GetCPUInfo ( void  )

Get the infomation of CPU.

Parameters
None.
Return values
Stringof IMPVersion.
Remarks
The return value is a string of the CPU model type e.g. "T10", "T10-Lite" etc.
Attention
None.
int64_t IMP_System_GetTimeStamp ( void  )

Get the current timestamp(unit is usec).

Parameters
None.
Return values
timestamp(usec).
Remarks
After the system initialization, the time stamp is initialized automatically.
Attention
None.
int IMP_System_GetVersion ( IMPVersion pstVersion)

Get the version of IMP library.

Parameters
[out]pstVersionPointer to IMPVersion.
Return values
0Success.
OtherValuesFailure.
Remarks
None.
Attention
None.
int IMP_System_Init ( void  )

Initialize the IMP.

Parameters
None.
Return values
0Success.
OtherValuesFailure.
Remarks
After calling this API, the basis of data structure will be initialized, but does not initialize the hardware unit.
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]regAddrPhysical address register
Return values
Valueof the the register(32bit).
Remarks
None.
Attention
None.
int IMP_System_RebaseTimeStamp ( int64_t  basets)

Set the timestamp(usec).

Parameters
[in]basetsBase timestamp.
Return values
0Success.
OtherValuesFailure.
Remarks
None.
Attention
None.
int IMP_System_UnBind ( IMPCell srcCell,
IMPCell dstCell 
)

UnBind source Cell and the destination Cell.

Parameters
[in]srcCellThe source Cell pointer.
[in]dstCellThe destination Cell pointer.
Return values
0Success.
OtherValuesFailure.
Remarks
None.
Attention
None.
void IMP_System_WriteReg32 ( uint32_t  regAddr,
uint32_t  value 
)

Write the value to register(32bit).

Parameters
[in]regAddrPhysical address
[in]valueValue to be written
Return values
None.
Remarks
None.
Attention
If you are not clear on the meaning of the register, please call this API carefully, or you may cause a system error.