blob: 77530f8febafcf0f6b94a4abc0aa4247d8931963 [file] [log] [blame]
Gregory Maxwellae231142011-07-30 08:18:48 -04001/***********************************************************************
2Copyright (c) 2006-2011, Skype Limited. All rights reserved.
3Redistribution and use in source and binary forms, with or without
Jean-Marc Valinae00e602012-04-20 16:31:04 -04004modification, are permitted provided that the following conditions
5are met:
Gregory Maxwellae231142011-07-30 08:18:48 -04006- Redistributions of source code must retain the above copyright notice,
7this list of conditions and the following disclaimer.
8- Redistributions in binary form must reproduce the above copyright
9notice, this list of conditions and the following disclaimer in the
10documentation and/or other materials provided with the distribution.
Jean-Marc Valinae00e602012-04-20 16:31:04 -040011- Neither the name of Internet Society, IETF or IETF Trust, nor the
12names of specific contributors, may be used to endorse or promote
13products derived from this software without specific prior written
14permission.
Timothy B. Terriberry80ad3832013-05-19 18:00:39 -070015THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Jean-Marc Valinae00e602012-04-20 16:31:04 -040016AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25POSSIBILITY OF SUCH DAMAGE.
Gregory Maxwellae231142011-07-30 08:18:48 -040026***********************************************************************/
27
28#ifndef SILK_CONTROL_H
29#define SILK_CONTROL_H
30
Jean-Marc Valin1c2f5632011-09-16 01:16:53 -070031#include "typedef.h"
Gregory Maxwellae231142011-07-30 08:18:48 -040032
33#ifdef __cplusplus
34extern "C"
35{
36#endif
37
38/* Decoder API flags */
39#define FLAG_DECODE_NORMAL 0
40#define FLAG_PACKET_LOST 1
41#define FLAG_DECODE_LBRR 2
42
43/***********************************************/
44/* Structure for controlling encoder operation */
45/***********************************************/
46typedef struct {
47 /* I: Number of channels; 1/2 */
48 opus_int32 nChannelsAPI;
49
50 /* I: Number of channels; 1/2 */
51 opus_int32 nChannelsInternal;
52
53 /* I: Input signal sampling rate in Hertz; 8000/12000/16000/24000/32000/44100/48000 */
54 opus_int32 API_sampleRate;
55
56 /* I: Maximum internal sampling rate in Hertz; 8000/12000/16000 */
57 opus_int32 maxInternalSampleRate;
58
59 /* I: Minimum internal sampling rate in Hertz; 8000/12000/16000 */
60 opus_int32 minInternalSampleRate;
61
62 /* I: Soft request for internal sampling rate in Hertz; 8000/12000/16000 */
63 opus_int32 desiredInternalSampleRate;
64
65 /* I: Number of samples per packet in milliseconds; 10/20/40/60 */
66 opus_int payloadSize_ms;
67
68 /* I: Bitrate during active speech in bits/second; internally limited */
69 opus_int32 bitRate;
70
71 /* I: Uplink packet loss in percent (0-100) */
72 opus_int packetLossPercentage;
73
74 /* I: Complexity mode; 0 is lowest, 10 is highest complexity */
75 opus_int complexity;
76
77 /* I: Flag to enable in-band Forward Error Correction (FEC); 0/1 */
78 opus_int useInBandFEC;
79
80 /* I: Flag to enable discontinuous transmission (DTX); 0/1 */
81 opus_int useDTX;
82
83 /* I: Flag to use constant bitrate */
84 opus_int useCBR;
85
Koen Vosacc7a6c2011-10-28 19:44:26 -040086 /* I: Maximum number of bits allowed for the frame */
Jean-Marc Valin294bfec2011-10-20 00:39:41 -040087 opus_int maxBits;
88
Koen Vosacc7a6c2011-10-28 19:44:26 -040089 /* I: Causes a smooth downmix to mono */
Jean-Marc Valinde3e16c2011-10-03 00:39:29 -040090 opus_int toMono;
91
Koen Vosacc7a6c2011-10-28 19:44:26 -040092 /* I: Opus encoder is allowing us to switch bandwidth */
Jean-Marc Valin3b2aee02011-10-21 23:21:34 -040093 opus_int opusCanSwitch;
94
Gregory Maxwellae231142011-07-30 08:18:48 -040095 /* O: Internal sampling rate used, in Hertz; 8000/12000/16000 */
96 opus_int32 internalSampleRate;
97
98 /* O: Flag that bandwidth switching is allowed (because low voice activity) */
99 opus_int allowBandwidthSwitch;
100
101 /* O: Flag that SILK runs in WB mode without variable LP filter (use for switching between WB/SWB/FB) */
102 opus_int inWBmodeWithoutVariableLP;
103
104 /* O: Stereo width */
105 opus_int stereoWidth_Q14;
Jean-Marc Valin3b2aee02011-10-21 23:21:34 -0400106
Koen Vosacc7a6c2011-10-28 19:44:26 -0400107 /* O: Tells the Opus encoder we're ready to switch */
Jean-Marc Valin3b2aee02011-10-21 23:21:34 -0400108 opus_int switchReady;
109
Gregory Maxwellae231142011-07-30 08:18:48 -0400110} silk_EncControlStruct;
111
112/**************************************************************************/
113/* Structure for controlling decoder operation and reading decoder status */
114/**************************************************************************/
115typedef struct {
116 /* I: Number of channels; 1/2 */
117 opus_int32 nChannelsAPI;
118
119 /* I: Number of channels; 1/2 */
120 opus_int32 nChannelsInternal;
121
122 /* I: Output signal sampling rate in Hertz; 8000/12000/16000/24000/32000/44100/48000 */
123 opus_int32 API_sampleRate;
124
125 /* I: Internal sampling rate used, in Hertz; 8000/12000/16000 */
126 opus_int32 internalSampleRate;
127
128 /* I: Number of samples per packet in milliseconds; 10/20/40/60 */
129 opus_int payloadSize_ms;
Jean-Marc Valinb24e5742011-10-11 21:09:14 -0400130
131 /* O: Pitch lag of previous frame (0 if unvoiced), measured in samples at 48 kHz */
132 opus_int prevPitchLag;
Gregory Maxwellae231142011-07-30 08:18:48 -0400133} silk_DecControlStruct;
134
135#ifdef __cplusplus
136}
137#endif
138
139#endif