resampler_private.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /***********************************************************************
  2. Copyright (c) 2006-2012 IETF Trust and Skype Limited. All rights reserved.
  3. This file is extracted from RFC6716. Please see that RFC for additional
  4. information.
  5. Redistribution and use in source and binary forms, with or without
  6. modification, are permitted provided that the following conditions
  7. are met:
  8. - Redistributions of source code must retain the above copyright notice,
  9. this list of conditions and the following disclaimer.
  10. - Redistributions in binary form must reproduce the above copyright
  11. notice, this list of conditions and the following disclaimer in the
  12. documentation and/or other materials provided with the distribution.
  13. - Neither the name of Internet Society, IETF or IETF Trust, nor the
  14. names of specific contributors, may be used to endorse or promote
  15. products derived from this software without specific prior written
  16. permission.
  17. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
  18. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  21. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  22. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  23. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  24. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  25. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  26. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  27. POSSIBILITY OF SUCH DAMAGE.
  28. ***********************************************************************/
  29. #ifndef SILK_RESAMPLER_PRIVATE_H
  30. #define SILK_RESAMPLER_PRIVATE_H
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #include "SigProc_FIX.h"
  35. #include "resampler_structs.h"
  36. #include "resampler_rom.h"
  37. /* Number of input samples to process in the inner loop */
  38. #define RESAMPLER_MAX_BATCH_SIZE_MS 10
  39. #define RESAMPLER_MAX_FS_KHZ 48
  40. #define RESAMPLER_MAX_BATCH_SIZE_IN ( RESAMPLER_MAX_BATCH_SIZE_MS * RESAMPLER_MAX_FS_KHZ )
  41. /* Description: Hybrid IIR/FIR polyphase implementation of resampling */
  42. void silk_resampler_private_IIR_FIR(
  43. void *SS, /* I/O Resampler state */
  44. opus_int16 out[], /* O Output signal */
  45. const opus_int16 in[], /* I Input signal */
  46. opus_int32 inLen /* I Number of input samples */
  47. );
  48. /* Description: Hybrid IIR/FIR polyphase implementation of resampling */
  49. void silk_resampler_private_down_FIR(
  50. void *SS, /* I/O Resampler state */
  51. opus_int16 out[], /* O Output signal */
  52. const opus_int16 in[], /* I Input signal */
  53. opus_int32 inLen /* I Number of input samples */
  54. );
  55. /* Upsample by a factor 2, high quality */
  56. void silk_resampler_private_up2_HQ_wrapper(
  57. void *SS, /* I/O Resampler state (unused) */
  58. opus_int16 *out, /* O Output signal [ 2 * len ] */
  59. const opus_int16 *in, /* I Input signal [ len ] */
  60. opus_int32 len /* I Number of input samples */
  61. );
  62. /* Upsample by a factor 2, high quality */
  63. void silk_resampler_private_up2_HQ(
  64. opus_int32 *S, /* I/O Resampler state [ 6 ] */
  65. opus_int16 *out, /* O Output signal [ 2 * len ] */
  66. const opus_int16 *in, /* I Input signal [ len ] */
  67. opus_int32 len /* I Number of input samples */
  68. );
  69. /* Second order AR filter */
  70. void silk_resampler_private_AR2(
  71. opus_int32 S[], /* I/O State vector [ 2 ] */
  72. opus_int32 out_Q8[], /* O Output signal */
  73. const opus_int16 in[], /* I Input signal */
  74. const opus_int16 A_Q14[], /* I AR coefficients, Q14 */
  75. opus_int32 len /* I Signal length */
  76. );
  77. #ifdef __cplusplus
  78. }
  79. #endif
  80. #endif /* SILK_RESAMPLER_PRIVATE_H */