[xiph-cvs] cvs commit: Tremor codec_internal.h floor0.c floor1.c framing.c lsp_lookup.h mdct.c mdct_lookup.h window.c window.h

Monty xiphmont at xiph.org
Wed Oct 16 01:10:09 PDT 2002



xiphmont    02/10/16 04:10:09

  Modified:    .        codec_internal.h floor0.c floor1.c framing.c
                        lsp_lookup.h mdct.c mdct_lookup.h window.c window.h
  Log:
  const-ify a few things that really ought to be.

Revision  Changes    Path
1.4       +1 -1      Tremor/codec_internal.h

Index: codec_internal.h
===================================================================
RCS file: /usr/local/cvsroot/Tremor/codec_internal.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- codec_internal.h	16 Oct 2002 07:39:56 -0000	1.3
+++ codec_internal.h	16 Oct 2002 08:10:08 -0000	1.4
@@ -39,7 +39,7 @@
 
 typedef struct private_state {
   /* local lookup storage */
-  ogg_int32_t               *window[2];
+  const ogg_int32_t      *window[2];
 
   /* backend lookups are tied to the mode, not the backend or naked mapping */
   int                     modebits;

<p><p>1.3       +4 -4      Tremor/floor0.c

Index: floor0.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/floor0.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- floor0.c	3 Sep 2002 03:15:19 -0000	1.2
+++ floor0.c	16 Oct 2002 08:10:08 -0000	1.3
@@ -94,7 +94,7 @@
   return(a);
 }
 
-static int barklook[28]={
+static const int barklook[28]={
   0,100,200,301,          405,516,635,766,
   912,1077,1263,1476,     1720,2003,2333,2721,
   3184,3742,4428,5285,    6376,7791,9662,12181,
@@ -117,21 +117,21 @@
   }
 }
 
-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};
 
 void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln,
                          ogg_int32_t *lsp,int m,

<p><p>1.3       +1 -1      Tremor/floor1.c

Index: floor1.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/floor1.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- floor1.c	3 Sep 2002 03:15:19 -0000	1.2
+++ floor1.c	16 Oct 2002 08:10:08 -0000	1.3
@@ -216,7 +216,7 @@
   }
 }
 
