Example #1
0
/*
 *
 * \brief Perform complex-valued inverse modulation of the subband
 *        samples stored in rSubband (real part) and iSubband (imaginary
 *        part) and stores the result in timeOut
 *
 */
static void
inverseModulation (float *qmfReal,
                   float *qmfImag,
                   HANDLE_SBR_QMF_FILTER_BANK synQmf
                   )
{
  int i, no_synthesis_channels, M;

  float r1, i1, r2, i2;

  COUNT_sub_start("inverseModulation");

  INDIRECT(1); MOVE(1);
  no_synthesis_channels = synQmf->no_channels;

  MULT(1);
  M = no_synthesis_channels / 2;
  PTR_INIT(2);  /* pointer for qmfReal[],
                               qmfImag[] */
  INDIRECT(1); LOOP(1);
  for (i = synQmf->usb; i < no_synthesis_channels; i++) {
    MOVE(2);

    qmfReal[i]=qmfImag[i]=0;
  }

  FUNC(2);
  cosMod (qmfReal, synQmf);
  FUNC(2);
  sinMod (qmfImag, synQmf);

  PTR_INIT(4);  /* pointer for qmfReal[],
                               qmfImag[],
                               qmfImag[no_synthesis_channels - 1 - i],
                               qmfReal[no_synthesis_channels - i - 1]   */
  LOOP(1);
  for (i = 0; i < M; i++) {

    MOVE(4);
    r1 = qmfReal[i];
    i2 = qmfImag[no_synthesis_channels - 1 - i];
    r2 = qmfReal[no_synthesis_channels - i - 1];
    i1 = qmfImag[i];

    ADD(4); STORE(4);
    qmfReal[i] = (r1 - i1);
    qmfImag[no_synthesis_channels - 1 - i] = -(r1 + i1);
    qmfReal[no_synthesis_channels - i - 1] = (r2 - i2);
    qmfImag[i] = -(r2 + i2);
  }

  COUNT_sub_end();
}
Example #2
0
/*
 *
 * \brief Perform complex-valued forward modulation of the time domain
 *        data of timeIn and stores the real part of the subband
 *        samples in rSubband, and the imaginary part in iSubband
 *
 */
static void
sbrForwardModulation (const float *timeIn,
                      float *rSubband,
                      float *iSubband,
                      HANDLE_SBR_QMF_FILTER_BANK anaQmf
                      )
{
  int i, offset;

  float real, imag;

  COUNT_sub_start("sbrForwardModulation");

  MOVE(1);
  offset = 2 * NO_ANALYSIS_CHANNELS;

  PTR_INIT(1);  /* pointer for timeIn[offset - 1 - i] */
  LOOP(1);
  for (i = 0; i < NO_ANALYSIS_CHANNELS; i++) {
    ADD(2); STORE(2);
    rSubband[i] = timeIn[i] - timeIn[offset - 1 - i];
    iSubband[i] = timeIn[i] + timeIn[offset - 1 - i];
  }

  FUNC(2);
  cosMod (rSubband, anaQmf);
  FUNC(2);
  sinMod (iSubband, anaQmf);

  PTR_INIT(4);  /* pointers for rSubband[i],
                                iSubband[i],
                                anaQmf->t_cos[i],
                                anaQmf->t_sin[i]  */
  INDIRECT(1); LOOP(1);
  for (i = 0; i < anaQmf->lsb; i++) {

    MOVE(2);
    real = rSubband[i];
    imag = iSubband[i];

    MULT(1); MAC(1); STORE(1);
    rSubband[i] = real * anaQmf->t_cos[i] + imag * anaQmf->t_sin[i];
    MULT(2); ADD(1); STORE(1);
    iSubband[i] = imag * anaQmf->t_cos[i] - real * anaQmf->t_sin[i];
  }

  COUNT_sub_end();
}
Example #3
0
/*******************************************************************************
 Functionname:  inverseModulation
 *******************************************************************************

 Description: Performs inverse modulation.
 Return:      none

*******************************************************************************/
static void
inverseModulation (const float *sbrReal,
                   const float *sbrImag,
                   float *timeOut,
                   HANDLE_SBR_QMF_FILTER_BANK qmfBank)
{
  int i;


  float gain = 0.015625f;
  float r1, i1, r2, i2;

  

   /* counting previous operations */

   /* timeOut[i]
                  timeOut[32 + i]
                  sbrReal[i]
                  sbrImag[i]
               */
  
  for (i = 0; i < 32; i++) {
     
    timeOut[i]      = gain * sbrReal[i];
    timeOut[32 + i] = gain * sbrImag[i];
  }

  
  cosMod (timeOut, qmfBank);
  
  sinMod (timeOut + 32, qmfBank);

    /* timeOut[i]
                   timeOut[63 - i]
                   timeOut[31 - i]
                   timeOut[32 + i]
                */
  
  for (i = 0; i < 16; i++) {

    
    r1 = timeOut[i];
    i2 = timeOut[63 - i];
    r2 = timeOut[31 - i];
    i1 = timeOut[32 + i];

     
    timeOut[i] = r1 - i1;

      
    timeOut[63 - i] = -(r1 + i1);

     
    timeOut[31 - i] = r2 - i2;

      
    timeOut[32 + i] = -(r2 + i2);

  }

  
}