Changeset 4112:215f5e16823a in roaraudio
- Timestamp:
- 08/06/10 16:46:06 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroardsp/convert.c
r4111 r4112 1229 1229 1230 1230 if ( (int)pos_in == 0 ) { 1231 y[0] = ip[ c];1232 y[1] = ip[ channels + c];1231 y[0] = ip[0 * channels + c]; 1232 y[1] = ip[1 * channels + c]; 1233 1233 y[2] = ip[2 * channels + c]; 1234 1234 x_val = pos_in; … … 1237 1237 * We will assume this value, by linearly extrapolating the two preceding values. From causual testing, this is not audible. */ 1238 1238 y[0] = ip[((int)pos_in - 1) * channels + c]; 1239 y[1] = ip[( int)pos_in* channels + c];1239 y[1] = ip[((int)pos_in ) * channels + c]; 1240 1240 y[2] = y[1] * 2.0 - y[0]; 1241 /* We have to clip this value. */1242 if ( (int32_t)y[2] > 0x7FFE )1243 y[2] = 0x7FFE;1244 else if ( (int32_t)y[2] < -0x7FFE )1245 y[2] = -0x7FFE;1246 1247 1241 x_val = pos_in - (int)pos_in + 1.0; 1248 1242 } else { 1249 1243 y[0] = ip[((int)pos_in - 1) * channels + c]; 1250 y[1] = ip[( int)pos_in* channels + c];1244 y[1] = ip[((int)pos_in ) * channels + c]; 1251 1245 y[2] = ip[((int)pos_in + 1) * channels + c]; 1252 1246 x_val = pos_in - (int)pos_in + 1.0; … … 1257 1251 int32_t temp = (int32_t)(poly[2]*x_val*x_val + poly[1]*x_val + poly[0] + 0.5); 1258 1252 /* temp could be out of bounds, so need to check this */ 1259 if (temp > 0x7FFE ) 1260 out[x * channels + c] = 0x7FFE;1261 else if (temp < -0x7FFE)1253 if (temp > 0x7FFE ) { 1254 out[x * channels + c] = 0x7FFE; 1255 } else if (temp < -0x7FFE) { 1262 1256 out[x * channels + c] = -0x7FFE; 1263 else1257 } else { 1264 1258 out[x * channels + c] = (int16_t)temp; 1259 } 1265 1260 } 1266 1261 }
Note: See TracChangeset
for help on using the changeset viewer.