| 2133 | #endif |
| 2134 | |
| 2135 | void init_ramps() { |
| 2136 | #ifdef USE_RAMPS |
| 2137 | int clog, bits; |
| 2138 | int in_data; // p1; |
| 2139 | int p2; |
| 2140 | int i; |
| 2141 | int o1, o2; |
| 2142 | |
| 2143 | if (g_init_ramps > 0) { |
| 2144 | g_init_ramps++; |
| 2145 | return; |
| 2146 | } |
| 2147 | |
| 2148 | mtx.lock(); |
| 2149 | |
| 2150 | |
| 2151 | // sp_datap = (SP_DATA **)malloc(SP_ERRIDX_MAX*sizeof(struct SP_DATA)); |
| 2152 | // assert(sp_datap); |
| 2153 | // for (int i = 0; i < SP_ERRIDX_MAX; i++) |
| 2154 | // { |
| 2155 | // sp_datap[i] = (SP_DATA *)malloc(sizeof(struct SP_DATA)); |
| 2156 | // } |
| 2157 | |
| 2158 | #ifndef USE_NEWRAMP |
| 2159 | |
| 2160 | for (bits = BIT_BASE; bits < BIT_RANGE; bits++) |
| 2161 | for (p1 = 0; p1 < (1 << bits); p1++) { |
| 2162 | ep_d[BTT(bits)][p1] = (float)expandbits_(bits, p1); |
| 2163 | } |
| 2164 | |
| 2165 | |
| 2166 | for (clog = LOG_CL_BASE; clog < LOG_CL_RANGE; clog++) |
| 2167 | for (bits = BIT_BASE; bits < BIT_RANGE; bits++) |
| 2168 | for (p1 = 0; p1 < (1 << bits); p1++) |
| 2169 | for (p2 = 0; p2 < (1 << bits); p2++) { |
| 2170 | for (o1 = 0; o1 < (1 << clog); o1++) { |
| 2171 | ramp[CLT(clog)][BTT(bits)][p1][p2][o1] = |
| 2172 | floorf((float)ep_d[BTT(bits)][p1] + rampLerpWeights[clog][o1] * (float)((ep_d[BTT(bits)][p2] - ep_d[BTT(bits)][p1])) + 0.5F); |
| 2173 | } |
| 2174 | } |
| 2175 | #endif |
| 2176 | |
| 2177 | //----------------------------------------------------------------------------- |
| 2178 | // Step 1 |
| 2179 | |
| 2180 | for (clog = LOG_CL_BASE; clog<LOG_CL_RANGE; clog++) |
| 2181 | for (bits = BIT_BASE; bits<BIT_RANGE; bits++) |
| 2182 | for (in_data = 0; in_data<SP_ERRIDX_MAX; in_data++) |
| 2183 | for (o1 = 0; o1<2; o1++) |
| 2184 | for (o2 = 0; o2<2; o2++) |
| 2185 | for (i = 0; i<16; i++) { |
| 2186 | sp_data[in_data].sp_err[CLT(clog)][BTT(bits)][o1][o2][i] = FLT_MAX; |
| 2187 | sp_data[in_data].sp_idx[CLT(clog)][BTT(bits)][o1][o2][i][0] = -1; |
| 2188 | } |
| 2189 | |
| 2190 | // Step 2 |
| 2191 | for (clog = LOG_CL_BASE; clog<LOG_CL_RANGE; clog++) |
| 2192 | for (bits = BIT_BASE; bits<BIT_RANGE; bits++) |
nothing calls this directly
no test coverage detected