Tested all shifts, and they seem to work!
This commit is contained in:
parent
95ebc0e790
commit
4380bec6fa
3 changed files with 1653 additions and 968 deletions
File diff suppressed because it is too large
Load diff
39
libcsdr.c
39
libcsdr.c
|
@ -394,6 +394,44 @@ float shift_addfast_cc(complexf *input, complexf* output, int input_size, shift_
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
|
||||||
|
#define SADF_L1(j) cos_vals_ ## j = cos_start * dcos_ ## j - sin_start * dsin_ ## j; \
|
||||||
|
sin_vals_ ## j = sin_start * dcos_ ## j + cos_start * dsin_ ## j;
|
||||||
|
#define SADF_L2(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);
|
||||||
|
|
||||||
|
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
|
||||||
|
//fprintf(stderr, "shift_addfast_cc: input_size = %d\n", input_size);
|
||||||
|
float cos_start=cos(starting_phase);
|
||||||
|
float sin_start=sin(starting_phase);
|
||||||
|
float register cos_vals_0, cos_vals_1, cos_vals_2, cos_vals_3,
|
||||||
|
sin_vals_0, sin_vals_1, sin_vals_2, sin_vals_3,
|
||||||
|
dsin_0 = d->dsin[0], dsin_1 = d->dsin[1], dsin_2 = d->dsin[2], dsin_3 = d->dsin[3],
|
||||||
|
dcos_0 = d->dcos[0], dcos_1 = d->dcos[1], dcos_2 = d->dcos[2], dcos_3 = d->dcos[3];
|
||||||
|
|
||||||
|
for(int i=0;i<input_size/4; i++) //@shift_addfast_cc
|
||||||
|
{
|
||||||
|
SADF_L1(0)
|
||||||
|
SADF_L1(1)
|
||||||
|
SADF_L1(2)
|
||||||
|
SADF_L1(3)
|
||||||
|
SADF_L2(0)
|
||||||
|
SADF_L2(1)
|
||||||
|
SADF_L2(2)
|
||||||
|
SADF_L2(3)
|
||||||
|
cos_start = cos_vals_3;
|
||||||
|
sin_start = sin_vals_3;
|
||||||
|
}
|
||||||
|
starting_phase+=input_size*d->phase_increment;
|
||||||
|
while(starting_phase>PI) starting_phase-=2*PI;
|
||||||
|
while(starting_phase<-PI) starting_phase+=2*PI;
|
||||||
|
return starting_phase;
|
||||||
|
}
|
||||||
|
#else
|
||||||
float shift_addfast_cc(complexf *input, complexf* output, int input_size, shift_addfast_data_t* d, float starting_phase)
|
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
|
//input_size should be multiple of 4
|
||||||
|
@ -421,6 +459,7 @@ float shift_addfast_cc(complexf *input, complexf* output, int input_size, shift_
|
||||||
while(starting_phase<-PI) starting_phase+=2*PI;
|
while(starting_phase<-PI) starting_phase+=2*PI;
|
||||||
return starting_phase;
|
return starting_phase;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,15 @@ int main()
|
||||||
clock_gettime(CLOCK_MONOTONIC_RAW, &end_time);
|
clock_gettime(CLOCK_MONOTONIC_RAW, &end_time);
|
||||||
fprintf(stderr,"shift_math_cc done in %g seconds.\n",TIME_TAKEN(start_time,end_time));
|
fprintf(stderr,"shift_math_cc done in %g seconds.\n",TIME_TAKEN(start_time,end_time));
|
||||||
|
|
||||||
|
//shift_table_cc
|
||||||
|
shift_table_data_t shift_table_data=shift_table_init(65536);
|
||||||
|
starting_phase = 0;
|
||||||
|
|
||||||
|
clock_gettime(CLOCK_MONOTONIC_RAW, &start_time);
|
||||||
|
for(int i=0;i<T_N;i++) starting_phase = starting_phase=shift_table_cc(buf_c, outbuf_c, T_BUFSIZE, 0.1, shift_table_data, starting_phase);;
|
||||||
|
clock_gettime(CLOCK_MONOTONIC_RAW, &end_time);
|
||||||
|
fprintf(stderr,"shift_table_cc (table size = %d) done in %g seconds.\n",65536,TIME_TAKEN(start_time,end_time));
|
||||||
|
|
||||||
|
|
||||||
//shift_addition_cc
|
//shift_addition_cc
|
||||||
shift_addition_data_t data_addition = shift_addition_init(0.1);
|
shift_addition_data_t data_addition = shift_addition_init(0.1);
|
||||||
|
|
Loading…
Reference in a new issue