ph_disp.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 : ph_disp.h
  11. * Purpose : Phase dispersion of excitation signal
  12. *
  13. ********************************************************************************
  14. */
  15. #ifndef ph_disp_h
  16. #define ph_disp_h "$Id $"
  17. /*
  18. ********************************************************************************
  19. * INCLUDE FILES
  20. ********************************************************************************
  21. */
  22. #include "typedef.h"
  23. #include "mode.h"
  24. /*
  25. ********************************************************************************
  26. * LOCAL VARIABLES AND TABLES
  27. ********************************************************************************
  28. */
  29. #define PHDGAINMEMSIZE 5
  30. #define PHDTHR1LTP 9830 /* 0.6 in Q14 */
  31. #define PHDTHR2LTP 14746 /* 0.9 in Q14 */
  32. #define ONFACTPLUS1 16384 /* 2.0 in Q13 */
  33. #define ONLENGTH 2
  34. /*
  35. ********************************************************************************
  36. * DEFINITION OF DATA TYPES
  37. ********************************************************************************
  38. */
  39. typedef struct {
  40. Word16 gainMem[PHDGAINMEMSIZE];
  41. Word16 prevState;
  42. Word16 prevCbGain;
  43. Word16 lockFull;
  44. Word16 onset;
  45. } ph_dispState;
  46. /*
  47. ********************************************************************************
  48. * DECLARATION OF PROTOTYPES
  49. ********************************************************************************
  50. */
  51. /*************************************************************************
  52. *
  53. * Function: ph_disp_init
  54. * Purpose: Allocates state memory and initializes state memory
  55. *
  56. **************************************************************************
  57. */
  58. int ph_disp_init (ph_dispState **state);
  59. /*************************************************************************
  60. *
  61. * Function: ph_disp_reset
  62. * Purpose: Initializes state memory
  63. *
  64. **************************************************************************
  65. */
  66. int ph_disp_reset (ph_dispState *state);
  67. /*************************************************************************
  68. *
  69. * Function: ph_disp_exit
  70. * Purpose: The memory used for state memory is freed
  71. *
  72. **************************************************************************
  73. */
  74. void ph_disp_exit (ph_dispState **state);
  75. /*************************************************************************
  76. *
  77. * Function: ph_disp_lock
  78. * Purpose: mark phase dispersion as locked in state struct
  79. *
  80. **************************************************************************
  81. */
  82. void ph_disp_lock (ph_dispState *state);
  83. /*************************************************************************
  84. *
  85. * Function: ph_disp_release
  86. * Purpose: mark phase dispersion as unlocked in state struct
  87. *
  88. **************************************************************************
  89. */
  90. void ph_disp_release (ph_dispState *state);
  91. /*************************************************************************
  92. *
  93. * Function: ph_disp
  94. * Purpose: perform phase dispersion according to the specified codec
  95. * mode and computes total excitation for synthesis part
  96. * if decoder
  97. *
  98. **************************************************************************
  99. */
  100. void ph_disp (
  101. ph_dispState *state, /* i/o : State struct */
  102. enum Mode mode, /* i : codec mode */
  103. Word16 x[], /* i/o Q0 : in: LTP excitation signal */
  104. /* out: total excitation signal */
  105. Word16 cbGain, /* i Q1 : Codebook gain */
  106. Word16 ltpGain, /* i Q14 : LTP gain */
  107. Word16 inno[], /* i Q13 : Innovation vector (Q12 for 12.2) */
  108. Word16 pitch_fac, /* i Q14 : pitch factor used to scale the
  109. LTP excitation (Q13 for 12.2) */
  110. Word16 tmp_shift /* i Q0 : shift factor applied to sum of
  111. scaled LTP ex & innov. before
  112. rounding */
  113. );
  114. #endif