@@ -1344,27 +1344,23 @@ int main(int argc, char *argv[])
1344
1344
sscanf (argv [3 ],"%d" ,& fft_size );
1345
1345
sscanf (argv [4 ],"%d" ,& avgnumber );
1346
1346
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 ) ;
1349
1349
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 );
1354
1351
for (;;)
1355
1352
{
1356
1353
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 ;
1359
1356
}
1360
1357
FEOF_CHECK ;
1361
1358
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 );
1365
1361
}
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 ) ;
1368
1364
TRY_YIELD ;
1369
1365
}
1370
1366
return 0 ;
0 commit comments