comparison src/sgiplay.c @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 74fd4e045ea6
children
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
361 #include "libst.h" 361 #include "libst.h"
362 #else /* not USE_MULAW_DECODE_TABLE */ 362 #else /* not USE_MULAW_DECODE_TABLE */
363 static int 363 static int
364 st_ulaw_to_linear (int u) 364 st_ulaw_to_linear (int u)
365 { 365 {
366 static const short table[] = {0,132,396,924,1980,4092,8316,16764}; 366 static CONST short table[] = {0,132,396,924,1980,4092,8316,16764};
367 int u1 = ~u; 367 int u1 = ~u;
368 short exponent = (u1 >> 4) & 0x07; 368 short exponent = (u1 >> 4) & 0x07;
369 int mantissa = u1 & 0x0f; 369 int mantissa = u1 & 0x0f;
370 int unsigned_result = table[exponent]+(mantissa << (exponent+3)); 370 int unsigned_result = table[exponent]+(mantissa << (exponent+3));
371 return u1 & 0x80 ? -unsigned_result : unsigned_result; 371 return u1 & 0x80 ? -unsigned_result : unsigned_result;