XilinxProcessorIPLib/drivers/mipicsiss/examples/xmipi_vck_example/mipi_cfg.c
void InitVprocSs_Scaler(int count,int width,int height)
{
	XVprocSs_Config* p_vpss_cfg;
	int status;
	int widthIn, heightIn, widthOut, heightOut;

	if(Pipeline_Cfg.VideoDestn == XVIDDES_DSI){
		widthOut = DSI_H_RES;
		heightOut = DSI_V_RES;
	} else {

		widthOut = HDMI_H_RES;
		heightOut = HDMI_V_RES;
	}
	usleep(1000);
	/* Local variables */
	XVidC_VideoMode resIdIn, resIdOut;
	XVidC_VideoStream StreamIn;

	if (Pipeline_Cfg.VideoMode == XVIDC_VM_1280x720_60_P) {
		widthIn = 1280;
		heightIn = 720;
		StreamIn.FrameRate = XVIDC_FR_60HZ;
	}

	if (Pipeline_Cfg.VideoMode == XVIDC_VM_1920x1080_30_P) {
		widthIn = 1920;
		heightIn = 1080;
		StreamIn.FrameRate = XVIDC_FR_60HZ;
	}

	if (Pipeline_Cfg.VideoMode == XVIDC_VM_1920x1080_60_P) {
		widthIn = 1920;
		heightIn = 1080;
		StreamIn.FrameRate = XVIDC_FR_60HZ;
	}

	if (Pipeline_Cfg.VideoMode == XVIDC_VM_3840x2160_30_P) {
		widthIn = 3840;
		heightIn = 2160;
		StreamIn.FrameRate = XVIDC_FR_60HZ;
	}

	if (Pipeline_Cfg.VideoMode == XVIDC_VM_3840x2160_60_P) {
		widthIn = 3840;
		heightIn = 2160;
		StreamIn.FrameRate = XVIDC_FR_60HZ;
	}

	if (count) {
		p_vpss_cfg = XVprocSs_LookupConfig(XVPROCSS_DEVICE_ID);
		if (p_vpss_cfg == NULL) {
			xil_printf("ERROR! Failed to find VPSS-based scaler.");
			xil_printf("\n\r");
			return;
		}

		status = XVprocSs_CfgInitialize(&scaler_new_inst, p_vpss_cfg,
				p_vpss_cfg->BaseAddress);
		if (status != XST_SUCCESS) {
			xil_printf("ERROR! Failed to initialize VPSS-based ");
			xil_printf("scaler.\n\r");
			return;
		}
	}

	XVprocSs_Stop(&scaler_new_inst);

	/* Get resolution ID from frame size */
	resIdIn = XVidC_GetVideoModeId(widthIn, heightIn, StreamIn.FrameRate,
			FALSE);

	/* Setup Video Processing Subsystem */
	StreamIn.VmId = resIdIn;
	StreamIn.Timing.HActive = widthIn;
	StreamIn.Timing.VActive = heightIn;
	StreamIn.ColorFormatId = XVIDC_CSF_RGB;
	StreamIn.ColorDepth = (XVidC_ColorDepth)scaler_new_inst.Config.ColorDepth;
	StreamIn.PixPerClk = (XVidC_PixelsPerClock)scaler_new_inst.Config.PixPerClock;
	StreamIn.IsInterlaced = 0;

	status = XVprocSs_SetVidStreamIn(&scaler_new_inst, &StreamIn);
	if (status != XST_SUCCESS) {
		xil_printf("Unable to set input video stream parameters \
				correctly\r\n");
		return;
	}

	/* Get resolution ID from frame size */
	resIdOut = XVidC_GetVideoModeId(widthOut, heightOut, XVIDC_FR_60HZ,
					FALSE);



	StreamOut.VmId = resIdOut;
	StreamOut.Timing.HActive = widthOut;
	StreamOut.Timing.VActive = heightOut;
	StreamOut.ColorFormatId = XVIDC_CSF_RGB;
	StreamOut.ColorDepth = (XVidC_ColorDepth)scaler_new_inst.Config.ColorDepth;
	StreamOut.PixPerClk=(XVidC_PixelsPerClock)scaler_new_inst.Config.PixPerClock;
	StreamOut.FrameRate = XVIDC_FR_60HZ;
	StreamOut.IsInterlaced = 0;

	/* Get resolution ID from frame size */
	resIdOut = XVidC_GetVideoModeId(widthOut, heightOut, XVIDC_FR_60HZ,
					FALSE);



	XVprocSs_SetVidStreamOut(&scaler_new_inst, &StreamOut);
	if (status != XST_SUCCESS) {
		xil_printf("Unable to set output video stream parameters correctly\r\n");
		return;
	}

	status = XVprocSs_SetSubsystemConfig(&scaler_new_inst);
	if (status != XST_SUCCESS) {
		xil_printf("XVprocSs_SetSubsystemConfig failed %d\r\n", status);
		XVprocSs_LogDisplay(&scaler_new_inst);
		return;
	}

}
/*****************************************************************************/
/**
 * This function initializes and configures VProcSS IP for scalar mode with the
 * given input and output width and height values.
 *
 * @param	count is a flag value to initialize IP only once.
 *
 * @return	None.
 *
 * @note	None.
 *
 *****************************************************************************/
