예제 #1
0
static void video_InputInit()
{
//	int i = 0;
	// init sdk
	{
		VI_PUB_ATTR_S stViDevAttr;
		VI_CHN_ATTR_S stViChnAttr;

		// vi0 1-16 ch cif input 1d1
		// vi2 1-16 ch d1 input mutex d1 live
		////////////////////////////////////////////////////////////////
		////////////////////////////////////////////////////////////////
		// vi0
		stViDevAttr.enInputMode = VI_MODE_BT656;
		stViDevAttr.enWorkMode = VI_WORK_MODE_1D1;
		stViDevAttr.enViNorm = (VIDEO_IS_PAL() ? VIDEO_ENCODING_MODE_PAL : VIDEO_ENCODING_MODE_NTSC);
		// channel attribute
		stViChnAttr.stCapRect.s32X = 0;
		stViChnAttr.stCapRect.s32Y = 0;
		stViChnAttr.stCapRect.u32Width = VI_CIF_WIDTH;
		stViChnAttr.stCapRect.u32Height = 8 * VI_CIF_HEIGHT + 7 * 2; // half field height combo frame
		stViChnAttr.bChromaResample = HI_FALSE;
		stViChnAttr.enCapSel = VI_CAPSEL_BOTH;
		stViChnAttr.bDownScale = HI_FALSE;
		stViChnAttr.bHighPri = HI_FALSE;
		stViChnAttr.enViPixFormat = PIXEL_FORMAT_YUV_SEMIPLANAR_420;

		DVR_ASSERT(HI_MPI_VI_Disable(0));
		DVR_ASSERT(HI_MPI_VI_SetPubAttr(0, &stViDevAttr));
		DVR_ASSERT(HI_MPI_VI_Enable(0));
		DVR_ASSERT(HI_MPI_VI_SetChnAttr(0, 0, &stViChnAttr));
		DVR_ASSERT(HI_MPI_VI_EnableChn(0, 0));
		DVR_ASSERT(HI_MPI_VI_SetSrcFrameRate(0, 0, MAX_CIF_LIVE_FPS));
		DVR_ASSERT(HI_MPI_VI_SetFrameRate(0, 0, MAX_CIF_LIVE_FPS));

		////////////////////////////////////////////////////////////////
		////////////////////////////////////////////////////////////////
		// vi2 must be d1
		stViChnAttr.enCapSel = VI_CAPSEL_BOTH;
		stViChnAttr.bDownScale = HI_FALSE;
		stViChnAttr.stCapRect.s32Y = 0;
		stViChnAttr.stCapRect.u32Height = VIDEO_IS_PAL() ? 288 : 240;
		stViChnAttr.bChromaResample = HI_FALSE;
		stViChnAttr.bHighPri = HI_FALSE;
		VI_CIF_ATTR_CONF(&stViChnAttr);

		// vi2
		DVR_ASSERT(HI_MPI_VI_Disable(2));
		DVR_ASSERT(HI_MPI_VI_SetPubAttr(2, &stViDevAttr));
		DVR_ASSERT(HI_MPI_VI_Enable(2));
		DVR_ASSERT(HI_MPI_VI_SetChnAttr(2, 0, &stViChnAttr));
		DVR_ASSERT(HI_MPI_VI_EnableChn(2, 0));
		DVR_ASSERT(HI_MPI_VI_SetSrcFrameRate(2, 0, MAX_D1_LIVE_FPS));
		DVR_ASSERT(HI_MPI_VI_SetFrameRate(2, 0, MAX_D1_LIVE_FPS));
	}
}
예제 #2
0
static void video_InputInit()
{
	int i = 0, ii = 0;
	// init sdk
	{
		int nDev = 0;
		int nChnCnt = 0;
		VI_PUB_ATTR_S stViDevAttr;
		VI_CHN_ATTR_S stViChnAttr;
		int const vi_fps = (VIDEO_IS_PAL() ? 25 : 30);

		// vi0 1-4 ch cif input 4d1
		// vi2 5-8 ch d1 input 4d1

		// device attributes
		stViDevAttr.enInputMode = VI_MODE_BT656;
		stViDevAttr.enWorkMode = VI_WORK_MODE_4D1;
		stViDevAttr.enViNorm = (VIDEO_IS_PAL() ? VIDEO_ENCODING_MODE_PAL : VIDEO_ENCODING_MODE_NTSC);
		// channel attributes
		stViChnAttr.stCapRect.s32Y = 0;
		stViChnAttr.stCapRect.u32Height = (VIDEO_IS_PAL() ? 288 : 240);
		stViChnAttr.bHighPri = HI_FALSE;
		stViChnAttr.bChromaResample = HI_FALSE;
		stViChnAttr.enViPixFormat = PIXEL_FORMAT_YUV_SEMIPLANAR_420;
		VI_CIF_ATTR_CONF(&stViChnAttr);

        for(ii = 0; ii < MAX_CAM_CH; ii += 4) {
            if(VIMAP_Get(ii, &nDev, NULL) < 0) {
                continue;
            }

            DVR_ASSERT(HI_MPI_VI_Disable(nDev));
            DVR_ASSERT(HI_MPI_VI_SetPubAttr(nDev, &stViDevAttr));
            DVR_ASSERT(HI_MPI_VI_Enable(nDev));

            for(i = 0; i < 4; ++i) {
                if(nChnCnt++ < MAX_D1_CNT){
                    VI_D1_ATTR_CONF(&stViChnAttr);
                }else{
                    VI_CIF_ATTR_CONF(&stViChnAttr);
                }
                DVR_ASSERT(HI_MPI_VI_SetChnAttr(nDev, i, &stViChnAttr));
                DVR_ASSERT(HI_MPI_VI_EnableChn(nDev, i));
                DVR_ASSERT(HI_MPI_VI_SetSrcFrameRate(nDev, i, vi_fps));
                DVR_ASSERT(HI_MPI_VI_SetFrameRate(nDev, i, vi_fps));
            }
        }
	}
}
예제 #3
0
int HDDVR_GetFormatInfo(HD_INPUT_FORMAT Frmt, int * SizW, int * SizH, int * Fps)
{
	int ViInfoTBL[HDVIDEO_CNT2][3] = {
		{ 720,  576, 25}, { 720,  480, 30}, //SD720H
		{ 960,  576, 25}, { 960,  480, 30}, //SD960H
		{1280,  720, 25}, {1280,  720, 30}, //HD720P
		{1280,  720, 50}, {1280,  720, 60}, //HD720P
		{1920, 1080, 25}, {1920, 1080, 30}, //HD1080P
		{ 0, 0, 0},
		{ 960, 0, 0},
		{ 1280, 720, 0},
		{ 1920, 1080, 0},
	};
	
	if((Frmt <= HDVIDEO_UNKNOWN) || (Frmt >= HDVIDEO_CNT2)) {
		return -1;
	}
	if (ViInfoTBL[Frmt][0] == 0) {
		return -1;
	}

	if(SizW) {
		*SizW = ViInfoTBL[Frmt][0];
	}

	if(SizH) {
		*SizH = ViInfoTBL[Frmt][1];
		if (*SizH == 0) {
			*SizH = VIDEO_IS_PAL() ? 576 : 480;
		}
	}

	if(Fps) {
		*Fps  = ViInfoTBL[Frmt][2];
		if (*Fps == 0) {
			*Fps = VIDEO_IS_PAL() ? 25: 30;
		}
	}
	

	return 0;
}
예제 #4
0
static void video_InputInit()
{
    int ii, jj;

    VI_PUB_ATTR_S stViDevAttr;
    VI_CHN_ATTR_S stViChnAttr;

    // vi0 1-4   ch cif input 4d1
    // vi1 5-8   ch cif input 4d1
    // vi2 9-12  ch cif input 4d1
    // vi3 13-16 ch cif input 4d1
    ////////////////////////////////////////////////////////////////
    // vi
    stViDevAttr.enInputMode = VI_MODE_BT656;
    stViDevAttr.enWorkMode = VI_WORK_MODE_4D1;
    stViDevAttr.enViNorm = (VIDEO_IS_PAL() ? VIDEO_ENCODING_MODE_PAL : VIDEO_ENCODING_MODE_NTSC);
    // 4d1 input
    stViChnAttr.stCapRect.u32Width  = 704;
    stViChnAttr.stCapRect.u32Height = VI_CIF_HEIGHT;
    stViChnAttr.stCapRect.s32X = VI_X_OFFSET;
    stViChnAttr.stCapRect.s32Y = 0;
    stViChnAttr.bChromaResample = HI_FALSE;
    stViChnAttr.enCapSel = VO_FIELD_BOTTOM;
    stViChnAttr.bDownScale = HI_TRUE;
    stViChnAttr.bHighPri = HI_FALSE;
    stViChnAttr.enViPixFormat = PIXEL_FORMAT_YUV_SEMIPLANAR_420;
    for(ii = 0; ii < 4; ii ++) {
        // interface
        DVR_ASSERT(HI_MPI_VI_Disable(ii));
        DVR_ASSERT(HI_MPI_VI_SetPubAttr(ii, &stViDevAttr));
        DVR_ASSERT(HI_MPI_VI_Enable(ii));
        for(jj = 0; jj < 4; jj ++) {
            DVR_ASSERT(HI_MPI_VI_SetChnAttr(ii, jj, &stViChnAttr));
            DVR_ASSERT(HI_MPI_VI_EnableChn(ii, jj));
            DVR_ASSERT(HI_MPI_VI_SetSrcFrameRate(ii, jj, MAX_CIF_LIVE_FPS));
            DVR_ASSERT(HI_MPI_VI_SetFrameRate(ii, jj, MAX_CIF_LIVE_FPS));
        }
    }
}
예제 #5
0
static void video_InputInit()
{
	int i = 0;
	// init sdk
	{
		VI_PUB_ATTR_S stViDevAttr;
		VI_CHN_ATTR_S stViChnAttr;

		// vi0 1-16 ch cif input 1d1
		// vi1 1-16 ch selecting input 1d1
		// vi2 17-20 ch d1 input 4d1
		// vi3 21-24 ch d1 input 4d1

		////////////////////////////////////////////////////////////////
		////////////////////////////////////////////////////////////////
		// vi0
		stViDevAttr.enInputMode = VI_MODE_BT656;
		stViDevAttr.enWorkMode = VI_WORK_MODE_1D1;
		stViDevAttr.enViNorm = (VIDEO_IS_PAL() ? VIDEO_ENCODING_MODE_PAL : VIDEO_ENCODING_MODE_NTSC);
        // channel attribute
        stViChnAttr.stCapRect.s32X = 0;
        stViChnAttr.stCapRect.s32Y = 0;
        stViChnAttr.stCapRect.u32Width = VI_CIF_WIDTH;
        stViChnAttr.stCapRect.u32Height = 8 * VI_CIF_HEIGHT + 7 * 2; // half field height combo frame
        stViChnAttr.bChromaResample = HI_FALSE;
        stViChnAttr.enCapSel = VI_CAPSEL_BOTH;
        stViChnAttr.bDownScale = HI_FALSE;
        stViChnAttr.bHighPri = HI_FALSE;
        stViChnAttr.enViPixFormat = PIXEL_FORMAT_YUV_SEMIPLANAR_420;

        DVR_ASSERT(HI_MPI_VI_Disable(0));
        DVR_ASSERT(HI_MPI_VI_SetPubAttr(0, &stViDevAttr));
        DVR_ASSERT(HI_MPI_VI_Enable(0));
        DVR_ASSERT(HI_MPI_VI_SetChnAttr(0, 0, &stViChnAttr));
        DVR_ASSERT(HI_MPI_VI_EnableChn(0, 0));
        DVR_ASSERT(HI_MPI_VI_SetSrcFrameRate(0, 0, MAX_CIF_LIVE_FPS));

		////////////////////////////////////////////////////////////////
		////////////////////////////////////////////////////////////////
		// vi1
		stViDevAttr.enInputMode = VI_MODE_BT656;
		stViDevAttr.enWorkMode = VI_WORK_MODE_1D1;
		stViDevAttr.enViNorm = (VIDEO_IS_PAL() ? VIDEO_ENCODING_MODE_PAL : VIDEO_ENCODING_MODE_NTSC);
		// channel attribute
		stViChnAttr.stCapRect.u32Width  = 704;
		stViChnAttr.stCapRect.u32Height = VI_CIF_HEIGHT;
		stViChnAttr.stCapRect.s32X = 8;
		stViChnAttr.stCapRect.s32Y = 0;
		stViChnAttr.bChromaResample = HI_FALSE;
		stViChnAttr.enCapSel = VI_CAPSEL_BOTH;
		stViChnAttr.bDownScale = HI_FALSE;
		stViChnAttr.bHighPri = HI_FALSE;
		stViChnAttr.enViPixFormat = PIXEL_FORMAT_YUV_SEMIPLANAR_420;

		// interface
		DVR_ASSERT(HI_MPI_VI_Disable(1));
		DVR_ASSERT(HI_MPI_VI_SetPubAttr(1, &stViDevAttr));
		DVR_ASSERT(HI_MPI_VI_Enable(1));
		DVR_ASSERT(HI_MPI_VI_SetChnAttr(1, 0, &stViChnAttr));
		DVR_ASSERT(HI_MPI_VI_EnableChn(1, 0));
		DVR_ASSERT(HI_MPI_VI_SetSrcFrameRate(1, 0, MAX_D1_LIVE_FPS));

		////////////////////////////////////////////////////////////////
		////////////////////////////////////////////////////////////////
		// vi2
		stViDevAttr.enInputMode = VI_MODE_BT656;
		stViDevAttr.enWorkMode = VI_WORK_MODE_4D1;
		stViDevAttr.enViNorm = (VIDEO_IS_PAL() ? VIDEO_ENCODING_MODE_PAL : VIDEO_ENCODING_MODE_NTSC);
		// cif input
		stViChnAttr.stCapRect.u32Width = 704;
		stViChnAttr.stCapRect.u32Height = VI_CIF_HEIGHT;
		stViChnAttr.stCapRect.s32X = 8;
		stViChnAttr.stCapRect.s32Y = 0;
		stViChnAttr.bChromaResample = HI_FALSE;
		stViChnAttr.enCapSel = VI_CAPSEL_BOTTOM;
		stViChnAttr.bDownScale = HI_TRUE;
		stViChnAttr.bHighPri = HI_FALSE;
		stViChnAttr.enViPixFormat = PIXEL_FORMAT_YUV_SEMIPLANAR_420;

		// interface
		DVR_ASSERT(HI_MPI_VI_Disable(2));
		DVR_ASSERT(HI_MPI_VI_SetPubAttr(2, &stViDevAttr));
		DVR_ASSERT(HI_MPI_VI_Enable(2));
		for(i = 0; i < 4; ++i){
			DVR_ASSERT(HI_MPI_VI_SetChnAttr(2, i, &stViChnAttr));
			DVR_ASSERT(HI_MPI_VI_EnableChn(2, i));
			DVR_ASSERT(HI_MPI_VI_SetSrcFrameRate(2, i, MAX_CIF_LIVE_FPS));
		}

		////////////////////////////////////////////////////////////////
		////////////////////////////////////////////////////////////////
		// vi3
		stViDevAttr.enInputMode = VI_MODE_BT656;
		stViDevAttr.enWorkMode = VI_WORK_MODE_4D1;
		stViDevAttr.enViNorm = (VIDEO_IS_PAL() ? VIDEO_ENCODING_MODE_PAL : VIDEO_ENCODING_MODE_NTSC);
		// cif input
		stViChnAttr.stCapRect.u32Width = 704;
		stViChnAttr.stCapRect.u32Height = VI_CIF_HEIGHT;
		stViChnAttr.stCapRect.s32X = 8;
		stViChnAttr.stCapRect.s32Y = 0;
		stViChnAttr.bChromaResample = HI_FALSE;
		stViChnAttr.enCapSel = VI_CAPSEL_BOTTOM;
		stViChnAttr.bDownScale = HI_TRUE;
		stViChnAttr.bHighPri = HI_FALSE;
		stViChnAttr.enViPixFormat = PIXEL_FORMAT_YUV_SEMIPLANAR_420;

		// interface
		DVR_ASSERT(HI_MPI_VI_Disable(3));
		DVR_ASSERT(HI_MPI_VI_SetPubAttr(3, &stViDevAttr));
		DVR_ASSERT(HI_MPI_VI_Enable(3));
		for(i = 0; i < 4; ++i){
			DVR_ASSERT(HI_MPI_VI_SetChnAttr(3, i, &stViChnAttr));
			DVR_ASSERT(HI_MPI_VI_EnableChn(3, i));
			DVR_ASSERT(HI_MPI_VI_SetSrcFrameRate(3, i, MAX_CIF_LIVE_FPS));
		}
	}
}
예제 #6
0
int SYSTEM_Init()
{
	int BSizW = VIDEO_IS_960() ?VRES_SIZE_W_EF :VRES_SIZE_W_SD;
	int BSizH = VIDEO_IS_PAL() ?VRES_SIZE_H_PL :VRES_SIZE_H_NT;
	int ii    = 0;

	VB_CONF_S stVbConf   = {0};
	MPP_SYS_CONF_S stSysConf = {0};
	memset(&stVbConf, 0, sizeof(stVbConf));

#ifdef _NVR
	stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
	stVbConf.astCommPool[0].u32BlkSize = 352 * 288 * 2;
	stVbConf.astCommPool[0].u32BlkCnt  = 4;
#elif defined(_EXT_HDDVR)
#if   (MAX_CAM_CH == 4) && defined(_HI3520D_EXT)
	stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
	//stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD720P * VRES_SIZE_H_HD720P * 2;
	//stVbConf.astCommPool[ii].u32BlkCnt  = 3 * MAX_CAM_CH;
	//ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = (VRES_SIZE_W_HD1080P/2) * VRES_SIZE_W_HD720P * 3 / 2;// 1280*720*2 , 1280*960*1.5( 1080* 960* 1.5)
	stVbConf.astCommPool[ii].u32BlkCnt  = 7 * MAX_CAM_CH - 1;
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = (BSizW) * (BSizH) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 3 * MAX_CAM_CH - 2;
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 4 * MAX_CAM_CH;
	ii ++;
#elif (MAX_CAM_CH == 4)
	stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
	stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD1080P * VRES_SIZE_H_HD1080P * 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 6 * MAX_CAM_CH;
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD720P * VRES_SIZE_H_HD720P * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 4 * MAX_CAM_CH;
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = (BSizW) * (BSizH) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 4 * MAX_CAM_CH;
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 4 * MAX_CAM_CH;
	ii ++;
#endif
#if   (MAX_CAM_CH == 8) && defined(SDK_PLATFORM_HI3521)
	stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
	stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD720P * VRES_SIZE_H_HD1080P * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 3 * MAX_CAM_CH;
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = (VRES_SIZE_W_HD1080P/2) * VRES_SIZE_H_HD1080P * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 5 * MAX_CAM_CH;
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = (BSizW) * (BSizH) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 2 * MAX_CAM_CH;
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 2 * MAX_CAM_CH;
	ii ++;
#elif (MAX_CAM_CH == 8)
	stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
	stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD1080P * VRES_SIZE_H_HD1080P * 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 2 * MAX_CAM_CH;
	ii ++;
	stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD1080P * VRES_SIZE_H_HD1080P * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 2 * MAX_CAM_CH;
	ii ++;
	stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD720P * VRES_SIZE_H_HD720P* 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 3 * MAX_CAM_CH;
	ii ++;
	stVbConf.astCommPool[ii].u32BlkSize = (BSizW) * (BSizH) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 3 * MAX_CAM_CH;
	ii ++;
	stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 3 * MAX_CAM_CH;
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD1080P * VRES_SIZE_H_HD1080P * 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 4 * MAX_CAM_CH;
	strcpy(stVbConf.astCommPool[ii ++].acMmzName, MMZ_ZONE_NAME1);
	stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD1080P * VRES_SIZE_H_HD1080P * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 4 * MAX_CAM_CH;
	strcpy(stVbConf.astCommPool[ii ++].acMmzName, MMZ_ZONE_NAME1);
	stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD720P * VRES_SIZE_H_HD720P* 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 3 * MAX_CAM_CH;
	strcpy(stVbConf.astCommPool[ii ++].acMmzName, MMZ_ZONE_NAME1);
	stVbConf.astCommPool[ii].u32BlkSize = (BSizW) * (BSizH) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 1 * MAX_CAM_CH;
	strcpy(stVbConf.astCommPool[ii ++].acMmzName, MMZ_ZONE_NAME1);
	stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 1 * MAX_CAM_CH;
	strcpy(stVbConf.astCommPool[ii ++].acMmzName, MMZ_ZONE_NAME1);

#endif
#if   (MAX_CAM_CH == 16) && defined(SDK_PLATFORM_HI3531)
#ifdef _HVR
	stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
	if (JCONF_BNC_CAM() > 0) {
		stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD720P * VRES_SIZE_H_HD720P * 2;
		stVbConf.astCommPool[ii].u32BlkCnt  = 4 * ((JCONF_BNC_CAM()+1)/2*2)/2;
		ii ++;

		stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD720P * VRES_SIZE_H_HD720P * 2;
		stVbConf.astCommPool[ii].u32BlkCnt  = 4 * ((JCONF_BNC_CAM()+1)/2*2)/2;
		strcpy(stVbConf.astCommPool[ii ++].acMmzName, MMZ_ZONE_NAME1);

		stVbConf.astCommPool[ii].u32BlkSize = (VRES_SIZE_W_HD1080P/2) * VRES_SIZE_H_HD1080P * 3 / 2;
		stVbConf.astCommPool[ii].u32BlkCnt  = 5 * ((JCONF_BNC_CAM()+1)/2*2)/2;
		ii ++;

		stVbConf.astCommPool[ii].u32BlkSize = (VRES_SIZE_W_HD1080P/2) * VRES_SIZE_H_HD1080P * 3 / 2;
		stVbConf.astCommPool[ii].u32BlkCnt  = 5 * ((JCONF_BNC_CAM()+1)/2*2)/2;
		strcpy(stVbConf.astCommPool[ii ++].acMmzName, MMZ_ZONE_NAME1);

		stVbConf.astCommPool[ii].u32BlkSize = (BSizW) * (BSizH) * 3 / 2;
		stVbConf.astCommPool[ii].u32BlkCnt  = 4 * JCONF_BNC_CAM();
		ii ++;

		stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2;
		stVbConf.astCommPool[ii].u32BlkCnt  = 4 * JCONF_BNC_CAM();
		ii ++;
	}

	if (JCONF_BNC_CAM()  == 0) {
		stVbConf.astCommPool[ii].u32BlkSize = (1920 * 1080) * 2;
		stVbConf.astCommPool[ii].u32BlkCnt  = 4;
		ii ++;
		stVbConf.astCommPool[ii].u32BlkSize = (1280 * 960) * 2;
		stVbConf.astCommPool[ii].u32BlkCnt  = 4;
		ii ++;
		stVbConf.astCommPool[ii].u32BlkSize = (720 * 576) * 3 / 2;
		stVbConf.astCommPool[ii].u32BlkCnt	= 6;
		ii ++;
		stVbConf.astCommPool[ii].u32BlkSize = (352 * 288) * 3 / 2;
		stVbConf.astCommPool[ii].u32BlkCnt	= 6;
		ii ++;
	}
#else
	stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
	stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD720P * VRES_SIZE_H_HD720P * 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 3 * MAX_CAM_CH;
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD720P * VRES_SIZE_H_HD720P * 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 3 * MAX_CAM_CH;
	strcpy(stVbConf.astCommPool[ii ++].acMmzName, MMZ_ZONE_NAME1);

	stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD720P * VRES_SIZE_H_HD720P * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 4 * MAX_CAM_CH;
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = VRES_SIZE_W_HD720P * VRES_SIZE_H_HD720P * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 4 * MAX_CAM_CH;
	strcpy(stVbConf.astCommPool[ii ++].acMmzName, MMZ_ZONE_NAME1);

	stVbConf.astCommPool[ii].u32BlkSize = (BSizW) * (BSizH) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 4 * MAX_CAM_CH;
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 4 * MAX_CAM_CH;
	ii ++;
#endif
#endif
	
#elif defined(_JA2024NC)
//	stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkSize = 704 * 576 * 2; // 4*4CIF live vi0
//	stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkCnt  = 4 * 16;
	stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkSize = 384 * 4636 * 2; // 16CIF live must be YUV422 2bpp
	stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkCnt  = 12;
      ++stVbConf.u32MaxPoolCnt;
	stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkSize = 704 * 576 * 2; // D1 live(1-16) vi1
	stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkCnt  = 8;
	++stVbConf.u32MaxPoolCnt;
	stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkSize = 384 * 288 * 2; // 4CIF live vi3 (17-20)
	stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkCnt  = 8 * 4;
	++stVbConf.u32MaxPoolCnt;
	stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkSize = 384 * 288 * 2; // 4CIF live vi4 (21-24)
	stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkCnt  = 8 * 4;
	++stVbConf.u32MaxPoolCnt;
	stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkSize = 704 * 576 * 2; // 1D1 live vi3/4 (17-24)
	stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkCnt  = 8;
	++stVbConf.u32MaxPoolCnt;

    stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkSize = 384 * 288 * 3 / 2; // VENC main stream
    stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkCnt = 6 * MAX_CAM_CH;
	++stVbConf.u32MaxPoolCnt;
	stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkSize = 384 * 288 * 3 / 2; // VENC sub stream
    stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkCnt = 6 * MAX_CAM_CH;
	++stVbConf.u32MaxPoolCnt;
	stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkSize = 384 * 288 * 3 / 2; // VENC cell-phonme stream
    stVbConf.astCommPool[stVbConf.u32MaxPoolCnt].u32BlkCnt = 6;
	++stVbConf.u32MaxPoolCnt;

#elif defined(_JA2032NC)

	stVbConf.u32MaxPoolCnt = 7;
	stVbConf.astCommPool[0].u32BlkSize = 384 * 4636 * 2; // 16CIF live must be YUV422 2bpp
	stVbConf.astCommPool[0].u32BlkCnt  = 12;
	stVbConf.astCommPool[1].u32BlkSize = 384 * 4636 * 2; // 16CIF live must be YUV422 2bpp
	stVbConf.astCommPool[1].u32BlkCnt  = 12;
	stVbConf.astCommPool[2].u32BlkSize = 704 * 576 * 2; // D1 live(1-8) vi1
	stVbConf.astCommPool[2].u32BlkCnt  = 5;
	stVbConf.astCommPool[3].u32BlkSize = 704 * 576 * 2; // D1 live(9-16) vi3
	stVbConf.astCommPool[3].u32BlkCnt  = 5;

    stVbConf.astCommPool[4].u32BlkSize = 384 * 288 * 2; // VENC main stream
    stVbConf.astCommPool[4].u32BlkCnt = 5 * MAX_CAM_CH;
	stVbConf.astCommPool[5].u32BlkSize = 384 * 288 * 2; // VENC sub stream
    stVbConf.astCommPool[5].u32BlkCnt = 5 * MAX_CAM_CH;
	stVbConf.astCommPool[6].u32BlkSize = 384 * 288 * 2; // VENC cell-phonme stream
    stVbConf.astCommPool[6].u32BlkCnt = 5;

    //stVbConf.astCommPool[7].u32BlkSize = 704 * 576 * 2; // D1 live(9-16) vi3
	//stVbConf.astCommPool[7].u32BlkCnt  = 2;

#elif defined(_JA7216CX) || defined(_JA7216NC)
	stVbConf.u32MaxPoolCnt = 6;
//	// from tongli
//	stVbConf.astCommPool[0].u32BlkSize = 3339968;
//	stVbConf.astCommPool[0].u32BlkCnt  = 10;
//	stVbConf.astCommPool[1].u32BlkSize = 813056;
//	stVbConf.astCommPool[1].u32BlkCnt  = 10;
//	stVbConf.astCommPool[2].u32BlkSize = 214016;
//	stVbConf.astCommPool[2].u32BlkCnt  = 40;
	// from yangyi
	stVbConf.astCommPool[0].u32BlkSize = 384 * 4636 * 2; // 16CIF live must be YUV422 2bpp
	stVbConf.astCommPool[0].u32BlkCnt  = 12;
	stVbConf.astCommPool[1].u32BlkSize = 704 * 576 * 2; // D1 live(1-8) vi1
	stVbConf.astCommPool[1].u32BlkCnt  = 5;
	stVbConf.astCommPool[2].u32BlkSize = 704 * 576 * 2; // D1 live(9-16) vi3
	stVbConf.astCommPool[2].u32BlkCnt  = 5;

    stVbConf.astCommPool[3].u32BlkSize = 384 * 288 * 2; // VENC main stream
    stVbConf.astCommPool[3].u32BlkCnt = 5 * MAX_CAM_CH;
	stVbConf.astCommPool[4].u32BlkSize = 384 * 288 * 2; // VENC sub stream
    stVbConf.astCommPool[4].u32BlkCnt = 5 * MAX_CAM_CH;
	stVbConf.astCommPool[5].u32BlkSize = 384 * 288 * 2; // VENC cell-phonme stream
    stVbConf.astCommPool[5].u32BlkCnt = 5;



#elif defined(_JA2016CX) || defined(_JA2016NC) || defined(_JA2016ICX)
	stVbConf.u32MaxPoolCnt = 6;
	stVbConf.astCommPool[0].u32BlkSize = 704 * 576 * 2; // D1 for full screen live
	stVbConf.astCommPool[0].u32BlkCnt  = 5 * (MAX_D1_CNT + 1);
	stVbConf.astCommPool[1].u32BlkSize = 352 * 288 * 2; // cif for live
	stVbConf.astCommPool[1].u32BlkCnt  = 5 * (MAX_CIF_CNT - MAX_D1_CNT);

	stVbConf.astCommPool[2].u32BlkSize = 704 * 576 * 3 / 2; // cif for main stream venc
	stVbConf.astCommPool[2].u32BlkCnt  = 4 * MAX_D1_CNT;
	stVbConf.astCommPool[3].u32BlkSize = 352 * 288 * 3 / 2; // cif for sub stream venc
	stVbConf.astCommPool[3].u32BlkCnt  = 4 * (MAX_CIF_CNT - MAX_D1_CNT);
	stVbConf.astCommPool[4].u32BlkSize = 352 * 288 * 3 / 2; // cif for sub stream venc
	stVbConf.astCommPool[4].u32BlkCnt  = 4 * MAX_CAM_CH;
	stVbConf.astCommPool[5].u32BlkSize = 352 * 288 * 3 / 2; // VENC cell-phonme stream
	stVbConf.astCommPool[5].u32BlkCnt  = 4;

#elif defined(_JA2008NC)
	stVbConf.u32MaxPoolCnt = 6;
	stVbConf.astCommPool[0].u32BlkSize = 704 * 576 * 2; // D1 for full screen live
	stVbConf.astCommPool[0].u32BlkCnt  = 5 * (MAX_D1_CNT + 1);
	stVbConf.astCommPool[1].u32BlkSize = 352 * 288 * 2; // cif for live
	stVbConf.astCommPool[1].u32BlkCnt  = 5 * (MAX_CIF_CNT - MAX_D1_CNT);

	stVbConf.astCommPool[2].u32BlkSize = 704 * 576 * 3 / 2; // cif for main stream venc
	stVbConf.astCommPool[2].u32BlkCnt  = 4 * MAX_D1_CNT;
	stVbConf.astCommPool[3].u32BlkSize = 352 * 288 * 3 / 2; // cif for sub stream venc
	stVbConf.astCommPool[3].u32BlkCnt  = 4 * (MAX_CIF_CNT - MAX_D1_CNT);
	stVbConf.astCommPool[4].u32BlkSize = 352 * 288 * 3 / 2; // cif for sub stream venc
	stVbConf.astCommPool[4].u32BlkCnt  = 4 * MAX_CAM_CH;
	stVbConf.astCommPool[5].u32BlkSize = 352 * 288 * 3 / 2; // VENC cell-phonme stream
	stVbConf.astCommPool[5].u32BlkCnt  = 4;
#elif defined(_JA9204RN)
	stVbConf.u32MaxPoolCnt = 5;
	stVbConf.astCommPool[0].u32BlkSize = 960 * 576 * 3 / 2; // D1 for full screen live
	stVbConf.astCommPool[0].u32BlkCnt  = 5 * (MAX_D1_CNT + 1);
	stVbConf.astCommPool[1].u32BlkSize = 480 * 288 * 3 / 2; // cif for live
	stVbConf.astCommPool[1].u32BlkCnt  = 5 * (MAX_CIF_CNT - MAX_D1_CNT);

	stVbConf.astCommPool[2].u32BlkSize = 960 * 576 * 3 / 2; // cif for main stream venc
	stVbConf.astCommPool[2].u32BlkCnt  = 4 * MAX_D1_CNT;
	stVbConf.astCommPool[3].u32BlkSize = 480 * 288 * 3 / 2; // cif for sub stream venc
	stVbConf.astCommPool[3].u32BlkCnt  = 4 * (MAX_CIF_CNT - MAX_D1_CNT);
	stVbConf.astCommPool[4].u32BlkSize = 480 * 288 * 3 / 2; // cif for sub stream venc
	stVbConf.astCommPool[4].u32BlkCnt  = 4 * MAX_CAM_CH;

#elif defined(_JA3116TW)
	stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
	stVbConf.astCommPool[ii].u32BlkSize = BSizW * BSizH * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 1.5 * (MAX_D1_CNT) * (VIDEO_IS_PAL() ?1 :1.2f);
	ii ++;
	stVbConf.astCommPool[ii].u32BlkSize = BSizW * BSizH * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 4 * (MAX_D1_CNT + 1) * (VIDEO_IS_PAL() ?1 :1.2f);
	strcpy(stVbConf.astCommPool[ii ++].acMmzName, MMZ_ZONE_NAME1);

	stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 2.5 * (MAX_CAM_CH + 1) * (VIDEO_IS_PAL() ?1 :1.2f);
	ii ++;
	stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 2 * (MAX_CAM_CH + 1) * (VIDEO_IS_PAL() ?1 :1.2f);
	strcpy(stVbConf.astCommPool[ii ++].acMmzName, MMZ_ZONE_NAME1);

#elif defined(_JA2104) || defined(_JA2106) || defined(_JA2116)
	#if   defined(_HI3520D_RAM_LITE) && (MAX_CAM_CH == 4)
	 	stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
		stVbConf.astCommPool[ii].u32BlkSize = BSizW * BSizH * 3 / 2;
		stVbConf.astCommPool[ii].u32BlkCnt  = 4 * MAX_D1_CNT + 2;
	 	ii ++;

		stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2;
		stVbConf.astCommPool[ii].u32BlkCnt  = 4 * (MAX_CIF_CNT - MAX_D1_CNT) + 3 * MAX_CAM_CH + 2;
	 	ii ++;
	#elif defined(_HI3520D_RAM_LITE) && (MAX_CAM_CH == 8)
		stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
		stVbConf.astCommPool[ii].u32BlkSize = BSizW * BSizH * 3 / 2;
		stVbConf.astCommPool[ii].u32BlkCnt  = 4 * (MAX_D1_CNT + 1);
	 	ii ++;
 
		stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2;
		stVbConf.astCommPool[ii].u32BlkCnt  = 4 * (MAX_CIF_CNT - MAX_D1_CNT) + 2 * MAX_CAM_CH;
		ii ++;
	#elif defined(_HI3515A_EXT) && defined(_JA2104)
		stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
		stVbConf.astCommPool[ii].u32BlkSize = BSizW * BSizH * 3 / 2;
		stVbConf.astCommPool[ii].u32BlkCnt  = 9 * (MAX_D1_CNT + 1);
		ii ++;

		stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2;
		stVbConf.astCommPool[ii].u32BlkCnt  = 6 * (MAX_CIF_CNT - MAX_D1_CNT) + 10 * (MAX_CAM_CH);
		ii ++;
	#elif defined(_HI3520D_EXT) && defined(_JA2104)
		stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
		stVbConf.astCommPool[ii].u32BlkSize = BSizW * BSizH * 3 / 2; // D1 for full screen live
		stVbConf.astCommPool[ii].u32BlkCnt  = 7 * (MAX_D1_CNT + 1);
		ii ++;

		stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2; // cif for live
		stVbConf.astCommPool[ii].u32BlkCnt  = 6 * (MAX_CIF_CNT - MAX_D1_CNT);
		ii ++;

		stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2; // cif for live
		stVbConf.astCommPool[ii].u32BlkCnt  = 4 * (MAX_CAM_CH);
		ii ++;
	#else
		stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
		stVbConf.astCommPool[ii].u32BlkSize = BSizW * BSizH * 3 / 2; // D1 for full screen live
		stVbConf.astCommPool[ii].u32BlkCnt  = 5 * (MAX_D1_CNT + 1) + 3;
		ii ++;

		stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2; // cif for live
		stVbConf.astCommPool[ii].u32BlkCnt  = 6 * (MAX_CIF_CNT - MAX_D1_CNT) + 4 * (MAX_CAM_CH);
		ii ++;
	#endif
#elif defined(_JA2108) || defined(_JA2116D)
	stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
	stVbConf.astCommPool[ii].u32BlkSize = BSizW * BSizH * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 12 * (MAX_D1_CNT + 1);
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 12 * (MAX_CIF_CNT - MAX_D1_CNT);
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2; // cif for live
	stVbConf.astCommPool[ii].u32BlkCnt  = 5 * (MAX_CAM_CH);
	ii ++;

#elif defined(_JA2124) || defined(_JA2132)
	stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
	stVbConf.astCommPool[ii].u32BlkSize = 720 * BSizH * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 9 * ((MAX_CAM_CH/16) * 4);
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = BSizW * BSizH * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 6 * ((MAX_CAM_CH%16)/4)+6;
	ii ++;

	stVbConf.astCommPool[ii].u32BlkSize = (BSizW/2) * (BSizH/2) * 3 / 2;
	stVbConf.astCommPool[ii].u32BlkCnt  = 4 * MAX_CAM_CH;
	ii ++;

#else
	stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
	stVbConf.astCommPool[0].u32BlkSize = 704 * 576 * 3 / 2;
	stVbConf.astCommPool[0].u32BlkCnt  = 8 * (MAX_D1_CNT);
	stVbConf.astCommPool[1].u32BlkSize = 352 * 288 * 3 / 2;
	stVbConf.astCommPool[1].u32BlkCnt  = 8 * (MAX_CIF_CNT - MAX_D1_CNT) + 2;
#endif

	SYSTEM_Destroy();
	SYSTEM_SetTime(NULL);
	DVR_ASSERT(HI_MPI_VB_SetConf(&stVbConf));
	DVR_ASSERT(HI_MPI_VB_Init());
	stSysConf.u32AlignWidth = 16;
	DVR_ASSERT(HI_MPI_SYS_SetConf(&stSysConf));
	DVR_ASSERT(HI_MPI_SYS_Init());
	return 0;
}