Borland needs malloc.h, and this is a cleaner fix for MSVC too (rather than Define alloca...)
Fix sqrt of small negative numbers in smoothing is psy.c
Uninitialized space in floor0.c lookup struct could cause lpc_clear to
trigger on garbage.
Monty
svn path=/trunk/vorbis/; revision=598
********************************************************************
function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.21 2000/08/19 11:46:28 xiphmont Exp $
+ last mod: $Id: floor0.c,v 1.22 2000/08/23 06:38:49 xiphmont Exp $
********************************************************************/
double scale;
vorbis_info *vi=vd->vi;
vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
- vorbis_look_floor0 *look=malloc(sizeof(vorbis_look_floor0));
+ vorbis_look_floor0 *look=calloc(1,sizeof(vorbis_look_floor0));
look->m=info->order;
look->n=vi->blocksizes[mi->blockflag]/2;
look->ln=info->barkmap;
********************************************************************
function: #ifdef jail to whip a few platforms into the UNIX ideal.
- last mod: $Id: os.h,v 1.8 2000/07/07 00:48:19 xiphmont Exp $
+ last mod: $Id: os.h,v 1.9 2000/08/23 06:38:49 xiphmont Exp $
********************************************************************/
#ifndef __GNUC__
#ifdef _WIN32
-# define alloca(x) (_alloca(x))
+# include <malloc.h>
# define rint(x) (floor((x)+0.5))
#endif
#endif
********************************************************************
function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.25 2000/08/15 11:53:18 xiphmont Exp $
+ last mod: $Id: psy.c,v 1.26 2000/08/23 06:38:49 xiphmont Exp $
********************************************************************/
for(i=1;i<n-1;i++){
double this=smooth[i];
acc+=smooth[i+1]*smooth[i+1];
+ if(acc<0)acc=0; /* it can happen due to finite precision */
smooth[i]=sqrt(acc);
acc-=prev*prev;
prev=this;