dtx_enc.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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 : dtx_enc.h
  11. * Purpose : DTX mode computation of SID parameters
  12. *
  13. ********************************************************************************
  14. */
  15. #ifndef dtx_enc_h
  16. #define dtx_enc_h "$Id $"
  17. /*
  18. ********************************************************************************
  19. * INCLUDE FILES
  20. ********************************************************************************
  21. */
  22. #include "typedef.h"
  23. #include "cnst.h"
  24. #include "q_plsf.h"
  25. #include "gc_pred.h"
  26. #include "mode.h"
  27. /*
  28. ********************************************************************************
  29. * LOCAL VARIABLES AND TABLES
  30. ********************************************************************************
  31. */
  32. #define DTX_HIST_SIZE 8
  33. #define DTX_ELAPSED_FRAMES_THRESH (24 + 7 -1)
  34. #define DTX_HANG_CONST 7 /* yields eight frames of SP HANGOVER */
  35. /*
  36. ********************************************************************************
  37. * DEFINITION OF DATA TYPES
  38. ********************************************************************************
  39. */
  40. typedef struct {
  41. Word16 lsp_hist[M * DTX_HIST_SIZE];
  42. Word16 log_en_hist[DTX_HIST_SIZE];
  43. Word16 hist_ptr;
  44. Word16 log_en_index;
  45. Word16 init_lsf_vq_index;
  46. Word16 lsp_index[3];
  47. /* DTX handler stuff */
  48. Word16 dtxHangoverCount;
  49. Word16 decAnaElapsedCount;
  50. } dtx_encState;
  51. /*
  52. ********************************************************************************
  53. * DECLARATION OF PROTOTYPES
  54. ********************************************************************************
  55. */
  56. /*
  57. **************************************************************************
  58. * Function : dtx_enc_init
  59. * Purpose : Allocates memory and initializes state variables
  60. * Description : Stores pointer to filter status struct in *st. This
  61. * pointer has to be passed to dtx_enc in each call.
  62. * Returns : 0 on success
  63. *
  64. **************************************************************************
  65. */
  66. int dtx_enc_init (dtx_encState **st);
  67. /*
  68. **************************************************************************
  69. *
  70. * Function : dtx_enc_reset
  71. * Purpose : Resets state memory
  72. * Returns : 0 on success
  73. *
  74. **************************************************************************
  75. */
  76. int dtx_enc_reset (dtx_encState *st);
  77. /*
  78. **************************************************************************
  79. *
  80. * Function : dtx_enc_exit
  81. * Purpose : The memory used for state memory is freed
  82. * Description : Stores NULL in *st
  83. *
  84. **************************************************************************
  85. */
  86. void dtx_enc_exit (dtx_encState **st);
  87. /*
  88. **************************************************************************
  89. *
  90. * Function : dtx_enc
  91. * Purpose :
  92. * Description :
  93. *
  94. **************************************************************************
  95. */
  96. int dtx_enc(dtx_encState *st, /* i/o : State struct */
  97. Word16 computeSidFlag, /* i : compute SID */
  98. Q_plsfState *qSt, /* i/o : Qunatizer state struct */
  99. gc_predState* predState, /* i/o : State struct */
  100. Word16 **anap /* o : analysis parameters */
  101. );
  102. /*
  103. **************************************************************************
  104. *
  105. * Function : dtx_buffer
  106. * Purpose : handles the DTX buffer
  107. *
  108. **************************************************************************
  109. */
  110. int dtx_buffer(dtx_encState *st, /* i/o : State struct */
  111. Word16 lsp_new[], /* i : LSP vector */
  112. Word16 speech[] /* i : speech samples */
  113. );
  114. /*
  115. **************************************************************************
  116. *
  117. * Function : tx_dtx_handler
  118. * Purpose : adds extra speech hangover to analyze speech on the decoding side.
  119. * Description : returns 1 when a new SID analysis may be made
  120. * otherwise it adds the appropriate hangover after a sequence
  121. * with out updates of SID parameters .
  122. *
  123. **************************************************************************
  124. */
  125. Word16 tx_dtx_handler(dtx_encState *st, /* i/o : State struct */
  126. Word16 vadFlag, /* i : vad control variable */
  127. enum Mode *usedMode /* o : mode changed or not */
  128. );
  129. #endif