This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Defines | |
| #define | MINLIN -32768 |
| #define | MAXLIN 32767 |
| #define | LINCLIP(x) do { if ( x < MINLIN ) x = MINLIN ; else if ( x > MAXLIN ) x = MAXLIN; } while ( 0 ) |
Functions | |
| unsigned char | st_linear_to_ulaw (int sample) |
| int | st_ulaw_to_linear (unsigned char ulawbyte) |
| unsigned char | st_linear_to_Alaw (int sample) |
| int | st_Alaw_to_linear (unsigned char ulawbyte) |
| int st_Alaw_to_linear | ( | unsigned char | ulawbyte | ) |
Definition at line 2250 of file libst.c.
References sign.
Referenced by rawread().
02251 { 02252 static int exp_lut[8] = { 0, 264, 528, 1056, 2112, 4224, 8448, 16896 }; 02253 int sign, exponent, mantissa, sample; 02254 02255 Alawbyte ^= 0x55; 02256 sign = ( Alawbyte & 0x80 ); 02257 Alawbyte &= 0x7f; /* get magnitude */ 02258 if (Alawbyte >= 16) 02259 { 02260 exponent = (Alawbyte >> 4 ) & 0x07; 02261 mantissa = Alawbyte & 0x0F; 02262 sample = exp_lut[exponent] + ( mantissa << ( exponent + 3 ) ); 02263 } 02264 else 02265 sample = (Alawbyte << 4) + 8; 02266 if ( sign == 0 ) sample = -sample; 02267 02268 return sample; 02269 }
Here is the caller graph for this function:

| unsigned char st_linear_to_Alaw | ( | int | sample | ) |
Definition at line 2208 of file libst.c.
Referenced by rawwrite().
02209 { 02210 static int exp_lut[128] = {1,1,2,2,3,3,3,3, 02211 4,4,4,4,4,4,4,4, 02212 5,5,5,5,5,5,5,5, 02213 5,5,5,5,5,5,5,5, 02214 6,6,6,6,6,6,6,6, 02215 6,6,6,6,6,6,6,6, 02216 6,6,6,6,6,6,6,6, 02217 6,6,6,6,6,6,6,6, 02218 7,7,7,7,7,7,7,7, 02219 7,7,7,7,7,7,7,7, 02220 7,7,7,7,7,7,7,7, 02221 7,7,7,7,7,7,7,7, 02222 7,7,7,7,7,7,7,7, 02223 7,7,7,7,7,7,7,7, 02224 7,7,7,7,7,7,7,7, 02225 7,7,7,7,7,7,7,7}; 02226 02227 int sign, exponent, mantissa; 02228 unsigned char Alawbyte; 02229 02230 /* Get the sample into sign-magnitude. */ 02231 sign = ((~sample) >> 8) & 0x80; /* set aside the sign */ 02232 if ( sign == 0 ) sample = -sample; /* get magnitude */ 02233 if ( sample > ACLIP ) sample = ACLIP; /* clip the magnitude */ 02234 02235 /* Convert from 16 bit linear to ulaw. */ 02236 if (sample >= 256) 02237 { 02238 exponent = exp_lut[( sample >> 8 ) & 0x7F]; 02239 mantissa = ( sample >> ( exponent + 3 ) ) & 0x0F; 02240 Alawbyte = (( exponent << 4 ) | mantissa); 02241 } 02242 else 02243 Alawbyte = (sample >> 4); 02244 Alawbyte ^= (sign ^ 0x55); 02245 02246 return Alawbyte; 02247 }
Here is the caller graph for this function:

| unsigned char st_linear_to_ulaw | ( | int | sample | ) |
Definition at line 35 of file libst.c.
References sign, uBIAS, and uCLIP.
Referenced by rawwrite().
00036 { 00037 static int exp_lut[256] = {0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3, 00038 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 00039 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 00040 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 00041 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 00042 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 00043 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 00044 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 00045 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 00046 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 00047 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 00048 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 00049 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 00050 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 00051 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 00052 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}; 00053 int sign, exponent, mantissa; 00054 unsigned char ulawbyte; 00055 00056 /* Get the sample into sign-magnitude. */ 00057 sign = (sample >> 8) & 0x80; /* set aside the sign */ 00058 if ( sign != 0 ) sample = -sample; /* get magnitude */ 00059 if ( sample > uCLIP ) sample = uCLIP; /* clip the magnitude */ 00060 00061 /* Convert from 16 bit linear to ulaw. */ 00062 sample = sample + uBIAS; 00063 exponent = exp_lut[( sample >> 7 ) & 0xFF]; 00064 mantissa = ( sample >> ( exponent + 3 ) ) & 0x0F; 00065 ulawbyte = ~ ( sign | ( exponent << 4 ) | mantissa ); 00066 #ifdef ZEROTRAP 00067 if ( ulawbyte == 0 ) ulawbyte = 0x02; /* optional CCITT trap */ 00068 #endif 00069 00070 return ulawbyte; 00071 }
Here is the caller graph for this function:

| int st_ulaw_to_linear | ( | unsigned char | ulawbyte | ) |
Definition at line 90 of file libst.c.
References sign.
Referenced by rawread().
00091 { 00092 static int exp_lut[8] = { 0, 132, 396, 924, 1980, 4092, 8316, 16764 }; 00093 int sign, exponent, mantissa, sample; 00094 00095 ulawbyte = ~ ulawbyte; 00096 sign = ( ulawbyte & 0x80 ); 00097 exponent = ( ulawbyte >> 4 ) & 0x07; 00098 mantissa = ulawbyte & 0x0F; 00099 sample = exp_lut[exponent] + ( mantissa << ( exponent + 3 ) ); 00100 if ( sign != 0 ) sample = -sample; 00101 00102 return sample; 00103 }
Here is the caller graph for this function:

1.5.1