cannam@154: /*********************************************************************** cannam@154: Copyright (c) 2006-2011, Skype Limited. All rights reserved. cannam@154: Redistribution and use in source and binary forms, with or without cannam@154: modification, are permitted provided that the following conditions cannam@154: are met: cannam@154: - Redistributions of source code must retain the above copyright notice, cannam@154: this list of conditions and the following disclaimer. cannam@154: - Redistributions in binary form must reproduce the above copyright cannam@154: notice, this list of conditions and the following disclaimer in the cannam@154: documentation and/or other materials provided with the distribution. cannam@154: - Neither the name of Internet Society, IETF or IETF Trust, nor the cannam@154: names of specific contributors, may be used to endorse or promote cannam@154: products derived from this software without specific prior written cannam@154: permission. cannam@154: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" cannam@154: AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE cannam@154: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE cannam@154: ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE cannam@154: LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR cannam@154: CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF cannam@154: SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS cannam@154: INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN cannam@154: CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) cannam@154: ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE cannam@154: POSSIBILITY OF SUCH DAMAGE. cannam@154: ***********************************************************************/ cannam@154: cannam@154: #ifndef SILK_CONTROL_H cannam@154: #define SILK_CONTROL_H cannam@154: cannam@154: #include "typedef.h" cannam@154: cannam@154: #ifdef __cplusplus cannam@154: extern "C" cannam@154: { cannam@154: #endif cannam@154: cannam@154: /* Decoder API flags */ cannam@154: #define FLAG_DECODE_NORMAL 0 cannam@154: #define FLAG_PACKET_LOST 1 cannam@154: #define FLAG_DECODE_LBRR 2 cannam@154: cannam@154: /***********************************************/ cannam@154: /* Structure for controlling encoder operation */ cannam@154: /***********************************************/ cannam@154: typedef struct { cannam@154: /* I: Number of channels; 1/2 */ cannam@154: opus_int32 nChannelsAPI; cannam@154: cannam@154: /* I: Number of channels; 1/2 */ cannam@154: opus_int32 nChannelsInternal; cannam@154: cannam@154: /* I: Input signal sampling rate in Hertz; 8000/12000/16000/24000/32000/44100/48000 */ cannam@154: opus_int32 API_sampleRate; cannam@154: cannam@154: /* I: Maximum internal sampling rate in Hertz; 8000/12000/16000 */ cannam@154: opus_int32 maxInternalSampleRate; cannam@154: cannam@154: /* I: Minimum internal sampling rate in Hertz; 8000/12000/16000 */ cannam@154: opus_int32 minInternalSampleRate; cannam@154: cannam@154: /* I: Soft request for internal sampling rate in Hertz; 8000/12000/16000 */ cannam@154: opus_int32 desiredInternalSampleRate; cannam@154: cannam@154: /* I: Number of samples per packet in milliseconds; 10/20/40/60 */ cannam@154: opus_int payloadSize_ms; cannam@154: cannam@154: /* I: Bitrate during active speech in bits/second; internally limited */ cannam@154: opus_int32 bitRate; cannam@154: cannam@154: /* I: Uplink packet loss in percent (0-100) */ cannam@154: opus_int packetLossPercentage; cannam@154: cannam@154: /* I: Complexity mode; 0 is lowest, 10 is highest complexity */ cannam@154: opus_int complexity; cannam@154: cannam@154: /* I: Flag to enable in-band Forward Error Correction (FEC); 0/1 */ cannam@154: opus_int useInBandFEC; cannam@154: cannam@154: /* I: Flag to actually code in-band Forward Error Correction (FEC) in the current packet; 0/1 */ cannam@154: opus_int LBRR_coded; cannam@154: cannam@154: /* I: Flag to enable discontinuous transmission (DTX); 0/1 */ cannam@154: opus_int useDTX; cannam@154: cannam@154: /* I: Flag to use constant bitrate */ cannam@154: opus_int useCBR; cannam@154: cannam@154: /* I: Maximum number of bits allowed for the frame */ cannam@154: opus_int maxBits; cannam@154: cannam@154: /* I: Causes a smooth downmix to mono */ cannam@154: opus_int toMono; cannam@154: cannam@154: /* I: Opus encoder is allowing us to switch bandwidth */ cannam@154: opus_int opusCanSwitch; cannam@154: cannam@154: /* I: Make frames as independent as possible (but still use LPC) */ cannam@154: opus_int reducedDependency; cannam@154: cannam@154: /* O: Internal sampling rate used, in Hertz; 8000/12000/16000 */ cannam@154: opus_int32 internalSampleRate; cannam@154: cannam@154: /* O: Flag that bandwidth switching is allowed (because low voice activity) */ cannam@154: opus_int allowBandwidthSwitch; cannam@154: cannam@154: /* O: Flag that SILK runs in WB mode without variable LP filter (use for switching between WB/SWB/FB) */ cannam@154: opus_int inWBmodeWithoutVariableLP; cannam@154: cannam@154: /* O: Stereo width */ cannam@154: opus_int stereoWidth_Q14; cannam@154: cannam@154: /* O: Tells the Opus encoder we're ready to switch */ cannam@154: opus_int switchReady; cannam@154: cannam@154: /* O: SILK Signal type */ cannam@154: opus_int signalType; cannam@154: cannam@154: /* O: SILK offset (dithering) */ cannam@154: opus_int offset; cannam@154: } silk_EncControlStruct; cannam@154: cannam@154: /**************************************************************************/ cannam@154: /* Structure for controlling decoder operation and reading decoder status */ cannam@154: /**************************************************************************/ cannam@154: typedef struct { cannam@154: /* I: Number of channels; 1/2 */ cannam@154: opus_int32 nChannelsAPI; cannam@154: cannam@154: /* I: Number of channels; 1/2 */ cannam@154: opus_int32 nChannelsInternal; cannam@154: cannam@154: /* I: Output signal sampling rate in Hertz; 8000/12000/16000/24000/32000/44100/48000 */ cannam@154: opus_int32 API_sampleRate; cannam@154: cannam@154: /* I: Internal sampling rate used, in Hertz; 8000/12000/16000 */ cannam@154: opus_int32 internalSampleRate; cannam@154: cannam@154: /* I: Number of samples per packet in milliseconds; 10/20/40/60 */ cannam@154: opus_int payloadSize_ms; cannam@154: cannam@154: /* O: Pitch lag of previous frame (0 if unvoiced), measured in samples at 48 kHz */ cannam@154: opus_int prevPitchLag; cannam@154: } silk_DecControlStruct; cannam@154: cannam@154: #ifdef __cplusplus cannam@154: } cannam@154: #endif cannam@154: cannam@154: #endif