qgain475.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 : qgain475.h
  11. * Purpose : Quantization of pitch and codebook gains for MR475.
  12. *
  13. ********************************************************************************
  14. */
  15. #ifndef qgain475_h
  16. #define qgain475_h "$Id $"
  17. /*
  18. ********************************************************************************
  19. * INCLUDE FILES
  20. ********************************************************************************
  21. */
  22. #include "typedef.h"
  23. #include "gc_pred.h"
  24. #include "mode.h"
  25. /*
  26. ********************************************************************************
  27. * DECLARATION OF PROTOTYPES
  28. ********************************************************************************
  29. */
  30. /*************************************************************************
  31. *
  32. * FUNCTION: MR475_update_unq_pred()
  33. *
  34. * PURPOSE: use optimum codebook gain and update "unquantized"
  35. * gain predictor with the (bounded) prediction error
  36. *
  37. *************************************************************************/
  38. void
  39. MR475_update_unq_pred(
  40. gc_predState *pred_st, /* i/o: gain predictor state struct */
  41. Word16 exp_gcode0, /* i : predicted CB gain (exponent), Q0 */
  42. Word16 frac_gcode0, /* i : predicted CB gain (fraction), Q15 */
  43. Word16 cod_gain_exp, /* i : optimum codebook gain (exponent), Q0 */
  44. Word16 cod_gain_frac /* i : optimum codebook gain (fraction), Q15 */
  45. );
  46. /*************************************************************************
  47. *
  48. * FUNCTION: MR475_gain_quant()
  49. *
  50. * PURPOSE: Quantization of pitch and codebook gains for two subframes
  51. * (using predicted codebook gain)
  52. *
  53. *************************************************************************/
  54. Word16
  55. MR475_gain_quant( /* o : index of quantization. */
  56. gc_predState *pred_st, /* i/o: gain predictor state struct */
  57. /* data from subframe 0 (or 2) */
  58. Word16 sf0_exp_gcode0, /* i : predicted CB gain (exponent), Q0 */
  59. Word16 sf0_frac_gcode0, /* i : predicted CB gain (fraction), Q15 */
  60. Word16 sf0_exp_coeff[], /* i : energy coeff. (5), exponent part, Q0 */
  61. Word16 sf0_frac_coeff[], /* i : energy coeff. (5), fraction part, Q15 */
  62. /* (frac_coeff and exp_coeff computed in */
  63. /* calc_filt_energies()) */
  64. Word16 sf0_exp_target_en, /* i : exponent of target energy, Q0 */
  65. Word16 sf0_frac_target_en, /* i : fraction of target energy, Q15 */
  66. /* data from subframe 1 (or 3) */
  67. Word16 sf1_code_nosharp[], /* i : innovative codebook vector (L_SUBFR) */
  68. /* (whithout pitch sharpening) */
  69. Word16 sf1_exp_gcode0, /* i : predicted CB gain (exponent), Q0 */
  70. Word16 sf1_frac_gcode0, /* i : predicted CB gain (fraction), Q15 */
  71. Word16 sf1_exp_coeff[], /* i : energy coeff. (5), exponent part, Q0 */
  72. Word16 sf1_frac_coeff[], /* i : energy coeff. (5), fraction part, Q15 */
  73. /* (frac_coeff and exp_coeff computed in */
  74. /* calc_filt_energies()) */
  75. Word16 sf1_exp_target_en, /* i : exponent of target energy, Q0 */
  76. Word16 sf1_frac_target_en, /* i : fraction of target energy, Q15 */
  77. Word16 gp_limit, /* i : pitch gain limit */
  78. Word16 *sf0_gain_pit, /* o : Pitch gain, Q14 */
  79. Word16 *sf0_gain_cod, /* o : Code gain, Q1 */
  80. Word16 *sf1_gain_pit, /* o : Pitch gain, Q14 */
  81. Word16 *sf1_gain_cod /* o : Code gain, Q1 */
  82. );
  83. #endif