c_g_aver.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 : c_g_aver.h
  11. * Purpose : Background noise source charateristic detector (SCD)
  12. *
  13. ********************************************************************************
  14. */
  15. #ifndef c_g_aver_h
  16. #define c_g_aver_h "$Id $"
  17. /*
  18. ********************************************************************************
  19. * INCLUDE FILES
  20. ********************************************************************************
  21. */
  22. #include "typedef.h"
  23. #include "mode.h"
  24. #include "cnst.h"
  25. /*
  26. ********************************************************************************
  27. * LOCAL VARIABLES AND TABLES
  28. ********************************************************************************
  29. */
  30. #define L_CBGAINHIST 7
  31. /*
  32. ********************************************************************************
  33. * DEFINITION OF DATA TYPES
  34. ********************************************************************************
  35. */
  36. typedef struct{
  37. /* history vector of past synthesis speech energy */
  38. Word16 cbGainHistory[L_CBGAINHIST];
  39. /* state flags */
  40. Word16 hangVar; /* counter; */
  41. Word16 hangCount; /* counter; */
  42. } Cb_gain_averageState;
  43. /*
  44. ********************************************************************************
  45. * DECLARATION OF PROTOTYPES
  46. ********************************************************************************
  47. */
  48. /*
  49. **************************************************************************
  50. *
  51. * Function : Cb_gain_average_init
  52. * Purpose : Allocates initializes state memory
  53. * Description : Stores pointer to filter status struct in *st. This
  54. * pointer has to be passed to Cb_gain_average in each call.
  55. * Returns : 0 on success
  56. *
  57. **************************************************************************
  58. */
  59. Word16 Cb_gain_average_init (Cb_gain_averageState **st);
  60. /*
  61. **************************************************************************
  62. *
  63. * Function : Cb_gain_average_reset
  64. * Purpose : Resets state memory
  65. * Returns : 0 on success
  66. *
  67. **************************************************************************
  68. */
  69. Word16 Cb_gain_average_reset (Cb_gain_averageState *st);
  70. /*
  71. **************************************************************************
  72. *
  73. * Function : Cb_gain_average_exit
  74. * Purpose : The memory used for state memory is freed
  75. * Description : Stores NULL in *s
  76. * Returns : void
  77. *
  78. **************************************************************************
  79. */
  80. void Cb_gain_average_exit (Cb_gain_averageState **st);
  81. /*
  82. **************************************************************************
  83. *
  84. * Function : Cb_gain_average
  85. * Purpose : Charaterice synthesis speech and detect background noise
  86. * Returns : background noise decision; 0 = bgn, 1 = no bgn
  87. *
  88. **************************************************************************
  89. */
  90. Word16 Cb_gain_average (
  91. Cb_gain_averageState *st, /* i/o : State variables for CB gain avergeing */
  92. enum Mode mode, /* i : AMR mode */
  93. Word16 gain_code, /* i : CB gain Q1 */
  94. Word16 lsp[], /* i : The LSP for the current frame Q15 */
  95. Word16 lspAver[], /* i : The average of LSP for 8 frames Q15 */
  96. Word16 bfi, /* i : bad frame indication flag */
  97. Word16 prev_bf, /* i : previous bad frame indication flag */
  98. Word16 pdfi, /* i : potential degraded bad frame ind flag */
  99. Word16 prev_pdf, /* i : prev pot. degraded bad frame ind flag */
  100. Word16 inBackgroundNoise, /* i : background noise decision */
  101. Word16 voicedHangover /* i : # of frames after last voiced frame */
  102. );
  103. #endif