Esempio n. 1
0
HI_S32 MppSysInit(HI_VOID)
{
	HI_S32 i = 0;
	MPP_SYS_CONF_S stSysConf = {0};

	HI_MPI_SYS_Exit();
	
	stSysConf.u32AlignWidth = 16;
    if (HI_MPI_SYS_SetConf(&stSysConf))
    {
        printf("conf : system config failed!\n");
        return -1;
    }

    if (HI_MPI_SYS_Init())
    {
        printf("sys init failed!\n");
        return -1;
    }

	/*to ensure all vo device are disabled*/
	for(i=0; i<VOU_DEV_BUTT; i++)
	{
		(HI_VOID)HI_MPI_VO_Disable(i);
	}

    return HI_SUCCESS;
}
Esempio n. 2
0
static int _mem_init()
{
    //printf("Init hisi mpp sys & vb\n");
    
    MPP_SYS_CONF_S stSysConf = {0};
    stSysConf.u32AlignWidth = MPP_SYS_ALIGN_WIDTH;
    
    VB_CONF_S stVbConf;
    memset(&stVbConf,0,sizeof(VB_CONF_S));

    unsigned int u32BlkSize;
    stVbConf.u32MaxPoolCnt = 128;
    SIZE_S size;
    size.u32Height = 1088;
    size.u32Width = 1920;
    u32BlkSize = calc_pic_vb_blk_size(&size, PIXEL_FORMAT_YUV_SEMIPLANAR_420, MPP_SYS_ALIGN_WIDTH);
    stVbConf.astCommPool[0].u32BlkSize = u32BlkSize;
    stVbConf.astCommPool[0].u32BlkCnt = 15;
    
    CHECK_RET(HI_MPI_VB_Exit(),"HI_MPI_VB_Exit");
    CHECK_RET(HI_MPI_SYS_Exit(),"HI_MPI_SYS_Exit");

    CHECK_RET(HI_MPI_VB_SetConf(&stVbConf),"HI_MPI_VB_SetConf");
    CHECK_RET(HI_MPI_VB_Init(),"HI_MPI_VB_Init");

    CHECK_RET(HI_MPI_SYS_SetConf(&stSysConf),"HI_MPI_SYS_SetConf");
    CHECK_RET(HI_MPI_SYS_Init(),"HI_MPI_SYS_Init");

    return HI_SUCCESS;
}
Esempio n. 3
0
HI_S32 PCIV_Slave_SysInit()
{
    HI_S32         s32Ret, i;
    MPP_SYS_CONF_S stSysConf = {0};
    VB_CONF_S      stVbConf = {0};
    VI_PUB_ATTR_S  stviAttr;
    VO_PUB_ATTR_S  stvoAttr;

    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();

    stVbConf.u32MaxPoolCnt = 128;
    stVbConf.astCommPool[0].u32BlkSize = 884736;/* 768*576*1.5*/
    stVbConf.astCommPool[0].u32BlkCnt  = 20;
    stVbConf.astCommPool[1].u32BlkSize = 221184;/* 384*288*1.5*/
    stVbConf.astCommPool[1].u32BlkCnt  = 60;
    s32Ret = HI_MPI_VB_SetConf(&stVbConf);
    HI_ASSERT((HI_SUCCESS == s32Ret));

    s32Ret = HI_MPI_VB_Init();
    HI_ASSERT((HI_SUCCESS == s32Ret));

    stSysConf.u32AlignWidth = 64;
    s32Ret = HI_MPI_SYS_SetConf(&stSysConf);
    HI_ASSERT((HI_SUCCESS == s32Ret));

    s32Ret = HI_MPI_SYS_Init();
    HI_ASSERT((HI_SUCCESS == s32Ret));

    /* Enable VI device*/
    memset(&stviAttr,0,sizeof(VI_PUB_ATTR_S));
    stviAttr.enInputMode = VI_MODE_BT656;
    stviAttr.enWorkMode  = VI_WORK_MODE_2D1;
    stviAttr.u32AdType   = AD_2815;
    stviAttr.enViNorm    = VIDEO_ENCODING_MODE_PAL;
    for (i = 0; i < VIU_MAX_DEV_NUM; i++)
    {
        s32Ret = HI_MPI_VI_SetPubAttr(i, &stviAttr);
        HI_ASSERT((HI_SUCCESS == s32Ret));

        s32Ret = HI_MPI_VI_Enable(i);
        HI_ASSERT((HI_SUCCESS == s32Ret));
    }

    /* Enable VO device*/
    stvoAttr.stTvConfig.stComposeMode = VIDEO_ENCODING_MODE_PAL;
    stvoAttr.u32BgColor = 0x000000;
    s32Ret = HI_MPI_VO_SetPubAttr(&stvoAttr);
    HI_ASSERT((HI_SUCCESS == s32Ret));

    s32Ret = HI_MPI_VO_Enable();
    HI_ASSERT((HI_SUCCESS == s32Ret));

    return HI_SUCCESS;
}
Esempio n. 4
0
int mpp_system_init(void)
{
	HI_S32 s32Ret;
	MPP_SYS_CONF_S stSysConf = {0};
	VB_CONF_S stVbConf ={0};
	static int mpp_inited = 0;

	if(mpp_inited == 1)
	{
		msg_dbg("Mpp system have inited!\n");
		return 0;
	}

	HI_MPI_SYS_Exit();
	HI_MPI_VB_Exit();
//	stVbConf.u32MaxPoolCnt = 128;
	stVbConf.astCommPool[0].u32BlkSize = 720 * 576 * 4;
	stVbConf.astCommPool[0].u32BlkCnt = 20;

	s32Ret = HI_MPI_VB_SetConf(&stVbConf);
	if (HI_SUCCESS != s32Ret)
	{
		printf("HI_MPI_VB_SetConf failed 0x%x!\n",s32Ret);
		return -1;
	}

	s32Ret = HI_MPI_VB_Init();
	if(HI_SUCCESS != s32Ret)
	{
		printf("HI_MPI_VB_Init failed 0x%x!\n",s32Ret);
		return -1;
	}

	stSysConf.u32AlignWidth = 16;
	s32Ret = HI_MPI_SYS_SetConf(&stSysConf);
	if (HI_SUCCESS != s32Ret)
	{
		HI_MPI_VB_Exit();
		printf("conf : system config failed 0x%x!\n",s32Ret);
		return -1;
	}

	s32Ret = HI_MPI_SYS_Init();
	if(HI_SUCCESS != s32Ret)
	{
		HI_MPI_VB_Exit();
		printf("HI_MPI_SYS_Init err 0x%x\n",s32Ret);
		return -1;
	}

	mpp_inited = 1;
	
	return 0;
}
Esempio n. 5
0
HI_S32 SampleSysInit(HI_VOID)
{
    HI_S32 s32Ret;
    MPP_SYS_CONF_S stSysConf = {0};
    VB_CONF_S stVbConf ={0};
    
    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();
    
    stVbConf.u32MaxPoolCnt = 64;
    stVbConf.astCommPool[0].u32BlkSize = 768*576*2;
    stVbConf.astCommPool[0].u32BlkCnt = 20; 
    stVbConf.astCommPool[1].u32BlkSize = 384*288*2;
    stVbConf.astCommPool[1].u32BlkCnt = 40; 

    s32Ret = HI_MPI_VB_SetConf(&stVbConf);
    if (HI_SUCCESS != s32Ret)
    {
        printf("HI_MPI_VB_SetConf failed 0x%x!\n",s32Ret);
        return HI_FAILURE;
    }

    s32Ret = HI_MPI_VB_Init();
    if(HI_SUCCESS != s32Ret)
    {
        printf("HI_MPI_VB_Init failed 0x%x!\n",s32Ret);
        return HI_FAILURE;
    }

    stSysConf.u32AlignWidth = 64;

    s32Ret = HI_MPI_SYS_SetConf(&stSysConf);
    if (HI_SUCCESS != s32Ret)
    {
        HI_MPI_VB_Exit();
        printf("conf : system config failed 0x%x!\n",s32Ret);
        return HI_FAILURE;
    }

    s32Ret = HI_MPI_SYS_Init();
    if(HI_SUCCESS != s32Ret)
    {
        HI_MPI_VB_Exit();
        printf("HI_MPI_SYS_Init err 0x%x\n",s32Ret);
        return HI_FAILURE;
    }

    return HI_SUCCESS;
}
Esempio n. 6
0
void ipcam_media_sys_ctrl_init_media_system(IpcamMediaSysCtrl *self)
{
    VB_CONF_S stVbConf;
    MPP_SYS_CONF_S stSysConf = {0};
    HI_S32 s32Ret = HI_FAILURE;

    memset(&stVbConf, 0, sizeof(VB_CONF_S));
    stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
    stVbConf.astCommPool[0].u32BlkSize = (CEILING_2_POWER(IMAGE_MAX_WIDTH, SYS_ALIGN_WIDTH) * \
                                          CEILING_2_POWER(IMAGE_MAX_HEIGHT, SYS_ALIGN_WIDTH) * \
                                          2);
    stVbConf.astCommPool[0].u32BlkCnt = 12;
    memset(stVbConf.astCommPool[0].acMmzName, 0, sizeof(stVbConf.astCommPool[0].acMmzName));

    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();

    s32Ret = HI_MPI_VB_SetConf(&stVbConf);
    if (HI_SUCCESS != s32Ret)
    {
        g_critical("HI_MPI_VB_SetConf failed with %#x!\n", s32Ret);
        return;
    }

    s32Ret = HI_MPI_VB_Init();
    if (HI_SUCCESS != s32Ret)
    {
        g_critical("HI_MPI_VB_Init failed with %#x!\n", s32Ret);
        return;
    }

    stSysConf.u32AlignWidth = SYS_ALIGN_WIDTH;
    s32Ret = HI_MPI_SYS_SetConf(&stSysConf);
    if (HI_SUCCESS != s32Ret)
    {
        g_critical("HI_MPI_SYS_SetConf failed with %#x!\n", s32Ret);
        return;
    }

    s32Ret = HI_MPI_SYS_Init();
    if (HI_SUCCESS != s32Ret)
    {
        g_critical("HI_MPI_SYS_Init failed with %#x!\n", s32Ret);
        return;
    }
}
Esempio n. 7
0
/******************************************************************************
* function : vb init & MPI system init
******************************************************************************/
HI_S32 SAMPLE_COMM_SYS_Init(VB_CONF_S *pstVbConf)
{
    MPP_SYS_CONF_S stSysConf = {0};
    HI_S32 s32Ret = HI_FAILURE;

    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();

    if (NULL == pstVbConf)
    {
        SAMPLE_PRT("input parameter is null, it is invaild!\n");
        return HI_FAILURE;
    }

    s32Ret = HI_MPI_VB_SetConf(pstVbConf);
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_VB_SetConf failed!\n");
        return HI_FAILURE;
    }

    s32Ret = HI_MPI_VB_Init();
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_VB_Init failed!\n");
        return HI_FAILURE;
    }

    stSysConf.u32AlignWidth = SAMPLE_SYS_ALIGN_WIDTH;
    s32Ret = HI_MPI_SYS_SetConf(&stSysConf);
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_SYS_SetConf failed\n");
        return HI_FAILURE;
    }

    s32Ret = HI_MPI_SYS_Init();
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_SYS_Init failed!\n");
        return HI_FAILURE;
    }

    return HI_SUCCESS;
}
Esempio n. 8
0
bool HimppSysctl::enableObject()
{
    HI_S32 s32Ret = HI_FAILURE;

    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();


    VB_CONF_S vbconf;
    memset(&vbconf, 0, sizeof(vbconf));
    vbconf.u32MaxPoolCnt = maxPoolCount;
    int i = 0;
    for (auto &b : buffers) {
        vbconf.astCommPool[i].u32BlkSize = b.blksiz;
        vbconf.astCommPool[i].u32BlkCnt = b.blkcnt;
        i++;
    }
    s32Ret = HI_MPI_VB_SetConf(&vbconf);
    if (s32Ret != HI_SUCCESS) {
        return HI_FAILURE;
    }

    s32Ret = HI_MPI_VB_Init();
    if (s32Ret != HI_SUCCESS) {
        return HI_FAILURE;
    }

    MPP_SYS_CONF_S sysconf = {
        .u32AlignWidth = alignWidth
    };
    s32Ret = HI_MPI_SYS_SetConf(&sysconf);
    if (s32Ret != HI_SUCCESS) {
        goto err_vb_cleanup;
    }

    s32Ret = HI_MPI_SYS_Init();
    if (s32Ret != HI_SUCCESS) {
        goto err_vb_cleanup;
    }
    return true;

err_vb_cleanup:
    HI_MPI_VB_Exit();
    return false;
}
Esempio n. 9
0
static HI_S32 SAMPLE_IVE_MPI_Init(HI_VOID)
{
    HI_S32 s32Ret;
    VB_CONF_S struVbConf;
    MPP_SYS_CONF_S struSysConf;

    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();

    memset(&struVbConf,0,sizeof(VB_CONF_S));
    struVbConf.u32MaxPoolCnt             = 128;
    struVbConf.astCommPool[0].u32BlkSize = 1920*1080*3/2;
    struVbConf.astCommPool[0].u32BlkCnt  = 4;
    s32Ret = HI_MPI_VB_SetConf(&struVbConf);
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_VB_SetConf fail,Error(%#x)\n",s32Ret);
        return s32Ret;
    }
    s32Ret = HI_MPI_VB_Init();
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_VB_Init fail,Error(%#x)\n",s32Ret);
        return s32Ret;
    }
    struSysConf.u32AlignWidth = 64;
    s32Ret = HI_MPI_SYS_SetConf(&struSysConf);
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_SYS_SetConf fail,Error(%#x)\n",s32Ret);
        (HI_VOID)HI_MPI_VB_Exit();
        return s32Ret;
    }
    
    s32Ret = HI_MPI_SYS_Init();
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_SYS_Init fail,Error(%#x)\n",s32Ret);
        (HI_VOID)HI_MPI_VB_Exit();
        return s32Ret;
    }    

    return HI_SUCCESS;
}
Esempio n. 10
0
int framework_init ()
{
	VB_CONF_S stVbConf;
	MPP_SYS_CONF_S stSysConf = {0};
	HI_S32 ret = HI_FAILURE;
	int result = FAILURE;

	HI_MPI_SYS_Exit ();
	HI_MPI_VB_Exit ();

	memset (&stVbConf, 0x00, sizeof (stVbConf));
	ret = HI_MPI_VB_SetConf (&stVbConf);
	if (ret != HI_SUCCESS)
	{
		printf ("HI_MPI_VB_SetConf Eorr[%x]\n", ret);
		return result;
	}

	ret = HI_MPI_VB_Init ();
	if (ret != HI_SUCCESS)
	{
		printf ("HI_MPI_VB_Init Eorr[%x]\n", ret);
		return result;
	}

	stSysConf.u32AlignWidth = 64;
	ret = HI_MPI_SYS_SetConf (&stSysConf);
	if (ret != HI_SUCCESS)
	{
		printf ("HI_MPI_SYS_SetConf Eorr[%x]\n", ret);
		return result;
	}

	ret = HI_MPI_SYS_Init ();
	if (ret != HI_SUCCESS)
	{
		printf ("HI_MPI_SYS_Init Eorr[%x]\n", ret);
		return result;
	}

	result = SUCCESS;
	return result;
}
Esempio n. 11
0
HI_S32 SampleSysInit(MPP_SYS_CONF_S * pstSysConf,VB_CONF_S* pstVbConf)
{
	HI_S32 s32Ret;

    HI_MPI_SYS_Exit();
	HI_MPI_VB_Exit();

	s32Ret = HI_MPI_VB_SetConf(pstVbConf);
	if (HI_SUCCESS != s32Ret)
	{
		printf("HI_MPI_VB_SetConf failed 0x%x!\n",s32Ret);
		return HI_FAILURE;
	}

	s32Ret = HI_MPI_VB_Init();
	if(HI_SUCCESS != s32Ret)
	{
		printf("HI_MPI_VB_Init failed 0x%x!\n",s32Ret);
		return HI_FAILURE;
	}

	s32Ret = HI_MPI_SYS_SetConf(pstSysConf);
	if (HI_SUCCESS != s32Ret)
	{
		HI_MPI_VB_Exit();
		printf("conf : system config failed 0x%x!\n",s32Ret);
		return HI_FAILURE;
	}

	s32Ret = HI_MPI_SYS_Init();
	if(HI_SUCCESS != s32Ret)
	{
		HI_MPI_VB_Exit();
		printf("HI_MPI_SYS_Init err 0x%x\n",s32Ret);
		return HI_FAILURE;
	}

    return HI_SUCCESS;
}
Esempio n. 12
0
/*****************************************************************************
 Prototype       : main
 Description     : main entry
 Input           : argc    : "reset", "N", "n" is optional.
                   argv[]  : 0 or 1 is optional
 Output          : None
 Return Value    :
 Global Variable
    Read Only    :
    Read & Write :
  History
  1.Date         : 2008/8/30
    Author       : x00100808
    Modification : Created function

*****************************************************************************/
int main(int argc, char *argv[])
{
	char ch;

    /* configure for vi2vo preview                                         */
	MPP_SYS_CONF_S stSysConf = {0};
	VB_CONF_S stVbConf ={0};

	stVbConf.u32MaxPoolCnt = 64;
	stVbConf.astCommPool[0].u32BlkSize = 768*576*2;
	stVbConf.astCommPool[0].u32BlkCnt = 20;
	stVbConf.astCommPool[1].u32BlkSize = 384*288*2;
	stVbConf.astCommPool[1].u32BlkCnt = 60;
	stSysConf.u32AlignWidth = 64;

    if (argc > 1)
    {
        /* if program can not run anymore, you may try 'reset' adhere command  */
        if (!strcmp(argv[1],"reset"))
        {
           	CHECK(HI_MPI_SYS_Exit(),"HI_MPI_SYS_Exit");
        	CHECK(HI_MPI_VB_Exit(),"HI_MPI_VB_Exit");
        	return HI_SUCCESS;
        }
        else if ((!strcmp(argv[1],"N") || (!strcmp(argv[1],"n"))))
        {
            /* if you live in Japan or North America, you may need adhere 'N/n' */
            g_u32TvMode = VIDEO_ENCODING_MODE_NTSC;
            g_u32ScreenHeight = 480;
        }
        else if (!strcmp(argv[1],"vi2vo"))
        {
            /* you can open vi2vo preview only                              */
            g_bPreviewOnly = HI_TRUE;
        }
    }

    /* process abnormal case                                                */
    signal(SIGINT, HandleSig);
    signal(SIGTERM, HandleSig);

    /* configure video buffer and initial system                            */
	CHECK(HI_MPI_VB_SetConf(&stVbConf),"HI_MPI_VB_SetConf");
	CHECK(HI_MPI_VB_Init(),"HI_MPI_VB_Init");
	CHECK(HI_MPI_SYS_SetConf(&stSysConf),"HI_MPI_SYS_SetConf");
	CHECK(HI_MPI_SYS_Init(),"HI_MPI_SYS_Init");


    /* set AD and DA for VI and VO                                          */
    do_Set2815_2d1();
    if (VIDEO_ENCODING_MODE_NTSC == g_u32TvMode)
    {
        do_Set7179(VIDEO_ENCODING_MODE_NTSC);
    }
    else
    {
        do_Set7179(VIDEO_ENCODING_MODE_PAL);;
    }

	Usage();
	while((ch = getchar())!= 'q')
	{

		if('\n' == ch)
		{
			continue;
		}

		switch(ch)
		{
			case '1':
			{
			    printf("\033[0;33mwhat you see is codecing!\033[0;39m\n");
				CHECK(CODEC_1D1_H264(),"CODEC_1D1_H264");
				break;
			}

			case '2':
			{
    			printf("\033[0;33mthe last window is codecing!\033[0;39m\n");
				CHECK(VI2VO_3CIF_CODEC_1CIF_H264(),"VI2VO_3CIF_CODEC_1CIF_H264");
				break;
			}

			case '3':
			{
    			printf("\033[0;33mthe last window is codecing!\033[0;39m\n");
				CHECK(VI2VO_8CIF_CODEC_1CIF_H264(),"VI2VO_8CIF_CODEC_1CIF_H264");
				break;
			}

			default:
				printf("\033[0;31mno order!\033[0;39m\n");
		}

		Usage();
	}

    /* de-init sys and vb */
	CHECK(HI_MPI_SYS_Exit(),"HI_MPI_SYS_Exit");
	CHECK(HI_MPI_VB_Exit(),"HI_MPI_VB_Exit");

	return HI_SUCCESS;
}
Esempio n. 13
0
HI_S32 main(HI_VOID)
{
    HI_U32 u32Size;
    HI_S32 s32Fd;
    HI_U32 u32Times;
    HI_U8* pu8Screen;

    HI_U32 u32PhyAddr;
    HI_S32 s32Ret = -1;
    HI_U32 i = 0;

    MPP_SYS_CONF_S struSysConf;
    HI_S32 s32ret;

    /* mpi sys init */
    HI_MPI_SYS_Exit();
    struSysConf.u32AlignWidth = 64;
    s32ret = HI_MPI_SYS_SetConf(&struSysConf);
    if (HI_SUCCESS != s32ret)
    {
        printf("HI_MPI_SYS_SetConf err\n");
        return s32ret;
    }
    s32ret = HI_MPI_SYS_Init();
    if (HI_SUCCESS != s32ret)
    {
        printf("HI_MPI_SYS_Init err\n");
        return s32ret;
    }

    struct fb_fix_screeninfo stFixInfo;
    struct fb_var_screeninfo stVarInfo;
    struct fb_bitfield stR32 = {16, 8, 0};
    struct fb_bitfield stG32 = {8, 8, 0};
    struct fb_bitfield stB32 = {0, 8, 0};
    struct fb_bitfield stA32 = {24, 8, 0};

    /* 1. open tde device */
    HI_API_TDE_Open();

    /* 2. framebuffer operation */
    s32Fd = open("/dev/fb/0", O_RDWR);
    if (s32Fd == -1)
    {
        printf("open frame buffer device error\n");
        goto FB_OPEN_ERROR;
    }

    stVarInfo.xres_virtual	 	= SCREEN_WIDTH;
    stVarInfo.yres_virtual		= SCREEN_HEIGHT*2;
    stVarInfo.xres      		= SCREEN_WIDTH;
    stVarInfo.yres      		= SCREEN_HEIGHT;
    stVarInfo.activate  		= FB_ACTIVATE_FORCE;
    stVarInfo.bits_per_pixel	= 32;
    stVarInfo.xoffset = 0;
    stVarInfo.yoffset = 0;
    stVarInfo.red   = stR32;
    stVarInfo.green = stG32;
    stVarInfo.blue  = stB32;
    stVarInfo.transp = stA32;

    if (ioctl(s32Fd, FBIOPUT_VSCREENINFO, &stVarInfo) < 0)
    {
        printf("process frame buffer device error\n");
        goto FB_PROCESS_ERROR0;
    }

    if (ioctl(s32Fd, FBIOGET_FSCREENINFO, &stFixInfo) < 0)
    {
        printf("process frame buffer device error\n");
        goto FB_PROCESS_ERROR0;
    }

    u32Size 	= stFixInfo.smem_len;
    if(u32Size < MIN_VIDEO_MEMORY)
    {
        printf("need more video memory to run the sample, the minimum size is %d\n", MIN_VIDEO_MEMORY);
        goto FB_PROCESS_ERROR0;
    }
    u32PhyAddr  = stFixInfo.smem_start;
    pu8Screen   = mmap(NULL, u32Size, PROT_READ|PROT_WRITE, MAP_SHARED, s32Fd, 0);

    memset(pu8Screen, 0xff, SCREEN_WIDTH*SCREEN_HEIGHT*4);

    /* 3. create surface */
    g_stScreen[0].enColorFmt = PIXFMT;
    g_stScreen[0].pu8PhyAddr = (HI_U8*)u32PhyAddr;
    g_stScreen[0].u16Width = SCREEN_WIDTH;
    g_stScreen[0].u16Height = SCREEN_HEIGHT;
    g_stScreen[0].u16Stride = g_stScreen[0].u16Width * BPP;

    g_stScreen[1] = g_stScreen[0];
    g_stScreen[1].pu8PhyAddr = g_stScreen[0].pu8PhyAddr + g_stScreen[0].u16Stride * g_stScreen[0].u16Height;

    g_stBackGround.pu8PhyAddr = g_stScreen[1].pu8PhyAddr + g_stScreen[1].u16Stride * g_stScreen[1].u16Height;
    CreateSurfaceByBitMap(BACKGROUND_NAME, &g_stBackGround, pu8Screen + ((HI_U32)g_stBackGround.pu8PhyAddr - u32PhyAddr));
    g_stImgSur[0].pu8PhyAddr = g_stBackGround.pu8PhyAddr + g_stBackGround.u16Stride * g_stBackGround.u16Height;
    for(i = 0; i < N_IMAGES - 1; i++)
    {
        CreateSurfaceByBitMap(pszImageNames[i], &g_stImgSur[i], pu8Screen + ((HI_U32)g_stImgSur[i].pu8PhyAddr - u32PhyAddr));
        g_stImgSur[i+1].pu8PhyAddr = g_stImgSur[i].pu8PhyAddr + g_stImgSur[i].u16Stride * g_stImgSur[i].u16Height;
    }
    CreateSurfaceByBitMap(pszImageNames[i], &g_stImgSur[i], pu8Screen + ((HI_U32)g_stImgSur[i].pu8PhyAddr - u32PhyAddr));

    g_s32FrameNum = 0;

    /* 3. use tde and framebuffer to realize rotational effect */
    for (u32Times = 0; u32Times < 1000; u32Times++)
    {
        circumrotate(u32Times%2);
        stVarInfo.yoffset = (u32Times%2)?0:576;

        /*set frame buffer start position*/
        if (ioctl(s32Fd, FBIOPAN_DISPLAY, &stVarInfo) < 0)
        {
            printf("process frame buffer device error\n");
            goto FB_PROCESS_ERROR1;
        }
    }

    s32Ret = 0;

FB_PROCESS_ERROR1:
    munmap(pu8Screen, u32Size);
FB_PROCESS_ERROR0:
    close(s32Fd);
FB_OPEN_ERROR:
    HI_API_TDE_Close();

    return s32Ret;
}
Esempio n. 14
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;
}