diff options
author | Ralph Giles <giles@xiph.org> | 2009-04-16 17:00:44 +0000 |
---|---|---|
committer | Ralph Giles <giles@xiph.org> | 2009-04-16 17:00:44 +0000 |
commit | 8513b4df9d01a4b11e4ab9d71e6cc22e16d6df17 (patch) | |
tree | 8eedea97ab979f8993e6c2df33bd06fac387a9fb | |
parent | 8ab5ace478ce4c64f9bf718f34787318f87bd759 (diff) | |
download | libvorbis-git-8513b4df9d01a4b11e4ab9d71e6cc22e16d6df17.tar.gz |
Const-ify some static data tables.
Patch from eldar. Trac issue #1496.
svn path=/trunk/vorbis/; revision=15937
-rw-r--r-- | lib/floor1.c | 2 | ||||
-rw-r--r-- | lib/lookup_data.h | 14 | ||||
-rw-r--r-- | lib/lsp.c | 6 | ||||
-rw-r--r-- | lib/psy.c | 8 |
4 files changed, 15 insertions, 15 deletions
diff --git a/lib/floor1.c b/lib/floor1.c index 7c09c7a5..8eb47b03 100644 --- a/lib/floor1.c +++ b/lib/floor1.c @@ -273,7 +273,7 @@ static int vorbis_dBquant(const float *x){ return i; } -static float FLOOR1_fromdB_LOOKUP[256]={ +static const float FLOOR1_fromdB_LOOKUP[256]={ 1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, 1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, 1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, diff --git a/lib/lookup_data.h b/lib/lookup_data.h index bae04241..dc3b2e3b 100644 --- a/lib/lookup_data.h +++ b/lib/lookup_data.h @@ -19,7 +19,7 @@ #ifdef FLOAT_LOOKUP #define COS_LOOKUP_SZ 128 -static float COS_LOOKUP[COS_LOOKUP_SZ+1]={ +static const float COS_LOOKUP[COS_LOOKUP_SZ+1]={ +1.0000000000000f,+0.9996988186962f,+0.9987954562052f,+0.9972904566787f, +0.9951847266722f,+0.9924795345987f,+0.9891765099648f,+0.9852776423889f, +0.9807852804032f,+0.9757021300385f,+0.9700312531945f,+0.9637760657954f, @@ -56,7 +56,7 @@ static float COS_LOOKUP[COS_LOOKUP_SZ+1]={ }; #define INVSQ_LOOKUP_SZ 32 -static float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={ +static const float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={ 1.414213562373f,1.392621247646f,1.371988681140f,1.352246807566f, 1.333333333333f,1.315191898443f,1.297771369046f,1.281025230441f, 1.264911064067f,1.249390095109f,1.234426799697f,1.219988562661f, @@ -70,7 +70,7 @@ static float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={ #define INVSQ2EXP_LOOKUP_MIN (-32) #define INVSQ2EXP_LOOKUP_MAX 32 -static float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\ +static const float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\ INVSQ2EXP_LOOKUP_MIN+1]={ 65536.f, 46340.95001f, 32768.f, 23170.47501f, 16384.f, 11585.2375f, 8192.f, 5792.618751f, @@ -100,7 +100,7 @@ static float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\ #define FROMdB2_MASK 31 #ifdef FLOAT_LOOKUP -static float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={ +static const float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={ 1.f, 0.6309573445f, 0.3981071706f, 0.2511886432f, 0.1584893192f, 0.1f, 0.06309573445f, 0.03981071706f, 0.02511886432f, 0.01584893192f, 0.01f, 0.006309573445f, @@ -112,7 +112,7 @@ static float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={ 3.981071706e-07f,2.511886432e-07f,1.584893192e-07f, }; -static float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={ +static const float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={ 0.9928302478f, 0.9786445908f, 0.9646616199f, 0.9508784391f, 0.9372921937f, 0.92390007f, 0.9106992942f, 0.8976871324f, 0.8848608897f, 0.8722179097f, 0.8597555737f, 0.8474713009f, @@ -128,7 +128,7 @@ static float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={ #define INVSQ_LOOKUP_I_SHIFT 10 #define INVSQ_LOOKUP_I_MASK 1023 -static long INVSQ_LOOKUP_I[64+1]={ +static const long INVSQ_LOOKUP_I[64+1]={ 92682l, 91966l, 91267l, 90583l, 89915l, 89261l, 88621l, 87995l, 87381l, 86781l, 86192l, 85616l, @@ -151,7 +151,7 @@ static long INVSQ_LOOKUP_I[64+1]={ #define COS_LOOKUP_I_SHIFT 9 #define COS_LOOKUP_I_MASK 511 #define COS_LOOKUP_I_SZ 128 -static long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={ +static const long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={ 16384l, 16379l, 16364l, 16340l, 16305l, 16261l, 16207l, 16143l, 16069l, 15986l, 15893l, 15791l, @@ -118,21 +118,21 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m, compilers (like gcc) that can't inline across modules */ -static int MLOOP_1[64]={ +static const int MLOOP_1[64]={ 0,10,11,11, 12,12,12,12, 13,13,13,13, 13,13,13,13, 14,14,14,14, 14,14,14,14, 14,14,14,14, 14,14,14,14, 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, }; -static int MLOOP_2[64]={ +static const int MLOOP_2[64]={ 0,4,5,5, 6,6,6,6, 7,7,7,7, 7,7,7,7, 8,8,8,8, 8,8,8,8, 8,8,8,8, 8,8,8,8, 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9, }; -static int MLOOP_3[8]={0,1,2,2,3,3,3,3}; +static const int MLOOP_3[8]={0,1,2,2,3,3,3,3}; /* side effect: changes *lsp to cosines of lsp */ @@ -30,8 +30,8 @@ #include "misc.h" #define NEGINF -9999.f -static double stereo_threshholds[]={0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10}; -static double stereo_threshholds_limited[]={0.0, .5, 1.0, 1.5, 2.0, 2.5, 4.5, 8.5, 9e10}; +static const double stereo_threshholds[]={0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10}; +static const double stereo_threshholds_limited[]={0.0, .5, 1.0, 1.5, 2.0, 2.5, 4.5, 8.5, 9e10}; vorbis_look_psy_global *_vp_global_look(vorbis_info *vi){ codec_setup_info *ci=vi->codec_setup; @@ -696,7 +696,7 @@ static void bark_noise_hybridmp(int n,const long *b, } } -static float FLOOR1_fromdB_INV_LOOKUP[256]={ +static const float FLOOR1_fromdB_INV_LOOKUP[256]={ 0.F, 8.81683e+06F, 8.27882e+06F, 7.77365e+06F, 7.29930e+06F, 6.85389e+06F, 6.43567e+06F, 6.04296e+06F, 5.67422e+06F, 5.32798e+06F, 5.00286e+06F, 4.69759e+06F, @@ -946,7 +946,7 @@ static void couple_lossless(float A, float B, } } -static float hypot_lookup[32]={ +static const float hypot_lookup[32]={ -0.009935, -0.011245, -0.012726, -0.014397, -0.016282, -0.018407, -0.020800, -0.023494, -0.026522, -0.029923, -0.033737, -0.038010, |