shithub: opus

Download patch

ref: 7d40730e2284f841fd5ad366da4590600e7988b2
parent: 05686a5d6e366d3a067c39f1b8567def7baa450d
author: Jean-Marc Valin <[email protected]>
date: Tue Feb 12 06:32:20 EST 2008

optional fast ncwrs64() implementation (copied from ncwrs) requiring
statis memory allocation (not enabled by default)

--- a/libcelt/cwrs.c
+++ b/libcelt/cwrs.c
@@ -63,7 +63,18 @@
 }
 #endif
 
+#if 0
 celt_uint64_t ncwrs64(int _n,int _m){
+  static celt_uint64_t c[100][100];
+  if(_n<0||_m<0)return 0;
+  if(!c[_n][_m]){
+    if(_m<=0)c[_n][_m]=1;
+    else if(_n>0)c[_n][_m]=ncwrs(_n-1,_m)+ncwrs(_n,_m-1)+ncwrs(_n-1,_m-1);
+}
+  return c[_n][_m];
+}
+#else
+celt_uint64_t ncwrs64(int _n,int _m){
   celt_uint64_t ret;
   celt_uint64_t f;
   celt_uint64_t d;
@@ -81,6 +92,7 @@
   }
   return ret;
 }
+#endif
 
 /*Returns the _i'th combination of _m elements chosen from a set of size _n
    with associated sign bits.