blob: 8df7da088114ee5207f9df4e9926f782294f21f3 [file] [log] [blame]
Alexandre Lision8af73cb2013-12-10 14:11:20 -05001.\"
2.\" Copyright 1992-1995 by Jutta Degener and Carsten Bormann, Technische
3.\" Universitaet Berlin. See the accompanying file "COPYRIGHT" for
4.\" details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
5.\"
6.PU
7.TH GSM_OPTION 3
8.SH NAME
9gsm_option \(em customizing the GSM 06.10 implementation
10.SH SYNOPSIS
11#include "gsm.h"
12.PP
13int gsm_option(handle, option, valueP);
14.br
15gsm handle;
16.br
17int option;
18.br
19int * valueP;
20.SH "DESCRIPTION"
21The gsm library is an implementation of the final draft GSM 06.10
22standard for full-rate speech transcoding, a lossy
23speech compression algorithm.
24.PP
25The gsm_option() function can be used to set and query various
26options or flags that are not needed for regular GSM 06.10 encoding
27or decoding, but might be of interest in special cases.
28.PP
29The second argument to gsm_option specifies what parameter
30should be changed or queried.
31The third argument is either a null pointer, in which case
32the current value of that parameter is returned;
33or it is a pointer to an integer containing the value
34you want to set, in which case the previous value will
35be returned.
36.PP
37The following options are defined:
38.PP
39.I GSM_OPT_VERBOSE
40Verbosity level.
41.br
42.in+5
43This option is only supported if the library was compiled
44with debugging turned on, and may be used by developers of
45compression algorithms to aid debugging.
46.br
47The verbosity level can be changed at any time during encoding or decoding.
48.in-5
49.sp
50.PP
51.I GSM_OPT_FAST
52Faster compression algorithm.
53.br
54.in+5
55This implementation offers a not strictly standard-compliant, but
56faster compression algorithm that is compatible with the regular
57method and does not noticably degrade audio quality.
58.br
59The value passed to
60.br
61.nf
62 gsm_option(handle, GSM_OPT_FAST, & value)
63.fi
64.br
65functions as a boolean flag; if it is zero, the regular algorithm
66will be used, if not, the faster version will be used.
67.br
68The availability of this option depends on the hardware used;
69if it is not available, gsm_option will return -1 on an attempt
70to set or query it.
71.br
72This option can be set any time during encoding or decoding.
73.in-5
74.ne 5
75.sp
76.PP
77.I GSM_OPT_LTP_CUT
78Enable, disable, or query the LTP cut-off optimization.
79.br
80.in+5
81During encoding, the search for the long-term correlation
82lag forms the bottleneck of the algorithm.
83The ltp-cut option enables an approximation that disregards most
84of the samples for purposes of finding that correlation,
85and hence speeds up the encoding at a noticable loss in quality.
86.br
87The value passed to
88.br
89.nf
90 gsm_option(handle, GSM_OPT_LTP_CUT, & value)
91.fi
92.br
93turns the optimization on if nonzero, and off if zero.
94.br
95This option can be set any time during encoding
96or decoding; it will only affect the encoding pass, not
97the decoding.
98.sp
99.PP
100.I GSM_OPT_WAV49
101WAV-style byte ordering.
102.br
103.in+5
104A WAV file of type #49 contains GSM 06.10-encoded frames.
105Unfortunately, the framing and code ordering of the WAV version
106are incompatible with the native ones of this GSM 06.10 library.
107The GSM_OPT_WAV49 option turns on a different packing
108algorithm that produces alternating frames of 32 and 33 bytes
109(or makes it consume alternating frames of 33 and 32 bytes, note
110the opposite order of the two numbers) which, when concatenated,
111can be used in the body of a WAV #49 frame.
112It is up to the user program to write a WAV header, if any;
113neither the library itself nor the toast program produce
114complete WAV files.
115.br
116The value passed to
117.br
118.nf
119 gsm_option(handle, GSM_OPT_WAV49, & value)
120.fi
121.br
122functions as a boolean flag; if it is zero, the library's native
123framing algorithm will be used, if nonzero, WAV-type packing is in effect.
124.br
125This option should be used before any frames are encoded.
126Whether or not it is supported at all depends on a
127compile-time switch, WAV49.
128Both option and compile time switch are new to the library
129as of patchlevel 9, and are considerably less tested than the
130well-worn rest of the it.
131.br
132Thanks to Jeff Chilton for the detective work and first free
133implementation of this version of the GSM 06.10 encoding.
134.sp
135.PP
136.I GSM_OPT_FRAME_CHAIN
137Query or set the chaining byte.
138.br
139.in+5
140Between the two frames of a WAV-style encoding, the GSM 06.10 library
141must keep track of one half-byte that is technically part of the first
142frame, but will be written as the first four bits of the second.
143This half-byte are the lowest four bits of the value returned by,
144and optionally set by,
145.br
146.nf
147 gsm_option(handle, GSM_OPT_FRAME_CHAIN, & value)
148.fi
149.br
150This option can be queried and set at any time.
151.sp
152.PP
153.I GSM_OPT_FRAME_INDEX
154Query or set the current frame's index in a format's
155alternating list of frames.
156.br
157.in+5
158The WAV #49 framing uses two alternating types of frames.
159Which type the next GSM-coded frame belongs to can be queried, or,
160when decoding, announced, using
161.br
162.nf
163 gsm_option(handle, GSM_OPT_FRAME_INDEX, & value)
164.fi
165.br
166For WAV-style framing, the value should be 0 or 1; the first frame
167of an encoding has an index of 0.
168At library initialization, the index is set to zero.
169.br
170The frame index can be queried and set at any time.
171Used in combination with the
172.IR GSM_OPT_FRAME_CHAIN ,
173option, it can be used to position on arbitrary GSM frames
174within a format like WAV #49 (not accounting for the lost
175internal GSM state).
176.in-5
177.SH "RETURN VALUE"
178gsm_option() returns -1 if an option is not supported, the
179previous value of the option otherwise.
180.SH BUGS
181Please direct bug reports to jutta@cs.tu-berlin.de and cabo@cs.tu-berlin.de.
182.SH "SEE ALSO"
183toast(1), gsm(3), gsm_explode(3), gsm_print(3)