[xiph-commits] r15937 - trunk/vorbis/lib

giles at svn.xiph.org giles at svn.xiph.org
Thu Apr 16 10:00:44 PDT 2009


Author: giles
Date: 2009-04-16 10:00:44 -0700 (Thu, 16 Apr 2009)
New Revision: 15937

Modified:
   trunk/vorbis/lib/floor1.c
   trunk/vorbis/lib/lookup_data.h
   trunk/vorbis/lib/lsp.c
   trunk/vorbis/lib/psy.c
Log:
Const-ify some static data tables.

Patch from eldar. Trac issue #1496.


Modified: trunk/vorbis/lib/floor1.c
===================================================================
--- trunk/vorbis/lib/floor1.c	2009-04-16 16:20:49 UTC (rev 15936)
+++ trunk/vorbis/lib/floor1.c	2009-04-16 17:00:44 UTC (rev 15937)
@@ -273,7 +273,7 @@
   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, 

Modified: trunk/vorbis/lib/lookup_data.h
===================================================================
--- trunk/vorbis/lib/lookup_data.h	2009-04-16 16:20:49 UTC (rev 15936)
+++ trunk/vorbis/lib/lookup_data.h	2009-04-16 17:00:44 UTC (rev 15937)
@@ -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 @@
 };
 
 #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 @@
 
 #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 @@
 #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 @@
 	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 @@
 
 #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 @@
 #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,

Modified: trunk/vorbis/lib/lsp.c
===================================================================
--- trunk/vorbis/lib/lsp.c	2009-04-16 16:20:49 UTC (rev 15936)
+++ trunk/vorbis/lib/lsp.c	2009-04-16 17:00:44 UTC (rev 15937)
@@ -118,21 +118,21 @@
                        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 */

Modified: trunk/vorbis/lib/psy.c
===================================================================
--- trunk/vorbis/lib/psy.c	2009-04-16 16:20:49 UTC (rev 15936)
+++ trunk/vorbis/lib/psy.c	2009-04-16 17:00:44 UTC (rev 15937)
@@ -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 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 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, 



More information about the commits mailing list