shithub: opus

Download patch

ref: e6d832a7218dbf4188be8d6ed20472e20e9ef037
parent: 388fccc3344d08fdd2c2f228436844a8af9216b2
author: Jean-Marc Valin <[email protected]>
date: Wed Jul 8 18:21:31 EDT 2009

Allowing frame sizes up to 1024, with pitch enabled only up to 512

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -607,7 +607,7 @@
 
    if (shortBlocks && !transient_shift) 
    {
-      celt_word32_t sum[5]={1,1,1,1,1};
+      celt_word32_t sum[8]={1,1,1,1,1,1,1,1};
       int m;
       for (c=0;c<C;c++)
       {
@@ -677,7 +677,9 @@
    /* Pitch analysis: we do it early to save on the peak stack space */
    /* Don't use pitch if there isn't enough data available yet, 
       or if we're using shortBlocks */
-   has_pitch = st->pitch_enabled && st->pitch_permitted && (st->pitch_available >= MAX_PERIOD) && (!shortBlocks) && !intra_ener;
+   has_pitch = st->pitch_enabled && st->pitch_permitted && (N <= 512) 
+            && (st->pitch_available >= MAX_PERIOD) && (!shortBlocks)
+            && !intra_ener;
 #ifdef EXP_PSY
    ALLOC(tonality, MAX_PERIOD/4, celt_word16_t);
    {
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -328,9 +328,9 @@
          *error = CELT_BAD_ARG;
       return NULL;
    }
-   if (frame_size < 64 || frame_size > 512 || frame_size%2!=0)
+   if (frame_size < 64 || frame_size > 1024 || frame_size%2!=0)
    {
-      celt_warning("Only even frame sizes from 64 to 512 are supported");
+      celt_warning("Only even frame sizes from 64 to 1024 are supported");
       if (error)
          *error = CELT_BAD_ARG;
       return NULL;
@@ -352,7 +352,10 @@
       goto failure;
    mode->ePredCoef = QCONST16(.8f,15);
 
-   if (frame_size > 384 && (frame_size%8)==0)
+   if (frame_size > 640 && (frame_size%16)==0)
+   {
+     mode->nbShortMdcts = 8;
+   } else if (frame_size > 384 && (frame_size%8)==0)
    {
      mode->nbShortMdcts = 4;
    } else if (frame_size > 384 && (frame_size%10)==0)