Commit 0185fc26 authored by Monty's avatar Monty

const-ify a few things that really ought to be.


git-svn-id: https://svn.xiph.org/trunk/Tremor@4010 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 049a9334
......@@ -39,7 +39,7 @@ typedef void vorbis_info_mapping;
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;
......
......@@ -94,7 +94,7 @@ static inline ogg_int32_t vorbis_coslook2_i(long a){
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 inline ogg_int32_t toBARK(int n){
}
}
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,
......
......@@ -216,7 +216,7 @@ static int render_point(int x0,int x1,int y0,int y1,int x){
}
}
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,
......
......@@ -95,7 +95,7 @@ int ogg_page_packets(ogg_page *og){
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,
......
......@@ -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 @@ static ogg_int32_t FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={
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 @@ static ogg_int32_t 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]={
92682, 91966, 91267, 90583,
89915, 89261, 88621, 87995,
87381, 86781, 86192, 85616,
......@@ -70,7 +70,7 @@ static long INVSQ_LOOKUP_I[64+1]={
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 @@ static long INVSQ_LOOKUP_IDel[64]={
#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,
......
......@@ -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 @@ STIN void mdct_butterfly_32(DATA_TYPE *x){
/* 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 @@ STIN void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift){
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 @@ void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out){
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;
......
......@@ -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 @@ static ogg_int32_t sincos_lookup0[1026] = {
};
/* {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,
......
......@@ -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 @@ static ogg_int32_t vwin64[32]={
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 @@ static ogg_int32_t vwin128[64]={
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 @@ static ogg_int32_t vwin256[128]={
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 @@ static ogg_int32_t vwin512[256]={
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 @@ static ogg_int32_t vwin1024[512]={
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 @@ static ogg_int32_t vwin2048[1024]={
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 @@ static ogg_int32_t vwin4096[2048]={
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 @@ static ogg_int32_t vwin8192[4096]={
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 @@ ogg_int32_t *_vorbis_window(int type, int left){
}
}
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];
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment