shithub: sox

Download patch

ref: b1720d247188415baf55bdc0f9b9d295a739ad6c
parent: c276b0f734215afa7b5ce25086900552b06aad76
author: Ulrich Klauer <ulrich@chirlu.de>
date: Sun Mar 18 23:44:12 EDT 2012

dither: use 64-bit numbers to count samples

--- a/src/dither.c
+++ b/src/dither.c
@@ -257,7 +257,8 @@
 
   double        previous_errors[MAX_N * 2];
   double        previous_outputs[MAX_N * 2];
-  size_t        pos, prec, num_output;
+  size_t        pos, prec;
+  uint64_t      num_output;
   int32_t       history, ranqd1, r;
   double const  * coefs;
   sox_bool      dither_off;
@@ -310,13 +311,13 @@
       else *obuf = i << (32 - p->prec);
       ++obuf;
       if (p->dither_off)
-        lsx_debug("flow %u: on  @ %u", (unsigned)effp->flow, (unsigned)p->num_output);
+        lsx_debug("flow %" PRIuPTR ": on  @ %" PRIu64, effp->flow, p->num_output);
       p->dither_off = sox_false;
     }
     else {
       *obuf++ = *ibuf++;
       if (!p->dither_off)
-        lsx_debug("flow %u: off @ %u", (unsigned)effp->flow, (unsigned)p->num_output);
+        lsx_debug("flow %" PRIuPTR ": off @ %" PRIu64, effp->flow, p->num_output);
       p->dither_off = sox_true;
     }
     ++p->num_output;
--- a/src/dither.h
+++ b/src/dither.h
@@ -38,13 +38,13 @@
       ++obuf;
 
       if (p->dither_off)
-        lsx_debug("flow %u: on  @ %u", (unsigned)effp->flow, (unsigned)p->num_output);
+        lsx_debug("flow %" PRIuPTR ": on  @ %" PRIu64, effp->flow, p->num_output);
       p->dither_off = sox_false;
     }
     else {
       *obuf++ = *ibuf++;
       if (!p->dither_off) {
-        lsx_debug("flow %u: off @ %u", (unsigned)effp->flow, (unsigned)p->num_output);
+        lsx_debug("flow %" PRIuPTR ": off @ %" PRIu64, effp->flow, p->num_output);
         memset(p->previous_errors, 0, sizeof(p->previous_errors));
         memset(p->previous_outputs, 0, sizeof(p->previous_outputs));
       }