• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef foog711hfoo
2 #define foog711hfoo
3 
4 /* g711.h - include for G711 u-law and a-law conversion routines
5 **
6 ** Copyright (C) 2001 Chris Bagwell
7 **
8 ** Permission to use, copy, modify, and distribute this software and its
9 ** documentation for any purpose and without fee is hereby granted, provided
10 ** that the above copyright notice appear in all copies and that both that
11 ** copyright notice and this permission notice appear in supporting
12 ** documentation.  This software is provided "as is" without express or
13 ** implied warranty.
14 */
15 
16 /** Copied from sox -- Lennart Poettering */
17 
18 #include <inttypes.h>
19 
20 #ifdef FAST_ALAW_CONVERSION
21 extern uint8_t _st_13linear2alaw[0x2000];
22 extern int16_t _st_alaw2linear16[256];
23 #define st_13linear2alaw(sw) (_st_13linear2alaw[(sw + 0x1000)])
24 #define st_alaw2linear16(uc) (_st_alaw2linear16[uc])
25 #else
26 unsigned char st_13linear2alaw(int16_t pcm_val);
27 int16_t st_alaw2linear16(unsigned char);
28 #endif
29 
30 #ifdef FAST_ULAW_CONVERSION
31 extern uint8_t _st_14linear2ulaw[0x4000];
32 extern int16_t _st_ulaw2linear16[256];
33 #define st_14linear2ulaw(sw) (_st_14linear2ulaw[(sw + 0x2000)])
34 #define st_ulaw2linear16(uc) (_st_ulaw2linear16[uc])
35 #else
36 unsigned char st_14linear2ulaw(int16_t pcm_val);
37 int16_t st_ulaw2linear16(unsigned char);
38 #endif
39 
40 #endif
41