shithub: opus-tools

Download patch

ref: 25c9d378d527604f86819d1cc33e77b4f36f3ae5
parent: 4f3aa6d8bb1f62cd65cbdffd76428ea431d8d0e1
author: Gregory Maxwell <greg@xiph.org>
date: Fri Jun 15 21:13:35 EDT 2012

Warning cleanups; On osx opusinfo was complaining that "sync" shadows a global.

--- a/src/opusinfo.c
+++ b/src/opusinfo.c
@@ -436,7 +436,7 @@
    return stream;
 }
 
-static int get_next_page(FILE *f, ogg_sync_state *sync, ogg_page *page,
+static int get_next_page(FILE *f, ogg_sync_state *ogsync, ogg_page *page,
         ogg_int64_t *written)
 {
     int ret;
@@ -443,7 +443,7 @@
     char *buffer;
     int bytes;
 
-    while((ret = ogg_sync_pageseek(sync, page)) <= 0) {
+    while((ret = ogg_sync_pageseek(ogsync, page)) <= 0) {
         if(ret < 0) {
             /* unsynced, we jump over bytes to a possible capture - we don't need to read more just yet */
             oi_warn(_("WARNING: Hole in data (%d bytes) found at approximate offset %" I64FORMAT " bytes. Corrupted Ogg.\n"), -ret, *written);
@@ -451,13 +451,13 @@
         }
 
         /* zero return, we didn't have enough data to find a whole page, read */
-        buffer = ogg_sync_buffer(sync, CHUNK);
+        buffer = ogg_sync_buffer(ogsync, CHUNK);
         bytes = fread(buffer, 1, CHUNK, f);
         if(bytes <= 0) {
-            ogg_sync_wrote(sync, 0);
+            ogg_sync_wrote(ogsync, 0);
             return 0;
         }
-        ogg_sync_wrote(sync, bytes);
+        ogg_sync_wrote(ogsync, bytes);
         *written += bytes;
     }
 
@@ -466,7 +466,7 @@
 
 static void process_file(char *filename) {
     FILE *file = fopen(filename, "rb");
-    ogg_sync_state sync;
+    ogg_sync_state ogsync;
     ogg_page page;
     stream_set *processors = create_stream_set();
     int gotpage = 0;
@@ -480,9 +480,9 @@
 
     printf(_("Processing file \"%s\"...\n\n"), filename);
 
-    ogg_sync_init(&sync);
+    ogg_sync_init(&ogsync);
 
-    while(get_next_page(file, &sync, &page, &written)) {
+    while(get_next_page(file, &ogsync, &page, &written)) {
         stream_processor *p = find_stream_processor(processors, &page);
         gotpage = 1;
 
@@ -557,7 +557,7 @@
 
     free_stream_set(processors);
 
-    ogg_sync_clear(&sync);
+    ogg_sync_clear(&ogsync);
 
     fclose(file);
 }
--- a/src/resample.c
+++ b/src/resample.c
@@ -341,12 +341,12 @@
 
    while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len))
    {
-      const spx_word16_t *sinc = & sinc_table[samp_frac_num*N];
+      const spx_word16_t *sinct = & sinc_table[samp_frac_num*N];
       const spx_word16_t *iptr = & in[last_sample];
 
 #ifndef OVERRIDE_INNER_PRODUCT_SINGLE
       sum = 0;
-      for(j=0;j<N;j++) sum += MULT16_16(sinc[j], iptr[j]);
+      for(j=0;j<N;j++) sum += MULT16_16(sinct[j], iptr[j]);
 
 /*    This code is slower on most DSPs which have only 2 accumulators.
       Plus this this forces truncation to 32 bits and you lose the HW guard bits.
@@ -353,15 +353,15 @@
       I think we can trust the compiler and let it vectorize and/or unroll itself.
       spx_word32_t accum[4] = {0,0,0,0};
       for(j=0;j<N;j+=4) {
-        accum[0] += MULT16_16(sinc[j], iptr[j]);
-        accum[1] += MULT16_16(sinc[j+1], iptr[j+1]);
-        accum[2] += MULT16_16(sinc[j+2], iptr[j+2]);
-        accum[3] += MULT16_16(sinc[j+3], iptr[j+3]);
+        accum[0] += MULT16_16(sinct[j], iptr[j]);
+        accum[1] += MULT16_16(sinct[j+1], iptr[j+1]);
+        accum[2] += MULT16_16(sinct[j+2], iptr[j+2]);
+        accum[3] += MULT16_16(sinct[j+3], iptr[j+3]);
       }
       sum = accum[0] + accum[1] + accum[2] + accum[3];
 */
 #else
-      sum = inner_product_single(sinc, iptr, N);
+      sum = inner_product_single(sinct, iptr, N);
 #endif
 
       out[out_stride * out_sample++] = SATURATE32(PSHR32(sum, 15), 32767);
@@ -398,7 +398,7 @@
 
    while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len))
    {
-      const spx_word16_t *sinc = & sinc_table[samp_frac_num*N];
+      const spx_word16_t *sinct = & sinc_table[samp_frac_num*N];
       const spx_word16_t *iptr = & in[last_sample];
 
 #ifndef OVERRIDE_INNER_PRODUCT_DOUBLE
@@ -405,14 +405,14 @@
       double accum[4] = {0,0,0,0};
 
       for(j=0;j<N;j+=4) {
-        accum[0] += sinc[j]*iptr[j];
-        accum[1] += sinc[j+1]*iptr[j+1];
-        accum[2] += sinc[j+2]*iptr[j+2];
-        accum[3] += sinc[j+3]*iptr[j+3];
+        accum[0] += sinct[j]*iptr[j];
+        accum[1] += sinct[j+1]*iptr[j+1];
+        accum[2] += sinct[j+2]*iptr[j+2];
+        accum[3] += sinct[j+3]*iptr[j+3];
       }
       sum = accum[0] + accum[1] + accum[2] + accum[3];
 #else
-      sum = inner_product_double(sinc, iptr, N);
+      sum = inner_product_double(sinct, iptr, N);
 #endif
 
       out[out_stride * out_sample++] = PSHR32(sum, 15);