XilinxProcessorIPLib/drivers/dp14txss/examples/src/pt_only/xdptxss_dp14_pt.c
u32 CalcStride(XVidC_ColorFormat Cfmt,
					  u16 AXIMMDataWidth,
					  XVidC_VideoStream *StreamPtr)
{
	u32 stride;
	int width = StreamPtr->Timing.HActive;
	u16 MMWidthBytes = AXIMMDataWidth/8;

	if ((Cfmt == XVIDC_CSF_MEM_Y_UV10) || (Cfmt == XVIDC_CSF_MEM_Y_UV10_420)
	  || (Cfmt == XVIDC_CSF_MEM_Y10)) {
	// 4 bytes per 3 pixels (Y_UV10, Y_UV10_420, Y10)
	stride = ((((width*4)/3)+MMWidthBytes-1)/MMWidthBytes)*MMWidthBytes;

	}
	else if ((Cfmt == XVIDC_CSF_MEM_Y_UV8) || (Cfmt == XVIDC_CSF_MEM_Y_UV8_420)
		   || (Cfmt == XVIDC_CSF_MEM_Y8)) {
	// 1 byte per pixel (Y_UV8, Y_UV8_420, Y8)
	stride = ((width+MMWidthBytes-1)/MMWidthBytes)*MMWidthBytes;

	}
	else if ((Cfmt == XVIDC_CSF_MEM_RGB8) || (Cfmt == XVIDC_CSF_MEM_YUV8)) {
	// 3 bytes per pixel (RGB8, YUV8)
	stride = (((width*3)+MMWidthBytes-1)/MMWidthBytes)*MMWidthBytes;

	} else if (Cfmt == XVIDC_CSF_MEM_YUYV8) {
		stride = (((width*2)+MMWidthBytes-1)/MMWidthBytes)*MMWidthBytes;
	} else {
	// 4 bytes per pixel
	stride = (((width*4)+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
u32 CalcStride(XVidC_ColorFormat Cfmt,
					  u16 AXIMMDataWidth,
					  XVidC_VideoStream *StreamPtr)
{
	u32 stride;
	int width = StreamPtr->Timing.HActive;
	u16 MMWidthBytes = AXIMMDataWidth/8;
	if ((Cfmt == XVIDC_CSF_MEM_Y_UV10) || (Cfmt == XVIDC_CSF_MEM_Y_UV10_420)
	  || (Cfmt == XVIDC_CSF_MEM_Y10)) {
	stride = ((((width*4)/3)+MMWidthBytes-1)/MMWidthBytes)*MMWidthBytes;
	}
	else if ((Cfmt == XVIDC_CSF_MEM_Y_UV8) || (Cfmt == XVIDC_CSF_MEM_Y_UV8_420)
		   || (Cfmt == XVIDC_CSF_MEM_Y8)) {
	stride = ((width+MMWidthBytes-1)/MMWidthBytes)*MMWidthBytes;
	}
	else if ((Cfmt == XVIDC_CSF_MEM_RGB8) || (Cfmt == XVIDC_CSF_MEM_YUV8)) {
	stride = (((width*3)+MMWidthBytes-1)/MMWidthBytes)*MMWidthBytes;
	} else if (Cfmt == XVIDC_CSF_MEM_YUYV8) {
		stride = (((width*2)+MMWidthBytes-1)/MMWidthBytes)*MMWidthBytes;
	} else {
	stride = (((width*4)+MMWidthBytes-1)/MMWidthBytes)*MMWidthBytes;
	}
	return(stride);
}
u32 CalcStride ( XVidC_ColorFormat Cfmt , u16 AXIMMDataWidth , XVidC_VideoStream * StreamPtr ) { u32 stride ; int width = StreamPtr -> Timing . HActive ; u16 MMWidthBytes = AXIMMDataWidth / 8 ; if ( ( Cfmt == XVIDC_CSF_MEM_Y_UV10 ) || ( Cfmt == XVIDC_CSF_MEM_Y_UV10_420 ) || ( Cfmt == XVIDC_CSF_MEM_Y10 ) ) { stride = ( ( ( ( width * 4 ) / 3 ) + MMWidthBytes - 1 ) / MMWidthBytes ) * MMWidthBytes ; } else if ( ( Cfmt == XVIDC_CSF_MEM_Y_UV8 ) || ( Cfmt == XVIDC_CSF_MEM_Y_UV8_420 ) || ( Cfmt == XVIDC_CSF_MEM_Y8 ) ) { stride = ( ( width + MMWidthBytes - 1 ) / MMWidthBytes ) * MMWidthBytes ; } else if ( ( Cfmt == XVIDC_CSF_MEM_RGB8 ) || ( Cfmt == XVIDC_CSF_MEM_YUV8 ) ) { stride = ( ( ( width * 3 ) + MMWidthBytes - 1 ) / MMWidthBytes ) * MMWidthBytes ; } else if ( Cfmt == XVIDC_CSF_MEM_YUYV8 ) { stride = ( ( ( width * 2 ) + MMWidthBytes - 1 ) / MMWidthBytes ) * MMWidthBytes ; } else { stride = ( ( ( width * 4 ) + 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) // 4 bytes per pixel