changeset 24899:3245638ab801

af_scaletempo: code cleanup Make internal functions static and remove leading '_' from some function names. Cast pointers to compatible 8-bit pointer types instead of ints when calculating their difference.
author uau
date Thu, 01 Nov 2007 06:52:47 +0000
parents 0701957d2bf7
children 9079c9745ff9
files libaf/af_scaletempo.c
diffstat 1 files changed, 17 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libaf/af_scaletempo.c	Thu Nov 01 06:52:44 2007 +0000
+++ b/libaf/af_scaletempo.c	Thu Nov 01 06:52:47 2007 +0000
@@ -79,7 +79,8 @@
   short   speed_pitch;
 } af_scaletempo_t;
 
-int fill_queue(struct af_instance_s* af, af_data_t* data, int offset) {
+static int fill_queue(struct af_instance_s* af, af_data_t* data, int offset)
+{
   af_scaletempo_t* s = af->setup;
   int bytes_in = data->len - offset;
   int offset_unchanged = offset;
@@ -115,7 +116,8 @@
   return offset - offset_unchanged;
 }
 
-int _best_overlap_offset_float(af_scaletempo_t* s) {
+static int best_overlap_offset_float(af_scaletempo_t* s)
+{
   float *pw, *po, *ppc, *search_start;
   float best_corr = INT_MIN;
   int best_off = 0;
@@ -146,7 +148,8 @@
   return best_off * 4 * s->num_channels;
 }
 
-int _best_overlap_offset_s16(af_scaletempo_t* s) {
+static int best_overlap_offset_s16(af_scaletempo_t* s)
+{
   int32_t *pw, *ppc;
   int16_t *po, *search_start;
   int32_t best_corr = INT_MIN;
@@ -178,7 +181,9 @@
   return best_off * 2 * s->num_channels;
 }
 
-void _output_overlap_float(af_scaletempo_t* s, int8_t* buf_out, int bytes_off) {
+static void output_overlap_float(af_scaletempo_t* s, int8_t* buf_out,
+				  int bytes_off)
+{
   float* pout = (float*)buf_out;
   float* pb   = (float*)s->table_blend;
   float* po   = (float*)s->buf_overlap;
@@ -188,7 +193,9 @@
     *pout++ = *po - *pb++ * ( *po - *pin++ ); po++;
   }
 }
-void _output_overlap_s16(af_scaletempo_t* s, int8_t* buf_out, int bytes_off) {
+static void output_overlap_s16(af_scaletempo_t* s, int8_t* buf_out,
+			       int bytes_off)
+{
   int16_t* pout = (int16_t*)buf_out;
   int32_t* pb   = (int32_t*)s->table_blend;
   int16_t* po   = (int16_t*)s->buf_overlap;
@@ -255,7 +262,7 @@
   }
 
   data->audio = af->data->audio;
-  data->len   = (int)pout - (int)af->data->audio;
+  data->len   = pout - (int8_t *)af->data->audio;
   return data;
 }
 
@@ -330,7 +337,7 @@
           }
           blend += 65536;  // 2^16
         }
-        s->output_overlap = _output_overlap_s16;
+        s->output_overlap = output_overlap_s16;
       } else {
         float* pb = (float*)s->table_blend;
         for (i=0; i<frames_overlap; i++) {
@@ -339,7 +346,7 @@
             *pb++ = v;
           }
         }
-        s->output_overlap = _output_overlap_float;
+        s->output_overlap = output_overlap_float;
       }
     }
 
@@ -365,7 +372,7 @@
           }
         }
         s->shift_corr = av_log2( 2*(s->samples_overlap - nch) - 1 );
-        s->best_overlap_offset = _best_overlap_offset_s16;
+        s->best_overlap_offset = best_overlap_offset_s16;
       } else {
         float* pw;
         s->buf_pre_corr = realloc(s->buf_pre_corr, s->bytes_overlap);
@@ -381,7 +388,7 @@
             *pw++ = v;
           }
         }
-        s->best_overlap_offset = _best_overlap_offset_float;
+        s->best_overlap_offset = best_overlap_offset_float;
       }
     }