Example #1
0
static void video_InputDestroy()
{
	int i = 0;
	// 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
	////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////
	// vi3
	for(i = 0; i < 4; ++i){
		DVR_ASSERT(HI_MPI_VI_DisableChn(3, i));
	}
	DVR_ASSERT(HI_MPI_VI_Disable(3));
	////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////
	// vi2
	for(i = 0; i < 4; ++i){
		DVR_ASSERT(HI_MPI_VI_DisableChn(2, i));
	}
	DVR_ASSERT(HI_MPI_VI_Disable(2));
	////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////
	// vi1
	DVR_ASSERT(HI_MPI_VI_DisableChn(1, 0));
	DVR_ASSERT(HI_MPI_VI_Disable(1));
	////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////
	// vi0
	DVR_ASSERT(HI_MPI_VI_DisableChn(0, 0));
	DVR_ASSERT(HI_MPI_VI_Disable(0));
}
Example #2
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));
	}
}
Example #3
0
static void video_InputDestroy()
{
	////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////
	// vi2
	DVR_ASSERT(HI_MPI_VI_DisableChn(2, 0));
	DVR_ASSERT(HI_MPI_VI_Disable(2));
	////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////
	// vi0
	DVR_ASSERT(HI_MPI_VI_DisableChn(0, 0));
	DVR_ASSERT(HI_MPI_VI_Disable(0));
}
Example #4
0
static void video_InputDestroy()
{
	int nDev = 0;
	int i = 0;
#if (MAX_CAM_CH > 4)
	////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////
	// vi2
	nDev = 2;
	for(i = 0; i < 4; ++i){
		DVR_ASSERT(HI_MPI_VI_DisableChn(nDev, i));
	}
	DVR_ASSERT(HI_MPI_VI_Disable(nDev));
#endif
	////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////
	// vi0
	nDev = 0;
	for(i = 0; i < 4; ++i){
		DVR_ASSERT(HI_MPI_VI_DisableChn(nDev, i));
	}
	DVR_ASSERT(HI_MPI_VI_Disable(nDev));
}
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));
            }
        }
	}
}
Example #6
0
static void video_InputDestroy()
{
    int ii, jj;

    // 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
    ////////////////////////////////////////////////////////////////
    for(ii = 0; ii < 4; ii ++) {
        for(jj = 0; jj < 4; ++ jj){
            DVR_ASSERT(HI_MPI_VI_DisableChn(ii, jj));
        }
        DVR_ASSERT(HI_MPI_VI_Disable(ii));
    }
}
static void video_InputDestroy()
{
	int nDev = 0;
	int i = 0, ii = 0;

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

        for(i = 0; i < 4; ++i) {
            DVR_ASSERT(HI_MPI_VI_DisableChn(nDev, i));
        }
        DVR_ASSERT(HI_MPI_VI_Disable(nDev));
    }
}
Example #8
0
HI_S32 SampleDisableVi(HI_U32 ScreenCnt)
{
    HI_U32 i;

    ScreenCnt = (ScreenCnt == 1 ? 2 : ScreenCnt);
    ScreenCnt = (ScreenCnt == 9 ? 8 : ScreenCnt);

    for (i = 0; i < ScreenCnt; i++)
    {
        CHECK(HI_MPI_VI_DisableChn(i/2, i%2), "HI_MPI_VI_DisableChn");
    }

    for (i = 0; i < ScreenCnt/2; i++)
    {
        CHECK(HI_MPI_VI_Disable(i), "HI_MPI_VI_Disable");
    }

    return HI_SUCCESS;
}
Example #9
0
HI_S32 SampleDisableVi(VI_DEV ViDev,VI_CHN ViChn)
{
	HI_S32 s32Ret;

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

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

	return HI_SUCCESS;
}
Example #10
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));
        }
    }
}
Example #11
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));
		}
	}
}