XilinxProcessorIPLib/drivers/v_hscaler/src/xv_hscaler_l2.c
static void XV_HScalerSelectCoeff(XV_Hscaler_l2 *InstancePtr,
                                  u32 WidthIn,
                                  u32 WidthOut)
{
  const short *coeff;
  u16 numTaps, numPhases;
  u16 ScalingRatio;
  u16 IsScaleDown;

  /*
   * validate input arguments
   */
  Xil_AssertVoid(InstancePtr != NULL);

  numPhases = (1<<InstancePtr->Hsc.Config.PhaseShift);

  IsScaleDown = (WidthOut < WidthIn);

  /* Scale Down Mode will use dynamic filter selection logic
   * Scale Up Mode (including 1:1) will always use 6 tap filter
   */
  if(IsScaleDown)
  {
    ScalingRatio = ((WidthIn * 10)/WidthOut);

    switch(InstancePtr->Hsc.Config.NumTaps)
    {
      case XV_HSCALER_TAPS_6:
		if (ScalingRatio > 35) {// > 3.5
			coeff = &XV_hscaler_fixedcoeff_taps6_ScalingRatio4[0][0];
			numTaps = XV_HSCALER_TAPS_6;
		} else if (ScalingRatio > 25) {//2.6 < Ratio <= 3.5
			coeff = &XV_hscaler_fixedcoeff_taps6_ScalingRatio3[0][0];
			numTaps = XV_HSCALER_TAPS_6;
		} else if (ScalingRatio > 15) {//1.6 < Ratio <= 2.5
			coeff = &XV_hscaler_fixedcoeff_taps6_ScalingRatio2[0][0];
			numTaps = XV_HSCALER_TAPS_6;
		} else {// <= 1.5
			coeff = &XV_hscaler_fixedcoeff_taps6_ScalingRatio1p2[0][0];
			numTaps = XV_HSCALER_TAPS_6;
		}
           break;

      case XV_HSCALER_TAPS_8:
		if (ScalingRatio > 35) {// > 3.5
			coeff = &XV_hscaler_fixedcoeff_taps8_ScalingRatio4[0][0];
			numTaps = XV_HSCALER_TAPS_8;
		} else if (ScalingRatio > 25) {//2.6 < Ratio <= 3.5
			coeff = &XV_hscaler_fixedcoeff_taps8_ScalingRatio3[0][0];
			numTaps = XV_HSCALER_TAPS_8;
		} else if (ScalingRatio > 15) {//1.6 < Ratio <= 2.5
			coeff = &XV_hscaler_fixedcoeff_taps8_ScalingRatio2[0][0];
			numTaps = XV_HSCALER_TAPS_8;
		} else {// <= 1.5
			coeff = &XV_hscaler_fixedcoeff_taps6_ScalingRatio1p2[0][0];
			numTaps = XV_HSCALER_TAPS_6;
		}
           break;

      case XV_HSCALER_TAPS_10:
		if (ScalingRatio > 35) {// > 3.5
			coeff = &XV_hscaler_fixedcoeff_taps10_ScalingRatio4[0][0];
			numTaps = XV_HSCALER_TAPS_10;
		} else if (ScalingRatio > 25) {//2.6 < Ratio <= 3.5
			coeff = &XV_hscaler_fixedcoeff_taps10_ScalingRatio3[0][0];
			numTaps = XV_HSCALER_TAPS_10;
		} else if (ScalingRatio > 15) {//1.6 < Ratio <= 2.5
			coeff = &XV_hscaler_fixedcoeff_taps8_ScalingRatio2[0][0];
			numTaps = XV_HSCALER_TAPS_8;
		} else {// <= 1.5
			coeff = &XV_hscaler_fixedcoeff_taps6_ScalingRatio1p2[0][0];
			numTaps = XV_HSCALER_TAPS_6;
		}
           break;

      case XV_HSCALER_TAPS_12:
		if (ScalingRatio > 35) {// > 3.5
			coeff = &XV_hscaler_fixedcoeff_taps12_ScalingRatio4[0][0];
			numTaps = XV_HSCALER_TAPS_12;
		} else if (ScalingRatio > 25) {//2.6 < Ratio <= 3.5
			coeff = &XV_hscaler_fixedcoeff_taps10_ScalingRatio3[0][0];
			numTaps = XV_HSCALER_TAPS_10;
		} else if (ScalingRatio > 15) {//1.6 < Ratio <= 2.5
			coeff = &XV_hscaler_fixedcoeff_taps8_ScalingRatio2[0][0];
			numTaps = XV_HSCALER_TAPS_8;
		} else {// <= 1.5
			coeff = &XV_hscaler_fixedcoeff_taps6_ScalingRatio1p2[0][0];
			numTaps = XV_HSCALER_TAPS_6;
		}
           break;

      default:
          return;
    }
  }
  else //Scale Up
  {
	coeff = &XV_hscaler_Lanczos2_taps6[0][0];
	numTaps = XV_HSCALER_TAPS_6;
  }

  XV_HScalerLoadExtCoeff(InstancePtr,
                         numPhases,
                         numTaps,
                         coeff);

  /* Disable use of external coefficients */
  InstancePtr->UseExtCoeff = FALSE;
}
/*****************************************************************************/
/**
* This function determines the internal coeffiecient table to be used based on
* scaling ratio and loads the filter coefficients in the scaler coefficient
* storage.
*
* @param  InstancePtr is a pointer to the core instance to be worked on.
* @param  WidthIn is the input stream width
* @param  Widthout is the output stream width
*
* @return None
*
******************************************************************************/
This function determines the internal coeffiecient table to be used based on
scaling ratio and loads the filter coefficients in the scaler coefficient
storage.
This function determines the internal coeffiecient table to be used based on scaling ratio and loads the filter coefficients in the scaler coefficient storage .
static void XV_HScalerSelectCoeff(XV_Hscaler_l2 *InstancePtr,
                                  u32 WidthIn,
                                  u32 WidthOut)
{
  const short *coeff;
  u16 numTaps, numPhases;
  u16 ScalingRatio;
  u16 IsScaleDown;
  Xil_AssertVoid(InstancePtr != NULL);
  numPhases = (1<<InstancePtr->Hsc.Config.PhaseShift);
  IsScaleDown = (WidthOut < WidthIn);
  if(IsScaleDown)
  {
    ScalingRatio = ((WidthIn * 10)/WidthOut);
    switch(InstancePtr->Hsc.Config.NumTaps)
    {
      case XV_HSCALER_TAPS_6:
		if (ScalingRatio > 35) {
			coeff = &XV_hscaler_fixedcoeff_taps6_ScalingRatio4[0][0];
			numTaps = XV_HSCALER_TAPS_6;
		} else if (ScalingRatio > 25) {
			coeff = &XV_hscaler_fixedcoeff_taps6_ScalingRatio3[0][0];
			numTaps = XV_HSCALER_TAPS_6;
		} else if (ScalingRatio > 15) {
			coeff = &XV_hscaler_fixedcoeff_taps6_ScalingRatio2[0][0];
			numTaps = XV_HSCALER_TAPS_6;
		} else {
			coeff = &XV_hscaler_fixedcoeff_taps6_ScalingRatio1p2[0][0];
			numTaps = XV_HSCALER_TAPS_6;
		}
           break;
      case XV_HSCALER_TAPS_8:
		if (ScalingRatio > 35) {
			coeff = &XV_hscaler_fixedcoeff_taps8_ScalingRatio4[0][0];
			numTaps = XV_HSCALER_TAPS_8;
		} else if (ScalingRatio > 25) {
			coeff = &XV_hscaler_fixedcoeff_taps8_ScalingRatio3[0][0];
			numTaps = XV_HSCALER_TAPS_8;
		} else if (ScalingRatio > 15) {
			coeff = &XV_hscaler_fixedcoeff_taps8_ScalingRatio2[0][0];
			numTaps = XV_HSCALER_TAPS_8;
		} else {
			coeff = &XV_hscaler_fixedcoeff_taps6_ScalingRatio1p2[0][0];
			numTaps = XV_HSCALER_TAPS_6;
		}
           break;
      case XV_HSCALER_TAPS_10:
		if (ScalingRatio > 35) {
			coeff = &XV_hscaler_fixedcoeff_taps10_ScalingRatio4[0][0];
			numTaps = XV_HSCALER_TAPS_10;
		} else if (ScalingRatio > 25) {
			coeff = &XV_hscaler_fixedcoeff_taps10_ScalingRatio3[0][0];
			numTaps = XV_HSCALER_TAPS_10;
		} else if (ScalingRatio > 15) {
			coeff = &XV_hscaler_fixedcoeff_taps8_ScalingRatio2[0][0];
			numTaps = XV_HSCALER_TAPS_8;
		} else {
			coeff = &XV_hscaler_fixedcoeff_taps6_ScalingRatio1p2[0][0];
			numTaps = XV_HSCALER_TAPS_6;
		}
           break;
      case XV_HSCALER_TAPS_12:
		if (ScalingRatio > 35) {
			coeff = &XV_hscaler_fixedcoeff_taps12_ScalingRatio4[0][0];
			numTaps = XV_HSCALER_TAPS_12;
		} else if (ScalingRatio > 25) {
			coeff = &XV_hscaler_fixedcoeff_taps10_ScalingRatio3[0][0];
			numTaps = XV_HSCALER_TAPS_10;
		} else if (ScalingRatio > 15) {
			coeff = &XV_hscaler_fixedcoeff_taps8_ScalingRatio2[0][0];
			numTaps = XV_HSCALER_TAPS_8;
		} else {
			coeff = &XV_hscaler_fixedcoeff_taps6_ScalingRatio1p2[0][0];
			numTaps = XV_HSCALER_TAPS_6;
		}
           break;
      default:
          return;
    }
  }
  else 
  {
	coeff = &XV_hscaler_Lanczos2_taps6[0][0];
	numTaps = XV_HSCALER_TAPS_6;
  }
  XV_HScalerLoadExtCoeff(InstancePtr,
                         numPhases,
                         numTaps,
                         coeff);
  InstancePtr->UseExtCoeff = FALSE;
}
static void XV_HScalerSelectCoeff ( XV_Hscaler_l2 * InstancePtr , u32 WidthIn , u32 WidthOut ) { const short * coeff ; u16 numTaps , numPhases ; u16 ScalingRatio ; u16 IsScaleDown ; Xil_AssertVoid ( InstancePtr != NULL ) ; numPhases = ( 1 << InstancePtr -> Hsc . Config . PhaseShift ) ; IsScaleDown = ( WidthOut < WidthIn ) ; if ( IsScaleDown ) { ScalingRatio = ( ( WidthIn * 10 ) / WidthOut ) ; switch ( InstancePtr -> Hsc . Config . NumTaps ) { case XV_HSCALER_TAPS_6 : if ( ScalingRatio > 35 ) { coeff = & XV_hscaler_fixedcoeff_taps6_ScalingRatio4 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_6 ; } else if ( ScalingRatio > 25 ) { coeff = & XV_hscaler_fixedcoeff_taps6_ScalingRatio3 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_6 ; } else if ( ScalingRatio > 15 ) { coeff = & XV_hscaler_fixedcoeff_taps6_ScalingRatio2 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_6 ; } else { coeff = & XV_hscaler_fixedcoeff_taps6_ScalingRatio1p2 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_6 ; } break ; case XV_HSCALER_TAPS_8 : if ( ScalingRatio > 35 ) { coeff = & XV_hscaler_fixedcoeff_taps8_ScalingRatio4 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_8 ; } else if ( ScalingRatio > 25 ) { coeff = & XV_hscaler_fixedcoeff_taps8_ScalingRatio3 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_8 ; } else if ( ScalingRatio > 15 ) { coeff = & XV_hscaler_fixedcoeff_taps8_ScalingRatio2 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_8 ; } else { coeff = & XV_hscaler_fixedcoeff_taps6_ScalingRatio1p2 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_6 ; } break ; case XV_HSCALER_TAPS_10 : if ( ScalingRatio > 35 ) { coeff = & XV_hscaler_fixedcoeff_taps10_ScalingRatio4 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_10 ; } else if ( ScalingRatio > 25 ) { coeff = & XV_hscaler_fixedcoeff_taps10_ScalingRatio3 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_10 ; } else if ( ScalingRatio > 15 ) { coeff = & XV_hscaler_fixedcoeff_taps8_ScalingRatio2 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_8 ; } else { coeff = & XV_hscaler_fixedcoeff_taps6_ScalingRatio1p2 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_6 ; } break ; case XV_HSCALER_TAPS_12 : if ( ScalingRatio > 35 ) { coeff = & XV_hscaler_fixedcoeff_taps12_ScalingRatio4 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_12 ; } else if ( ScalingRatio > 25 ) { coeff = & XV_hscaler_fixedcoeff_taps10_ScalingRatio3 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_10 ; } else if ( ScalingRatio > 15 ) { coeff = & XV_hscaler_fixedcoeff_taps8_ScalingRatio2 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_8 ; } else { coeff = & XV_hscaler_fixedcoeff_taps6_ScalingRatio1p2 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_6 ; } break ; default : return ; } } else { coeff = & XV_hscaler_Lanczos2_taps6 [ 0 ] [ 0 ] ; numTaps = XV_HSCALER_TAPS_6 ; } XV_HScalerLoadExtCoeff ( InstancePtr , numPhases , numTaps , coeff ) ; InstancePtr -> UseExtCoeff = FALSE ; }
This function determines the internal coeffiecient table to be used based on
scaling ratio and loads the filter coefficients in the scaler coefficient
storage.
This function determines the internal coeffiecient table to be used based on scaling ratio and loads the filter coefficients in the scaler coefficient storage .
/*
   * validate input arguments
   */ /* Scale Down Mode will use dynamic filter selection logic
   * Scale Up Mode (including 1:1) will always use 6 tap filter
   */ // > 3.5 //2.6 < Ratio <= 3.5 //1.6 < Ratio <= 2.5 // <= 1.5 // > 3.5 //2.6 < Ratio <= 3.5 //1.6 < Ratio <= 2.5 // <= 1.5 // > 3.5 //2.6 < Ratio <= 3.5 //1.6 < Ratio <= 2.5 // <= 1.5 // > 3.5 //2.6 < Ratio <= 3.5 //1.6 < Ratio <= 2.5 // <= 1.5 //Scale Up /* Disable use of external coefficients */