Renamed convert_f_i16 -> convert_f_s16 and convert_i16_f -> convert_s16_f. (csdr also triggers for the original functions, but they are deprecated.

This commit is contained in:
ha7ilm 2016-02-14 11:19:36 +01:00
parent aa0309f512
commit 277075b397
3 changed files with 14 additions and 9 deletions

10
csdr.c
View file

@ -58,8 +58,8 @@ char usage[]=
" convert_f_u8\n" " convert_f_u8\n"
" convert_s8_f\n" " convert_s8_f\n"
" convert_f_s8\n" " convert_f_s8\n"
" convert_f_i16\n" " convert_f_s16\n"
" convert_i16_f\n" " convert_s16_f\n"
" realpart_cf\n" " realpart_cf\n"
" clipdetect_ff\n" " clipdetect_ff\n"
" limit_ff [max_amplitude]\n" " limit_ff [max_amplitude]\n"
@ -372,7 +372,7 @@ int main(int argc, char *argv[])
TRY_YIELD; TRY_YIELD;
} }
} }
if(!strcmp(argv[1],"convert_f_i16")) if((!strcmp(argv[1],"convert_f_i16")) || (!strcmp(argv[1],"convert_f_s16")))
{ {
if(!sendbufsize(initialize_buffers())) return -2; if(!sendbufsize(initialize_buffers())) return -2;
for(;;) for(;;)
@ -384,7 +384,7 @@ int main(int argc, char *argv[])
TRY_YIELD; TRY_YIELD;
} }
} }
if(!strcmp(argv[1],"convert_i16_f")) //not tested if((!strcmp(argv[1],"convert_i16_f")) || (!strcmp(argv[1],"convert_s16_f"))) //not tested
{ {
if(!sendbufsize(initialize_buffers())) return -2; if(!sendbufsize(initialize_buffers())) return -2;
for(;;) for(;;)
@ -1426,7 +1426,7 @@ int main(int argc, char *argv[])
} }
}*/ }*/
if(!strcmp(argv[1],"flowcontrol")) if(!strcmp(argv[1],"flowcontrol"))
{ {
if(argc<=3) return badsyntax("need required parameters (data_rate, reads_per_seconds)"); if(argc<=3) return badsyntax("need required parameters (data_rate, reads_per_seconds)");

View file

@ -949,9 +949,9 @@ void convert_s8_f(signed char* input, float* output, int input_size)
for(int i=0;i<input_size;i++) output[i]=((float)input[i])/SCHAR_MAX; //@convert_s8_f for(int i=0;i<input_size;i++) output[i]=((float)input[i])/SCHAR_MAX; //@convert_s8_f
} }
void convert_i16_f(short* input, float* output, int input_size) void convert_s16_f(short* input, float* output, int input_size)
{ {
for(int i=0;i<input_size;i++) output[i]=(float)input[i]/SHRT_MAX; //@convert_i16_f for(int i=0;i<input_size;i++) output[i]=(float)input[i]/SHRT_MAX; //@convert_s16_f
} }
void convert_f_u8(float* input, unsigned char* output, int input_size) void convert_f_u8(float* input, unsigned char* output, int input_size)
@ -966,16 +966,19 @@ void convert_f_s8(float* input, signed char* output, int input_size)
for(int i=0;i<input_size;i++) output[i]=input[i]*SCHAR_MAX; //@convert_f_s8 for(int i=0;i<input_size;i++) output[i]=input[i]*SCHAR_MAX; //@convert_f_s8
} }
void convert_f_i16(float* input, short* output, int input_size) void convert_f_s16(float* input, short* output, int input_size)
{ {
/*for(int i=0;i<input_size;i++) /*for(int i=0;i<input_size;i++)
{ {
if(input[i]>1.0) input[i]=1.0; if(input[i]>1.0) input[i]=1.0;
if(input[i]<-1.0) input[i]=-1.0; if(input[i]<-1.0) input[i]=-1.0;
}*/ }*/
for(int i=0;i<input_size;i++) output[i]=input[i]*SHRT_MAX; //@convert_f_i16 for(int i=0;i<input_size;i++) output[i]=input[i]*SHRT_MAX; //@convert_f_s16
} }
void convert_i16_f(short* input, float* output, int input_size) { convert_s16_f(input, output, input_size); }
void convert_f_i16(float* input, short* output, int input_size) { convert_f_s16(input, output, input_size); }
int trivial_vectorize() int trivial_vectorize()
{ {
//this function is trivial to vectorize and should pass on both NEON and SSE //this function is trivial to vectorize and should pass on both NEON and SSE

View file

@ -170,6 +170,8 @@ void convert_u8_f(unsigned char* input, float* output, int input_size);
void convert_f_u8(float* input, unsigned char* output, int input_size); void convert_f_u8(float* input, unsigned char* output, int input_size);
void convert_s8_f(signed char* input, float* output, int input_size); void convert_s8_f(signed char* input, float* output, int input_size);
void convert_f_s8(float* input, signed char* output, int input_size); void convert_f_s8(float* input, signed char* output, int input_size);
void convert_f_s16(float* input, short* output, int input_size);
void convert_s16_f(short* input, float* output, int input_size);
void convert_f_i16(float* input, short* output, int input_size); void convert_f_i16(float* input, short* output, int input_size);
void convert_i16_f(short* input, float* output, int input_size); void convert_i16_f(short* input, float* output, int input_size);