XilinxProcessorIPLib/drivers/ycrcb2rgb/examples/ycrcb2rgb_example.c
int YCrCb2Rgb_Update_Example(u16 DeviceId)
{

	struct XYCrCb2Rgb_Coef_Inputs CoefIn;
	struct XYCrCb2Rgb_Coef_Outputs CoefOut;
	struct XYCrCb2Rgb_Coefficients Coef;
	XYCrCb2Rgb_Config *Config;
	int Status;

	/* Initialize the CrCb2RGB driver so that it's ready to use look up
	 * the configuration in the config table then initialize it.
	 */
	Config = XYCrCb2Rgb_LookupConfig(DeviceId);
	if(NULL == Config){
		return XST_FAILURE;
	}

	Status = XYCrCb2Rgb_CfgInitialize(&XYccInstance, Config,
						Config->BaseAddress);
	if(Status != XST_SUCCESS){
		return XST_FAILURE;
	}

	/* Enable the YCRCB2RGB core */
	XYCrCb2Rgb_Enable(&XYccInstance);

	/* Disable register updates. This is the default operating mode for
	 * the YCRCB2RGB core and allows registers to be updated without
	 * effecting the core's behavior.
	 */
	XYCrCb2Rgb_RegUpdateDisable(&XYccInstance);

	/* Setup CoefIn for XYCC_STANDARD_ITU_601_SD, 16_to_240_for_TV
	 * and data width of 8-bits.
	 * enum XYcc_Standards are:
	 *	0 = XYCC_STANDARD_ITU_601_SD
	 *	1 = XYCC_STANDARD_ITU_709_NTSC
	 *	2 = XYCC_STANDARD_ITU_709_PAL
	 *	3 = XYCC_STANDARD_YUV.
	 */
	XYCrCb2Rgb_Select_Standard(&XYccInstance, XYCC_STANDARD_ITU_601_SD,
				XYCC_TV_16_TO_240, (u32)XYCC_DATA_WIDTH_8,
					&CoefIn);

	/* Translate into YCRCB2RGB core coefficients */
	XYCrCb2Rgb_Coefficient_Translation(&XYccInstance,
				&CoefIn, &CoefOut,(u32)XYCC_DATA_WIDTH_8,
				(u32)XYCC_DATA_WIDTH_8);

	/* Store coefficient values */
	Coef.ACoef = CoefIn.ACoef;
	Coef.ACoef = CoefIn.ACoef;
	Coef.ACoef = CoefIn.ACoef;
	Coef.ACoef = CoefIn.ACoef;

	/* Program the new YCRCB2RGB core coefficients */
	XYCrCb2Rgb_SetCoefs(&XYccInstance, &Coef);

	/* Set output range */
	XYCrCb2Rgb_Select_OutputRange(&XYccInstance, XYCC_TV_16_TO_240);

	/* Set the Active Columns and Rows */
	XYCrCb2Rgb_SetActiveSize(&XYccInstance, 720, 1280);

	/* Set the offsets
	 * For 8-bit color:  Valid range = [0, 255]
	 * For 10-bit color: Valid range = [0, 1023]
	 * For 12-bit color: Valid range = [0, 4095]
	 * For 16-bit color: Valid range = [0, 65535]
	 */
	XYCrCb2Rgb_SetROffset(&XYccInstance, 16);
	XYCrCb2Rgb_SetGOffset(&XYccInstance, 128);
	XYCrCb2Rgb_SetBOffset(&XYccInstance, 128);

	/* Set the Clip/Clamp
	 * For 8-bit color:  Valid range = [0,   255]
	 * For 10-bit color: Valid range = [0,  1023]
	 * For 12-bit color: Valid range = [0,  4095]
	 * For 16-bit color: Valid range = [0, 65535]
	 */
	XYCrCb2Rgb_SetRGBMax(&XYccInstance, 240);
	XYCrCb2Rgb_SetRGBMin(&XYccInstance, 16);

	/* Enable register updates. This mode will cause the coefficient and
	 * offset registers internally to the YCRCB2RGB core to automatically
	 * be updated on the next start-of-frame (SOF).
	 */
	XYCrCb2Rgb_RegUpdateEnable(&XYccInstance);

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* YCrCb to RGB Color Space Converter Register Update Example.
* This function provides an example of the process used to update the
* coefficient and offset registers in the YCRCB2RGB core.
*
* @param	DeviceId is the unique device id of the YCRCB2RGB core.
*
* @return
*		- XST_SUCCESS if successful,
*		- XST_FAILURE if it is un-successful
*
* @note		None.
*
****************************************************************************/
YCrCb to RGB Color Space Converter Register Update Example.
This function provides an example of the process used to update the
coefficient and offset registers in the YCRCB2RGB core.
YCrCb to RGB Color Space Converter Register Update Example . This function provides an example of the process used to update the coefficient and offset registers in the YCRCB2RGB core .
int YCrCb2Rgb_Update_Example(u16 DeviceId)
{
	struct XYCrCb2Rgb_Coef_Inputs CoefIn;
	struct XYCrCb2Rgb_Coef_Outputs CoefOut;
	struct XYCrCb2Rgb_Coefficients Coef;
	XYCrCb2Rgb_Config *Config;
	int Status;
	Config = XYCrCb2Rgb_LookupConfig(DeviceId);
	if(NULL == Config){
		return XST_FAILURE;
	}
	Status = XYCrCb2Rgb_CfgInitialize(&XYccInstance, Config,
						Config->BaseAddress);
	if(Status != XST_SUCCESS){
		return XST_FAILURE;
	}
	XYCrCb2Rgb_Enable(&XYccInstance);
	XYCrCb2Rgb_RegUpdateDisable(&XYccInstance);
	XYCrCb2Rgb_Select_Standard(&XYccInstance, XYCC_STANDARD_ITU_601_SD,
				XYCC_TV_16_TO_240, (u32)XYCC_DATA_WIDTH_8,
					&CoefIn);
	XYCrCb2Rgb_Coefficient_Translation(&XYccInstance,
				&CoefIn, &CoefOut,(u32)XYCC_DATA_WIDTH_8,
				(u32)XYCC_DATA_WIDTH_8);
	Coef.ACoef = CoefIn.ACoef;
	Coef.ACoef = CoefIn.ACoef;
	Coef.ACoef = CoefIn.ACoef;
	Coef.ACoef = CoefIn.ACoef;
	XYCrCb2Rgb_SetCoefs(&XYccInstance, &Coef);
	XYCrCb2Rgb_Select_OutputRange(&XYccInstance, XYCC_TV_16_TO_240);
	XYCrCb2Rgb_SetActiveSize(&XYccInstance, 720, 1280);
	XYCrCb2Rgb_SetROffset(&XYccInstance, 16);
	XYCrCb2Rgb_SetGOffset(&XYccInstance, 128);
	XYCrCb2Rgb_SetBOffset(&XYccInstance, 128);
	XYCrCb2Rgb_SetRGBMax(&XYccInstance, 240);
	XYCrCb2Rgb_SetRGBMin(&XYccInstance, 16);
	XYCrCb2Rgb_RegUpdateEnable(&XYccInstance);
	return XST_SUCCESS;
}
int YCrCb2Rgb_Update_Example ( u16 DeviceId ) { struct XYCrCb2Rgb_Coef_Inputs CoefIn ; struct XYCrCb2Rgb_Coef_Outputs CoefOut ; struct XYCrCb2Rgb_Coefficients Coef ; XYCrCb2Rgb_Config * Config ; int Status ; Config = XYCrCb2Rgb_LookupConfig ( DeviceId ) ; if ( NULL == Config ) { return XST_FAILURE ; } Status = XYCrCb2Rgb_CfgInitialize ( & XYccInstance , Config , Config -> BaseAddress ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } XYCrCb2Rgb_Enable ( & XYccInstance ) ; XYCrCb2Rgb_RegUpdateDisable ( & XYccInstance ) ; XYCrCb2Rgb_Select_Standard ( & XYccInstance , XYCC_STANDARD_ITU_601_SD , XYCC_TV_16_TO_240 , ( u32 ) XYCC_DATA_WIDTH_8 , & CoefIn ) ; XYCrCb2Rgb_Coefficient_Translation ( & XYccInstance , & CoefIn , & CoefOut , ( u32 ) XYCC_DATA_WIDTH_8 , ( u32 ) XYCC_DATA_WIDTH_8 ) ; Coef . ACoef = CoefIn . ACoef ; Coef . ACoef = CoefIn . ACoef ; Coef . ACoef = CoefIn . ACoef ; Coef . ACoef = CoefIn . ACoef ; XYCrCb2Rgb_SetCoefs ( & XYccInstance , & Coef ) ; XYCrCb2Rgb_Select_OutputRange ( & XYccInstance , XYCC_TV_16_TO_240 ) ; XYCrCb2Rgb_SetActiveSize ( & XYccInstance , 720 , 1280 ) ; XYCrCb2Rgb_SetROffset ( & XYccInstance , 16 ) ; XYCrCb2Rgb_SetGOffset ( & XYccInstance , 128 ) ; XYCrCb2Rgb_SetBOffset ( & XYccInstance , 128 ) ; XYCrCb2Rgb_SetRGBMax ( & XYccInstance , 240 ) ; XYCrCb2Rgb_SetRGBMin ( & XYccInstance , 16 ) ; XYCrCb2Rgb_RegUpdateEnable ( & XYccInstance ) ; return XST_SUCCESS ; }
YCrCb to RGB Color Space Converter Register Update Example.
YCrCb to RGB Color Space Converter Register Update Example .
/* Initialize the CrCb2RGB driver so that it's ready to use look up
	 * the configuration in the config table then initialize it.
	 */ /* Enable the YCRCB2RGB core */ /* Disable register updates. This is the default operating mode for
	 * the YCRCB2RGB core and allows registers to be updated without
	 * effecting the core's behavior.
	 */ /* Setup CoefIn for XYCC_STANDARD_ITU_601_SD, 16_to_240_for_TV
	 * and data width of 8-bits.
	 * enum XYcc_Standards are:
	 *	0 = XYCC_STANDARD_ITU_601_SD
	 *	1 = XYCC_STANDARD_ITU_709_NTSC
	 *	2 = XYCC_STANDARD_ITU_709_PAL
	 *	3 = XYCC_STANDARD_YUV.
	 */ /* Translate into YCRCB2RGB core coefficients */ /* Store coefficient values */ /* Program the new YCRCB2RGB core coefficients */ /* Set output range */ /* Set the Active Columns and Rows */ /* Set the offsets
	 * For 8-bit color:  Valid range = [0, 255]
	 * For 10-bit color: Valid range = [0, 1023]
	 * For 12-bit color: Valid range = [0, 4095]
	 * For 16-bit color: Valid range = [0, 65535]
	 */ /* Set the Clip/Clamp
	 * For 8-bit color:  Valid range = [0,   255]
	 * For 10-bit color: Valid range = [0,  1023]
	 * For 12-bit color: Valid range = [0,  4095]
	 * For 16-bit color: Valid range = [0, 65535]
	 */ /* Enable register updates. This mode will cause the coefficient and
	 * offset registers internally to the YCRCB2RGB core to automatically
	 * be updated on the next start-of-frame (SOF).
	 */