XilinxProcessorIPLib/drivers/v_hscaler/src/xv_hscaler_l2.c
void XV_HScalerLoadExtCoeff(XV_Hscaler_l2 *InstancePtr,
                            u16 num_phases,
                            u16 num_taps,
                            const short *Coeff)
{
  int i,j, pad, offset;

  /*
   * validate input arguments
   */
  Xil_AssertVoid(InstancePtr != NULL);
  Xil_AssertVoid(num_taps <= InstancePtr->Hsc.Config.NumTaps);
  Xil_AssertVoid(num_phases == (1<<InstancePtr->Hsc.Config.PhaseShift));
  Xil_AssertVoid(Coeff != NULL);

  switch(num_taps)
  {
    case XV_HSCALER_TAPS_6:
    case XV_HSCALER_TAPS_8:
    case XV_HSCALER_TAPS_10:
    case XV_HSCALER_TAPS_12:
         break;

    default:
         return;
  }

  //determine if coefficient needs padding (effective vs. max taps)
  pad = XV_HSCALER_MAX_H_TAPS - num_taps;
  offset = ((pad) ? (pad>>1) : 0);

  //Load User defined coefficients into scaler coefficient table
  for (i = 0; i < num_phases; i++)
  {
    for (j=0; j<num_taps; ++j)
    {
      InstancePtr->coeff[i][j+offset] = Coeff[i*num_taps+j];
    }
  }

  if(pad) //effective taps < max_taps
  {
    for (i = 0; i < num_phases; i++)
    {
      //pad left
      for (j = 0; j < offset; j++)
      {
        InstancePtr->coeff[i][j] = 0;
      }
        //pad right
      for (j = (num_taps+offset); j < XV_HSCALER_MAX_H_TAPS; j++)
      {
        InstancePtr->coeff[i][j] = 0;
      }
    }
  }

  /* Enable use of external coefficients */
  InstancePtr->UseExtCoeff = TRUE;
}
/*****************************************************************************/
/**
* This function loads user defined filter coefficients in the scaler coefficient
* storage
*
* @param  InstancePtr is a pointer to the core instance to be worked on.
* @param  num_phases is the number of phases in coefficient table
* @param  num_taps is the number of taps in coefficient table
* @param  Coeff is a pointer to user defined filter coefficients table
*
* @return None
*
******************************************************************************/
This function loads user defined filter coefficients in the scaler coefficient
storage
This function loads user defined filter coefficients in the scaler coefficient storage
void XV_HScalerLoadExtCoeff(XV_Hscaler_l2 *InstancePtr,
                            u16 num_phases,
                            u16 num_taps,
                            const short *Coeff)
{
  int i,j, pad, offset;
  Xil_AssertVoid(InstancePtr != NULL);
  Xil_AssertVoid(num_taps <= InstancePtr->Hsc.Config.NumTaps);
  Xil_AssertVoid(num_phases == (1<<InstancePtr->Hsc.Config.PhaseShift));
  Xil_AssertVoid(Coeff != NULL);
  switch(num_taps)
  {
    case XV_HSCALER_TAPS_6:
    case XV_HSCALER_TAPS_8:
    case XV_HSCALER_TAPS_10:
    case XV_HSCALER_TAPS_12:
         break;
    default:
         return;
  }
  pad = XV_HSCALER_MAX_H_TAPS - num_taps;
  offset = ((pad) ? (pad>>1) : 0);
  for (i = 0; i < num_phases; i++)
  {
    for (j=0; j<num_taps; ++j)
    {
      InstancePtr->coeff[i][j+offset] = Coeff[i*num_taps+j];
    }
  }
  if(pad) 
  {
    for (i = 0; i < num_phases; i++)
    {
      for (j = 0; j < offset; j++)
      {
        InstancePtr->coeff[i][j] = 0;
      }
      for (j = (num_taps+offset); j < XV_HSCALER_MAX_H_TAPS; j++)
      {
        InstancePtr->coeff[i][j] = 0;
      }
    }
  }
  InstancePtr->UseExtCoeff = TRUE;
}
void XV_HScalerLoadExtCoeff ( XV_Hscaler_l2 * InstancePtr , u16 num_phases , u16 num_taps , const short * Coeff ) { int i , j , pad , offset ; Xil_AssertVoid ( InstancePtr != NULL ) ; Xil_AssertVoid ( num_taps <= InstancePtr -> Hsc . Config . NumTaps ) ; Xil_AssertVoid ( num_phases == ( 1 << InstancePtr -> Hsc . Config . PhaseShift ) ) ; Xil_AssertVoid ( Coeff != NULL ) ; switch ( num_taps ) { case XV_HSCALER_TAPS_6 : case XV_HSCALER_TAPS_8 : case XV_HSCALER_TAPS_10 : case XV_HSCALER_TAPS_12 : break ; default : return ; } pad = XV_HSCALER_MAX_H_TAPS - num_taps ; offset = ( ( pad ) ? ( pad >> 1 ) : 0 ) ; for ( i = 0 ; i < num_phases ; i ++ ) { for ( j = 0 ; j < num_taps ; ++ j ) { InstancePtr -> coeff [ i ] [ j + offset ] = Coeff [ i * num_taps + j ] ; } } if ( pad ) { for ( i = 0 ; i < num_phases ; i ++ ) { for ( j = 0 ; j < offset ; j ++ ) { InstancePtr -> coeff [ i ] [ j ] = 0 ; } for ( j = ( num_taps + offset ) ; j < XV_HSCALER_MAX_H_TAPS ; j ++ ) { InstancePtr -> coeff [ i ] [ j ] = 0 ; } } } InstancePtr -> UseExtCoeff = TRUE ; }
This function loads user defined filter coefficients in the scaler coefficient
storage
This function loads user defined filter coefficients in the scaler coefficient storage
/*
   * validate input arguments
   */ //determine if coefficient needs padding (effective vs. max taps) //Load User defined coefficients into scaler coefficient table //effective taps < max_taps //pad left //pad right /* Enable use of external coefficients */