dec_amr.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /*
  2. *****************************************************************************
  3. *
  4. * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
  5. * R99 Version 3.3.0
  6. * REL-4 Version 4.1.0
  7. *
  8. *****************************************************************************
  9. *
  10. * File : dec_amr.h
  11. * Purpose : Speech decoder routine.
  12. *
  13. *****************************************************************************
  14. */
  15. #ifndef dec_amr_h
  16. #define dec_amr_h "$Id $"
  17. /*
  18. *****************************************************************************
  19. * INCLUDE FILES
  20. *****************************************************************************
  21. */
  22. #include "typedef.h"
  23. #include "cnst.h"
  24. #include "mode.h"
  25. #include "dtx_dec.h"
  26. #include "d_plsf.h"
  27. #include "gc_pred.h"
  28. #include "ec_gains.h"
  29. #include "ph_disp.h"
  30. #include "c_g_aver.h"
  31. #include "bgnscd.h"
  32. #include "lsp_avg.h"
  33. #include "frame.h"
  34. /*
  35. *****************************************************************************
  36. * LOCAL VARIABLES AND TABLES
  37. *****************************************************************************
  38. */
  39. /*---------------------------------------------------------------*
  40. * Postfilter constant parameters (defined in "cnst.h") *
  41. *---------------------------------------------------------------*
  42. * L_FRAME : Frame size. *
  43. * PIT_MAX : Maximum pitch lag. *
  44. * L_INTERPOL : Length of filter for interpolation. *
  45. * M : LPC order. *
  46. *---------------------------------------------------------------*/
  47. /*
  48. *****************************************************************************
  49. * DEFINITION OF DATA TYPES
  50. *****************************************************************************
  51. */
  52. typedef struct{
  53. /* Excitation vector */
  54. Word16 old_exc[L_SUBFR + PIT_MAX + L_INTERPOL];
  55. Word16 *exc;
  56. /* Lsp (Line spectral pairs) */
  57. /* Word16 lsp[M]; */ /* Used by CN codec */
  58. Word16 lsp_old[M];
  59. /* Filter's memory */
  60. Word16 mem_syn[M];
  61. /* pitch sharpening */
  62. Word16 sharp;
  63. Word16 old_T0;
  64. /* Memories for bad frame handling */
  65. Word16 prev_bf;
  66. Word16 prev_pdf;
  67. Word16 state;
  68. Word16 excEnergyHist[9];
  69. /* Variable holding received ltpLag, used in background noise and BFI */
  70. Word16 T0_lagBuff;
  71. /* Variables for the source characteristic detector (SCD) */
  72. Word16 inBackgroundNoise;
  73. Word16 voicedHangover;
  74. Word16 ltpGainHistory[9];
  75. Bgn_scdState* background_state;
  76. Word16 nodataSeed;
  77. Cb_gain_averageState *Cb_gain_averState;
  78. lsp_avgState *lsp_avg_st;
  79. D_plsfState* lsfState;
  80. ec_gain_pitchState* ec_gain_p_st;
  81. ec_gain_codeState* ec_gain_c_st;
  82. gc_predState* pred_state;
  83. ph_dispState* ph_disp_st;
  84. dtx_decState* dtxDecoderState;
  85. } Decoder_amrState;
  86. /*
  87. *****************************************************************************
  88. * DECLARATION OF PROTOTYPES
  89. *****************************************************************************
  90. */
  91. /*
  92. **************************************************************************
  93. *
  94. * Function : Decoder_amr_init
  95. * Purpose : Allocates initializes state memory
  96. * Description : Stores pointer to filter status struct in *st. This
  97. * pointer has to be passed to Decoder_amr in each call.
  98. * Returns : 0 on success
  99. *
  100. **************************************************************************
  101. */
  102. int Decoder_amr_init (Decoder_amrState **st);
  103. /*
  104. **************************************************************************
  105. *
  106. * Function : Decoder_amr_reset
  107. * Purpose : Resets state memory
  108. * Returns : 0 on success
  109. *
  110. **************************************************************************
  111. */
  112. int Decoder_amr_reset (Decoder_amrState *st,enum Mode mode);
  113. /*
  114. **************************************************************************
  115. *
  116. * Function : Decoder_amr_exit
  117. * Purpose : The memory used for state memory is freed
  118. * Description : Stores NULL in *s
  119. * Returns : void
  120. *
  121. **************************************************************************
  122. */
  123. void Decoder_amr_exit (Decoder_amrState **st);
  124. /*
  125. **************************************************************************
  126. *
  127. * Function : Decoder_amr
  128. * Purpose : Speech decoder routine.
  129. * Returns : 0
  130. *
  131. **************************************************************************
  132. */
  133. int Decoder_amr (
  134. Decoder_amrState *st, /* i/o : State variables */
  135. enum Mode mode, /* i : AMR mode */
  136. Word16 parm[], /* i : vector of synthesis parameters
  137. (PRM_SIZE) */
  138. enum RXFrameType frame_type, /* i : received frame type */
  139. Word16 synth[], /* o : synthesis speech (L_FRAME) */
  140. Word16 A_t[] /* o : decoded LP filter in 4 subframes
  141. (AZ_SIZE) */
  142. );
  143. #endif