SKP_Silk_resampler_structs.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /***********************************************************************
  2. Copyright (c) 2006-2012, Skype Limited. All rights reserved.
  3. Redistribution and use in source and binary forms, with or without
  4. modification, (subject to the limitations in the disclaimer below)
  5. are permitted provided that the following conditions are met:
  6. - Redistributions of source code must retain the above copyright notice,
  7. this list of conditions and the following disclaimer.
  8. - Redistributions in binary form must reproduce the above copyright
  9. notice, this list of conditions and the following disclaimer in the
  10. documentation and/or other materials provided with the distribution.
  11. - Neither the name of Skype Limited, nor the names of specific
  12. contributors, may be used to endorse or promote products derived from
  13. this software without specific prior written permission.
  14. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
  15. BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  16. CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
  17. BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  18. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  19. COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  20. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  21. NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  22. USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  23. ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  25. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. ***********************************************************************/
  27. /* *
  28. * File Name: SKP_Silk_resampler_structs.h *
  29. * *
  30. * Description: Structs for IIR/FIR resamplers *
  31. * *
  32. * Copyright 2010 (c), Skype Limited *
  33. * All rights reserved. *
  34. * *
  35. * */
  36. #ifndef SKP_Silk_RESAMPLER_STRUCTS_H
  37. #define SKP_Silk_RESAMPLER_STRUCTS_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Flag to enable support for input/output sampling rates above 48 kHz. Turn off for embedded devices */
  42. #define RESAMPLER_SUPPORT_ABOVE_48KHZ 1
  43. #define SKP_Silk_RESAMPLER_MAX_FIR_ORDER 16
  44. #define SKP_Silk_RESAMPLER_MAX_IIR_ORDER 6
  45. typedef struct _SKP_Silk_resampler_state_struct{
  46. SKP_int32 sIIR[ SKP_Silk_RESAMPLER_MAX_IIR_ORDER ]; /* this must be the first element of this struct */
  47. SKP_int32 sFIR[ SKP_Silk_RESAMPLER_MAX_FIR_ORDER ];
  48. SKP_int32 sDown2[ 2 ];
  49. void (*resampler_function)( void *, SKP_int16 *, const SKP_int16 *, SKP_int32 );
  50. void (*up2_function)( SKP_int32 *, SKP_int16 *, const SKP_int16 *, SKP_int32 );
  51. SKP_int32 batchSize;
  52. SKP_int32 invRatio_Q16;
  53. SKP_int32 FIR_Fracs;
  54. SKP_int32 input2x;
  55. const SKP_int16 *Coefs;
  56. #if RESAMPLER_SUPPORT_ABOVE_48KHZ
  57. SKP_int32 sDownPre[ 2 ];
  58. SKP_int32 sUpPost[ 2 ];
  59. void (*down_pre_function)( SKP_int32 *, SKP_int16 *, const SKP_int16 *, SKP_int32 );
  60. void (*up_post_function)( SKP_int32 *, SKP_int16 *, const SKP_int16 *, SKP_int32 );
  61. SKP_int32 batchSizePrePost;
  62. SKP_int32 ratio_Q16;
  63. SKP_int32 nPreDownsamplers;
  64. SKP_int32 nPostUpsamplers;
  65. #endif
  66. SKP_int32 magic_number;
  67. } SKP_Silk_resampler_state_struct;
  68. #ifdef __cplusplus
  69. }
  70. #endif
  71. #endif /* SKP_Silk_RESAMPLER_STRUCTS_H */