This function initializes and configures VProcSS IP for scalar mode with the
given input and output width and height values.

@param       count is a flag value to initialize IP only once.

@return      None.

@note        None.
This function initializes and configures VProcSS IP for scalar mode with the given input and output width and height values . @param count is a flag value to initialize IP only once . @return None . @note None .
void InitVprocSs_Scaler(int count,int width,int height)
{
	XVprocSs_Config* p_vpss_cfg;
	int status;
	int widthIn, heightIn, widthOut, heightOut;
	if(Pipeline_Cfg.VideoDestn == XVIDDES_DSI){
		widthOut = DSI_H_RES;
		heightOut = DSI_V_RES;
	} else {
		widthOut = HDMI_H_RES;
		heightOut = HDMI_V_RES;
	}
	usleep(1000);
	XVidC_VideoMode resIdIn, resIdOut;
	XVidC_VideoStream StreamIn;
	if (Pipeline_Cfg.VideoMode == XVIDC_VM_1280x720_60_P) {
		widthIn = 1280;
		heightIn = 720;
		StreamIn.FrameRate = XVIDC_FR_60HZ;
	}
	if (Pipeline_Cfg.VideoMode == XVIDC_VM_1920x1080_30_P) {
		widthIn = 1920;
		heightIn = 1080;
		StreamIn.FrameRate = XVIDC_FR_60HZ;
	}
	if (Pipeline_Cfg.VideoMode == XVIDC_VM_1920x1080_60_P) {
		widthIn = 1920;
		heightIn = 1080;
		StreamIn.FrameRate = XVIDC_FR_60HZ;
	}
	if (Pipeline_Cfg.VideoMode == XVIDC_VM_3840x2160_30_P) {
		widthIn = 3840;
		heightIn = 2160;
		StreamIn.FrameRate = XVIDC_FR_60HZ;
	}
	if (Pipeline_Cfg.VideoMode == XVIDC_VM_3840x2160_60_P) {
		widthIn = 3840;
		heightIn = 2160;
		StreamIn.FrameRate = XVIDC_FR_60HZ;
	}
	if (count) {
		p_vpss_cfg = XVprocSs_LookupConfig(XVPROCSS_DEVICE_ID);
		if (p_vpss_cfg == NULL) {
			xil_printf("ERROR! Failed to find VPSS-based scaler.");
			xil_printf("\n\r");
			return;
		}
		status = XVprocSs_CfgInitialize(&scaler_new_inst, p_vpss_cfg,
				p_vpss_cfg->BaseAddress);
		if (status != XST_SUCCESS) {
			xil_printf("ERROR! Failed to initialize VPSS-based ");
			xil_printf("scaler.\n\r");
			return;
		}
	}
	XVprocSs_Stop(&scaler_new_inst);
	resIdIn = XVidC_GetVideoModeId(widthIn, heightIn, StreamIn.FrameRate,
			FALSE);
	StreamIn.VmId = resIdIn;
	StreamIn.Timing.HActive = widthIn;
	StreamIn.Timing.VActive = heightIn;
	StreamIn.ColorFormatId = XVIDC_CSF_RGB;
	StreamIn.ColorDepth = (XVidC_ColorDepth)scaler_new_inst.Config.ColorDepth;
	StreamIn.PixPerClk = (XVidC_PixelsPerClock)scaler_new_inst.Config.PixPerClock;
	StreamIn.IsInterlaced = 0;
	status = XVprocSs_SetVidStreamIn(&scaler_new_inst, &StreamIn);
	if (status != XST_SUCCESS) {
		xil_printf("Unable to set input video stream parameters \
				correctly\r\n");
		return;
	}
	resIdOut = XVidC_GetVideoModeId(widthOut, heightOut, XVIDC_FR_60HZ,
					FALSE);
	StreamOut.VmId = resIdOut;
	StreamOut.Timing.HActive = widthOut;
	StreamOut.Timing.VActive = heightOut;
	StreamOut.ColorFormatId = XVIDC_CSF_RGB;
	StreamOut.ColorDepth = (XVidC_ColorDepth)scaler_new_inst.Config.ColorDepth;
	StreamOut.PixPerClk=(XVidC_PixelsPerClock)scaler_new_inst.Config.PixPerClock;
	StreamOut.FrameRate = XVIDC_FR_60HZ;
	StreamOut.IsInterlaced = 0;
	resIdOut = XVidC_GetVideoModeId(widthOut, heightOut, XVIDC_FR_60HZ,
					FALSE);
	XVprocSs_SetVidStreamOut(&scaler_new_inst, &StreamOut);
	if (status != XST_SUCCESS) {
		xil_printf("Unable to set output video stream parameters correctly\r\n");
		return;
	}
	status = XVprocSs_SetSubsystemConfig(&scaler_new_inst);
	if (status != XST_SUCCESS) {
		xil_printf("XVprocSs_SetSubsystemConfig failed %d\r\n", status);
		XVprocSs_LogDisplay(&scaler_new_inst);
		return;
	}
}
void InitVprocSs_Scaler ( int count , int width , int height ) { XVprocSs_Config * p_vpss_cfg ; int status ; int widthIn , heightIn , widthOut , heightOut ; if ( Pipeline_Cfg . VideoDestn == XVIDDES_DSI ) { widthOut = DSI_H_RES ; heightOut = DSI_V_RES ; } else { widthOut = HDMI_H_RES ; heightOut = HDMI_V_RES ; } usleep ( 1000 ) ; XVidC_VideoMode resIdIn , resIdOut ; XVidC_VideoStream StreamIn ; if ( Pipeline_Cfg . VideoMode == XVIDC_VM_1280x720_60_P ) { widthIn = 1280 ; heightIn = 720 ; StreamIn . FrameRate = XVIDC_FR_60HZ ; } if ( Pipeline_Cfg . VideoMode == XVIDC_VM_1920x1080_30_P ) { widthIn = 1920 ; heightIn = 1080 ; StreamIn . FrameRate = XVIDC_FR_60HZ ; } if ( Pipeline_Cfg . VideoMode == XVIDC_VM_1920x1080_60_P ) { widthIn = 1920 ; heightIn = 1080 ; StreamIn . FrameRate = XVIDC_FR_60HZ ; } if ( Pipeline_Cfg . VideoMode == XVIDC_VM_3840x2160_30_P ) { widthIn = 3840 ; heightIn = 2160 ; StreamIn . FrameRate = XVIDC_FR_60HZ ; } if ( Pipeline_Cfg . VideoMode == XVIDC_VM_3840x2160_60_P ) { widthIn = 3840 ; heightIn = 2160 ; StreamIn . FrameRate = XVIDC_FR_60HZ ; } if ( count ) { p_vpss_cfg = XVprocSs_LookupConfig ( XVPROCSS_DEVICE_ID ) ; if ( p_vpss_cfg == NULL ) { xil_printf ( " " ) ; xil_printf ( " \n \r " ) ; return ; } status = XVprocSs_CfgInitialize ( & scaler_new_inst , p_vpss_cfg , p_vpss_cfg -> BaseAddress ) ; if ( status != XST_SUCCESS ) { xil_printf ( " " ) ; xil_printf ( " \n \r " ) ; return ; } } XVprocSs_Stop ( & scaler_new_inst ) ; resIdIn = XVidC_GetVideoModeId ( widthIn , heightIn , StreamIn . FrameRate , FALSE ) ; StreamIn . VmId = resIdIn ; StreamIn . Timing . HActive = widthIn ; StreamIn . Timing . VActive = heightIn ; StreamIn . ColorFormatId = XVIDC_CSF_RGB ; StreamIn . ColorDepth = ( XVidC_ColorDepth ) scaler_new_inst . Config . ColorDepth ; StreamIn . PixPerClk = ( XVidC_PixelsPerClock ) scaler_new_inst . Config . PixPerClock ; StreamIn . IsInterlaced = 0 ; status = XVprocSs_SetVidStreamIn ( & scaler_new_inst , & StreamIn ) ; if ( status != XST_SUCCESS ) { xil_printf ( " \
 \r \n " ) ; return ; } resIdOut = XVidC_GetVideoModeId ( widthOut , heightOut , XVIDC_FR_60HZ , FALSE ) ; StreamOut . VmId = resIdOut ; StreamOut . Timing . HActive = widthOut ; StreamOut . Timing . VActive = heightOut ; StreamOut . ColorFormatId = XVIDC_CSF_RGB ; StreamOut . ColorDepth = ( XVidC_ColorDepth ) scaler_new_inst . Config . ColorDepth ; StreamOut . PixPerClk = ( XVidC_PixelsPerClock ) scaler_new_inst . Config . PixPerClock ; StreamOut . FrameRate = XVIDC_FR_60HZ ; StreamOut . IsInterlaced = 0 ; resIdOut = XVidC_GetVideoModeId ( widthOut , heightOut , XVIDC_FR_60HZ , FALSE ) ; XVprocSs_SetVidStreamOut ( & scaler_new_inst , & StreamOut ) ; if ( status != XST_SUCCESS ) { xil_printf ( " \r \n " ) ; return ; } status = XVprocSs_SetSubsystemConfig ( & scaler_new_inst ) ; if ( status != XST_SUCCESS ) { xil_printf ( " \r \n " , status ) ; XVprocSs_LogDisplay ( & scaler_new_inst ) ; return ; } }
This function initializes and configures VProcSS IP for scalar mode with the
 given input and output width and height values.
This function initializes and configures VProcSS IP for scalar mode with the given input and output width and height values .
/* Local variables */ /* Get resolution ID from frame size */ /* Setup Video Processing Subsystem */ /* Get resolution ID from frame size */ /* Get resolution ID from frame size */