DSPRelated.com
Forums

trouble reading data into CCS 4.0, from a .pcm file which has data stored as 32-bit float.

Started by aaab February 18, 2013
Hi all, 

I am having trouble reading data into CCS 4.0, from a .pcm file which has
data stored as 32-bit float. 

If someone has a link for this please send. 

thanks and regards,
AAV.

Here is my C code: 

//globals
float in_data[FFT_LENGTH];       // data read from the .pcm file.
Int16 inter[1024*4]; 
Int16 out_vals[512]; // buffer which holds the output data in Q15 format to
write to .pcm file


// in main( )
// Formatting the byte read done by CCS
{
Int32 val;
Int32 val0, val1, val2, val3;
n = fread(inter,sizeof(float), 2 * 256, fp_in);
if(n < (2 * 256))
{
puts("EOF reached\n");
break;
}
for (i=0; i<256; i++)
{
val3 = (Int32)(inter[(4*i)+3]);
val2 = (Int32)(inter[(4*i)+2]);
val1 = (Int32)(inter[(4*i)+1]);
val0 = (Int32)(inter[(4*i)+0]);
val = (val3<<24) + (val2<<16) + (val1<<8) + (val0<<0);

in_data[i]e = (val*1.0) / 2113929216.0;

}
} // end of Formatting the byte read done by CCS