-static ogg_int32_t FLOOR_fromdB_LOOKUP[256]={
+static const ogg_int32_t FLOOR_fromdB_LOOKUP[256]={
   0x000000e5, 0x000000f4, 0x00000103, 0x00000114,
   0x00000126, 0x00000139, 0x0000014e, 0x00000163,
   0x0000017a, 0x00000193, 0x000001ad, 0x000001c9,

<p><p>1.3       +1 -1      Tremor/framing.c

Index: framing.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/framing.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- framing.c	3 Sep 2002 03:15:19 -0000	1.2
+++ framing.c	16 Oct 2002 08:10:08 -0000	1.3
@@ -95,7 +95,7 @@
   return(count);
 }
 
-static ogg_uint32_t crc_lookup[256]={
+static const ogg_uint32_t crc_lookup[256]={
   0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9,
   0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005,
   0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61,

<p><p>1.3       +5 -5      Tremor/lsp_lookup.h

Index: lsp_lookup.h
===================================================================
RCS file: /usr/local/cvsroot/Tremor/lsp_lookup.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- lsp_lookup.h	3 Sep 2002 03:15:19 -0000	1.2
+++ lsp_lookup.h	16 Oct 2002 08:10:08 -0000	1.3
@@ -26,7 +26,7 @@
 #define FROMdB2_SHIFT 3
 #define FROMdB2_MASK 31
 
-static ogg_int32_t FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={
+static const ogg_int32_t FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={
   0x003fffff, 0x0028619b, 0x00197a96, 0x0010137a,
   0x000a24b0, 0x00066666, 0x000409c3, 0x00028c42,
   0x00019b8c, 0x000103ab, 0x0000a3d7, 0x00006760,
@@ -37,7 +37,7 @@
   0x0000000b, 0x00000007, 0x00000004, 0x00000003,
   0x00000002, 0x00000001, 0x00000001};
 
-static ogg_int32_t FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={
+static const ogg_int32_t FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={
   0x000001fc, 0x000001f5, 0x000001ee, 0x000001e7,
   0x000001e0, 0x000001d9, 0x000001d2, 0x000001cc,
   0x000001c5, 0x000001bf, 0x000001b8, 0x000001b2,
@@ -50,7 +50,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]={
            92682,   91966,   91267,   90583,
            89915,   89261,   88621,   87995,
            87381,   86781,   86192,   85616,
@@ -70,7 +70,7 @@
            65536,
 };
 
-static long INVSQ_LOOKUP_IDel[64]={
+static const long INVSQ_LOOKUP_IDel[64]={
              716,     699,     684,     668,
              654,     640,     626,     614,
              600,     589,     576,     565,
@@ -92,7 +92,7 @@
 #define COS_LOOKUP_I_SHIFT 9
 #define COS_LOOKUP_I_MASK 511
 #define COS_LOOKUP_I_SZ 128
-static ogg_int32_t COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={
+static const ogg_int32_t COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={
            16384,   16379,   16364,   16340,
            16305,   16261,   16207,   16143,
            16069,   15986,   15893,   15791,

<p><p>1.7       +6 -6      Tremor/mdct.c

Index: mdct.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/mdct.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- mdct.c	16 Oct 2002 07:39:56 -0000	1.6
+++ mdct.c	16 Oct 2002 08:10:08 -0000	1.7
@@ -13,7 +13,7 @@
 
  function: normalized modified discrete cosine transform
            power of two length transform only [64 <= n ]
- last mod: $Id: mdct.c,v 1.6 2002/10/16 07:39:56 xiphmont Exp $
+ last mod: $Id: mdct.c,v 1.7 2002/10/16 08:10:08 xiphmont Exp $
 
  Original algorithm adapted long ago from _The use of multirate filter
  banks for coding of high quality digital audio_, by T. Sporer,
@@ -151,7 +151,7 @@
 /* N/stage point generic N stage butterfly (in place, 2 register) */
 STIN void mdct_butterfly_generic(DATA_TYPE *x,int points,int step){
 
-  DATA_TYPE *T         = sincos_lookup0;
+  const DATA_TYPE *T   = sincos_lookup0;
   DATA_TYPE *x1        = x + points      - 8;
   DATA_TYPE *x2        = x + (points>>1) - 8;
   REG_TYPE   r0;
@@ -261,8 +261,8 @@
   int          bit   = 0;
   DATA_TYPE   *w0    = x;
   DATA_TYPE   *w1    = x = w0+(n>>1);
-  DATA_TYPE   *T     = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
-  DATA_TYPE   *Ttop  = T+1024;
+  const DATA_TYPE *T = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
+  const DATA_TYPE *Ttop  = T+1024;
   DATA_TYPE    r2;
 
   do{
@@ -346,8 +346,8 @@
   int n4=n>>2;
   DATA_TYPE *iX;
   DATA_TYPE *oX;
-  DATA_TYPE *T;
-  DATA_TYPE *V;
+  const DATA_TYPE *T;
+  const DATA_TYPE *V;
   int shift;
   int step;
 

<p><p>1.6       +2 -2      Tremor/mdct_lookup.h

Index: mdct_lookup.h
===================================================================
RCS file: /usr/local/cvsroot/Tremor/mdct_lookup.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- mdct_lookup.h	20 Sep 2002 00:10:31 -0000	1.5
+++ mdct_lookup.h	16 Oct 2002 08:10:08 -0000	1.6
@@ -17,7 +17,7 @@
 
 
 /* {sin(2*i*PI/4096), cos(2*i*PI/4096)}, with i = 0 to 512 */
-static ogg_int32_t sincos_lookup0[1026] = {
+static const ogg_int32_t sincos_lookup0[1026] = {
   0x00000000, 0x7fffffff, 0x003243f5, 0x7ffff621, 0x006487e3, 0x7fffd886,
   0x0096cbc1, 0x7fffa72c, 0x00c90f88, 0x7fff6216, 0x00fb5330, 0x7fff0943,
   0x012d96b1, 0x7ffe9cb2, 0x015fda03, 0x7ffe1c65, 0x01921d20, 0x7ffd885a,
@@ -192,7 +192,7 @@
 };
 
 /* {sin((2*i+1)*PI/4096), cos((2*i+1)*PI/4096)}, with i = 0 to 511 */
-static ogg_int32_t sincos_lookup1[1024] = {
+static const ogg_int32_t sincos_lookup1[1024] = {
   0x001921fb, 0x7ffffd88, 0x004b65ee, 0x7fffe9cb, 0x007da9d4, 0x7fffc251,
   0x00afeda8, 0x7fff8719, 0x00e23160, 0x7fff3824, 0x011474f6, 0x7ffed572,
   0x0146b860, 0x7ffe5f03, 0x0178fb99, 0x7ffdd4d7, 0x01ab3e97, 0x7ffd36ee,

<p><p>1.3       +12 -11    Tremor/window.c

Index: window.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/window.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- window.c	3 Sep 2002 03:15:19 -0000	1.2
+++ window.c	16 Oct 2002 08:10:09 -0000	1.3
@@ -20,7 +20,7 @@
 #include "os.h"
 #include "misc.h"
 
-static ogg_int32_t vwin64[32]={
+static const ogg_int32_t vwin64[32]={
   0x001f0003, 0x01168c98, 0x030333c8, 0x05dfe3a4, 
   0x09a49562, 0x0e45df18, 0x13b47ef2, 0x19dcf676, 
   0x20a74d83, 0x27f7137c, 0x2fabb05a, 0x37a11059, 
@@ -31,7 +31,7 @@
   0x7fdd78a4, 0x7ff6ec6c, 0x7ffed0e8, 0x7ffffc3e, 
 };
 
-static ogg_int32_t vwin128[64]={
+static const ogg_int32_t vwin128[64]={
   0x0007c04d, 0x0045bb89, 0x00c18b87, 0x017ae294, 
   0x02714a4e, 0x03a4217a, 0x05129952, 0x06bbb24f, 
   0x089e38a1, 0x0ab8c073, 0x0d09a228, 0x0f8ef6bd, 
@@ -50,7 +50,7 @@
   0x7ffdcf38, 0x7fff6dab, 0x7fffed00, 0x7fffffc3, 
 };
 
-static ogg_int32_t vwin256[128]={
+static const ogg_int32_t vwin256[128]={
   0x0001f018, 0x00117066, 0x00306e9e, 0x005ee5f1, 
   0x009ccf26, 0x00ea208b, 0x0146cdea, 0x01b2c87f, 
   0x022dfedf, 0x02b85ced, 0x0351cbbd, 0x03fa317f, 
@@ -85,7 +85,7 @@
   0x7fffdcd1, 0x7ffff6d5, 0x7ffffecf, 0x7ffffffb, 
 };
 
-static ogg_int32_t vwin512[256]={
+static const ogg_int32_t vwin512[256]={
   0x00007c06, 0x00045c32, 0x000c1c62, 0x0017bc4c, 
   0x00273b7a, 0x003a9955, 0x0051d51c, 0x006cede7, 
   0x008be2a9, 0x00aeb22a, 0x00d55b0d, 0x00ffdbcc, 
@@ -152,7 +152,7 @@
   0x7ffffdcc, 0x7fffff6c, 0x7fffffec, 0x7fffffff, 
   };
 
-static ogg_int32_t vwin1024[512]={
+static const ogg_int32_t vwin1024[512]={
   0x00001f02, 0x0001170e, 0x00030724, 0x0005ef40, 
   0x0009cf59, 0x000ea767, 0x0014775e, 0x001b3f2e, 
   0x0022fec8, 0x002bb618, 0x00356508, 0x00400b81, 
@@ -283,7 +283,7 @@
   0x7fffffdc, 0x7ffffff6, 0x7ffffffe, 0x7fffffff, 
 };
 
-static ogg_int32_t vwin2048[1024]={
+static const ogg_int32_t vwin2048[1024]={
   0x000007c0, 0x000045c4, 0x0000c1ca, 0x00017bd3, 
   0x000273de, 0x0003a9eb, 0x00051df9, 0x0006d007, 
   0x0008c014, 0x000aee1e, 0x000d5a25, 0x00100428, 
@@ -542,7 +542,7 @@
   0x7ffffffd, 0x7ffffffe, 0x7fffffff, 0x7fffffff, 
 };
 
-static ogg_int32_t vwin4096[2048]={
+static const ogg_int32_t vwin4096[2048]={
   0x000001f0, 0x00001171, 0x00003072, 0x00005ef5, 
   0x00009cf8, 0x0000ea7c, 0x00014780, 0x0001b405, 
   0x0002300b, 0x0002bb91, 0x00035698, 0x0004011e, 
@@ -1057,7 +1057,7 @@
   0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff, 
 };
 
-static ogg_int32_t vwin8192[4096]={
+static const ogg_int32_t vwin8192[4096]={
   0x0000007c, 0x0000045c, 0x00000c1d, 0x000017bd, 
   0x0000273e, 0x00003a9f, 0x000051e0, 0x00006d02, 
   0x00008c03, 0x0000aee5, 0x0000d5a7, 0x00010049, 
@@ -2084,7 +2084,7 @@
   0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff, 
 };
 
-ogg_int32_t *_vorbis_window(int type, int left){
+const ogg_int32_t *_vorbis_window(int type, int left){
 
   switch(type){
   case 0:
@@ -2115,9 +2115,10 @@
   }
 }
 
-void _vorbis_apply_window(ogg_int32_t *d,ogg_int32_t *window[2],long *blocksizes,
+void _vorbis_apply_window(ogg_int32_t *d,const ogg_int32_t *window[2],
+			  long *blocksizes,
                           int lW,int W,int nW){
-
+  
   long n=blocksizes[W];
   long ln=blocksizes[lW];
   long rn=blocksizes[nW];

<p><p>1.3       +2 -2      Tremor/window.h

Index: window.h
===================================================================
RCS file: /usr/local/cvsroot/Tremor/window.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- window.h	3 Sep 2002 03:15:19 -0000	1.2
+++ window.h	16 Oct 2002 08:10:09 -0000	1.3
@@ -18,8 +18,8 @@
 #ifndef _V_WINDOW_
 #define _V_WINDOW_
 
-extern ogg_int32_t *_vorbis_window(int type,int left);
-extern void _vorbis_apply_window(ogg_int32_t *d,ogg_int32_t *window[2],
+extern const ogg_int32_t *_vorbis_window(int type,int left);
+extern void _vorbis_apply_window(ogg_int32_t *d,const ogg_int32_t *window[2],
                                  long *blocksizes,
                                  int lW,int W,int nW);
 

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list