XilinxProcessorIPLib/drivers/v_multi_scaler/examples/xv_multi_scaler_example.c
static u32 CalcStride(u16 Cfmt, u16 AXIMMDataWidth, u32 width)
{
	u32 stride;
	u16 MMWidthBytes = AXIMMDataWidth / 8;
	u8 bpp_numerator;
	u8 bpp_denominator = 1;

	switch (Cfmt) {
		case XV_MULTI_SCALER_Y_UV10:
		case XV_MULTI_SCALER_Y_UV10_420:
		case XV_MULTI_SCALER_Y10:
			/* 4 bytes per 3 pixels (Y_UV10, Y_UV10_420, Y10) */
			bpp_numerator = 4;
			bpp_denominator = 3;
			break;
		case XV_MULTI_SCALER_Y_UV8:
		case XV_MULTI_SCALER_Y_UV8_420:
		case  XV_MULTI_SCALER_Y8:
			/* 1 byte per pixel (Y_UV8, Y_UV8_420, Y8) */
			bpp_numerator = 1;
			break;
		case XV_MULTI_SCALER_RGB8:
		case  XV_MULTI_SCALER_YUV8:
		case XV_MULTI_SCALER_BGR8:
			/* 3 bytes per pixel (RGB8, YUV8, BGR8) */
			bpp_numerator = 3;
			break;
		case XV_MULTI_SCALER_YUYV8:
		case XV_MULTI_SCALER_UYVY8:
			/* 2 bytes per pixel (YUYV8, UYVY8) */
			bpp_numerator = 2;
			break;
		default:
			/* 4 bytes per pixel */
			bpp_numerator = 4;
	}
	stride = ((((width * bpp_numerator) / bpp_denominator) +
		MMWidthBytes - 1) / MMWidthBytes) * MMWidthBytes;

	return stride;
}
/*****************************************************************************/
/**
 * This function calculates the stride
 *
 * @returns stride in bytes
 *
 *****************************************************************************/
This function calculates the stride
@returns stride in bytes
This function calculates the stride @returns stride in bytes
static u32 CalcStride(u16 Cfmt, u16 AXIMMDataWidth, u32 width)
{
	u32 stride;
	u16 MMWidthBytes = AXIMMDataWidth / 8;
	u8 bpp_numerator;
	u8 bpp_denominator = 1;
	switch (Cfmt) {
		case XV_MULTI_SCALER_Y_UV10:
		case XV_MULTI_SCALER_Y_UV10_420:
		case XV_MULTI_SCALER_Y10:
			bpp_numerator = 4;
			bpp_denominator = 3;
			break;
		case XV_MULTI_SCALER_Y_UV8:
		case XV_MULTI_SCALER_Y_UV8_420:
		case  XV_MULTI_SCALER_Y8:
			bpp_numerator = 1;
			break;
		case XV_MULTI_SCALER_RGB8:
		case  XV_MULTI_SCALER_YUV8:
		case XV_MULTI_SCALER_BGR8:
			bpp_numerator = 3;
			break;
		case XV_MULTI_SCALER_YUYV8:
		case XV_MULTI_SCALER_UYVY8:
			bpp_numerator = 2;
			break;
		default:
			bpp_numerator = 4;
	}
	stride = ((((width * bpp_numerator) / bpp_denominator) +
		MMWidthBytes - 1) / MMWidthBytes) * MMWidthBytes;
	return stride;
}
static u32 CalcStride ( u16 Cfmt , u16 AXIMMDataWidth , u32 width ) { u32 stride ; u16 MMWidthBytes = AXIMMDataWidth / 8 ; u8 bpp_numerator ; u8 bpp_denominator = 1 ; switch ( Cfmt ) { case XV_MULTI_SCALER_Y_UV10 : case XV_MULTI_SCALER_Y_UV10_420 : case XV_MULTI_SCALER_Y10 : bpp_numerator = 4 ; bpp_denominator = 3 ; break ; case XV_MULTI_SCALER_Y_UV8 : case XV_MULTI_SCALER_Y_UV8_420 : case XV_MULTI_SCALER_Y8 : bpp_numerator = 1 ; break ; case XV_MULTI_SCALER_RGB8 : case XV_MULTI_SCALER_YUV8 : case XV_MULTI_SCALER_BGR8 : bpp_numerator = 3 ; break ; case XV_MULTI_SCALER_YUYV8 : case XV_MULTI_SCALER_UYVY8 : bpp_numerator = 2 ; break ; default : bpp_numerator = 4 ; } stride = ( ( ( ( width * bpp_numerator ) / bpp_denominator ) + MMWidthBytes - 1 ) / MMWidthBytes ) * MMWidthBytes ; return stride ; }
This function calculates the stride
 @returns stride in bytes
This function calculates the stride @returns stride in bytes
/* 4 bytes per 3 pixels (Y_UV10, Y_UV10_420, Y10) */ /* 1 byte per pixel (Y_UV8, Y_UV8_420, Y8) */ /* 3 bytes per pixel (RGB8, YUV8, BGR8) */ /* 2 bytes per pixel (YUYV8, UYVY8) */ /* 4 bytes per pixel */