1#!/usr/bin/perl 2print <<'EOD'; 3/******************************************************************** 4 * * 5 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 6 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 7 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 8 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 9 * * 10 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * 11 * by the Xiph.Org Foundation http://www.xiph.org/ * 12 * * 13 ******************************************************************** 14 15 function: lookup data; generated by lookups.pl; edit there 16 last mod: $Id: lookups.pl 13293 2007-07-24 00:09:47Z xiphmont $ 17 18 ********************************************************************/ 19 20#ifndef _V_LOOKUP_DATA_H_ 21 22#ifdef FLOAT_LOOKUP 23EOD 24 25$cos_sz=128; 26$invsq_sz=32; 27$invsq2exp_min=-32; 28$invsq2exp_max=32; 29 30$fromdB_sz=35; 31$fromdB_shift=5; 32$fromdB2_shift=3; 33 34$invsq_i_shift=10; 35$cos_i_shift=9; 36$delta_shift=6; 37 38print "#define COS_LOOKUP_SZ $cos_sz\n"; 39print "static float COS_LOOKUP[COS_LOOKUP_SZ+1]={\n"; 40 41for($i=0;$i<=$cos_sz;){ 42 print "\t"; 43 for($j=0;$j<4 && $i<=$cos_sz;$j++){ 44 printf "%+.13f,", cos(3.14159265358979323846*($i++)/$cos_sz) ; 45 } 46 print "\n"; 47} 48print "};\n\n"; 49 50print "#define INVSQ_LOOKUP_SZ $invsq_sz\n"; 51print "static float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={\n"; 52 53for($i=0;$i<=$invsq_sz;){ 54 print "\t"; 55 for($j=0;$j<4 && $i<=$invsq_sz;$j++){ 56 my$indexmap=$i++/$invsq_sz*.5+.5; 57 printf "%.12f,", 1./sqrt($indexmap); 58 } 59 print "\n"; 60} 61print "};\n\n"; 62 63print "#define INVSQ2EXP_LOOKUP_MIN $invsq2exp_min\n"; 64print "#define INVSQ2EXP_LOOKUP_MAX $invsq2exp_max\n"; 65print "static float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\\\n". 66 " INVSQ2EXP_LOOKUP_MIN+1]={\n"; 67 68for($i=$invsq2exp_min;$i<=$invsq2exp_max;){ 69 print "\t"; 70 for($j=0;$j<4 && $i<=$invsq2exp_max;$j++){ 71 printf "%15.10g,", 2**($i++*-.5); 72 } 73 print "\n"; 74} 75print "};\n\n#endif\n\n"; 76 77 78# 0 to -140 dB 79$fromdB2_sz=1<<$fromdB_shift; 80$fromdB_gran=1<<($fromdB_shift-$fromdB2_shift); 81print "#define FROMdB_LOOKUP_SZ $fromdB_sz\n"; 82print "#define FROMdB2_LOOKUP_SZ $fromdB2_sz\n"; 83print "#define FROMdB_SHIFT $fromdB_shift\n"; 84print "#define FROMdB2_SHIFT $fromdB2_shift\n"; 85print "#define FROMdB2_MASK ".((1<<$fromdB_shift)-1)."\n"; 86 87print "static float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={\n"; 88 89for($i=0;$i<$fromdB_sz;){ 90 print "\t"; 91 for($j=0;$j<4 && $i<$fromdB_sz;$j++){ 92 printf "%15.10g,", 10**(.05*(-$fromdB_gran*$i++)); 93 } 94 print "\n"; 95} 96print "};\n\n"; 97 98print "static float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={\n"; 99 100for($i=0;$i<$fromdB2_sz;){ 101 print "\t"; 102 for($j=0;$j<4 && $i<$fromdB_sz;$j++){ 103 printf "%15.10g,", 10**(.05*(-$fromdB_gran/$fromdB2_sz*(.5+$i++))); 104 } 105 print "\n"; 106} 107print "};\n\n#ifdef INT_LOOKUP\n\n"; 108 109 110$iisz=0x10000>>$invsq_i_shift; 111print "#define INVSQ_LOOKUP_I_SHIFT $invsq_i_shift\n"; 112print "#define INVSQ_LOOKUP_I_MASK ".(0x0ffff>>(16-$invsq_i_shift))."\n"; 113print "static long INVSQ_LOOKUP_I[$iisz+1]={\n"; 114for($i=0;$i<=$iisz;){ 115 print "\t"; 116 for($j=0;$j<4 && $i<=$iisz;$j++){ 117 my$indexmap=$i++/$iisz*.5+.5; 118 printf "%8d,", int(1./sqrt($indexmap)*65536.+.5); 119 } 120 print "\n"; 121} 122print "};\n\n"; 123 124$cisz=0x10000>>$cos_i_shift; 125print "#define COS_LOOKUP_I_SHIFT $cos_i_shift\n"; 126print "#define COS_LOOKUP_I_MASK ".(0x0ffff>>(16-$cos_i_shift))."\n"; 127print "#define COS_LOOKUP_I_SZ $cisz\n"; 128print "static long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={\n"; 129 130for($i=0;$i<=$cisz;){ 131 print "\t"; 132 for($j=0;$j<4 && $i<=$cisz;$j++){ 133 printf "%8d,", int(cos(3.14159265358979323846*($i++)/$cos_sz)*16384.+.5) ; 134 } 135 print "\n"; 136} 137print "};\n\n"; 138 139 140print "#endif\n\n#endif\n"; 141 142 143