Statistics
| Branch: | Tag: | Revision:

root / gnuradio-core / src / lib / g72x / README @ 5d69a524

History | View | Annotate | Download (3.1 kB)

1
The files in this directory comprise ANSI-C language reference implementations
2
of the CCITT (International Telegraph and Telephone Consultative Committee)
3
G.711, G.721 and G.723 voice compressions.  They have been tested on Sun
4
SPARCstations and passed 82 out of 84 test vectors published by CCITT
5
(Dec. 20, 1988) for G.721 and G.723.  [The two remaining test vectors,
6
which the G.721 decoder implementation for u-law samples did not pass,
7
may be in error because they are identical to two other vectors for G.723_40.]
8
9
This source code is released by Sun Microsystems, Inc. to the public domain.
10
Please give your acknowledgement in product literature if this code is used
11
in your product implementation.
12
13
Sun Microsystems supports some CCITT audio formats in Solaris 2.0 system
14
software.  However, Sun's implementations have been optimized for higher
15
performance on SPARCstations.
16
17
18
The source files for CCITT conversion routines in this directory are:
19
20
	g72x.h		header file for g721.c, g723_24.c and g723_40.c
21
	g711.c		CCITT G.711 u-law and A-law compression
22
	g72x.c		common denominator of G.721 and G.723 ADPCM codes
23
	g721.c		CCITT G.721 32Kbps ADPCM coder (with g72x.c)
24
	g723_24.c	CCITT G.723 24Kbps ADPCM coder (with g72x.c)
25
	g723_40.c	CCITT G.723 40Kbps ADPCM coder (with g72x.c)
26
27
28
Simple conversions between u-law, A-law, and 16-bit linear PCM are invoked
29
as follows:
30
31
	unsigned char		ucode, acode;
32
	short			pcm_val;
33
34
	ucode = linear2ulaw(pcm_val);
35
	ucode = alaw2ulaw(acode);
36
37
	acode = linear2alaw(pcm_val);
38
	acode = ulaw2alaw(ucode);
39
40
	pcm_val = ulaw2linear(ucode);
41
	pcm_val = alaw2linear(acode);
42
43
44
The other CCITT compression routines are invoked as follows:
45
46
	#include "g72x.h"
47
48
	struct g72x_state	state;
49
	int			sample, code;
50
51
	g72x_init_state(&state);
52
	code = {g721,g723_24,g723_40}_encoder(sample, coding, &state);
53
	sample = {g721,g723_24,g723_40}_decoder(code, coding, &state);
54
55
where
56
	coding = AUDIO_ENCODING_ULAW	for 8-bit u-law samples
57
		 AUDIO_ENCODING_ALAW	for 8-bit A-law samples
58
		 AUDIO_ENCODING_LINEAR	for 16-bit linear PCM samples
59
60
61
62
This directory also includes the following sample programs:
63
64
	encode.c	CCITT ADPCM encoder
65
	decode.c	CCITT ADPCM decoder
66
	Makefile	makefile for the sample programs
67
68
69
The sample programs contain examples of how to call the various compression
70
routines and pack/unpack the bits.  The sample programs read byte streams from
71
stdin and write to stdout.  The input/output data is raw data (no file header
72
or other identifying information is embedded).  The sample programs are
73
invoked as follows:
74
75
	encode [-3|4|5] [-a|u|l] <infile >outfile
76
	decode [-3|4|5] [-a|u|l] <infile >outfile
77
where:
78
	-3	encode to (decode from) G.723 24kbps (3-bit) data
79
	-4	encode to (decode from) G.721 32kbps (4-bit) data [the default]
80
	-5	encode to (decode from) G.723 40kbps (5-bit) data
81
	-a	encode from (decode to) A-law data
82
	-u	encode from (decode to) u-law data [the default]
83
	-l	encode from (decode to) 16-bit linear data
84
85
Examples:
86
	# Read 16-bit linear and output G.721
87
	encode -4 -l <pcmfile >g721file
88
89
	# Read 40Kbps G.723 and output A-law
90
	decode -5 -a <g723file >alawfile
91
92
	# Compress and then decompress u-law data using 24Kbps G.723
93
	encode -3 <ulawin | deoced -3 >ulawout
94