dmG711(3dm)
dmG711MulawEncode, dmG711MulawDecode, dmG711MulawZeroTrapEncode, dmG711MulawZeroTrapDecode, dmG711AlawEncode, dmG711AlawDecode, dmG711MulawToAlaw, dmG711AlawToMulaw, dmSunMulawEncode, dmSunMulawDecode, dmNeXTMulawEncode, dmNeXTMulawDecode - G.711 mu-law, A-law conversion routines
As shipped in IRIX 6.5.19. Unchanged since IRIX 6.5.
NAME dmG711MulawEncode, dmG711MulawDecode, dmG711MulawZeroTrapEncode, dmG711MulawZeroTrapDecode, dmG711AlawEncode, dmG711AlawDecode, dmG711MulawToAlaw, dmG711AlawToMulaw, dmSunMulawEncode, dmSunMulawDecode, dmNeXTMulawEncode, dmNeXTMulawDecode - G.711 mu-law, A-law conversion routines SYNOPSIS #include <dmedia/dm_audioutil.h> void dmG711MulawEncode(short *samples, unsigned char *mulawdata, int numsamples) void dmG711MulawDecode(unsigned char *mulawdata, short *samples, int numsamples) void dmG711MulawZeroTrapEncode(short *samples, unsigned char *mulawdata, int numsamples) void dmG711MulawZeroTrapDecode(unsigned char *mulawdata, short *samples, int numsamples) void dmG711AlawEncode(short *samples, unsigned char *Alawdata, int numsamples) void dmG711AlawDecode(unsigned char *Alawdata, short *samples, int numsamples) void dmG711MulawToAlaw(unsigned char *mulawdata, unsigned char *Alawdata, int numsamples) void dmG711AlawToMulaw(unsigned char *Alawdata, unsigned char *mulawdata, int numsamples) void dmSunMulawEncode(short *samples, unsigned char *mulawdata, int numsamples) void dmSunMulawDecode(unsigned char *mulawdata, short *samples, int numsamples) void dmNeXTMulawEncode(short *samples, unsigned char *mulawdata, int numsamples) void dmNeXTMulawDecode(unsigned char *mulawdata, short *samples, int numsamples) PARAMETER samples pointer to input sample data buffer. The data format is short (16-bit). The samples are assumed to be two's complement. Sampling rate could range from 8 kHz to 48 kHz. mulawdata pointer to output mulaw data buffer. The data format is unsigned char (8-bit). Alawdata pointer to output Alaw data buffer. The data format is unsigned char (8-bit). numsamples length of the input and output buffers, in samples. RETURNED VALUE None. DESCRIPTION dmG711MulawEncode(3dm), dmG711MulawDecode(3dm), dmG711MulawZeroTrapEncode(3dm), dmG711MulawZeroTrapDecode(3dm), dmG711AlawEncode(3dm), dmG711AlawDecode(3dm), dmG711MulawToAlaw(3dm), dmG711AlawToMulaw(3dm) implement the ITU (International Telecommunication Union) Recommendation G.711 compressions. They conform to the specifications in the Recommendation as well as the optional implementations for linear to mu-law and linear to A-law conversions, as described in the Recommendation G.721, 4.2.8 sub block COMPRESS. See NOTE for further explanation. dmG711MulawEncode(3dm), dmG711MulawDecode(3dm) convert a 16-bit linear PCM value to 8-bit mu-law value and vice versa. The input signed 16-bit linear sample is first truncated to 14-bit by right shift of 2 bits by dmG711MulawEncode and then converted to a 8-bit mu-law value by table lookup. The output of decompression is 16-bit PCM value, which is done by dmG711MulawDecode(3dm) through another table lookup. dmG711MulawZeroTrapEncode(3dm), dmG711MulawZeroTrapDecode(3dm) implement the ITU G.711 mu-law compression with zero trap during compression. Selection of this option is necessary in networks where suppression of the all 0 character signal is required. It reduces signal quality for large negative values. dmG711MulawZeroTrapDecode(3dm) is the same as dmG711MulawDecode(3dm). dmG711AlawEncode(3dm), dmG711AlawDecode(3dm) convert a 16-bit linear PCM value to 8-bit A-law value and vice versa. The input signed 16-bit linear sample is first truncated to 13-bit by right shift of 3 bits by dmG711AlawEncode and then converted to a 8-bit A-law value by table lookup. The output of decompression is 16-bit PCM value, which is done by dmG711AlawDecode(3dm) through another table lookup. dmG711MulawToAlaw(3dm), dmG711AlawToMulaw(3dm) implement direct mu-law to A-law or A-law to mu-law value conversions. dmSunMulawEncode(3dm), dmSunMulawDecode(3dm), dmNeXTMulawEncode(3dm), dmNeXTMulawDecode(3dm) convert a 16-bit linear PCM value to 8-bit mu-law value and vice versa but using the conversion tables of Sun Microsystems' and NeXT Computer's. The input signed 16-bit linear sample is first truncated to 13-bit by right shift of 3 bits and then converted to a 8- bit mu-law value by table lookup. The output of decompression is 16-bit PCM value, which is done through another table lookup. These tables are different from ITU Recommendation G.711 in that 13-bit precision table is used in Sun's and NeXT's implementation instead of 14-bit specified by G.711 for linear to mu-law conversion. The table size (8192) is half of the size of G.711 (16384). Sun Microsystems' tables are the same as those found on the 56k DSP in hardware. NeXT's table of mu-law to linear conversion agrees with G.711. These routines can be used in cases of processing Sun or NeXT mu-law audio files. The errors caused by using above different tables are generally not audible because they are even smaller than the mu-law quantization noise. NOTE ITU Recommendation G.711 states that "the conversion to A-law or mu-law values from uniform PCM values corresponding to the decision values, is left to the individual equipment specification." Therefore, there might be different implementations of G.711 that are all valid in term of mu- law values corresponding to the decision values, which are the values of the boundaries of the quantization intervals. Despite of the above variations, 14-bit precision linear to mu-law conversion is still required in order to conform the G.711 specifications. SEE ALSO ITU (International Telecommunication Union) Recommendations G.711 and G.721.