Added shift_addfast_cc and tests.
This commit is contained in:
parent
7879191935
commit
4697928c38
7 changed files with 1104 additions and 0 deletions
49
csdr.c
49
csdr.c
|
@ -486,6 +486,55 @@ int main(int argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
if(!strcmp(argv[1],"shift_addfast_cc"))
|
||||
{
|
||||
bigbufs=1;
|
||||
|
||||
float starting_phase=0;
|
||||
float rate;
|
||||
|
||||
int fd;
|
||||
if(fd=init_fifo(argc,argv))
|
||||
{
|
||||
while(!read_fifo_ctl(fd,"%g\n",&rate)) usleep(10000);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(argc<=2) return badsyntax("need required parameter (rate)");
|
||||
sscanf(argv[2],"%g",&rate);
|
||||
}
|
||||
|
||||
if(!sendbufsize(initialize_buffers())) return -2;
|
||||
for(;;)
|
||||
{
|
||||
shift_addfast_data_t data=shift_addfast_init(rate);
|
||||
fprintf(stderr,"shift_addfast_cc: reinitialized to %g\n",rate);
|
||||
int remain, current_size;
|
||||
float* ibufptr;
|
||||
float* obufptr;
|
||||
for(;;)
|
||||
{
|
||||
FEOF_CHECK;
|
||||
if(!FREAD_C) break;
|
||||
remain=the_bufsize;
|
||||
ibufptr=input_buffer;
|
||||
obufptr=output_buffer;
|
||||
while(remain)
|
||||
{
|
||||
current_size=(remain>1024)?1024:remain;
|
||||
starting_phase=shift_addfast_cc((complexf*)ibufptr, (complexf*)obufptr, current_size, &data, starting_phase);
|
||||
ibufptr+=current_size*2;
|
||||
obufptr+=current_size*2;
|
||||
remain-=current_size;
|
||||
}
|
||||
FWRITE_C;
|
||||
if(read_fifo_ctl(fd,"%g\n",&rate)) break;
|
||||
TRY_YIELD;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef LIBCSDR_GPL
|
||||
if(!strcmp(argv[1],"decimating_shift_addition_cc"))
|
||||
{
|
||||
|
|
912
grc_tests/test_shift_remote.grc
Normal file
912
grc_tests/test_shift_remote.grc
Normal file
|
@ -0,0 +1,912 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?grc format='1' created='3.7.8'?>
|
||||
<flow_graph>
|
||||
<timestamp>Thu Jan 15 18:51:48 2015</timestamp>
|
||||
<block>
|
||||
<key>options</key>
|
||||
<param>
|
||||
<key>author</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>window_size</key>
|
||||
<value>1280, 1024</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>category</key>
|
||||
<value>Custom</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>description</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(10, 10)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>generate_options</key>
|
||||
<value>wx_gui</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>top_block</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>max_nouts</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>realtime_scheduling</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>run_options</key>
|
||||
<value>prompt</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>run</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>thread_safe_setters</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>title</key>
|
||||
<value></value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>variable</key>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(8, 195)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>-0.1</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>variable</key>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(176, 11)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>samp_rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>250e3</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>analog_sig_source_x</key>
|
||||
<param>
|
||||
<key>amp</key>
|
||||
<value>1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>alias</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>freq</key>
|
||||
<value>20000</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(8, 75)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>analog_sig_source_x_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>maxoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>minoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>offset</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>complex</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>samp_rate</key>
|
||||
<value>samp_rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>waveform</key>
|
||||
<value>analog.GR_CONST_WAVE</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>blocks_throttle</key>
|
||||
<param>
|
||||
<key>alias</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(224, 107)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>blocks_throttle_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>ignoretag</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>maxoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>minoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>samples_per_second</key>
|
||||
<value>samp_rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>complex</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>vlen</key>
|
||||
<value>1</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>ha5kfu_execproc_xx</key>
|
||||
<param>
|
||||
<key>alias</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>commandline</key>
|
||||
<value>"csdr shift_addition_cc %g"%rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(824, 315)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>ha5kfu_execproc_xx_0_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>maxoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>minoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>cc</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>ha5kfu_execproc_xx</key>
|
||||
<param>
|
||||
<key>alias</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>commandline</key>
|
||||
<value>ncat -vv raspberrypi.local 5321</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(536, 443)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>ha5kfu_execproc_xx_0_0_0_1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>maxoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>minoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>cc</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>notebook</key>
|
||||
<param>
|
||||
<key>alias</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(272, 11)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>grid_pos</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>nb0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>labels</key>
|
||||
<value>['original', 'shift_addition_cc','shift_addfast_cc',]</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>notebook</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>style</key>
|
||||
<value>wx.NB_TOP</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>wxgui_fftsink2</key>
|
||||
<param>
|
||||
<key>avg_alpha</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>average</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>baseband_freq</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>alias</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>fft_size</key>
|
||||
<value>1024</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>freqvar</key>
|
||||
<value>None</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(848, 27)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>grid_pos</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>wxgui_fftsink2_0_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>notebook</key>
|
||||
<value>nb0,0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>peak_hold</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>ref_level</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>ref_scale</key>
|
||||
<value>2.0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>fft_rate</key>
|
||||
<value>15</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>samp_rate</key>
|
||||
<value>samp_rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>title</key>
|
||||
<value>FFT Plot</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>complex</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>win_size</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>win</key>
|
||||
<value>None</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>y_divs</key>
|
||||
<value>10</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>y_per_div</key>
|
||||
<value>10</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>wxgui_fftsink2</key>
|
||||
<param>
|
||||
<key>avg_alpha</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>average</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>baseband_freq</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>alias</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>fft_size</key>
|
||||
<value>1024</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>freqvar</key>
|
||||
<value>None</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(1112, 339)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>grid_pos</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>wxgui_fftsink2_0_1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>notebook</key>
|
||||
<value>nb0,1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>peak_hold</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>ref_level</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>ref_scale</key>
|
||||
<value>2.0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>fft_rate</key>
|
||||
<value>15</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>samp_rate</key>
|
||||
<value>samp_rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>title</key>
|
||||
<value>FFT Plot</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>complex</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>win_size</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>win</key>
|
||||
<value>None</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>y_divs</key>
|
||||
<value>10</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>y_per_div</key>
|
||||
<value>10</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>wxgui_fftsink2</key>
|
||||
<param>
|
||||
<key>avg_alpha</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>average</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>baseband_freq</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>alias</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>fft_size</key>
|
||||
<value>1024</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>freqvar</key>
|
||||
<value>None</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(808, 387)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>grid_pos</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>wxgui_fftsink2_0_1_1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>notebook</key>
|
||||
<value>nb0,2</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>peak_hold</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>ref_level</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>ref_scale</key>
|
||||
<value>2.0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>fft_rate</key>
|
||||
<value>15</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>samp_rate</key>
|
||||
<value>samp_rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>title</key>
|
||||
<value>FFT Plot</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>complex</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>win_size</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>win</key>
|
||||
<value>None</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>y_divs</key>
|
||||
<value>10</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>y_per_div</key>
|
||||
<value>10</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>wxgui_scopesink2</key>
|
||||
<param>
|
||||
<key>ac_couple</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>alias</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(1112, 555)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>grid_pos</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>wxgui_scopesink2_0_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>notebook</key>
|
||||
<value>nb0,1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>num_inputs</key>
|
||||
<value>1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>samp_rate</key>
|
||||
<value>samp_rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>t_scale</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>title</key>
|
||||
<value>Scope Plot</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>trig_mode</key>
|
||||
<value>wxgui.TRIG_MODE_NORM</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>complex</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>v_offset</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>v_scale</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>win_size</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>xy_mode</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>y_axis_label</key>
|
||||
<value>Counts</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>wxgui_scopesink2</key>
|
||||
<param>
|
||||
<key>ac_couple</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>alias</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(808, 611)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>grid_pos</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>wxgui_scopesink2_0_0_1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>notebook</key>
|
||||
<value>nb0,2</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>num_inputs</key>
|
||||
<value>1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>samp_rate</key>
|
||||
<value>samp_rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>t_scale</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>title</key>
|
||||
<value>Scope Plot</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>trig_mode</key>
|
||||
<value>wxgui.TRIG_MODE_NORM</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>complex</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>v_offset</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>v_scale</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>win_size</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>xy_mode</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>y_axis_label</key>
|
||||
<value>Counts</value>
|
||||
</param>
|
||||
</block>
|
||||
<connection>
|
||||
<source_block_id>analog_sig_source_x_0</source_block_id>
|
||||
<sink_block_id>blocks_throttle_0</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>blocks_throttle_0</source_block_id>
|
||||
<sink_block_id>ha5kfu_execproc_xx_0_0</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>blocks_throttle_0</source_block_id>
|
||||
<sink_block_id>ha5kfu_execproc_xx_0_0_0_1</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>blocks_throttle_0</source_block_id>
|
||||
<sink_block_id>wxgui_fftsink2_0_0</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>ha5kfu_execproc_xx_0_0</source_block_id>
|
||||
<sink_block_id>wxgui_fftsink2_0_1</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>ha5kfu_execproc_xx_0_0</source_block_id>
|
||||
<sink_block_id>wxgui_scopesink2_0_0</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>ha5kfu_execproc_xx_0_0_0_1</source_block_id>
|
||||
<sink_block_id>wxgui_fftsink2_0_1_1</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>ha5kfu_execproc_xx_0_0_0_1</source_block_id>
|
||||
<sink_block_id>wxgui_scopesink2_0_0_1</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
</flow_graph>
|
9
grc_tests/test_shift_remote.sh
Executable file
9
grc_tests/test_shift_remote.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
# Run this script on a Raspberry Pi 2, while running test_shift_remote.grc on your PC.
|
||||
# It allows you to debug the NEON-accelerated version of specific DSP algorithms on the target hardware.
|
||||
TEMPSCRIPT="/tmp/test_shift_remote_exec.sh"
|
||||
echo '#!/bin/sh\ncsdr shift_addfast_cc -0.1' > $TEMPSCRIPT
|
||||
cat $TEMPSCRIPT
|
||||
chmod +x $TEMPSCRIPT
|
||||
ncat -vvl 5321 -e $TEMPSCRIPT
|
||||
rm $TEMPSCRIPT
|
39
libcsdr.c
39
libcsdr.c
|
@ -263,6 +263,45 @@ float shift_table_cc(complexf* input, complexf* output, int input_size, float ra
|
|||
return phase;
|
||||
}
|
||||
|
||||
|
||||
|
||||
shift_addfast_data_t shift_addfast_init(float rate)
|
||||
{
|
||||
shift_addfast_data_t output;
|
||||
float phase_increment=2*rate*PI;
|
||||
for(int i=0;i<4;i++)
|
||||
{
|
||||
output.dsin[i]=sin(phase_increment*(i+1));
|
||||
output.dcos[i]=cos(phase_increment*(i+1));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
float shift_addfast_cc(complexf *input, complexf* output, int input_size, shift_addfast_data_t* d, float starting_phase)
|
||||
{
|
||||
//input_size should be multiple of 4
|
||||
float phase=starting_phase;
|
||||
float cos_start=cos(starting_phase);
|
||||
float sin_start=sin(starting_phase);
|
||||
float cos_vals[4], sin_vals[4];
|
||||
for(int i=0;i<input_size/4; i++) //@shift_addfast_cc
|
||||
{
|
||||
for(int j=0;j<4;j++)
|
||||
{
|
||||
cos_vals[i] = cos_start * d->dcos[i] - sin_start * d->dsin[i];
|
||||
sin_vals[i] = sin_start * d->dcos[i] + cos_start * d->dsin[i];
|
||||
}
|
||||
for(int j=0;j<4;j++)
|
||||
{
|
||||
iof(output,4*i+j)=cos_vals[j]*iof(input,4*i+j)-sin_vals[j]*qof(input,4*i+j);
|
||||
qof(output,4*i+j)=sin_vals[j]*iof(input,4*i+j)+cos_vals[j]*qof(input,4*i+j);
|
||||
}
|
||||
cos_start = cos_vals[3];
|
||||
sin_start = sin_vals[3];
|
||||
}
|
||||
return phase;
|
||||
}
|
||||
|
||||
#ifdef NEON_OPTS
|
||||
#pragma message "We have a faster fir_decimate_cc now."
|
||||
|
||||
|
|
|
@ -156,6 +156,15 @@ void shift_table_deinit(shift_table_data_t table_data);
|
|||
shift_table_data_t shift_table_init(int table_size);
|
||||
float shift_table_cc(complexf* input, complexf* output, int input_size, float rate, shift_table_data_t table_data, float starting_phase);
|
||||
|
||||
typedef struct shift_addfast_data_s
|
||||
{
|
||||
float dsin[4];
|
||||
float dcos[4];
|
||||
|
||||
} shift_addfast_data_t;
|
||||
shift_addfast_data_t shift_addfast_init(float rate);
|
||||
float shift_addfast_cc(complexf *input, complexf* output, int input_size, shift_addfast_data_t* d, float starting_phase);
|
||||
|
||||
|
||||
int log2n(int x);
|
||||
int next_pow2(int x);
|
||||
|
|
2
make_test200
Executable file
2
make_test200
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
gcc test200.c --std=gnu99 -o test200 -DUSE_FFTW -DLIBCSDR_GPL -lcsdr
|
84
test200.c
Normal file
84
test200.c
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
This software is part of libcsdr, a set of simple DSP routines for
|
||||
Software Defined Radio.
|
||||
|
||||
Copyright (c) 2014-2015, Andras Retzler <randras@sdr.hu>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holder nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL ANDRAS RETZLER BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "libcsdr.h"
|
||||
#include "libcsdr_gpl.h"
|
||||
|
||||
#define T_BUFSIZE (1024*1024/4)
|
||||
#define T_N (200)
|
||||
|
||||
int main()
|
||||
{
|
||||
fprintf(stderr,"Getting a %d of random samples...\n", T_BUFSIZE);
|
||||
int urand_fp = open("/dev/urandom",O_RDWR);
|
||||
unsigned char* buf_u8 = (unsigned char*)malloc(sizeof(unsigned char)*T_BUFSIZE*2);
|
||||
complexf* buf_c = (complexf*)malloc(sizeof(complexf)*T_BUFSIZE);
|
||||
complexf* outbuf_c = (complexf*)malloc(sizeof(complexf)*T_BUFSIZE);
|
||||
read(urand_fp, buf_u8, T_BUFSIZE);
|
||||
close(urand_fp);
|
||||
|
||||
for(int i=0;i<T_BUFSIZE;i++)
|
||||
{
|
||||
iof(buf_c,i)=buf_u8[2*i]/128.0;
|
||||
qof(buf_c,i)=buf_u8[2*i+1]/128.0;
|
||||
}
|
||||
|
||||
struct timespec start_time, end_time;
|
||||
|
||||
fprintf(stderr,"Starting tests of processing %d samples...\n", T_BUFSIZE*T_N);
|
||||
|
||||
//shift_addition_cc
|
||||
shift_addition_data_t data_addition = shift_addition_init(0.1);
|
||||
float starting_phase = 0;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &start_time);
|
||||
for(int i=0;i<T_N;i++) starting_phase = shift_addition_cc(buf_c, outbuf_c, T_BUFSIZE, data_addition, starting_phase);
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &end_time);
|
||||
fprintf(stderr,"shift_addition_cc done in %g seconds.\n",TIME_TAKEN(start_time,end_time));
|
||||
|
||||
//shift_addfast_cc
|
||||
shift_addfast_data_t data_addfast = shift_addfast_init(0.1);
|
||||
starting_phase = 0;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &start_time);
|
||||
for(int i=0;i<T_N;i++) starting_phase = shift_addfast_cc(buf_c, outbuf_c, T_BUFSIZE, &data_addfast, starting_phase);
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &end_time);
|
||||
fprintf(stderr,"shift_addition_cc done in %g seconds.\n",TIME_TAKEN(start_time,end_time));
|
||||
|
||||
|
||||
}
|
Loading…
Reference in a new issue