Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * TwinVQ decoder
  3.  * Copyright (c) 2009 Vitor Sessak
  4.  *
  5.  * This file is part of FFmpeg.
  6.  *
  7.  * FFmpeg is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  *
  12.  * FFmpeg is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with FFmpeg; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20.  */
  21.  
  22. #ifndef AVCODEC_TWINVQ_DATA_H
  23. #define AVCODEC_TWINVQ_DATA_H
  24.  
  25. #include <stddef.h>
  26. #include <stdint.h>
  27.  
  28. /*
  29.  * The bark_tab_* tables are constructed so that
  30.  *
  31.  *       /i-1              \
  32.  *       |--               |
  33.  *  bark |\   bark_tab[j]  | == i
  34.  *       |/                |
  35.  *       |--               |
  36.  *       \j=0              /
  37.  *
  38.  *
  39.  * for some slightly nonconventional bark-scale function
  40.  */
  41. static const uint16_t bark_tab_l08_512[] = {
  42.      7,  8,  7,  8,  8,  8,  8,  8,  8,  9,
  43.      9, 10, 10, 11, 11, 12, 12, 14, 15, 16,
  44.     18, 19, 21, 24, 27, 30, 35, 40, 46, 53
  45. };
  46.  
  47. static const uint16_t bark_tab_l11_512[] = {
  48.      6,  6,  6,  6,  6,  6,  7,  6,  7,  7,
  49.      8,  8,  8,  9, 10, 10, 11, 13, 13, 15,
  50.     17, 18, 21, 25, 27, 33, 38, 45, 54, 66
  51. };
  52.  
  53. static const uint16_t bark_tab_l16_1024[] = {
  54.      9,  9,  8,  9, 10, 9,  10,  10,  10,  12,
  55.     11, 13, 13, 14, 16, 17, 19,  20,  24,  26,
  56.     30, 35, 40, 48, 56, 68, 83, 102, 128, 165
  57. };
  58.  
  59. static const uint16_t bark_tab_l22_1024[] = {
  60.       6,   7,  6,  6,  7,  7,  7,  7,  7,   8,
  61.       9,   8, 10, 10, 11, 12, 13, 15, 16,  18,
  62.      21,  24, 27, 33, 38, 46, 55, 68, 84, 107,
  63.     140, 191
  64. };
  65.  
  66. static const uint16_t bark_tab_l22_512[] = {
  67.      3,  3,  3,  4,  3,  3,  4,  3,  4,  4,
  68.      4,  5,  4,  5,  6,  6,  7,  7,  8,  9,
  69.     10, 12, 14, 16, 20, 22, 28, 34, 42, 53,
  70.     71, 95
  71. };
  72.  
  73. static const uint16_t bark_tab_l44_2048[] = {
  74.      5,  6,  5,  6,  5,   6,   6,   6,   6,   6,
  75.      7,  7,  7,  8,  8,   9,   9,  10,  11,  11,
  76.     13, 14, 16, 17, 19,  22,  25,  29,  33,  39,
  77.     46, 54, 64, 79, 98, 123, 161, 220, 320, 512
  78. };
  79.  
  80. static const uint16_t bark_tab_m08_256[] = {
  81.     6,  5,  6,  6,  6,  6,  7,  7,  8,  8,
  82.     9, 10, 11, 13, 15, 18, 20, 25, 31, 39
  83. };
  84.  
  85. static const uint16_t bark_tab_m11_256[] = {
  86.     4, 5,  4,  5,  5,  5,  6,  5,  7,  7,
  87.     8, 9, 10, 12, 15, 17, 22, 28, 35, 47
  88. };
  89.  
  90. static const uint16_t bark_tab_m16_512[] = {
  91.      7,  6,  7,  7,  7,  8,  9,  9, 10,  11,
  92.     14, 15, 18, 22, 27, 34, 44, 59, 81, 117
  93. };
  94.  
  95. static const uint16_t bark_tab_m22_256[] = {
  96.     3, 2, 3, 2,  3,  3,  4,  3,  4,  5,
  97.     5, 7, 8, 9, 13, 16, 22, 30, 44, 70
  98. };
  99.  
  100. static const uint16_t bark_tab_m22_512[] = {
  101.      5,  5,  5,  6,  5,  7,  6,  7,  9,   9,
  102.     11, 13, 15, 20, 24, 33, 43, 61, 88, 140
  103. };
  104.  
  105. static const uint16_t bark_tab_m44_512[] = {
  106.     3, 2,  3,  3,  3,  4,  3,  5,  4,   6,
  107.     7, 8, 10, 14, 18, 25, 36, 55, 95, 208
  108. };
  109.  
  110. static const uint16_t bark_tab_s08_64[] = {
  111.     3, 3, 3, 3, 4, 5, 6, 8, 12, 17
  112. };
  113.  
  114. static const uint16_t bark_tab_s11_64[] = {
  115.     2, 3, 2, 3, 3, 4, 6, 8, 12, 21
  116. };
  117.  
  118. static const uint16_t bark_tab_s16_128[] = {
  119.     3, 4, 4, 4, 5, 7, 10, 16, 26, 49
  120. };
  121.  
  122. static const uint16_t bark_tab_s22_128[] = {
  123.     3, 2, 3, 4, 4, 6, 9, 14, 26, 57
  124. };
  125.  
  126. static const uint16_t bark_tab_s44_128[] = {
  127.     1, 2, 1, 2, 3, 4, 6, 10, 23, 76
  128. };
  129.  
  130. /**
  131.  * TwinVQ codebooks. They are coded in a struct so we can use code such as
  132.  *
  133.  * float val = tab.fcb0808l[get_bits(gb, 12)];
  134.  *
  135.  * without risking a segfault on malformed files.
  136.  */#endif /* AVCODEC_TWINVQ_DATA_H */
  137.