@@ -1344,27 +1344,23 @@ int main(int argc, char *argv[])
13441344 sscanf (argv [3 ],"%d" ,& fft_size );
13451345 sscanf (argv [4 ],"%d" ,& avgnumber );
13461346
1347- if (! getbufsize ()) return -2 ; //dummy
1348- if (! sendbufsize ( initialize_buffers ())) return -2 ;
1347+ float * input = malloc ( sizeof ( float ) * 2 * fft_size );
1348+ float * output = malloc ( sizeof ( float ) * fft_size ) ;
13491349
1350- if (fft_size != the_bufsize ) return -2 ;
1351-
1352- //fprintf(stderr, "logaveragepower_cf %f %d=%d %d\n", add_db, fft_size, the_bufsize, avgnumber);
1353- add_db -= 10 * log10 (avgnumber );
1350+ add_db -= 10.0 * log10 (avgnumber );
13541351 for (;;)
13551352 {
13561353 int i ,n ;
1357- for (i = 0 ; i < the_bufsize ; i ++ ) {
1358- output_buffer [i ] = 0 ;
1354+ for (i = 0 ; i < fft_size ; i ++ ) {
1355+ output [i ] = 0 ;
13591356 }
13601357 FEOF_CHECK ;
13611358 for (n = 0 ; n < avgnumber ; n ++ ) {
1362- FREAD_C ;
1363- //fprintf(stderr, "averaged %d\n", n);
1364- accumulate_power_cf ((complexf * )input_buffer , output_buffer , the_bufsize );
1359+ fread (input , sizeof (float )* 2 , fft_size , stdin );
1360+ accumulate_power_cf ((complexf * )input , output , fft_size );
13651361 }
1366- log_ff (NULL , output_buffer , the_bufsize , add_db );
1367- FWRITE_R ;
1362+ log_ff (output , output , fft_size , add_db );
1363+ fwrite ( output , sizeof ( float ), fft_size , stdout ) ;
13681364 TRY_YIELD ;
13691365 }
13701366 return 0 ;
0 commit comments