b_cn_cod.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 : b_cn_cod.h
  11. * Purpose : Contains function for comfort noise generation.
  12. *
  13. ********************************************************************************
  14. */
  15. #ifndef b_cn_cod_h
  16. #define b_cn_cod_h "$Id $"
  17. /*
  18. ********************************************************************************
  19. * INCLUDE FILES
  20. ********************************************************************************
  21. */
  22. #include "typedef.h"
  23. /*
  24. ********************************************************************************
  25. * DEFINITION OF DATA TYPES
  26. ********************************************************************************
  27. */
  28. /*
  29. ********************************************************************************
  30. * DECLARATION OF PROTOTYPES
  31. ********************************************************************************
  32. */
  33. /*************************************************************************
  34. *
  35. * FUNCTION NAME: pseudonoise
  36. *
  37. * PURPOSE: Generate a random integer value to use in comfort noise
  38. * generation. The algorithm uses polynomial x^31 + x^3 + 1
  39. * (length of PN sequence is 2^31 - 1).
  40. *
  41. * INPUTS: *shift_reg Old CN generator shift register state
  42. *
  43. *
  44. * OUTPUTS: *shift_reg Updated CN generator shift register state
  45. *
  46. * RETURN VALUE: Generated random integer value
  47. *
  48. *************************************************************************/
  49. Word16 pseudonoise (
  50. Word32 *shift_reg, /* i/o : Old CN generator shift register state */
  51. Word16 no_bits /* i : Number of bits */
  52. );
  53. /*************************************************************************
  54. *
  55. * FUNCTION NAME: build_CN_code
  56. *
  57. * PURPOSE: Compute the comfort noise fixed codebook excitation. The
  58. * gains of the pulses are always +/-1.
  59. *
  60. * INPUTS: *seed Old CN generator shift register state
  61. *
  62. * OUTPUTS: cod[0..39] Generated comfort noise fixed codebook vector
  63. * *seed Updated CN generator shift register state
  64. *
  65. * RETURN VALUE: none
  66. *
  67. *************************************************************************/
  68. void build_CN_code (
  69. Word32 *seed, /* i/o : Old CN generator shift register state */
  70. Word16 cod[] /* o : Generated CN fixed codebook vector */
  71. );
  72. /*************************************************************************
  73. *
  74. * FUNCTION NAME: build_CN_param
  75. *
  76. * PURPOSE: Randomize the speech parameters. So that they
  77. * do not produce tonal artifacts if used by ECU.
  78. *
  79. * INPUTS: *seed Old CN generator shift register state
  80. * n_param, Number of parameters to randomize
  81. * parm_size_table,
  82. *
  83. *
  84. * OUTPUTS: parm CN Generated Parameters
  85. * *seed Updated CN generator shift register state
  86. *
  87. * RETURN VALUE: none
  88. *
  89. *************************************************************************/
  90. void build_CN_param (
  91. Word16 *seed, /* i/o : Old CN generator shift register state */
  92. const Word16 n_param, /* i : number of params */
  93. const Word16 param_size_table[], /* i : size of params */
  94. Word16 parm[] /* o : CN Generated Params*/
  95. );
  96. #endif