23 #ifndef _ASTERISK_ALAW_H 24 #define _ASTERISK_ALAW_H 32 #define AST_ALAW_BIT_LOSS 4 33 #define AST_ALAW_STEP (1 << AST_ALAW_BIT_LOSS) 34 #define AST_ALAW_TAB_SIZE (32768 / AST_ALAW_STEP + 1) 35 #define AST_ALAW_SIGN_BIT 0x80 36 #define AST_ALAW_AMI_MASK 0x55 40 #ifndef G711_NEW_ALGORITHM 49 #ifndef G711_NEW_ALGORITHM 50 #define AST_LIN2A(a) (__ast_lin2a[((unsigned short)(a)) >> 3]) 52 #define AST_LIN2A_LOOKUP(mag) \ 53 __ast_lin2a[(mag) >> AST_ALAW_BIT_LOSS] 56 static inline void ast_alaw_get_sign_mag(
short sample,
unsigned *sign,
unsigned *mag)
62 #if defined(G711_REDUCED_BRANCHING) 64 unsigned dual_mag = (-sample << 16) | (
unsigned short)sample;
65 *mag = (dual_mag >> (*sign >> 3)) & 0xffffU;
76 static inline unsigned char AST_LIN2A(
short sample)
79 ast_alaw_get_sign_mag(sample, &sign, &mag);
84 #define AST_ALAW(a) (__ast_alaw[(int)(a)])
unsigned char __ast_lin2a[8192]
converts signed linear to alaw
#define AST_ALAW_AMI_MASK
void ast_alaw_init(void)
To init the alaw to slinear conversion stuff, this needs to be run.
#define AST_ALAW_SIGN_BIT
#define AST_ALAW_TAB_SIZE