src/mathutils.*: more const qualifiers
authorPaul Brossier <piem@piem.org>
Thu, 21 Apr 2016 17:03:58 +0000 (19:03 +0200)
committerPaul Brossier <piem@piem.org>
Thu, 21 Apr 2016 17:03:58 +0000 (19:03 +0200)
src/mathutils.c
src/mathutils.h

index cd7d849..5f7ac27 100644 (file)
@@ -291,7 +291,7 @@ fvec_ishift (fvec_t * s)
 }
 
 smpl_t
-aubio_level_lin (fvec_t * f)
+aubio_level_lin (const fvec_t * f)
 {
   smpl_t energy = 0.;
 #ifndef HAVE_ATLAS
@@ -440,7 +440,7 @@ smpl_t fvec_median (fvec_t * input) {
   }
 }
 
-smpl_t fvec_quadratic_peak_pos (fvec_t * x, uint_t pos) {
+smpl_t fvec_quadratic_peak_pos (const fvec_t * x, uint_t pos) {
   smpl_t s0, s1, s2; uint_t x0, x2;
   smpl_t half = .5, two = 2.;
   if (pos == 0 || pos == x->length - 1) return pos;
@@ -465,7 +465,7 @@ smpl_t fvec_quadratic_peak_mag (fvec_t *x, smpl_t pos) {
   return x1 - .25 * (x0 - x2) * (pos - index);
 }
 
-uint_t fvec_peakpick(fvec_t * onset, uint_t pos) {
+uint_t fvec_peakpick(const fvec_t * onset, uint_t pos) {
   uint_t tmp=0;
   tmp = (onset->data[pos] > onset->data[pos-1]
       &&  onset->data[pos] > onset->data[pos+1]
@@ -552,13 +552,13 @@ aubio_next_power_of_two (uint_t a)
 }
 
 smpl_t
-aubio_db_spl (fvec_t * o)
+aubio_db_spl (const fvec_t * o)
 {
   return 10. * LOG10 (aubio_level_lin (o));
 }
 
 uint_t
-aubio_silence_detection (fvec_t * o, smpl_t threshold)
+aubio_silence_detection (const fvec_t * o, smpl_t threshold)
 {
   return (aubio_db_spl (o) < threshold);
 }
@@ -598,7 +598,7 @@ aubio_zero_crossing_rate (fvec_t * input)
 }
 
 void
-aubio_autocorr (fvec_t * input, fvec_t * output)
+aubio_autocorr (const fvec_t * input, fvec_t * output)
 {
   uint_t i, j, length = input->length;
   smpl_t *data, *acf;
index ffa6556..7ed5ed1 100644 (file)
@@ -250,7 +250,7 @@ smpl_t fvec_median (fvec_t * v);
   \return \f$ p + p_{frac} \f$ exact peak position of interpolated maximum or minimum
 
 */
-smpl_t fvec_quadratic_peak_pos (fvec_t * x, uint_t p);
+smpl_t fvec_quadratic_peak_pos (const fvec_t * x, uint_t p);
 
 /** finds magnitude of peak by quadratic interpolation
 
@@ -293,7 +293,7 @@ peak is defined as follows:
   \return 1 if a peak is found, 0 otherwise
 
 */
-uint_t fvec_peakpick (fvec_t * v, uint_t p);
+uint_t fvec_peakpick (const fvec_t * v, uint_t p);
 
 /** return 1 if a is a power of 2, 0 otherwise */
 uint_t aubio_is_power_of_two(uint_t a);
@@ -307,7 +307,7 @@ uint_t aubio_next_power_of_two(uint_t a);
   \param output vector to store autocorrelation function to
 
 */
-void aubio_autocorr (fvec_t * input, fvec_t * output);
+void aubio_autocorr (const fvec_t * input, fvec_t * output);
 
 #ifdef __cplusplus
 }