sigproc: Make convolution and convert input buffers immutable

For good practice, use const specifier when applicable.

Signed-off-by: Tom Tsou <tom@tsou.cc>
diff --git a/Transceiver52M/common/convert.h b/Transceiver52M/common/convert.h
index 5b557bf..4827c28 100644
--- a/Transceiver52M/common/convert.h
+++ b/Transceiver52M/common/convert.h
@@ -1,7 +1,7 @@
 #ifndef _CONVERT_H_
 #define _CONVERT_H_
 
-void convert_float_short(short *out, float *in, float scale, int len);
-void convert_short_float(float *out, short *in, int len);
+void convert_float_short(short *out, const float *in, float scale, int len);
+void convert_short_float(float *out, const short *in, int len);
 
 #endif /* _CONVERT_H_ */
diff --git a/Transceiver52M/common/convolve.h b/Transceiver52M/common/convolve.h
index aef9953..08bda0c 100644
--- a/Transceiver52M/common/convolve.h
+++ b/Transceiver52M/common/convolve.h
@@ -3,26 +3,26 @@
 
 void *convolve_h_alloc(int num);
 
-int convolve_real(float *x, int x_len,
-		  float *h, int h_len,
+int convolve_real(const float *x, int x_len,
+		  const float *h, int h_len,
 		  float *y, int y_len,
 		  int start, int len,
 		  int step, int offset);
 
-int convolve_complex(float *x, int x_len,
-		     float *h, int h_len,
+int convolve_complex(const float *x, int x_len,
+		     const float *h, int h_len,
 		     float *y, int y_len,
 		     int start, int len,
 		     int step, int offset);
 
-int base_convolve_real(float *x, int x_len,
-		       float *h, int h_len,
+int base_convolve_real(const float *x, int x_len,
+		       const float *h, int h_len,
 		       float *y, int y_len,
 		       int start, int len,
 		       int step, int offset);
 
-int base_convolve_complex(float *x, int x_len,
-			  float *h, int h_len,
+int base_convolve_complex(const float *x, int x_len,
+			  const float *h, int h_len,
 			  float *y, int y_len,
 			  int start, int len,
 			  int step, int offset);
diff --git a/Transceiver52M/common/convolve_base.c b/Transceiver52M/common/convolve_base.c
index 41dba1c..71453a1 100644
--- a/Transceiver52M/common/convolve_base.c
+++ b/Transceiver52M/common/convolve_base.c
@@ -26,21 +26,21 @@
 #endif
 
 /* Base multiply and accumulate complex-real */
-static void mac_real(float *x, float *h, float *y)
+static void mac_real(const float *x, const float *h, float *y)
 {
 	y[0] += x[0] * h[0];
 	y[1] += x[1] * h[0];
 }
 
 /* Base multiply and accumulate complex-complex */
-static void mac_cmplx(float *x, float *h, float *y)
+static void mac_cmplx(const float *x, const float *h, float *y)
 {
 	y[0] += x[0] * h[0] - x[1] * h[1];
 	y[1] += x[0] * h[1] + x[1] * h[0];
 }
 
 /* Base vector complex-complex multiply and accumulate */
-static void mac_real_vec_n(float *x, float *h, float *y,
+static void mac_real_vec_n(const float *x, const float *h, float *y,
 			   int len, int step, int offset)
 {
 	for (int i = offset; i < len; i += step)
@@ -48,7 +48,7 @@
 }
 
 /* Base vector complex-complex multiply and accumulate */
-static void mac_cmplx_vec_n(float *x, float *h, float *y,
+static void mac_cmplx_vec_n(const float *x, const float *h, float *y,
 			    int len, int step, int offset)
 {
 	for (int i = offset; i < len; i += step)
@@ -56,8 +56,8 @@
 }
 
 /* Base complex-real convolution */
-int _base_convolve_real(float *x, int x_len,
-			float *h, int h_len,
+int _base_convolve_real(const float *x, int x_len,
+			const float *h, int h_len,
 			float *y, int y_len,
 			int start, int len,
 			int step, int offset)
@@ -73,8 +73,8 @@
 }
 
 /* Base complex-complex convolution */
-int _base_convolve_complex(float *x, int x_len,
-			   float *h, int h_len,
+int _base_convolve_complex(const float *x, int x_len,
+			   const float *h, int h_len,
 			   float *y, int y_len,
 			   int start, int len,
 			   int step, int offset)
@@ -110,8 +110,8 @@
 }
 
 /* API: Non-aligned (no SSE) complex-real */
-int base_convolve_real(float *x, int x_len,
-		       float *h, int h_len,
+int base_convolve_real(const float *x, int x_len,
+		       const float *h, int h_len,
 		       float *y, int y_len,
 		       int start, int len,
 		       int step, int offset)
@@ -128,8 +128,8 @@
 }
 
 /* API: Non-aligned (no SSE) complex-complex */
-int base_convolve_complex(float *x, int x_len,
-			  float *h, int h_len,
+int base_convolve_complex(const float *x, int x_len,
+			  const float *h, int h_len,
 			  float *y, int y_len,
 			  int start, int len,
 			  int step, int offset)
diff --git a/Transceiver52M/x86/convert.c b/Transceiver52M/x86/convert.c
index 40831da..eafe7b2 100644
--- a/Transceiver52M/x86/convert.c
+++ b/Transceiver52M/x86/convert.c
@@ -34,7 +34,7 @@
 
 /* 16*N 16-bit signed integer converted to single precision floats */
 static void _sse_convert_si16_ps_16n(float *restrict out,
-				     short *restrict in,
+				     const short *restrict in,
 				     int len)
 {
 	__m128i m0, m1, m2, m3, m4, m5;
@@ -69,7 +69,7 @@
 
 /* 16*N 16-bit signed integer conversion with remainder */
 static void _sse_convert_si16_ps(float *restrict out,
-				 short *restrict in,
+				 const short *restrict in,
 				 int len)
 {
 	int start = len / 16 * 16;
@@ -83,7 +83,7 @@
 
 /* 8*N single precision floats scaled and converted to 16-bit signed integer */
 static void _sse_convert_scale_ps_si16_8n(short *restrict out,
-					  float *restrict in,
+					  const float *restrict in,
 					  float scale, int len)
 {
 	__m128 m0, m1, m2;
@@ -111,7 +111,7 @@
 
 /* 8*N single precision floats scaled and converted with remainder */
 static void _sse_convert_scale_ps_si16(short *restrict out,
-				       float *restrict in,
+				       const float *restrict in,
 				       float scale, int len)
 {
 	int start = len / 8 * 8;
@@ -124,7 +124,7 @@
 
 /* 16*N single precision floats scaled and converted to 16-bit signed integer */
 static void _sse_convert_scale_ps_si16_16n(short *restrict out,
-					   float *restrict in,
+					   const float *restrict in,
 					   float scale, int len)
 {
 	__m128 m0, m1, m2, m3, m4;
@@ -158,7 +158,8 @@
 	}
 }
 #else /* HAVE_SSE3 */
-static void convert_scale_ps_si16(short *out, float *in, float scale, int len)
+static void convert_scale_ps_si16(short *out, const float *in,
+				  float scale, int len)
 {
 	for (int i = 0; i < len; i++)
 		out[i] = in[i] * scale;
@@ -166,14 +167,14 @@
 #endif
 
 #ifndef HAVE_SSE4_1
-static void convert_si16_ps(float *out, short *in, int len)
+static void convert_si16_ps(float *out, const short *in, int len)
 {
 	for (int i = 0; i < len; i++)
 		out[i] = in[i];
 }
 #endif
 
-void convert_float_short(short *out, float *in, float scale, int len)
+void convert_float_short(short *out, const float *in, float scale, int len)
 {
 #ifdef HAVE_SSE3
 	if (!(len % 16))
@@ -187,7 +188,7 @@
 #endif
 }
 
-void convert_short_float(float *out, short *in, int len)
+void convert_short_float(float *out, const short *in, int len)
 {
 #ifdef HAVE_SSE4_1
 	if (!(len % 16))
diff --git a/Transceiver52M/x86/convolve.c b/Transceiver52M/x86/convolve.c
index 1c0a91c..04923bc 100644
--- a/Transceiver52M/x86/convolve.c
+++ b/Transceiver52M/x86/convolve.c
@@ -27,14 +27,14 @@
 #endif
 
 /* Forward declarations from base implementation */
-int _base_convolve_real(float *x, int x_len,
-			float *h, int h_len,
+int _base_convolve_real(const float *x, int x_len,
+			const float *h, int h_len,
 			float *y, int y_len,
 			int start, int len,
 			int step, int offset);
 
-int _base_convolve_complex(float *x, int x_len,
-			   float *h, int h_len,
+int _base_convolve_complex(const float *x, int x_len,
+			   const float *h, int h_len,
 			   float *y, int y_len,
 			   int start, int len,
 			   int step, int offset);
@@ -47,8 +47,8 @@
 #include <pmmintrin.h>
 
 /* 4-tap SSE complex-real convolution */
-static void sse_conv_real4(float *restrict x,
-			   float *restrict h,
+static void sse_conv_real4(const float *restrict x,
+			   const float *restrict h,
 			   float *restrict y,
 			   int len)
 {
@@ -81,8 +81,8 @@
 }
 
 /* 8-tap SSE complex-real convolution */
-static void sse_conv_real8(float *restrict x,
-			   float *restrict h,
+static void sse_conv_real8(const float *restrict x,
+			   const float *restrict h,
 			   float *restrict y,
 			   int len)
 {
@@ -128,8 +128,8 @@
 }
 
 /* 12-tap SSE complex-real convolution */
-static void sse_conv_real12(float *restrict x,
-			    float *restrict h,
+static void sse_conv_real12(const float *restrict x,
+			    const float *restrict h,
 			    float *restrict y,
 			    int len)
 {
@@ -190,8 +190,8 @@
 }
 
 /* 16-tap SSE complex-real convolution */
-static void sse_conv_real16(float *restrict x,
-			    float *restrict h,
+static void sse_conv_real16(const float *restrict x,
+			    const float *restrict h,
 			    float *restrict y,
 			    int len)
 {
@@ -265,8 +265,8 @@
 }
 
 /* 20-tap SSE complex-real convolution */
-static void sse_conv_real20(float *restrict x,
-			    float *restrict h,
+static void sse_conv_real20(const float *restrict x,
+			    const float *restrict h,
 			    float *restrict y,
 			    int len)
 {
@@ -351,7 +351,10 @@
 }
 
 /* 4*N-tap SSE complex-real convolution */
-static void sse_conv_real4n(float *x, float *h, float *y, int h_len, int len)
+static void sse_conv_real4n(const float *x,
+			    const float *h,
+			    float *y,
+			    int h_len, int len)
 {
 	__m128 m0, m1, m2, m4, m5, m6, m7;
 
@@ -391,7 +394,10 @@
 }
 
 /* 4*N-tap SSE complex-complex convolution */
-static void sse_conv_cmplx_4n(float *x, float *h, float *y, int h_len, int len)
+static void sse_conv_cmplx_4n(const float *x,
+			      const float *h,
+			      float *y,
+			      int h_len, int len)
 {
 	__m128 m0, m1, m2, m3, m4, m5, m6, m7;
 
@@ -439,7 +445,10 @@
 }
 
 /* 8*N-tap SSE complex-complex convolution */
-static void sse_conv_cmplx_8n(float *x, float *h, float *y, int h_len, int len)
+static void sse_conv_cmplx_8n(const float *x,
+			      const float *h,
+			      float *y,
+			      int h_len, int len)
 {
 	__m128 m0, m1, m2, m3, m4, m5, m6, m7;
 	__m128 m8, m9, m10, m11, m12, m13, m14, m15;
@@ -511,14 +520,16 @@
 #endif
 
 /* API: Aligned complex-real */
-int convolve_real(float *x, int x_len,
-		  float *h, int h_len,
+int convolve_real(const float *x, int x_len,
+		  const float *h, int h_len,
 		  float *y, int y_len,
 		  int start, int len,
 		  int step, int offset)
 {
-	void (*conv_func)(float *, float *, float *, int) = NULL;
-	void (*conv_func_n)(float *, float *, float *, int, int) = NULL;
+	void (*conv_func)(const float *, const float *,
+			  float *, int) = NULL;
+	void (*conv_func_n)(const float *, const float *,
+			    float *, int, int) = NULL;
 
 	if (bounds_check(x_len, h_len, y_len, start, len, step) < 0)
 		return -1;
@@ -566,13 +577,14 @@
 }
 
 /* API: Aligned complex-complex */
-int convolve_complex(float *x, int x_len,
-		     float *h, int h_len,
+int convolve_complex(const float *x, int x_len,
+		     const float *h, int h_len,
 		     float *y, int y_len,
 		     int start, int len,
 		     int step, int offset)
 {
-	void (*conv_func)(float *, float *, float *, int, int) = NULL;
+	void (*conv_func)(const float *, const float *,
+			  float *, int, int) = NULL;
 
 	if (bounds_check(x_len, h_len, y_len, start, len, step) < 0)
 		return -1;