d_plsf.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 : d_plsf.h
  11. * Purpose : common part (init, exit, reset) of LSF decoder
  12. * module (rest in d_plsf_3.c and d_plsf_5.c)
  13. *
  14. ********************************************************************************
  15. */
  16. #ifndef d_plsf_h
  17. #define d_plsf_h "$Id $"
  18. /*
  19. ********************************************************************************
  20. * INCLUDE FILES
  21. ********************************************************************************
  22. */
  23. #include "typedef.h"
  24. #include "cnst.h"
  25. #include "mode.h"
  26. /*
  27. ********************************************************************************
  28. * LOCAL VARIABLES AND TABLES
  29. ********************************************************************************
  30. */
  31. /*
  32. *--------------------------------------------------*
  33. * Constants (defined in cnst.h) *
  34. *--------------------------------------------------*
  35. * M : LPC Order *
  36. *--------------------------------------------------*
  37. */
  38. /*
  39. ********************************************************************************
  40. * DEFINITION OF DATA TYPES
  41. ********************************************************************************
  42. */
  43. typedef struct {
  44. Word16 past_r_q[M]; /* Past quantized prediction error, Q15 */
  45. Word16 past_lsf_q[M]; /* Past dequantized lsfs, Q15 */
  46. } D_plsfState;
  47. /*
  48. ********************************************************************************
  49. * DECLARATION OF PROTOTYPES
  50. ********************************************************************************
  51. */
  52. /*
  53. **************************************************************************
  54. *
  55. * Function : D_plsf_init
  56. * Purpose : Allocates and initializes state memory
  57. * Description : Stores pointer to state struct in *st. This
  58. * pointer has to be passed to D_plsf in each call.
  59. * Returns : 0 on success
  60. *
  61. **************************************************************************
  62. */
  63. int D_plsf_init (D_plsfState **st);
  64. /*
  65. **************************************************************************
  66. *
  67. * Function : D_plsf_reset
  68. * Purpose : Resets state memory
  69. * Returns : 0 on success
  70. *
  71. **************************************************************************
  72. */
  73. int D_plsf_reset (D_plsfState *st);
  74. /*
  75. **************************************************************************
  76. *
  77. * Function : D_plsf_exit
  78. * Purpose : The memory used for state memory is freed
  79. * Description : Stores NULL in *st
  80. * Returns : void
  81. *
  82. **************************************************************************
  83. */
  84. void D_plsf_exit (D_plsfState **st);
  85. /*
  86. **************************************************************************
  87. *
  88. * Function : D_plsf_5
  89. * Purpose : Decodes the 2 sets of LSP parameters in a frame
  90. * using the received quantization indices.
  91. * Description : The two sets of LSFs are quantized using split by
  92. * 5 matrix quantization (split-MQ) with 1st order MA
  93. * prediction.
  94. * See "q_plsf_5.c" for more details about the
  95. * quantization procedure
  96. * Returns : 0
  97. *
  98. **************************************************************************
  99. */
  100. int D_plsf_5 (
  101. D_plsfState *st, /* i/o: State variables */
  102. Word16 bfi, /* i : bad frame indicator (set to 1 if a bad
  103. frame is received) */
  104. Word16 *indice, /* i : quantization indices of 5 submatrices, Q0 */
  105. Word16 *lsp1_q, /* o : quantized 1st LSP vector (M) Q15 */
  106. Word16 *lsp2_q /* o : quantized 2nd LSP vector (M) Q15 */
  107. );
  108. /*************************************************************************
  109. *
  110. * FUNCTION: D_plsf_3()
  111. *
  112. * PURPOSE: Decodes the LSP parameters using the received quantization
  113. * indices.1st order MA prediction and split by 3 matrix
  114. * quantization (split-MQ)
  115. *
  116. *************************************************************************/
  117. void D_plsf_3(
  118. D_plsfState *st, /* i/o: State struct */
  119. enum Mode mode, /* i : coder mode */
  120. Word16 bfi, /* i : bad frame indicator (set to 1 if a */
  121. /* bad frame is received) */
  122. Word16 * indice, /* i : quantization indices of 3 submatrices, Q0 */
  123. Word16 * lsp1_q /* o : quantized 1st LSP vector, Q15 */
  124. );
  125. /*************************************************************************
  126. *
  127. * FUNCTION: Init_D_plsf_3()
  128. *
  129. * PURPOSE: Set the past_r_q[M] vector to one of the eight
  130. * past_rq_init vectors.
  131. *
  132. *************************************************************************/
  133. void Init_D_plsf_3(D_plsfState *st, /* i/o: State struct */
  134. Word16 index /* i : past_rq_init[] index [0, 7] */
  135. );
  136. #endif