页次: 1
sample_ive_md 程序梳理
/******************************************
step 1: start vi vpss venc vo
******************************************/
SAMPLE_COMM_IVE_StartViVpssVencVo
SAMPLE_COMM_VI_GetSensorInfo
SAMPLE_COMM_VI_GetComboDevBySensor
SAMPLE_COMM_VI_GetSizeBySensor
/******************************************
step 1: Init vb
******************************************/
SAMPLE_COMM_IVE_VbInit
SAMPLE_COMM_SYS_GetPicSize
COMMON_GetPicBufferSize
SAMPLE_COMM_SYS_Init
/******************************************
step 2: Start vi
******************************************/
SAMPLE_COMM_VI_SetParam
SAMPLE_COMM_VI_StartVi
/******************************************
step 3: Start vpss
******************************************/
SAMPLE_COMM_IVE_StartVpss
/*config vpss*/
stVpssGrpAttr与astVpssChnAttr属性参数配置(结构体详见 VIO_ATTR_S.txt)
SAMPLE_COMM_VPSS_Start
/******************************************
step 4: Bind vpss to vi
******************************************/
SAMPLE_COMM_VI_Bind_VPSS
//Set vi frame
HI_MPI_VI_GetChnAttr
HI_MPI_VI_SetChnAttr
/******************************************
step 5: Start Vo
******************************************/
SAMPLE_COMM_IVE_StartVo
SAMPLE_COMM_VO_StartDev
SAMPLE_COMM_VO_HdmiStart
SAMPLE_COMM_VO_HdmiConvertSync
HI_MPI_HDMI_Init
HI_MPI_HDMI_Open
HI_MPI_HDMI_GetAttr
HI_MPI_HDMI_SetAttr
HI_MPI_HDMI_Start
SAMPLE_COMM_VO_GetWH
HI_MPI_VO_SetDisplayBufLen
SAMPLE_COMM_VO_StartLayer
SAMPLE_COMM_VO_StartChn
SAMPLE_COMM_VO_StartMipiTx
/******************************************
step 6: Start Venc
******************************************/
SAMPLE_COMM_VENC_GetGopAttr //VENC_GOPMODE_NORMALP
SAMPLE_COMM_VENC_Start
/******************************************
step 1: Creat Encode Chnl
******************************************/
SAMPLE_COMM_VENC_Creat
SAMPLE_COMM_SYS_GetPicSize
SAMPLE_COMM_VI_GetSensorInfo
SAMPLE_COMM_VI_GetFrameRateBySensor
//Create Venc Channel
stVencChnAttr参数配置
/* the attribute of the venc chnl */
typedef struct hiVENC_CHN_ATTR_S {
VENC_ATTR_S stVencAttr; /* the attribute of video encoder */
VENC_RC_ATTR_S stRcAttr; /* the attribute of rate ctrl */
VENC_GOP_ATTR_S stGopAttr; /* the attribute of gop */
} VENC_CHN_ATTR_S;
HI_MPI_VENC_CreateChn
SAMPLE_COMM_VENC_CloseReEncode
HI_MPI_VENC_GetChnAttr
HI_MPI_VENC_GetRcParam
HI_MPI_VENC_SetRcParam
/******************************************
step 2: Start Recv Venc Pictures
******************************************/
HI_MPI_VENC_StartRecvFrame //开启编码通道接收输入图像 允许指定接收帧数,超出指定的帧数后自动停止接收图像。
SAMPLE_COMM_VENC_StartGetStream
pthread_create(&gs_VencPid, 0, SAMPLE_COMM_VENC_GetVencStreamProc, (HI_VOID*)&gs_stPara);
SAMPLE_COMM_VENC_Stop
SAMPLE_COMM_IVE_StopVo
SAMPLE_COMM_VI_UnBind_VPSS
SAMPLE_COMM_IVE_StopVpss
SAMPLE_COMM_VI_StopVi
SAMPLE_COMM_SYS_Exit
SAMPLE_COMM_SYS_GetPicSize
/******************************************
step 2: Init Md
******************************************/
SAMPLE_IVE_Md_Init
SAMPLE_COMM_IVE_CreateImage
SAMPLE_COMM_IVE_CreateMemInfo
//Set attr info
HI_IVS_MD_Init
/******************************************
step 3: Create work thread
******************************************/
snprintf(acThreadName, 16, "IVE_MdProc");
prctl(PR_SET_NAME, (unsigned long)acThreadName, 0,0,0);
pthread_create(&s_hMdThread, 0, SAMPLE_IVE_MdProc, (HI_VOID *)&s_stMd);
//Create chn
HI_IVS_MD_CreateChn
HI_MPI_VPSS_GetChnFrame //用户获取一帧通道图像 ,用户从通道获取一帧处理完成的图像 mpp手册720页
SAMPLE_COMM_IVE_DmaImage //DMA帧信息以提供图像
//fill src
//fill dst
HI_MPI_IVE_DMA //创建直接内存访问任务,支持 快速拷贝 、 间隔拷贝 、 内存填充 可 实现数据从一块内存 快速拷 贝 到另一块内存 ,或者从一块内存有规律的拷贝一些数据到另一块内存,或者 对 一块内存 进行 填充 操作
//IVE_DMA_MODE_DIRECT_COPY 快速拷贝模式
HI_MPI_IVE_Query
HI_IVS_MD_Process //移动侦测处理 HiIVS 15页
SAMPLE_COMM_IVE_BlobToRect
//Draw rect
SAMPLE_COMM_VGS_FillRect
HI_MPI_VGS_BeginJob //启动一个job
HI_MPI_VGS_AddCoverTask //往一个已经启动的job添加打COVER task。
HI_MPI_VGS_EndJob //提交一个job。
HI_MPI_VO_SendFrame //将视频图像送入指定视频输出通道显示。
SAMPLE_PAUSE();
SAMPLE_IVE_Md_Uninit
SAMPLE_COMM_IVE_StopViVpssVencVo
-------------------------------------------------------------------------------------------------------------------------------------------
typedef struct hiSAMPLE_IVE_MD_S
{
IVE_SRC_IMAGE_S astImg[SAMPLE_IVE_MD_IMAGE_NUM]; //#define SAMPLE_IVE_MD_IMAGE_NUM 2
IVE_DST_MEM_INFO_S stBlob;
MD_ATTR_S stMdAttr;
SAMPLE_RECT_ARRAY_S stRegion;
}SAMPLE_IVE_MD_S;
/* Definition of the IVE_IMAGE_S. Added by Tan Bing, 2013-7-22. */
typedef struct hiIVE_IMAGE_S {
HI_U64 au64PhyAddr[3]; /* RW;The physical address of the image */
HI_U64 au64VirAddr[3]; /* RW;The virtual address of the image */
HI_U32 au32Stride[3]; /* RW;The stride of the image */
HI_U32 u32Width; /* RW;The width of the image */
HI_U32 u32Height; /* RW;The height of the image */
IVE_IMAGE_TYPE_E enType; /* RW;The type of the image */
} IVE_IMAGE_S;
/*
* Definition of the IVE_MEM_INFO_S.This struct special purpose for input or ouput, such as Hist, CCL, ShiTomasi.
* Added by Chen Quanfu, 2013-7-23.
*/
typedef struct hiIVE_MEM_INFO_S {
HI_U64 u64PhyAddr; /* RW;The physical address of the memory */
HI_U64 u64VirAddr; /* RW;The virtual address of the memory */
HI_U32 u32Size; /* RW;The size of memory */
} IVE_MEM_INFO_S;
/*
* Definition of md attribute
*/
typedef struct hiMD_ATTR_S {
MD_ALG_MODE_E enAlgMode; /* Md algorithm mode */
IVE_SAD_MODE_E enSadMode; /* Sad mode */
IVE_SAD_OUT_CTRL_E enSadOutCtrl; /* Sad output ctrl */
HI_U32 u32Width; /* Image width */
HI_U32 u32Height; /* Image height */
HI_U16 u16SadThr; /* Sad thresh */
IVE_CCL_CTRL_S stCclCtrl; /* Ccl ctrl */
IVE_ADD_CTRL_S stAddCtrl; /* Add ctrl */
} MD_ATTR_S;
typedef struct hiSAMPLE_RECT_ARRAY_S
{
HI_U16 u16Num;
SAMPLE_IVE_RECT_S astRect[IVE_RECT_NUM];
} SAMPLE_RECT_ARRAY_S;
typedef struct hiSAMPLE_IVE_RECT_S
{
POINT_S astPoint[4];
} SAMPLE_IVE_RECT_S;
页次: 1