Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

ulaw.c File Reference

#include <asterisk/ulaw.h>

Include dependency graph for ulaw.c:

Include dependency graph

Go to the source code of this file.

Defines

#define ZEROTRAP   /* turn on the trap as per the MIL-STD */
#define BIAS   0x84 /* define the add-in bias for 16 bit samples */
#define CLIP   32635

Functions

void ast_ulaw_init (void)
 Init the ulaw conversion stuff.


Variables

unsigned char __ast_lin2mu [16384]
 converts signed linear to mulaw

short __ast_mulaw [256]
 help


Define Documentation

#define BIAS   0x84 /* define the add-in bias for 16 bit samples */
 

Definition at line 17 of file ulaw.c.

#define CLIP   32635
 

Definition at line 18 of file ulaw.c.

#define ZEROTRAP   /* turn on the trap as per the MIL-STD */
 

Definition at line 16 of file ulaw.c.


Function Documentation

void ast_ulaw_init void   ) 
 

Init the ulaw conversion stuff.

To init the ulaw to slinear conversion stuff, this needs to be run.

Definition at line 62 of file ulaw.c.

References __ast_lin2mu, and __ast_mulaw.

Referenced by main().

00063 { 00064 int i; 00065 /* 00066 * Set up mu-law conversion table 00067 */ 00068 for(i = 0;i < 256;i++) 00069 { 00070 short mu,e,f,y; 00071 static short etab[]={0,132,396,924,1980,4092,8316,16764}; 00072 00073 mu = 255-i; 00074 e = (mu & 0x70)/16; 00075 f = mu & 0x0f; 00076 y = f * (1 << (e + 3)); 00077 y += etab[e]; 00078 if (mu & 0x80) y = -y; 00079 __ast_mulaw[i] = y; 00080 } 00081 /* set up the reverse (mu-law) conversion table */ 00082 for(i = -32768; i < 32768; i++) 00083 { 00084 __ast_lin2mu[((unsigned short)i) >> 2] = linear2ulaw(i); 00085 } 00086 00087 }


Variable Documentation

unsigned char __ast_lin2mu[16384]
 

converts signed linear to mulaw

Definition at line 20 of file ulaw.c.

Referenced by ast_ulaw_init().

short __ast_mulaw[256]
 

help

Definition at line 21 of file ulaw.c.

Referenced by ast_ulaw_init().


Generated on Sat Jun 12 16:41:49 2004 for Asterisk by doxygen 1.3.7