cb_search.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* Copyright (C) 2002 Jean-Marc Valin & David Rowe */
  2. /**
  3. @file cb_search.h
  4. @brief Overlapped codebook search
  5. */
  6. /*
  7. Redistribution and use in source and binary forms, with or without
  8. modification, are permitted provided that the following conditions
  9. are met:
  10. - Redistributions of source code must retain the above copyright
  11. notice, this list of conditions and the following disclaimer.
  12. - Redistributions in binary form must reproduce the above copyright
  13. notice, this list of conditions and the following disclaimer in the
  14. documentation and/or other materials provided with the distribution.
  15. - Neither the name of the Xiph.org Foundation nor the names of its
  16. contributors may be used to endorse or promote products derived from
  17. this software without specific prior written permission.
  18. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
  22. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  23. EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  24. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  25. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  26. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  27. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #ifndef CB_SEARCH_H
  31. #define CB_SEARCH_H
  32. #include <speex/speex_bits.h>
  33. #include "arch.h"
  34. /** Split codebook parameters. */
  35. typedef struct split_cb_params {
  36. int subvect_size;
  37. int nb_subvect;
  38. const signed char *shape_cb;
  39. int shape_bits;
  40. int have_sign;
  41. } split_cb_params;
  42. void split_cb_search_shape_sign(
  43. spx_word16_t target[], /* target vector */
  44. spx_coef_t ak[], /* LPCs for this subframe */
  45. spx_coef_t awk1[], /* Weighted LPCs for this subframe */
  46. spx_coef_t awk2[], /* Weighted LPCs for this subframe */
  47. const void *par, /* Codebook/search parameters */
  48. int p, /* number of LPC coeffs */
  49. int nsf, /* number of samples in subframe */
  50. spx_sig_t *exc,
  51. spx_word16_t *r,
  52. SpeexBits *bits,
  53. char *stack,
  54. int complexity,
  55. int update_target
  56. );
  57. void split_cb_shape_sign_unquant(
  58. spx_sig_t *exc,
  59. const void *par, /* non-overlapping codebook */
  60. int nsf, /* number of samples in subframe */
  61. SpeexBits *bits,
  62. char *stack,
  63. spx_int32_t *seed
  64. );
  65. void noise_codebook_quant(
  66. spx_word16_t target[], /* target vector */
  67. spx_coef_t ak[], /* LPCs for this subframe */
  68. spx_coef_t awk1[], /* Weighted LPCs for this subframe */
  69. spx_coef_t awk2[], /* Weighted LPCs for this subframe */
  70. const void *par, /* Codebook/search parameters */
  71. int p, /* number of LPC coeffs */
  72. int nsf, /* number of samples in subframe */
  73. spx_sig_t *exc,
  74. spx_word16_t *r,
  75. SpeexBits *bits,
  76. char *stack,
  77. int complexity,
  78. int update_target
  79. );
  80. void noise_codebook_unquant(
  81. spx_sig_t *exc,
  82. const void *par, /* non-overlapping codebook */
  83. int nsf, /* number of samples in subframe */
  84. SpeexBits *bits,
  85. char *stack,
  86. spx_int32_t *seed
  87. );
  88. #endif