shithub: opus

Download patch

ref: 3b0df0dc2a0f17bdff7b41d2b437e3e042fec1bc
parent: 69921c4cde12bc06dbe34eae168600707288829d
author: Jean-Marc Valin <[email protected]>
date: Fri Jul 16 11:55:30 EDT 2010

All modes based on 2.5 ms short blocks now use the same definition

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -159,6 +159,8 @@
 
    st->start = 0;
    st->end = st->mode->nbEBands;
+   while (st->mode->eBands[st->end] > st->mode->shortMdctSize)
+      st->end--;
 
    st->vbr_rate_norm = 0;
    st->pitch_enabled = 1;
@@ -1068,6 +1070,13 @@
       if (has_pitch)
          apply_pitch(st->mode, freq, pitch_freq, gain_id, 0, C, M);
       
+      for (c=0;c<C;c++)
+         for (i=0;i<M*st->mode->eBands[st->start];i++)
+            freq[c*N+i] = 0;
+      for (c=0;c<C;c++)
+         for (i=M*st->mode->eBands[st->end];i<N;i++)
+            freq[c*N+i] = 0;
+
       compute_inv_mdcts(st->mode, shortBlocks, freq, transient_time, transient_shift, st->out_mem, C, LM);
 
       /* De-emphasis and put everything back at the right place 
@@ -1414,6 +1423,8 @@
 
    st->start = 0;
    st->end = st->mode->nbEBands;
+   while (st->mode->eBands[st->end] > st->mode->shortMdctSize)
+      st->end--;
 
    st->decode_mem = (celt_sig*)celt_alloc((DECODE_BUFFER_SIZE+st->overlap)*C*sizeof(celt_sig));
    st->out_mem = st->decode_mem+DECODE_BUFFER_SIZE-MAX_PERIOD;
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -119,7 +119,8 @@
    celt_int16 *eBands;
    int i, lin, low, high, nBark, offset=0;
 
-   if (Fs == 400*(celt_int32)frame_size && Fs >= 40000)
+   /* All modes that have 2.5 ms short blocks use the same definition */
+   if (Fs == 400*(celt_int32)frame_size)
    {
       *nbEBands = sizeof(eband5ms)/sizeof(eband5ms[0])-1;
       eBands = celt_alloc(sizeof(celt_int16)*(*nbEBands+2));