You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
3.5KB

  1. // Copyright 2014 Olivier Gillet.
  2. //
  3. // Author: Olivier Gillet (ol.gillet@gmail.com)
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to deal
  7. // in the Software without restriction, including without limitation the rights
  8. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. // copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in
  13. // all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. // THE SOFTWARE.
  22. //
  23. // See http://creativecommons.org/licenses/MIT/ for more information.
  24. //
  25. // -----------------------------------------------------------------------------
  26. //
  27. // Mu-law encoding.
  28. #include "clouds/dsp/mu_law.h"
  29. namespace clouds {
  30. /* extern */
  31. int16_t lut_ulaw[256] = {
  32. -32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956,
  33. -23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764,
  34. -15996, -15484, -14972, -14460, -13948, -13436, -12924, -12412,
  35. -11900, -11388, -10876, -10364, -9852, -9340, -8828, -8316,
  36. -7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140,
  37. -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092,
  38. -3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004,
  39. -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980,
  40. -1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436,
  41. -1372, -1308, -1244, -1180, -1116, -1052, -988, -924,
  42. -876, -844, -812, -780, -748, -716, -684, -652,
  43. -620, -588, -556, -524, -492, -460, -428, -396,
  44. -372, -356, -340, -324, -308, -292, -276, -260,
  45. -244, -228, -212, -196, -180, -164, -148, -132,
  46. -120, -112, -104, -96, -88, -80, -72, -64,
  47. -56, -48, -40, -32, -24, -16, -8, 0,
  48. 32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956,
  49. 23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764,
  50. 15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412,
  51. 11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316,
  52. 7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140,
  53. 5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092,
  54. 3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004,
  55. 2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980,
  56. 1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436,
  57. 1372, 1308, 1244, 1180, 1116, 1052, 988, 924,
  58. 876, 844, 812, 780, 748, 716, 684, 652,
  59. 620, 588, 556, 524, 492, 460, 428, 396,
  60. 372, 356, 340, 324, 308, 292, 276, 260,
  61. 244, 228, 212, 196, 180, 164, 148, 132,
  62. 120, 112, 104, 96, 88, 80, 72, 64,
  63. 56, 48, 40, 32, 24, 16, 8, 0
  64. };
  65. } // namespace clouds