bv16externs.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*****************************************************************************/
  2. /* BroadVoice(R)16 (BV16) Fixed-Point ANSI-C Source Code */
  3. /* Revision Date: November 13, 2009 */
  4. /* Version 1.1 */
  5. /*****************************************************************************/
  6. /*****************************************************************************/
  7. /* Copyright 2000-2009 Broadcom Corporation */
  8. /* */
  9. /* This software is provided under the GNU Lesser General Public License, */
  10. /* version 2.1, as published by the Free Software Foundation ("LGPL"). */
  11. /* This program is distributed in the hope that it will be useful, but */
  12. /* WITHOUT ANY SUPPORT OR WARRANTY; without even the implied warranty of */
  13. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LGPL for */
  14. /* more details. A copy of the LGPL is available at */
  15. /* http://www.broadcom.com/licenses/LGPLv2.1.php, */
  16. /* or by writing to the Free Software Foundation, Inc., */
  17. /* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  18. /*****************************************************************************/
  19. /*****************************************************************************
  20. bv16externs.c : BV16 Fixed-Point externs
  21. $Log$
  22. ******************************************************************************/
  23. /* POINTERS */
  24. extern Word16 winl[WINSZ];
  25. extern Word16 sstwinl_h[];
  26. extern Word16 sstwinl_l[];
  27. extern Word16 gfsz[];
  28. extern Word16 gfsp[];
  29. extern Word16 idxord[];
  30. extern Word16 hpfa[];
  31. extern Word16 hpfb[];
  32. extern Word16 adf_h[];
  33. extern Word16 adf_l[];
  34. extern Word16 bdf[];
  35. extern Word16 x[];
  36. extern Word16 x2[];
  37. extern Word16 MPTH[];
  38. /* LSP Quantization */
  39. extern Word16 lspecb1[];
  40. extern Word16 lspecb2[];
  41. extern Word16 lspmean[];
  42. extern Word16 lspp[];
  43. /* Log-Gain Quantization */
  44. extern Word16 lgpecb[];
  45. extern Word16 lgp[];
  46. extern Word16 lgmean;
  47. /* Log-Gain Limitation */
  48. extern Word16 lgclimit[];
  49. /* Excitation Codebook */
  50. extern Word16 cccb[];
  51. /* Function Prototypes */
  52. Word32 estlevel(
  53. Word32 lg,
  54. Word32 *level,
  55. Word32 *lmax,
  56. Word32 *lmin,
  57. Word32 *lmean,
  58. Word32 *x1,
  59. Word16 ngfae,
  60. Word16 nggalgc,
  61. Word16 *estl_alpha_min); /* Q15 */
  62. void excdec_w_synth(
  63. Word16 *xq, /* (o) Q0 quantized signal vector */
  64. Word16 *ltsym, /* (i/o) Q16 quantized excitation signal vector */
  65. Word16 *stsym, /* (i/o) Q0 short-term predictor memory */
  66. Word16 *idx, /* (o) quantizer codebook index for uq[] vector */
  67. Word16 *b, /* (i) Q15 coefficient of 3-tap pitch predictor */
  68. Word16 *cb, /* (i) Q0 codebook */
  69. Word16 pp, /* pitch period (# of 8 kHz samples) */
  70. Word16 *aq, /* (i) Q12 short-term predictor coefficients */
  71. Word16 gain_exp, /* gain_exp of current sub-frame */
  72. Word32 *EE
  73. );
  74. Word32 gaindec(
  75. Word32 *lgq, /* Q25 */
  76. Word16 gidx,
  77. Word16 *lgpm, /* Q11 */
  78. Word32 *prevlg, /* Q25 */
  79. Word32 level, /* Q25 */
  80. Word16 *nggalgc,
  81. Word32 *lg_el);
  82. void gainplc(Word32 E, Word16 *lgeqm, Word32 *lgqm);
  83. void lspdec(
  84. Word16 *lspq, /* Q15 */
  85. Word16 *lspidx,
  86. Word16 *lsppm, /* Q15 */
  87. Word16 *lspqlast);
  88. void lspdecplc(
  89. Word16 *lspq, /* Q15 */
  90. Word16 *lsppm); /* Q15 */
  91. Word16 coarsepitch(
  92. Word16 *xw, /* (i) Q1 weighted low-band signal frame */
  93. struct BV16_Encoder_State *c); /* (i/o) coder state */
  94. Word16 refinepitch(
  95. Word16 *x,
  96. Word16 cpp,
  97. Word16 *ppt);
  98. Word16 pitchtapquan(
  99. Word16 *x,
  100. Word16 pp,
  101. Word16 *b,
  102. Word32 *re);
  103. void excquan(
  104. Word16 *idx, /* quantizer codebook index for uq[] vector */
  105. Word16 *s, /* (i) Q0 input signal vector */
  106. Word16 *aq, /* (i) Q12 noise feedback filter coefficient array */
  107. Word16 *fsz, /* (i) Q12 short-term noise feedback filter - numerator */
  108. Word16 *fsp, /* (i) Q12 short-term noise feedback filter - denominator */
  109. Word16 *b, /* (i) Q15 coefficient of 3-tap pitch predictor */
  110. Word16 beta, /* (i) Q13 coefficient of pitch feedback filter */
  111. Word16 *stsym, /* (i/o) Q0 filter memory */
  112. Word16 *ltsym, /* (i/0) Q0 long-term synthesis filter memory */
  113. Word16 *ltnfm, /* (i/o) Q0 long-term noise feedback filter memory */
  114. Word16 *stnfz, /* (i/o) Q0 filter memory */
  115. Word16 *stnfp, /* (i/o) Q0 filter memory */
  116. Word16 *cb, /* (i) scalar quantizer codebook - normalized by gain_exp */
  117. Word16 pp, /* pitch period (# of 8 kHz samples) */
  118. Word16 gain_exp
  119. );
  120. Word16 gainquan(
  121. Word32 *gainq, /* Q18 */
  122. Word32 *ee, /* Q3 */
  123. Word16 *lgpm, /* Q11 */
  124. Word32 *prevlg, /* Q25 */
  125. Word32 level); /* Q25 */
  126. void lspquan(
  127. Word16 *lspq,
  128. Word16 *lspidx,
  129. Word16 *lsp,
  130. Word16 *lsppm);
  131. void preprocess(
  132. struct BV16_Encoder_State *cs,
  133. Word16 *output, /* (o) Q0 output signal, less factor 1.5 */
  134. Word16 *input, /* (i) Q0 input signal */
  135. Word16 N); /* length of signal */