XilinxProcessorIPLib/drivers/v_vscaler/src/xv_vscaler_l2.c
int XV_VScalerSetup(XV_Vscaler_l2  *InstancePtr,
                    u32            WidthIn,
                    u32            HeightIn,
                    u32            HeightOut,
                    u32            ColorFormat)
{
  u32 LineRate;

  /*
   * Assert validates the input arguments
   */
  Xil_AssertNonvoid(InstancePtr != NULL);
  Xil_AssertNonvoid((WidthIn>0) && (WidthIn<=InstancePtr->Vsc.Config.MaxWidth));
  Xil_AssertNonvoid((HeightIn>0) && (HeightIn<=InstancePtr->Vsc.Config.MaxHeight));
  Xil_AssertNonvoid((HeightOut>0) && (HeightOut<=InstancePtr->Vsc.Config.MaxHeight));
  Xil_AssertNonvoid((InstancePtr->Vsc.Config.PixPerClk >= XVIDC_PPC_1) &&
		  (InstancePtr->Vsc.Config.PixPerClk <= XVIDC_PPC_8));

  if(ColorFormat==XVIDC_CSF_YCRCB_420 && !XV_VscalerIs420Enabled(InstancePtr)) {
    return(XST_FAILURE);
  }

  if(InstancePtr->Vsc.Config.ScalerType == XV_VSCALER_POLYPHASE)
  {
    if(!InstancePtr->UseExtCoeff) //No user defined coefficients
    {
      /* Determine coefficient table to use */
      XV_VScalerSelectCoeff(InstancePtr,  HeightIn, HeightOut);
    }

    /* Program coefficients into the IP register bank */
    XV_VScalerSetCoeff(InstancePtr);
  }

  LineRate = (HeightIn * STEP_PRECISION)/HeightOut;

  XV_vscaler_Set_HwReg_HeightIn(&InstancePtr->Vsc,   HeightIn);
  XV_vscaler_Set_HwReg_Width(&InstancePtr->Vsc,      WidthIn);
  XV_vscaler_Set_HwReg_HeightOut(&InstancePtr->Vsc,  HeightOut);
  XV_vscaler_Set_HwReg_LineRate(&InstancePtr->Vsc,   LineRate);
  XV_vscaler_Set_HwReg_ColorMode(&InstancePtr->Vsc,  ColorFormat);

  return XST_SUCCESS;
}
/*****************************************************************************/
/**
* This function configures the scaler core registers with the specified
* configuration parameters of the axi stream
*
* @param  InstancePtr is a pointer to the core instance to be worked on.
* @param  WidthIn is the input stream width
* @param  HeightIn is the input stream height
* @param  HeightOut is the output stream height
* @param  ColorFormat is the color format of the stream
*
* @return None
*
******************************************************************************/
This function configures the scaler core registers with the specified
configuration parameters of the axi stream
This function configures the scaler core registers with the specified configuration parameters of the axi stream
int XV_VScalerSetup(XV_Vscaler_l2  *InstancePtr,
                    u32            WidthIn,
                    u32            HeightIn,
                    u32            HeightOut,
                    u32            ColorFormat)
{
  u32 LineRate;
  Xil_AssertNonvoid(InstancePtr != NULL);
  Xil_AssertNonvoid((WidthIn>0) && (WidthIn<=InstancePtr->Vsc.Config.MaxWidth));
  Xil_AssertNonvoid((HeightIn>0) && (HeightIn<=InstancePtr->Vsc.Config.MaxHeight));
  Xil_AssertNonvoid((HeightOut>0) && (HeightOut<=InstancePtr->Vsc.Config.MaxHeight));
  Xil_AssertNonvoid((InstancePtr->Vsc.Config.PixPerClk >= XVIDC_PPC_1) &&
		  (InstancePtr->Vsc.Config.PixPerClk <= XVIDC_PPC_8));
  if(ColorFormat==XVIDC_CSF_YCRCB_420 && !XV_VscalerIs420Enabled(InstancePtr)) {
    return(XST_FAILURE);
  }
  if(InstancePtr->Vsc.Config.ScalerType == XV_VSCALER_POLYPHASE)
  {
    if(!InstancePtr->UseExtCoeff) 
    {
      XV_VScalerSelectCoeff(InstancePtr,  HeightIn, HeightOut);
    }
    XV_VScalerSetCoeff(InstancePtr);
  }
  LineRate = (HeightIn * STEP_PRECISION)/HeightOut;
  XV_vscaler_Set_HwReg_HeightIn(&InstancePtr->Vsc,   HeightIn);
  XV_vscaler_Set_HwReg_Width(&InstancePtr->Vsc,      WidthIn);
  XV_vscaler_Set_HwReg_HeightOut(&InstancePtr->Vsc,  HeightOut);
  XV_vscaler_Set_HwReg_LineRate(&InstancePtr->Vsc,   LineRate);
  XV_vscaler_Set_HwReg_ColorMode(&InstancePtr->Vsc,  ColorFormat);
  return XST_SUCCESS;
}
int XV_VScalerSetup ( XV_Vscaler_l2 * InstancePtr , u32 WidthIn , u32 HeightIn , u32 HeightOut , u32 ColorFormat ) { u32 LineRate ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( ( WidthIn > 0 ) && ( WidthIn <= InstancePtr -> Vsc . Config . MaxWidth ) ) ; Xil_AssertNonvoid ( ( HeightIn > 0 ) && ( HeightIn <= InstancePtr -> Vsc . Config . MaxHeight ) ) ; Xil_AssertNonvoid ( ( HeightOut > 0 ) && ( HeightOut <= InstancePtr -> Vsc . Config . MaxHeight ) ) ; Xil_AssertNonvoid ( ( InstancePtr -> Vsc . Config . PixPerClk >= XVIDC_PPC_1 ) && ( InstancePtr -> Vsc . Config . PixPerClk <= XVIDC_PPC_8 ) ) ; if ( ColorFormat == XVIDC_CSF_YCRCB_420 && ! XV_VscalerIs420Enabled ( InstancePtr ) ) { return ( XST_FAILURE ) ; } if ( InstancePtr -> Vsc . Config . ScalerType == XV_VSCALER_POLYPHASE ) { if ( ! InstancePtr -> UseExtCoeff ) { XV_VScalerSelectCoeff ( InstancePtr , HeightIn , HeightOut ) ; } XV_VScalerSetCoeff ( InstancePtr ) ; } LineRate = ( HeightIn * STEP_PRECISION ) / HeightOut ; XV_vscaler_Set_HwReg_HeightIn ( & InstancePtr -> Vsc , HeightIn ) ; XV_vscaler_Set_HwReg_Width ( & InstancePtr -> Vsc , WidthIn ) ; XV_vscaler_Set_HwReg_HeightOut ( & InstancePtr -> Vsc , HeightOut ) ; XV_vscaler_Set_HwReg_LineRate ( & InstancePtr -> Vsc , LineRate ) ; XV_vscaler_Set_HwReg_ColorMode ( & InstancePtr -> Vsc , ColorFormat ) ; return XST_SUCCESS ; }
This function configures the scaler core registers with the specified
configuration parameters of the axi stream
This function configures the scaler core registers with the specified configuration parameters of the axi stream
/*
   * Assert validates the input arguments
   */ //No user defined coefficients /* Determine coefficient table to use */ /* Program coefficients into the IP register bank */