pre_big.c 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 : pre_big.c
  11. * Purpose : Big subframe (2 subframes) preprocessing
  12. *
  13. ********************************************************************************
  14. */
  15. /*
  16. ********************************************************************************
  17. * MODULE INCLUDE FILE AND VERSION ID
  18. ********************************************************************************
  19. */
  20. #include "pre_big.h"
  21. const char pre_big_id[] = "@(#)$Id $" pre_big_h;
  22. /*
  23. ********************************************************************************
  24. * INCLUDE FILES
  25. ********************************************************************************
  26. */
  27. #include <stdlib.h>
  28. #include <stdio.h>
  29. #include "typedef.h"
  30. #include "basic_op.h"
  31. #include "oper_32b.h"
  32. #include "syn_filt.h"
  33. #include "weight_a.h"
  34. #include "residu.h"
  35. #include "count.h"
  36. #include "cnst.h"
  37. /*
  38. ********************************************************************************
  39. * PUBLIC PROGRAM CODE
  40. ********************************************************************************
  41. */
  42. int pre_big(
  43. enum Mode mode, /* i : coder mode */
  44. const Word16 gamma1[], /* i : spectral exp. factor 1 */
  45. const Word16 gamma1_12k2[],/* i : spectral exp. factor 1 for EFR */
  46. const Word16 gamma2[], /* i : spectral exp. factor 2 */
  47. Word16 A_t[], /* i : A(z) unquantized, for 4 subframes, Q12 */
  48. Word16 frameOffset, /* i : Start position in speech vector, Q0 */
  49. Word16 speech[], /* i : speech, Q0 */
  50. Word16 mem_w[], /* i/o: synthesis filter memory state, Q0 */
  51. Word16 wsp[] /* o : weighted speech Q0 */
  52. )
  53. {
  54. Word16 Ap1[MP1]; /* A(z) with spectral expansion */
  55. Word16 Ap2[MP1]; /* A(z) with spectral expansion */
  56. const Word16 *g1; /* Pointer to correct gammma1 vector */
  57. Word16 aOffset;
  58. Word16 i;
  59. test ();
  60. if (sub_ex (mode, MR795) <= 0 )
  61. {
  62. g1 = gamma1; move16 ();
  63. }
  64. else
  65. {
  66. g1 = gamma1_12k2; move16 ();
  67. }
  68. test ();
  69. if (frameOffset > 0) {
  70. aOffset = 2*MP1; move16 ();
  71. }
  72. else {
  73. aOffset = 0; move16 ();
  74. }
  75. /* process two subframes (which form the "big" subframe) */
  76. for (i = 0; i < 2; i++)
  77. {
  78. Weight_Ai(&A_t[aOffset], g1, Ap1);
  79. Weight_Ai(&A_t[aOffset], gamma2, Ap2);
  80. Residu(Ap1, &speech[frameOffset], &wsp[frameOffset], L_SUBFR);
  81. Syn_filt(Ap2, &wsp[frameOffset], &wsp[frameOffset], L_SUBFR, mem_w, 1);
  82. aOffset = add_ex (aOffset, MP1);
  83. frameOffset = add_ex (frameOffset, L_SUBFR);
  84. }
  85. return 0;
  86. }