structs_FIX.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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_STRUCTS_FIX_H
  28. #define SILK_STRUCTS_FIX_H
  29. #include "typedef.h"
  30. #include "main.h"
  31. #include "structs.h"
  32. #ifdef __cplusplus
  33. extern "C"
  34. {
  35. #endif
  36. /********************************/
  37. /* Noise shaping analysis state */
  38. /********************************/
  39. typedef struct {
  40. opus_int8 LastGainIndex;
  41. opus_int32 HarmBoost_smth_Q16;
  42. opus_int32 HarmShapeGain_smth_Q16;
  43. opus_int32 Tilt_smth_Q16;
  44. } silk_shape_state_FIX;
  45. /********************************/
  46. /* Prefilter state */
  47. /********************************/
  48. typedef struct {
  49. opus_int16 sLTP_shp[ LTP_BUF_LENGTH ];
  50. opus_int32 sAR_shp[ MAX_SHAPE_LPC_ORDER + 1 ];
  51. opus_int sLTP_shp_buf_idx;
  52. opus_int32 sLF_AR_shp_Q12;
  53. opus_int32 sLF_MA_shp_Q12;
  54. opus_int32 sHarmHP_Q2;
  55. opus_int32 rand_seed;
  56. opus_int lagPrev;
  57. } silk_prefilter_state_FIX;
  58. /********************************/
  59. /* Encoder state FIX */
  60. /********************************/
  61. typedef struct {
  62. silk_encoder_state sCmn; /* Common struct, shared with floating-point code */
  63. silk_shape_state_FIX sShape; /* Shape state */
  64. silk_prefilter_state_FIX sPrefilt; /* Prefilter State */
  65. /* Buffer for find pitch and noise shape analysis */
  66. silk_DWORD_ALIGN opus_int16 x_buf[ 2 * MAX_FRAME_LENGTH + LA_SHAPE_MAX ];/* Buffer for find pitch and noise shape analysis */
  67. opus_int LTPCorr_Q15; /* Normalized correlation from pitch lag estimator */
  68. } silk_encoder_state_FIX;
  69. /************************/
  70. /* Encoder control FIX */
  71. /************************/
  72. typedef struct {
  73. /* Prediction and coding parameters */
  74. opus_int32 Gains_Q16[ MAX_NB_SUBFR ];
  75. silk_DWORD_ALIGN opus_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ];
  76. opus_int16 LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ];
  77. opus_int LTP_scale_Q14;
  78. opus_int pitchL[ MAX_NB_SUBFR ];
  79. /* Noise shaping parameters */
  80. /* Testing */
  81. silk_DWORD_ALIGN opus_int16 AR1_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ];
  82. silk_DWORD_ALIGN opus_int16 AR2_Q13[ MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER ];
  83. opus_int32 LF_shp_Q14[ MAX_NB_SUBFR ]; /* Packs two int16 coefficients per int32 value */
  84. opus_int GainsPre_Q14[ MAX_NB_SUBFR ];
  85. opus_int HarmBoost_Q14[ MAX_NB_SUBFR ];
  86. opus_int Tilt_Q14[ MAX_NB_SUBFR ];
  87. opus_int HarmShapeGain_Q14[ MAX_NB_SUBFR ];
  88. opus_int Lambda_Q10;
  89. opus_int input_quality_Q14;
  90. opus_int coding_quality_Q14;
  91. /* measures */
  92. opus_int sparseness_Q8;
  93. opus_int32 predGain_Q16;
  94. opus_int LTPredCodGain_Q7;
  95. opus_int32 ResNrg[ MAX_NB_SUBFR ]; /* Residual energy per subframe */
  96. opus_int ResNrgQ[ MAX_NB_SUBFR ]; /* Q domain for the residual energy > 0 */
  97. /* Parameters for CBR mode */
  98. opus_int32 GainsUnq_Q16[ MAX_NB_SUBFR ];
  99. opus_int8 lastGainIndexPrev;
  100. } silk_encoder_control_FIX;
  101. /************************/
  102. /* Encoder Super Struct */
  103. /************************/
  104. typedef struct {
  105. silk_encoder_state_FIX state_Fxx[ ENCODER_NUM_CHANNELS ];
  106. stereo_enc_state sStereo;
  107. opus_int32 nBitsUsedLBRR;
  108. opus_int32 nBitsExceeded;
  109. opus_int nChannelsAPI;
  110. opus_int nChannelsInternal;
  111. opus_int nPrevChannelsInternal;
  112. opus_int timeSinceSwitchAllowed_ms;
  113. opus_int allowBandwidthSwitch;
  114. opus_int prev_decode_only_middle;
  115. } silk_encoder;
  116. #ifdef __cplusplus
  117. }
  118. #endif
  119. #endif