XilinxProcessorIPLib/drivers/v_sditx/src/xv_sditx.c
u8 XV_SdiTx_GetPayloadColorFormat(XSdiVid_TransMode SdiMode, XVidC_ColorFormat ColorFormatId)
{
	u32 Data;

	switch (SdiMode) {
	case XSDIVID_MODE_3GB:
	case XSDIVID_MODE_6G:
	case XSDIVID_MODE_12G:
	case XSDIVID_MODE_12GF:
		if (ColorFormatId == XVIDC_CSF_YCBCR_422)
				Data = 0x0;
		else if(ColorFormatId == XVIDC_CSF_YCBCR_420)
				Data = 0x3;
		else if (ColorFormatId == XVIDC_CSF_YCBCR_444 &&
				((SdiMode != XSDIVID_MODE_6G) || (SdiMode != XSDIVID_MODE_12GF)))
				Data = 0x1;
		else {
			xil_printf("Error: Invalid ColorFomat input. Defaulting to YCBCR_422\n\r");
			Data = 0x0;
		}
		break;
	case XSDIVID_MODE_SD:
	case XSDIVID_MODE_HD:
	case XSDIVID_MODE_3GA:
		if (ColorFormatId == XVIDC_CSF_YCBCR_422)
				Data = 0x0;
		else if (ColorFormatId == XVIDC_CSF_YCBCR_444 && (SdiMode == XSDIVID_MODE_3GA))
				Data = 0x1;
		else if (ColorFormatId == XVIDC_CSF_RGB)
				Data = 0x2;
		else {
				xil_printf("Error: Invalid ColorFomat input. Defaulting to YCBCR_422\n\r");
				Data = 0x0;
		}
		break;
	default:
			return XST_FAILURE;
	}
	return Data & 0xF;
}
/*****************************************************************************/
/**
 *
 * This function calculates the Color Format for 3rd byte of the Payload packet
 * for all SDI modes
 *
 * @param	SdiMode is a variable to the XSdiVid_TransMode.
 * @param	ColorFormatId is a variable of type XVidC_ColorFormat.
 *
 * @return
 *		- returns 8-bit value
 *
 * @note		None.
 *
 ******************************************************************************/
This function calculates the Color Format for 3rd byte of the Payload packet
for all SDI modes

@param       SdiMode is a variable to the XSdiVid_TransMode.
@param       ColorFormatId is a variable of type XVidC_ColorFormat.

@return
- returns 8-bit value

@note                None.
This function calculates the Color Format for 3rd byte of the Payload packet for all SDI modes @param SdiMode is a variable to the XSdiVid_TransMode . @param ColorFormatId is a variable of type XVidC_ColorFormat . @return - returns 8 - bit value @note None .
u8 XV_SdiTx_GetPayloadColorFormat(XSdiVid_TransMode SdiMode, XVidC_ColorFormat ColorFormatId)
{
	u32 Data;
	switch (SdiMode) {
	case XSDIVID_MODE_3GB:
	case XSDIVID_MODE_6G:
	case XSDIVID_MODE_12G:
	case XSDIVID_MODE_12GF:
		if (ColorFormatId == XVIDC_CSF_YCBCR_422)
				Data = 0x0;
		else if(ColorFormatId == XVIDC_CSF_YCBCR_420)
				Data = 0x3;
		else if (ColorFormatId == XVIDC_CSF_YCBCR_444 &&
				((SdiMode != XSDIVID_MODE_6G) || (SdiMode != XSDIVID_MODE_12GF)))
				Data = 0x1;
		else {
			xil_printf("Error: Invalid ColorFomat input. Defaulting to YCBCR_422\n\r");
			Data = 0x0;
		}
		break;
	case XSDIVID_MODE_SD:
	case XSDIVID_MODE_HD:
	case XSDIVID_MODE_3GA:
		if (ColorFormatId == XVIDC_CSF_YCBCR_422)
				Data = 0x0;
		else if (ColorFormatId == XVIDC_CSF_YCBCR_444 && (SdiMode == XSDIVID_MODE_3GA))
				Data = 0x1;
		else if (ColorFormatId == XVIDC_CSF_RGB)
				Data = 0x2;
		else {
				xil_printf("Error: Invalid ColorFomat input. Defaulting to YCBCR_422\n\r");
				Data = 0x0;
		}
		break;
	default:
			return XST_FAILURE;
	}
	return Data & 0xF;
}
u8 XV_SdiTx_GetPayloadColorFormat ( XSdiVid_TransMode SdiMode , XVidC_ColorFormat ColorFormatId ) { u32 Data ; switch ( SdiMode ) { case XSDIVID_MODE_3GB : case XSDIVID_MODE_6G : case XSDIVID_MODE_12G : case XSDIVID_MODE_12GF : if ( ColorFormatId == XVIDC_CSF_YCBCR_422 ) Data = 0x0 ; else if ( ColorFormatId == XVIDC_CSF_YCBCR_420 ) Data = 0x3 ; else if ( ColorFormatId == XVIDC_CSF_YCBCR_444 && ( ( SdiMode != XSDIVID_MODE_6G ) || ( SdiMode != XSDIVID_MODE_12GF ) ) ) Data = 0x1 ; else { xil_printf ( " \n \r " ) ; Data = 0x0 ; } break ; case XSDIVID_MODE_SD : case XSDIVID_MODE_HD : case XSDIVID_MODE_3GA : if ( ColorFormatId == XVIDC_CSF_YCBCR_422 ) Data = 0x0 ; else if ( ColorFormatId == XVIDC_CSF_YCBCR_444 && ( SdiMode == XSDIVID_MODE_3GA ) ) Data = 0x1 ; else if ( ColorFormatId == XVIDC_CSF_RGB ) Data = 0x2 ; else { xil_printf ( " \n \r " ) ; Data = 0x0 ; } break ; default : return XST_FAILURE ; } return Data & 0xF ; }
This function calculates the Color Format for 3rd byte of the Payload packet
 for all SDI modes
This function calculates the Color Format for 3rd byte of the Payload packet for all SDI modes