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

Video Source is the image source of IMP system, it can set some functions such as setting the image resolution, cropping, scaling and other properties as well as the back-end noise reduction function. More...

Collaboration diagram for IMP_FrameSource:

Data Structures

struct  IMPFSChnCrop
 The structure of cropping operation. More...
 
struct  IMPFSChnScaler
 The structure of scaling operation. More...
 
struct  IMPFSChnFifoAttr
 The structure of FIFO Channel's attributes. More...
 
struct  IMPFSChnAttr
 The structure of frame channel's attributes. More...
 

Enumerations

enum  IMPFSChnType { FS_PHY_CHANNEL, FS_EXT_CHANNEL }
 
enum  IMPFSChnFifoType { FIFO_CACHE_PRIORITY = 0, FIFO_DATA_PRIORITY }
 Channel FIFO Type. More...
 

Functions

int IMP_FrameSource_CreateChn (int chnNum, IMPFSChnAttr *chn_attr)
 Create a frame channel. More...
 
int IMP_FrameSource_DestroyChn (int chnNum)
 Destroy the selected frame channel. More...
 
int IMP_FrameSource_EnableChn (int chnNum)
 Enable the selected frame channel. More...
 
int IMP_FrameSource_DisableChn (int chnNum)
 Disable the selected frame channel. More...
 
int IMP_FrameSource_GetChnAttr (int chnNum, IMPFSChnAttr *chnAttr)
 Obtains the frame channel attribute. More...
 
int IMP_FrameSource_SetChnAttr (int chnNum, const IMPFSChnAttr *chnAttr)
 Sets the frame channel attribute. More...
 
int IMP_FrameSource_SetFrameDepth (int chnNum, int depth)
 Sets the maximum space(depth) for the images. More...
 
int IMP_FrameSource_GetFrameDepth (int chnNum, int *depth)
 Obtains the depth of Frame FIFO. More...
 
int IMP_FrameSource_GetFrame (int chnNum, IMPFrameInfo **frame)
 Obtained image. More...
 
int IMP_FrameSource_GetTimedFrame (int chnNum, IMPFrameTimestamp *framets, int block, void *framedata, IMPFrameInfo *frame)
 Obtained image with specified time. More...
 
int IMP_FrameSource_ReleaseFrame (int chnNum, IMPFrameInfo *frame)
 Release the frame. More...
 
int IMP_FrameSource_SnapFrame (int chnNum, IMPPixelFormat fmt, int width, int height, void *framedata, IMPFrameInfo *frame)
 Get frames. More...
 
int IMP_FrameSource_SetMaxDelay (int chnNum, int maxcnt)
 Set max frame delay. More...
 
int IMP_FrameSource_GetMaxDelay (int chnNum, int *maxcnt)
 Get max frame delay. More...
 
int IMP_FrameSource_SetDelay (int chnNum, int cnt)
 Set frame delay. More...
 
int IMP_FrameSource_GetDelay (int chnNum, int *cnt)
 Get frame delay. More...
 
int IMP_FrameSource_SetChnFifoAttr (int chnNum, IMPFSChnFifoAttr *attr)
 set channel's largest cache FIFO attribute More...
 
int IMP_FrameSource_GetChnFifoAttr (int chnNum, IMPFSChnFifoAttr *attr)
 Get channel maximum caches FIFO attribute. More...
 

Detailed Description

Video Source is the image source of IMP system, it can set some functions such as setting the image resolution, cropping, scaling and other properties as well as the back-end noise reduction function.

FrameSource is a data flow related to the concept, you can set the image resolution, format, etc., and provide the original image to the back-end.

The scheme of FrameSource is as follow:

framesource.png

According to this image above, FrameSource has 3 outputs, all of them can be used for encoding *Channel 0 : High clear video stream *Channel 1 : Standard clear video stream, or IVS can only do the algorithm of data source *Channel 2 : Expands the channel, is is used in special applications, it is not recommended to use it. Note: The video that frame channel-1 output maybe used to encode and analyse.
The example of FrameSource's operating instruction is below(example: two channels as output)

