shithub: opus

Download patch

ref: 493b38d48f3871eab67962a65c04bba8b9337664
parent: 949902fd1b0e9e9215eee2d4df4ae56b0fb9648d
author: Jean-Marc Valin <[email protected]>
date: Tue Mar 11 11:24:07 EDT 2008

Better heuristic for deciding when to use the 32-bit version of the cwrs code.

--- a/libcelt/cwrs.c
+++ b/libcelt/cwrs.c
@@ -372,8 +372,8 @@
    ALLOC(signs, K, int);
    
    pulse2comb(N, K, comb, signs, _y);
-   /* Go with 32-bit path if we're sure we can */
-   if (N<=13 && K<=13)
+   /* Simple heuristic to figure out whether it fits in 32 bits */
+   if((N+4)*(K+4)<250 || EC_ILOG(N)*K<31)
    {
       celt_uint32_t bound, id;
       id = icwrs(N, K, comb, signs, &bound);
@@ -394,7 +394,8 @@
    
    ALLOC(comb, K, int);
    ALLOC(signs, K, int);
-   if (N<=13 && K<=13)
+   /* Simple heuristic to figure out whether it fits in 32 bits */
+   if((N+4)*(K+4)<250 || EC_ILOG(N)*K<31)
    {
       cwrsi(N, K, ec_dec_uint(dec, ncwrs(N, K)), comb, signs);
       comb2pulse(N, K, _y, comb, signs);