Added plain_interpolate_cc

This commit is contained in:
ha7ilm 2017-05-01 13:09:42 +02:00
parent bfc6f5dea0
commit 84d23227f3
3 changed files with 33 additions and 0 deletions

22
csdr.c
View file

@ -143,7 +143,11 @@ char usage[]=
" gaussian_noise_c\n" " gaussian_noise_c\n"
" awgn_cc <snr_db> [--snrshow]\n" " awgn_cc <snr_db> [--snrshow]\n"
" pack_bits_8to1_u8_u8\n" " pack_bits_8to1_u8_u8\n"
" firdes_matched_filter_f (RRC <samples_per_symbol> <num_taps> <beta> | COSINE <samples_per_symbol>)\n"
" matched_filter_cc (RRC <samples_per_symbol> <num_taps> <beta> | COSINE <samples_per_symbol>)\n"
" add_n_zero_samples_at_beginning_f <n_zero_samples>\n" " add_n_zero_samples_at_beginning_f <n_zero_samples>\n"
" generic_slicer_f_u8 <n_symbols>\n"
" plain_interpolate_cc <n_symbols>\n"
" ?<search_the_function_list>\n" " ?<search_the_function_list>\n"
" =<evaluate_python_expression>\n" " =<evaluate_python_expression>\n"
" \n" " \n"
@ -3106,6 +3110,24 @@ int main(int argc, char *argv[])
return 0; return 0;
} }
if(!strcmp(argv[1], "plain_interpolate_cc")) //<interpolation>
{
int interpolation = 0;
if(argc<=2) return badsyntax("required parameter <interpolation> is missing.");
sscanf(argv[2],"%d",&interpolation);
if(!sendbufsize(interpolation*initialize_buffers())) return -2;
complexf* plainint_output_buffer = (complexf*)malloc(sizeof(complexf)*the_bufsize*interpolation);
for(;;)
{
FEOF_CHECK;
FREAD_C;
plain_interpolate_cc((complexf*)input_buffer, plainint_output_buffer, the_bufsize, interpolation);
fwrite(plainint_output_buffer, sizeof(float)*2, the_bufsize*interpolation, stdout);
TRY_YIELD;
}
return 0;
}
if(!strcmp(argv[1],"none")) if(!strcmp(argv[1],"none"))
{ {
return 0; return 0;

View file

@ -2383,6 +2383,15 @@ int firdes_rrc_f(float* taps, int taps_length, int samples_per_symbol, float bet
} }
} }
void plain_interpolate_cc(complexf* input, complexf* output, int input_size, int interpolation)
{
for(int i=0;i<input_size;i++)
{
output[i*interpolation]=input[i];
bzero(output+(interpolation*i)+1, (interpolation-1)*sizeof(complexf));
}
}
#define MMATCHEDFILT_GAS(NAME) \ #define MMATCHEDFILT_GAS(NAME) \
if(!strcmp( #NAME , input )) return MATCHED_FILTER_ ## NAME; if(!strcmp( #NAME , input )) return MATCHED_FILTER_ ## NAME;
@ -2408,3 +2417,4 @@ int trivial_vectorize()
} }
return c[0]; return c[0];
} }
void plain_interpolate_cc(complexf* input, complexf* output, int input_size, int interpolation);

View file

@ -384,3 +384,4 @@ int firdes_rrc_f(float* taps, int taps_length, int samples_per_symbol, float bet
matched_filter_type_t matched_filter_get_type_from_string(char* input); matched_filter_type_t matched_filter_get_type_from_string(char* input);
int apply_real_fir_cc(complexf* input, complexf* output, int input_size, float* taps, int taps_length); int apply_real_fir_cc(complexf* input, complexf* output, int input_size, float* taps, int taps_length);
void generic_slicer_f_u8(float* input, unsigned char* output, int input_size, int n_symbols); void generic_slicer_f_u8(float* input, unsigned char* output, int input_size, int n_symbols);
void plain_interpolate_cc(complexf* input, complexf* output, int input_size, int interpolation);;