Mercurial > audlegacy
annotate src/libSAD/SFMT-params.h @ 4887:0ddbd0025174 default tip
added libaudtag. (not used yet.)
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Wed, 05 May 2010 18:26:06 +0900 |
parents | 704607c1f858 |
children |
rev | line source |
---|---|
4232
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
1 #ifndef SFMT_PARAMS_H |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
2 #define SFMT_PARAMS_H |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
3 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
4 #if !defined(MEXP) |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
5 #ifdef __GNUC__ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
6 #warning "MEXP is not defined. I assume MEXP is 19937." |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
7 #endif |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
8 #define MEXP 19937 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
9 #endif |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
10 /*----------------- |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
11 BASIC DEFINITIONS |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
12 -----------------*/ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
13 /** Mersenne Exponent. The period of the sequence |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
14 * is a multiple of 2^MEXP-1. |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
15 * #define MEXP 19937 */ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
16 /** SFMT generator has an internal state array of 128-bit integers, |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
17 * and N is its size. */ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
18 #define N (MEXP / 128 + 1) |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
19 /** N32 is the size of internal state array when regarded as an array |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
20 * of 32-bit integers.*/ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
21 #define N32 (N * 4) |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
22 /** N64 is the size of internal state array when regarded as an array |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
23 * of 64-bit integers.*/ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
24 #define N64 (N * 2) |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
25 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
26 /*---------------------- |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
27 the parameters of SFMT |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
28 following definitions are in paramsXXXX.h file. |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
29 ----------------------*/ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
30 /** the pick up position of the array. |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
31 #define POS1 122 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
32 */ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
33 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
34 /** the parameter of shift left as four 32-bit registers. |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
35 #define SL1 18 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
36 */ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
37 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
38 /** the parameter of shift left as one 128-bit register. |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
39 * The 128-bit integer is shifted by (SL2 * 8) bits. |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
40 #define SL2 1 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
41 */ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
42 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
43 /** the parameter of shift right as four 32-bit registers. |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
44 #define SR1 11 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
45 */ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
46 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
47 /** the parameter of shift right as one 128-bit register. |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
48 * The 128-bit integer is shifted by (SL2 * 8) bits. |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
49 #define SR2 1 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
50 */ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
51 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
52 /** A bitmask, used in the recursion. These parameters are introduced |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
53 * to break symmetry of SIMD. |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
54 #define MSK1 0xdfffffefU |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
55 #define MSK2 0xddfecb7fU |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
56 #define MSK3 0xbffaffffU |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
57 #define MSK4 0xbffffff6U |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
58 */ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
59 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
60 /** These definitions are part of a 128-bit period certification vector. |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
61 #define PARITY1 0x00000001U |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
62 #define PARITY2 0x00000000U |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
63 #define PARITY3 0x00000000U |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
64 #define PARITY4 0xc98e126aU |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
65 */ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
66 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
67 #if MEXP == 607 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
68 #include "SFMT-params607.h" |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
69 #elif MEXP == 1279 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
70 #include "SFMT-params1279.h" |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
71 #elif MEXP == 2281 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
72 #include "SFMT-params2281.h" |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
73 #elif MEXP == 4253 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
74 #include "SFMT-params4253.h" |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
75 #elif MEXP == 11213 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
76 #include "SFMT-params11213.h" |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
77 #elif MEXP == 19937 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
78 #include "SFMT-params19937.h" |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
79 #elif MEXP == 44497 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
80 #include "SFMT-params44497.h" |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
81 #elif MEXP == 86243 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
82 #include "SFMT-params86243.h" |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
83 #elif MEXP == 132049 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
84 #include "SFMT-params132049.h" |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
85 #elif MEXP == 216091 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
86 #include "SFMT-params216091.h" |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
87 #else |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
88 #ifdef __GNUC__ |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
89 #error "MEXP is not valid." |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
90 #undef MEXP |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
91 #else |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
92 #undef MEXP |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
93 #endif |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
94 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
95 #endif |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
96 |
704607c1f858
1st attempt to integrate dithering and RG engine
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
diff
changeset
|
97 #endif /* SFMT_PARAMS_H */ |