ref: 811f21ab76dbf2d8fee75992c690aa0b011b4b02
parent: 073d0bc9254d9425585b6614fc9e1b01f3764f0f
author: Jean-Marc Valin <[email protected]>
date: Thu May 6 03:38:04 EDT 2010
Fix for very short frame size (M=1)
--- a/libcelt/cwrs.c
+++ b/libcelt/cwrs.c
@@ -781,7 +781,13 @@
int k;
/*_maxk==0 => there's nothing to do.*/
celt_assert(_maxk>0);
- if(fits_in32(_n,_maxk-1)){
+ if (_n==1)
+ {
+ _bits[0] = 0;
+ for (k=1;k<_maxk;k++)
+ _bits[k] = 1<<_frac;
+ }
+ else if(fits_in32(_n,_maxk-1)){
_bits[0]=0;
if(_maxk>1){
VARDECL(celt_uint32,u);
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -373,11 +373,7 @@
mode->window = window;
for (i=0;(1<<i)<=mode->nbShortMdcts;i++)
- {
- /* FIXME: Do something for i==0 */
- if (i!=0)
- mode->bits[i] = (const celt_int16 **)compute_alloc_cache(mode, 1, 1<<i);
- }
+ mode->bits[i] = (const celt_int16 **)compute_alloc_cache(mode, 1, 1<<i);
if (mode->bits==NULL)
goto failure;
@@ -442,9 +438,6 @@
#ifndef STATIC_MODES
for (m=0;(1<<m)<=mode->nbShortMdcts;m++)
{
- /* FIXME: Do something for i==0 */
- if (m==0)
- continue;
if (mode->bits[m]!=NULL)
{
for (i=0;i<mode->nbEBands;i++)