]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Add possibility of using an array of precalculated pseudo random numbers to reduce...
authorMike Brady <mikebrady@eircom.net>
Mon, 30 Jan 2017 18:34:09 +0000 (18:34 +0000)
committerMike Brady <mikebrady@eircom.net>
Mon, 30 Jan 2017 18:34:09 +0000 (18:34 +0000)
common.c
common.h
player.c
shairport.c

index d2eb17e4e5073f4f780a678d40fae49d95a466a5..cf1138a1db0fda79fb7910c991d8281dfbd9c7f1 100644 (file)
--- a/common.c
+++ b/common.c
@@ -757,6 +757,8 @@ uint64_t ranarrayval() {
   ranarraynext = (ranarraynext++)%ranarraylength;
 }
 
+void r64arrayinit() { ranarrayinit(); }
+
 uint64_t ranarray64u() { return (ranarrayval()); }
 
 int64_t ranarray64i() { return (ranarrayval(&rx) >> 1); }
index e52f82d29069c28277ed9b6dcaea121af2b68adb..e15edf1ae12bfcb1c9f19cc661561399d6c84d6a 100644 (file)
--- a/common.h
+++ b/common.h
@@ -152,6 +152,10 @@ void r64init(uint64_t seed);
 uint64_t r64u();
 int64_t r64i();
 
+void r64arrayinit();
+uint64_t ranarray64u();
+int64_t ranarray64i();
+
 int debuglev;
 void die(char *format, ...);
 void warn(char *format, ...);
index edc3dfbfabe74c7ef02fb6549c4914d45a612d79..edf2f4b0f46cb04c3a940f6d9764dcbda1f71a79 100644 (file)
--- a/player.c
+++ b/player.c
@@ -677,6 +677,8 @@ static inline void process_sample(int32_t sample, char **outp, enum sps_format_t
     }
     dither_mask -= 1;
     int64_t r = r64i();
+    // int64_t r = ranarray64i();
+    
     int64_t tpdf = (r & dither_mask) - (previous_random_number & dither_mask);
     previous_random_number = r;
     // add dither, allowing for clipping
index 6106aca698d48990a7d1e59bdacdae9132219314..4afd8e5d8a4b8fcdabfb42e4816a631386fa7480 100644 (file)
@@ -858,6 +858,10 @@ int main(int argc, char **argv) {
   // initialise random number generator
 
   r64init(0);
+  
+  // initialise the randomw number array
+  
+  r64arrayinit();
 
   /* Check if we are called with -V or --version parameter */
   if (argc >= 2 && ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0))) {