IMPFSChnAttr fs_chn_attr;
fs_chn_attr.pixFmt = PIX_FMT_NV12;
fs_chn_attr.outFrmRateNum = SENSOR_FRAME_RATE;
fs_chn_attr.outFrmRateDen = 1;
fs_chn_attr.nrVBs = 3;
fs_chn_attr.type = FS_PHY_CHANNEL;
fs_chn_attr.crop.enable = 1;
fs_chn_attr.crop.top = 0;
fs_chn_attr.crop.left = 0;
fs_chn_attr.crop.width = 960;
fs_chn_attr.crop.height = 640;
fs_chn_attr.scaler.enable = 1;
fs_chn_attr.scaler.outwidth = 320;
fs_chn_attr.scaler.outheight = 240;
ret = IMP_FrameSource_CreateChn(0, &fs_chn_attr); //step.1 Create Channel0
if (ret < 0) {
printf("FrameSource_CreateChn(0) error\n");
goto createchn_err;
}
ret = IMP_FrameSource_EnableChn(0); //step.2 Enable Channel 0, Channel 0 starts to output images.
if (ret < 0) {
printf("EnableChn(0) error\n";
return enablechn_err;
}
// so far, FrameSource began to pass data to the back-end Group
ret = IMP_FrameSource_DisableChn(0); //step.3 Disable channel 0, Channel 0 stops to output images
if (ret < 0) {
printf("FrameSource_DisableChn(0) error\n");
return disablechn_err;
}
ret = IMP_FrameSource_DestroyChn(0); //step.4 destroy channel 0
if (ret < 0) {
printf("FrameSource_DestroyChn error\n");
return destorychn_err;
}

There are more examples in the content of Samples.

Enumeration Type Documentation

Channel FIFO Type.

Enumerator
FIFO_CACHE_PRIORITY 

FIFO caches first,then output data.

FIFO_DATA_PRIORITY 

FIFO output data first, then caches.

Enumerator
FS_PHY_CHANNEL 

physics frame channel

FS_EXT_CHANNEL 

virtual frame channel

Function Documentation

int IMP_FrameSource_CreateChn ( int  chnNum,
IMPFSChnAttr chnAttr 
)

Create a frame channel.

Parameters
[in]chnNumId of frame channel
[in]chnAttrthe pointer of the frame channel's attribute
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks
Create a channel to provide a data source to the back-end module;
you can set the channel related attributes, including: the width of the picture, the height of the picture, the picture format, channel output frame rate, number of cache buf, cropping and scaling properties. On the chip of T10, frame channel 0 and 1 are physics channel, channel 2 and 3 are vritual.
Attention
none.
IMP_FrameSource_DestroyChn ( int  chnNum)

Destroy the selected frame channel.

Parameters
[in]chnNumId of frame channel
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks
the function will free some resources of the frame channel.
Attention
If the channel has been enabled (IMP_FrameSource_EnableChn), please disable it (IMP_FrameSource_DisableChn) before calling the current function.
int IMP_FrameSource_DisableChn ( int  chnNum)

Disable the selected frame channel.

Parameters
[in]chnNumId of frame channel
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks
none
Attention
none
int IMP_FrameSource_EnableChn ( int  chnNum)

Enable the selected frame channel.

Parameters
[in]chnNumId of frame channel
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks
none
Attention
Before calling the function, the frame channel has to been created.
int IMP_FrameSource_GetChnAttr ( int  chnNum,
IMPFSChnAttr chnAttr 
)

Obtains the frame channel attribute.

Parameters
[in]chnNumId of frame channel
[out]chnAttrPointer of the channel's attribute.
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks
The attribute contains elements such as: the width ,height and format of the image; the output video FPS, the number of buffers, cropping and scaling properties.
Attention
none
IMP_FrameSource_GetChnFifoAttr ( int  chnNum,
IMPFSChnFifoAttr attr 
)

Get channel maximum caches FIFO attribute.

Parameters
[in]chnNumChannel ID
[out]attrFIFO attribute.
Return values
0means success
othervalues means failure,its value is an error code
Remarks
none.
Attention
Use it after calling IMP_FrameSource_CreateChn.
IMP_FrameSource_GetDelay ( int  chnNum,
int *  cnt 
)

Get frame delay.

Parameters
[in]chnNumID of frame channel
[out]cntframe delay
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks
none.
Attention
Before calling the function, the frame channel has to been created.
IMP_FrameSource_GetFrame ( int  chnNum,
IMPFrameInfo **  frame 
)

Obtained image.

Parameters
[in]chnNumId of frame channel
[out]framePointer of the frame information.
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks

1.This interface can obtain the video image information of the specified channel. The image information mainly includes: the width of the image, the height, the pixel format and the image data starting address.

2.This interface will be valid only after the channel has been enabled.

3.It supports multiple access after release, but it is recommended to access and release the right interface for use.

4.The default timeout for this interface is 2S, that means after 2S without receiving any images the will be a timeout.

Attention
none.
IMP_FrameSource_GetFrameDepth ( int  chnNum,
int *  depth 
)

Obtains the depth of Frame FIFO.

Parameters
[in]chnNumId of frame channel
[out]depthPointer of the depth value.
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks
none.
Attention
none.
IMP_FrameSource_GetMaxDelay ( int  chnNum,
int *  maxcnt 
)

Get max frame delay.

Parameters
[in]chnNumID of frame channel
[out]maxcntmax frame delay
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks
none.
Attention
Before calling the function, the frame channel has to been created.
IMP_FrameSource_GetTimedFrame ( int  chnNum,
IMPFrameTimestamp framets,
int  block,
void *  framedata,
IMPFrameInfo frame 
)

Obtained image with specified time.

Parameters
[in]chnNumId of frame channel
[in]frametsTime info
[in]blockblock info
[in]framedataMem porinter used to store image
[in]frameImage info
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks

1.This interface can obtain the video image with certain time information of the specified channel. The image information mainly includes: the width of the image, the height, the pixel format and the image data starting address.

2.This interface will be valid only after the channel has been enabled.

3.Before this interface, IMP_FrameSource_SetMaxDelay and IMP_FrameSource_SetDelay should be used。

Attention
无.
IMP_FrameSource_ReleaseFrame ( int  chnNum,
IMPFrameInfo frame 
)

Release the frame.

Parameters
[in]chnNumID of frame channel
[in]framePointer of frame information.
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks
none.
Attention
none.
int IMP_FrameSource_SetChnAttr ( int  chnNum,
const IMPFSChnAttr chnAttr 
)

Sets the frame channel attribute.

Parameters
[in]chnNumId of frame channel
[out]chnAttrPointer of the channel's attribute.
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks
The attribute contains elements such as: the width ,height and format of the image; the output video FPS, the number of buffers, cropping and scaling properties.
Attention
none
IMP_FrameSource_SetChnFifoAttr ( int  chnNum,
IMPFSChnFifoAttr attr 
)

set channel's largest cache FIFO attribute

Parameters
[in]chnNumID of the frame channel
[in]attrFIFO attribute,includes FIFO maximum depth,unit(frame);FIFO type.
Return values
0means success
othervalues means failure,its value is an error code
Remarks
none.
Attention
use it in between of these two interfaces IMP_FrameSource_CreateChn, IMP_FrameSource_EnableChn.
IMP_FrameSource_SetDelay ( int  chnNum,
int  cnt 
)

Set frame delay.

Parameters
[in]chnNumID of frame channel
[in]cntframe delay
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks
none.
Attention
If need, this function should be called after IMP_FrameSource_SetMaxDelay.
IMP_FrameSource_SetFrameDepth ( int  chnNum,
int  depth 
)

Sets the maximum space(depth) for the images.

Parameters
[in]chnNumId of frame channel
[out]depththe maximum space(depth) for the images of the Frame channel.
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks

1.This interface is used to set the video frames of a channel cache. When the user sets caches for multi frame video image, he can access a certain number of consecutive image datas.

2.If the specified depth is 0, that does not require the system to cache the image of the channel, so users can not get the channel image data. The system default is not the channel cache image, so, depth is 0.

3.System will automatically update the most old image data, to ensure that once the user begins to get new image data, you can get the latest image.

4.If the system can not get the image then it automatically stops the cache of the new image, so the user can not get a new image. Therefore it is recommended that the user makes sure to access and release the interface for use.

5.System will automatically update the user that it has not yet acquired the old image data, to ensure that the cache image queue is for the most recent image. If the user can not guarantee acquisition speed, the whole process might end up receiving non-consecutive images.

6 this function can call the location, there is no requirement, but it can be done only once.

Attention
none.
IMP_FrameSource_SetMaxDelay ( int  chnNum,
int  maxcnt 
)

Set max frame delay.

Parameters
[in]chnNumID of frame channel
[in]maxcntmax frame delay
Return values
0means success.
Othervalues means failure, its value is an error code.
Remarks
none.
Attention
If need, this function should be called between IMP_FrameSource_CreateChn and IMP_FrameSource_EnableChn.
IMP_FrameSource_SnapFrame ( int  chnNum,
IMPPixelFormat  fmt,
int  width,
int  height,
void *  framedata,
IMPFrameInfo frame 
)

Get frames.

Parameters
[in]chnNumID of frame channel
[in]fmtformat of image
[in]widthwidth of image
[in]heightheight of image
[in]framedatamemory of image, provided by user
[in]framepointer of frame information.
Return values
0means success
othersmeans failure, its value is an error code
Remarks

1.This interface can snap a video image, format now only support NV12 and YUYV422, resolution support the same size of framesource resolution.

2.This interface does not need to be used with IMP_FrameSource_SetFrameDepth.

3.This interface will be valid only after the channel has been enabled.

Attention
none.