/********************************************************************
 *                                                                  *
 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
 * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
 * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH    *
 * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.        *
 *                                                                  *
 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000             *
 * by Monty <monty@xiph.org> and the XIPHOPHORUS Company            *
 * http://www.xiph.org/                                             *
 *                                                                  *
 ********************************************************************

  function: lookup data; generated by lookups.pl; edit there
  last mod: $Id: lookup_data.h,v 1.3 2000/11/06 00:07:01 xiphmont Exp $

 ********************************************************************/

#ifndef _V_LOOKUP_DATA_H_
#include "floor0_table.h"
/*
#define FROMdB_LOOKUP_SZ 35
#define FROMdB2_LOOKUP_SZ 32
#define FROMdB_SHIFT 5
#define FROMdB2_SHIFT 3
#define FROMdB2_MASK 31

// (1<<23)*EXP(-x*LN(10)/20)
static const xint FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]=
{
	8388608,	5292853,	3339565, 	2107123,
	1329504,	 838860,	 529285,	 333956,
	 210712,	 132950,	  83886,	  52928,
	  33395,	  21071,	  13295,	   8388,
	   5292,	   3339,	   2107,	   1329,
	    838,	    529,	    333,	    210,
	    132,	     83,	     52,	     33,
	     21,	     13,	      8,	      5,
	      3,	      2,	      1
};

// (1<<23)*EXP((-1/16-x/8)*LN(10)/20)
static const xint FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]=
{
	8328463,	8209465,	8092168,	7976546,
	7862576,	7750235,	7639499,	7530345,
	7422751,	7316694,	7212152,	7109104,
	7007528,	6907404,	6808711,	6711427,
	6615533,	6521010,	6427837,	6335996,
	6245466,	6156230,	6068270,	5981566,
	5896100,	5811856,	5728816,	5646962,
	5566278,	5486746,	5408351,	5331076
};
*/
#define INVSQ_LOOKUP_I_SHIFT 10
#define INVSQ_LOOKUP_I_MASK 1023
static const int32_t INVSQ_LOOKUP_I[64+1]=
{
	   92682,   91966,   91267,   90583,
	   89915,   89261,   88621,   87995,
	   87381,   86781,   86192,   85616,
	   85051,   84497,   83953,   83420,
	   82897,   82384,   81880,   81385,
	   80899,   80422,   79953,   79492,
	   79039,   78594,   78156,   77726,
	   77302,   76885,   76475,   76072,
	   75674,   75283,   74898,   74519,
	   74146,   73778,   73415,   73058,
	   72706,   72359,   72016,   71679,
	   71347,   71019,   70695,   70376,
	   70061,   69750,   69444,   69141,
	   68842,   68548,   68256,   67969,
	   67685,   67405,   67128,   66855,
	   66585,   66318,   66054,   65794,
	   65536,
};

#define COS_LOOKUP_I_SHIFT 9
#define COS_LOOKUP_I_MASK 511
#define COS_LOOKUP_I_SZ 128

static const int32_t COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]=
{
	   16384,   16379,   16364,   16340,
	   16305,   16261,   16207,   16143,
	   16069,   15986,   15893,   15791,
	   15679,   15557,   15426,   15286,
	   15137,   14978,   14811,   14635,
	   14449,   14256,   14053,   13842,
	   13623,   13395,   13160,   12916,
	   12665,   12406,   12140,   11866,
	   11585,   11297,   11003,   10702,
	   10394,   10080,    9760,    9434,
	    9102,    8765,    8423,    8076,
	    7723,    7366,    7005,    6639,
	    6270,    5897,    5520,    5139,
	    4756,    4370,    3981,    3590,
	    3196,    2801,    2404,    2006,
	    1606,    1205,     804,     402,
	       0,    -401,    -803,   -1204,
	   -1605,   -2005,   -2403,   -2800,
	   -3195,   -3589,   -3980,   -4369,
	   -4755,   -5138,   -5519,   -5896,
	   -6269,   -6638,   -7004,   -7365,
	   -7722,   -8075,   -8422,   -8764,
	   -9101,   -9433,   -9759,  -10079,
	  -10393,  -10701,  -11002,  -11296,
	  -11584,  -11865,  -12139,  -12405,
	  -12664,  -12915,  -13159,  -13394,
	  -13622,  -13841,  -14052,  -14255,
	  -14448,  -14634,  -14810,  -14977,
	  -15136,  -15285,  -15425,  -15556,
	  -15678,  -15790,  -15892,  -15985,
	  -16068,  -16142,  -16206,  -16260,
	  -16304,  -16339,  -16363,  -16378,
	  -16383,
};

extern int32_t vorbis_invsqlook_i(int32_t a, int32_t e);
extern int32_t vorbis_coslook_i(int32_t a);
extern xint vorbis_fromdBlook_i(int32_t a, int32_t* shift);

#endif
