bgnscd.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 : bgnscd.h
  11. * Purpose : Background noise source charateristic detector (SCD)
  12. *
  13. ********************************************************************************
  14. */
  15. #ifndef bgnscd_h
  16. #define bgnscd_h "$Id $"
  17. /*
  18. ********************************************************************************
  19. * INCLUDE FILES
  20. ********************************************************************************
  21. */
  22. #include "typedef.h"
  23. #include "cnst.h"
  24. /*
  25. ********************************************************************************
  26. * LOCAL VARIABLES AND TABLES
  27. ********************************************************************************
  28. */
  29. #define L_ENERGYHIST 60
  30. #define INV_L_FRAME 102
  31. /* 2*(160*x)^2 / 65536 where x is FLP values 150,5 and 50 */
  32. #define FRAMEENERGYLIMIT 17578 /* 150 */
  33. #define LOWERNOISELIMIT 20 /* 5 */
  34. #define UPPERNOISELIMIT 1953 /* 50 */
  35. /*
  36. ********************************************************************************
  37. * DEFINITION OF DATA TYPES
  38. ********************************************************************************
  39. */
  40. typedef struct{
  41. /* history vector of past synthesis speech energy */
  42. Word16 frameEnergyHist[L_ENERGYHIST];
  43. /* state flags */
  44. Word16 bgHangover; /* counter; number of frames after last speech frame */
  45. } Bgn_scdState;
  46. /*
  47. ********************************************************************************
  48. * DECLARATION OF PROTOTYPES
  49. ********************************************************************************
  50. */
  51. /*
  52. **************************************************************************
  53. *
  54. * Function : Bgn_scd_init
  55. * Purpose : Allocates initializes state memory
  56. * Description : Stores pointer to filter status struct in *st. This
  57. * pointer has to be passed to Bgn_scd in each call.
  58. * Returns : 0 on success
  59. *
  60. **************************************************************************
  61. */
  62. Word16 Bgn_scd_init (Bgn_scdState **st);
  63. /*
  64. **************************************************************************
  65. *
  66. * Function : Bgn_scd_reset
  67. * Purpose : Resets state memory
  68. * Returns : 0 on success
  69. *
  70. **************************************************************************
  71. */
  72. Word16 Bgn_scd_reset (Bgn_scdState *st);
  73. /*
  74. **************************************************************************
  75. *
  76. * Function : Bgn_scd_exit
  77. * Purpose : The memory used for state memory is freed
  78. * Description : Stores NULL in *s
  79. * Returns : void
  80. *
  81. **************************************************************************
  82. */
  83. void Bgn_scd_exit (Bgn_scdState **st);
  84. /*
  85. **************************************************************************
  86. *
  87. * Function : Bgn_scd
  88. * Purpose : Charaterice synthesis speech and detect background noise
  89. * Returns : background noise decision; 0 = bgn, 1 = no bgn
  90. *
  91. **************************************************************************
  92. */
  93. Word16 Bgn_scd (Bgn_scdState *st, /* i : State variables for bgn SCD */
  94. Word16 ltpGainHist[], /* i : LTP gain history */
  95. Word16 speech[], /* o : synthesis speech frame */
  96. Word16 *voicedHangover /* o : # of frames after last voiced frame */
  97. );
  98. #endif