control.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /***********************************************************************
  2. Copyright (c) 2006-2011, Skype Limited. All rights reserved.
  3. Redistribution and use in source and binary forms, with or without
  4. modification, are permitted provided that the following conditions
  5. are met:
  6. - Redistributions of source code must retain the above copyright notice,
  7. this list of conditions and the following disclaimer.
  8. - Redistributions in binary form must reproduce the above copyright
  9. notice, this list of conditions and the following disclaimer in the
  10. documentation and/or other materials provided with the distribution.
  11. - Neither the name of Internet Society, IETF or IETF Trust, nor the
  12. names of specific contributors, may be used to endorse or promote
  13. products derived from this software without specific prior written
  14. permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  16. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  18. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  19. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  20. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  21. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  22. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  23. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  24. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  25. POSSIBILITY OF SUCH DAMAGE.
  26. ***********************************************************************/
  27. #ifndef SILK_CONTROL_H
  28. #define SILK_CONTROL_H
  29. #include "typedef.h"
  30. #ifdef __cplusplus
  31. extern "C"
  32. {
  33. #endif
  34. /* Decoder API flags */
  35. #define FLAG_DECODE_NORMAL 0
  36. #define FLAG_PACKET_LOST 1
  37. #define FLAG_DECODE_LBRR 2
  38. /***********************************************/
  39. /* Structure for controlling encoder operation */
  40. /***********************************************/
  41. typedef struct {
  42. /* I: Number of channels; 1/2 */
  43. opus_int32 nChannelsAPI;
  44. /* I: Number of channels; 1/2 */
  45. opus_int32 nChannelsInternal;
  46. /* I: Input signal sampling rate in Hertz; 8000/12000/16000/24000/32000/44100/48000 */
  47. opus_int32 API_sampleRate;
  48. /* I: Maximum internal sampling rate in Hertz; 8000/12000/16000 */
  49. opus_int32 maxInternalSampleRate;
  50. /* I: Minimum internal sampling rate in Hertz; 8000/12000/16000 */
  51. opus_int32 minInternalSampleRate;
  52. /* I: Soft request for internal sampling rate in Hertz; 8000/12000/16000 */
  53. opus_int32 desiredInternalSampleRate;
  54. /* I: Number of samples per packet in milliseconds; 10/20/40/60 */
  55. opus_int payloadSize_ms;
  56. /* I: Bitrate during active speech in bits/second; internally limited */
  57. opus_int32 bitRate;
  58. /* I: Uplink packet loss in percent (0-100) */
  59. opus_int packetLossPercentage;
  60. /* I: Complexity mode; 0 is lowest, 10 is highest complexity */
  61. opus_int complexity;
  62. /* I: Flag to enable in-band Forward Error Correction (FEC); 0/1 */
  63. opus_int useInBandFEC;
  64. /* I: Flag to actually code in-band Forward Error Correction (FEC) in the current packet; 0/1 */
  65. opus_int LBRR_coded;
  66. /* I: Flag to enable discontinuous transmission (DTX); 0/1 */
  67. opus_int useDTX;
  68. /* I: Flag to use constant bitrate */
  69. opus_int useCBR;
  70. /* I: Maximum number of bits allowed for the frame */
  71. opus_int maxBits;
  72. /* I: Causes a smooth downmix to mono */
  73. opus_int toMono;
  74. /* I: Opus encoder is allowing us to switch bandwidth */
  75. opus_int opusCanSwitch;
  76. /* I: Make frames as independent as possible (but still use LPC) */
  77. opus_int reducedDependency;
  78. /* O: Internal sampling rate used, in Hertz; 8000/12000/16000 */
  79. opus_int32 internalSampleRate;
  80. /* O: Flag that bandwidth switching is allowed (because low voice activity) */
  81. opus_int allowBandwidthSwitch;
  82. /* O: Flag that SILK runs in WB mode without variable LP filter (use for switching between WB/SWB/FB) */
  83. opus_int inWBmodeWithoutVariableLP;
  84. /* O: Stereo width */
  85. opus_int stereoWidth_Q14;
  86. /* O: Tells the Opus encoder we're ready to switch */
  87. opus_int switchReady;
  88. /* O: SILK Signal type */
  89. opus_int signalType;
  90. /* O: SILK offset (dithering) */
  91. opus_int offset;
  92. } silk_EncControlStruct;
  93. /**************************************************************************/
  94. /* Structure for controlling decoder operation and reading decoder status */
  95. /**************************************************************************/
  96. typedef struct {
  97. /* I: Number of channels; 1/2 */
  98. opus_int32 nChannelsAPI;
  99. /* I: Number of channels; 1/2 */
  100. opus_int32 nChannelsInternal;
  101. /* I: Output signal sampling rate in Hertz; 8000/12000/16000/24000/32000/44100/48000 */
  102. opus_int32 API_sampleRate;
  103. /* I: Internal sampling rate used, in Hertz; 8000/12000/16000 */
  104. opus_int32 internalSampleRate;
  105. /* I: Number of samples per packet in milliseconds; 10/20/40/60 */
  106. opus_int payloadSize_ms;
  107. /* O: Pitch lag of previous frame (0 if unvoiced), measured in samples at 48 kHz */
  108. opus_int prevPitchLag;
  109. } silk_DecControlStruct;
  110. #ifdef __cplusplus
  111. }
  112. #endif
  113. #endif