Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * MPEG Audio common tables
  3.  * copyright (c) 2002 Fabrice Bellard
  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. /**
  23.  * @file
  24.  * mpeg audio layer common tables.
  25.  */
  26.  
  27. #include "mpegaudiodata.h"
  28.  
  29.  
  30. const uint16_t avpriv_mpa_bitrate_tab[2][3][15] = {
  31.     { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
  32.       {0, 32, 48, 56,  64,  80,  96, 112, 128, 160, 192, 224, 256, 320, 384 },
  33.       {0, 32, 40, 48,  56,  64,  80,  96, 112, 128, 160, 192, 224, 256, 320 } },
  34.     { {0, 32, 48, 56,  64,  80,  96, 112, 128, 144, 160, 176, 192, 224, 256},
  35.       {0,  8, 16, 24,  32,  40,  48,  56,  64,  80,  96, 112, 128, 144, 160},
  36.       {0,  8, 16, 24,  32,  40,  48,  56,  64,  80,  96, 112, 128, 144, 160}
  37.     }
  38. };
  39.  
  40. const uint16_t avpriv_mpa_freq_tab[3] = { 44100, 48000, 32000 };
  41.  
  42. /*******************************************************/
  43. /* layer 2 tables */
  44.  
  45. const int ff_mpa_sblimit_table[5] = { 27 , 30 , 8, 12 , 30 };
  46.  
  47. const int ff_mpa_quant_steps[17] = {
  48.     3,     5,    7,    9,    15,
  49.     31,    63,  127,  255,   511,
  50.     1023,  2047, 4095, 8191, 16383,
  51.     32767, 65535
  52. };
  53.  
  54. /* we use a negative value if grouped */
  55. const int ff_mpa_quant_bits[17] = {
  56.     -5,  -7,  3, -10, 4,
  57.      5,  6,  7,  8,  9,
  58.     10, 11, 12, 13, 14,
  59.     15, 16
  60. };
  61.  
  62. /* encoding tables which give the quantization index. Note how it is
  63.    possible to store them efficiently ! */
  64. static const unsigned char alloc_table_1[] = {
  65.  4,  0,  2,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
  66.  4,  0,  2,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
  67.  4,  0,  2,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
  68.  4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
  69.  4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
  70.  4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
  71.  4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
  72.  4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
  73.  4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
  74.  4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
  75.  4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
  76.  3,  0,  1,  2,  3,  4,  5, 16,
  77.  3,  0,  1,  2,  3,  4,  5, 16,
  78.  3,  0,  1,  2,  3,  4,  5, 16,
  79.  3,  0,  1,  2,  3,  4,  5, 16,
  80.  3,  0,  1,  2,  3,  4,  5, 16,
  81.  3,  0,  1,  2,  3,  4,  5, 16,
  82.  3,  0,  1,  2,  3,  4,  5, 16,
  83.  3,  0,  1,  2,  3,  4,  5, 16,
  84.  3,  0,  1,  2,  3,  4,  5, 16,
  85.  3,  0,  1,  2,  3,  4,  5, 16,
  86.  3,  0,  1,  2,  3,  4,  5, 16,
  87.  3,  0,  1,  2,  3,  4,  5, 16,
  88.  2,  0,  1, 16,
  89.  2,  0,  1, 16,
  90.  2,  0,  1, 16,
  91.  2,  0,  1, 16,
  92.  2,  0,  1, 16,
  93.  2,  0,  1, 16,
  94.  2,  0,  1, 16,
  95. };
  96.  
  97. static const unsigned char alloc_table_3[] = {
  98.  4,  0,  1,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
  99.  4,  0,  1,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
  100.  3,  0,  1,  3,  4,  5,  6,  7,
  101.  3,  0,  1,  3,  4,  5,  6,  7,
  102.  3,  0,  1,  3,  4,  5,  6,  7,
  103.  3,  0,  1,  3,  4,  5,  6,  7,
  104.  3,  0,  1,  3,  4,  5,  6,  7,
  105.  3,  0,  1,  3,  4,  5,  6,  7,
  106.  3,  0,  1,  3,  4,  5,  6,  7,
  107.  3,  0,  1,  3,  4,  5,  6,  7,
  108.  3,  0,  1,  3,  4,  5,  6,  7,
  109.  3,  0,  1,  3,  4,  5,  6,  7,
  110. };
  111.  
  112. static const unsigned char alloc_table_4[] = {
  113.  4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
  114.  4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
  115.  4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
  116.  4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
  117.  3,  0,  1,  3,  4,  5,  6,  7,
  118.  3,  0,  1,  3,  4,  5,  6,  7,
  119.  3,  0,  1,  3,  4,  5,  6,  7,
  120.  3,  0,  1,  3,  4,  5,  6,  7,
  121.  3,  0,  1,  3,  4,  5,  6,  7,
  122.  3,  0,  1,  3,  4,  5,  6,  7,
  123.  3,  0,  1,  3,  4,  5,  6,  7,
  124.  2,  0,  1,  3,
  125.  2,  0,  1,  3,
  126.  2,  0,  1,  3,
  127.  2,  0,  1,  3,
  128.  2,  0,  1,  3,
  129.  2,  0,  1,  3,
  130.  2,  0,  1,  3,
  131.  2,  0,  1,  3,
  132.  2,  0,  1,  3,
  133.  2,  0,  1,  3,
  134.  2,  0,  1,  3,
  135.  2,  0,  1,  3,
  136.  2,  0,  1,  3,
  137.  2,  0,  1,  3,
  138.  2,  0,  1,  3,
  139.  2,  0,  1,  3,
  140.  2,  0,  1,  3,
  141.  2,  0,  1,  3,
  142.  2,  0,  1,  3,
  143. };
  144.  
  145. const unsigned char * const ff_mpa_alloc_tables[5] =
  146. { alloc_table_1, alloc_table_1, alloc_table_3, alloc_table_3, alloc_table_4, };
  147.