gain_q.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 : gainQuant.h
  11. * Purpose : Quantazation of gains
  12. *
  13. ********************************************************************************
  14. */
  15. #ifndef gain_q_h
  16. #define gain_q_h "$Id $"
  17. /*
  18. ********************************************************************************
  19. * INCLUDE FILES
  20. ********************************************************************************
  21. */
  22. #include "typedef.h"
  23. #include "mode.h"
  24. #include "gc_pred.h"
  25. #include "g_adapt.h"
  26. /*
  27. ********************************************************************************
  28. * DEFINITION OF DATA TYPES
  29. ********************************************************************************
  30. */
  31. typedef struct {
  32. Word16 sf0_exp_gcode0;
  33. Word16 sf0_frac_gcode0;
  34. Word16 sf0_exp_target_en;
  35. Word16 sf0_frac_target_en;
  36. Word16 sf0_exp_coeff[5];
  37. Word16 sf0_frac_coeff[5];
  38. Word16 *gain_idx_ptr;
  39. gc_predState *gc_predSt;
  40. gc_predState *gc_predUnqSt;
  41. GainAdaptState *adaptSt;
  42. } gainQuantState;
  43. /*
  44. ********************************************************************************
  45. * DECLARATION OF PROTOTYPES
  46. ********************************************************************************
  47. */
  48. int gainQuant_init (gainQuantState **st);
  49. /* initialize one instance of the pre processing state.
  50. Stores pointer to filter status struct in *st. This pointer has to
  51. be passed to gainQuant in each call.
  52. returns 0 on success
  53. */
  54. int gainQuant_reset (gainQuantState *st);
  55. /* reset of pre processing state (i.e. set state memory to zero)
  56. returns 0 on success
  57. */
  58. void gainQuant_exit (gainQuantState **st);
  59. /* de-initialize pre processing state (i.e. free status struct)
  60. stores NULL in *st
  61. */
  62. int gainQuant(
  63. gainQuantState *st, /* i/o : State struct */
  64. enum Mode mode, /* i : coder mode */
  65. Word16 res[], /* i : LP residual, Q0 */
  66. Word16 exc[], /* i : LTP excitation (unfiltered), Q0 */
  67. Word16 code[], /* i : CB innovation (unfiltered), Q13 */
  68. /* (unsharpened for MR475) */
  69. Word16 xn[], /* i : Target vector. */
  70. Word16 xn2[], /* i : Target vector. */
  71. Word16 y1[], /* i : Adaptive codebook. */
  72. Word16 Y2[], /* i : Filtered innovative vector. */
  73. Word16 g_coeff[], /* i : Correlations <xn y1> <y1 y1> */
  74. /* Compute in G_pitch(). */
  75. Word16 even_subframe, /* i : even subframe indicator flag */
  76. Word16 gp_limit, /* i : pitch gain limit */
  77. Word16 *sf0_gain_pit, /* o : Pitch gain sf 0. MR475 */
  78. Word16 *sf0_gain_cod, /* o : Code gain sf 0. MR475 */
  79. Word16 *gain_pit, /* i/o : Pitch gain. */
  80. Word16 *gain_cod, /* o : Code gain. */
  81. /* MR475: gain_* unquantized in even */
  82. /* subframes, quantized otherwise */
  83. Word16 **anap /* o : Index of quantization */
  84. );
  85. #endif