• Resolved

C5515 eZdsp Pingpong buffer / HWAFFT

Hi,

in order to evaluate the performance of C5515, i'm using C5515 Audio Filter Demo. I acquire audio data from PC (youtube streaming) and putting them in the output port using ping pong buffer, in mono mode AIC3204 codec configuration. This sounds great and i have no issues.

if (CurrentRxL_DMAChannel ==2) {
    buff_copy(&RcvL1[0],&FilterOutL2[0], XMIT_BUFF_SIZE);
}else{
    buff_copy(&RcvL2[0],&FilterOutL2[0], XMIT_BUFF_SIZE);
}

where XMIT_BUFF_SIZE is defined 1024.

Now, i have tried a change use hawfft, In short terms, i get the signal RcvL1, i FFT it using hwafft_1024pts, then i anti-transform it back ad output it (only one input buffer), according to the example explained http://www.ti.com/lit/an/sprabb6b/sprabb6b.pdf 

Int32 *data;
Int32 *data_br;
Uint16 fft_flag;
Uint16 scale_flag;
Int32 *scratch;
Uint16 out_sel;
Int32 *result;
Int16 out[XMIT_BUFF_SIZE];

...

        if (CurrentRxL_DMAChannel ==2)
        {
          for(i  = 0 ; i < XMIT_BUFF_SIZE; i++){
              temp = *(RcvL1 + i);
              *(data + i) = temp << 16;
          }
          hwafft_br(data, data_br, XMIT_BUFF_SIZE);
          data = data_br;
          out_sel = hwafft_1024pts(data, scratch, fft_flag, scale_flag);
          if (out_sel == OUT_SEL_DATA) {
              result = data;
          }else{
              result = scratch;
          }

          hwafft_br(result, data_br, XMIT_BUFF_SIZE);
          data = data_br;
          out_sel = hwafft_1024pts(data, scratch, IFFT_FLAG, scale_flag);
          if (out_sel == OUT_SEL_DATA) {
             result = data;
          }else{
            result = scratch;
          }
          for(i = 0; i < XMIT_BUFF_SIZE; i++)
              out[i] = (result[i] >> 16);


          buff_copy(&out[0],&FilterOutL1[0], XMIT_BUFF_SIZE); // RcvL1 size = 1024
        }
        else
        {
           buff_copy(&RcvL2[0],&FilterOutL2[0], XMIT_BUFF_SIZE);
        }
    }

The issue consists that the signal is highly degraded.

Any tip? What's wrong in my code?

Thanks in advance,

Paolo

 

  • One of my problems seems to be:
    temp = *(RcvL1 + i);
    *(data + i) = temp << 16;
    where temp is declared ad Int32.

    when i print data[i] it is 0 or -1, why?
  • In reply to Paolo Martinetti:

    Hi Paolo,

    I've forwarded this to the C55x software experts. Their feedback should be posted here.

    BR
    Tsvetolin Shulev
  • In reply to Paolo Martinetti:

    Hi,

    I've notified the sw team. Feedback will be posted here.

    Best Regards,
    Yordan

     


     Please make sure you read the forum guidelines first.

  • In reply to Yordan Kovachev:

    Hi everybody,

    In order to do correct casts in data assignments i have modified my code such as:

            if (CurrentRxL_DMAChannel ==2)
            {
              for(i  = 0 ; i < XMIT_BUFF_SIZE; i++){
                  *(data + i) = ( (Int32) (*(RcvL1 + i))  << 16);
              }
              hwafft_br(data, data_br, XMIT_BUFF_SIZE);
              data = data_br;
              out_sel = hwafft_1024pts(data, scratch, fft_flag, scale_flag);
    
              if (out_sel == OUT_SEL_DATA) {
                  result = data;
              }else{
                  result = scratch;
              }
    
              hwafft_br(result, data_br, XMIT_BUFF_SIZE);
              data = data_br;
              out_sel = hwafft_1024pts(data, scratch, IFFT_FLAG, scale_flag);
              if (out_sel == OUT_SEL_DATA) {
                 result = data;
              }else{
                result = scratch;
              }
              for(i = 0; i < XMIT_BUFF_SIZE; i++){
                 out[i] = result[i] >> 16;
              }
              //buff_copy(&RcvL1[0],&FilterOutL1[0], XMIT_BUFF_SIZE); // RcvL1 size = 1024
              buff_copy(&out[0],&FilterOutL1[0], XMIT_BUFF_SIZE);
            }
            else
            {
               buff_copy(&RcvL2[0],&FilterOutL2[0], XMIT_BUFF_SIZE);
            }

    but i keep hearing sound distortion. Could you please suggest me some way to reach the solution, i'm new in DSP programming...

    Thanks a lot in advance

    Paolo

  • In reply to Paolo Martinetti:

    Hi everybody,
    i have solved by using tips found in e2e.ti.com/.../261883 thread,
    in particular
    for (i = 0; i < FFT_LENGTH; i++) {
    realL[FFT_LENGTH - i] = realL[i];
    imagL[FFT_LENGTH - i] = -imagL[i];
    }
    Thanks,
    Paolo