2
* MPEG1 codec / MPEG2 decoder
3
* copyright (c) 2000,2001 Fabrice Bellard
4
* copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
6
* This file is part of FFmpeg.
8
* FFmpeg is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2.1 of the License, or (at your option) any later version.
13
* FFmpeg is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with FFmpeg; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2
24
* @file mpeg12data.h
6
const int16_t ff_mpeg1_default_intra_matrix[64] = {
7
8, 16, 19, 22, 26, 27, 29, 34,
8
16, 16, 22, 24, 27, 29, 34, 37,
9
19, 22, 26, 27, 29, 34, 34, 38,
10
22, 22, 26, 27, 29, 34, 37, 40,
11
22, 26, 27, 29, 32, 35, 40, 48,
12
26, 27, 29, 32, 35, 40, 48, 58,
13
26, 27, 29, 34, 38, 46, 56, 69,
14
27, 29, 35, 38, 46, 56, 69, 83
17
const int16_t ff_mpeg1_default_non_intra_matrix[64] = {
18
16, 16, 16, 16, 16, 16, 16, 16,
19
16, 16, 16, 16, 16, 16, 16, 16,
20
16, 16, 16, 16, 16, 16, 16, 16,
21
16, 16, 16, 16, 16, 16, 16, 16,
22
16, 16, 16, 16, 16, 16, 16, 16,
23
16, 16, 16, 16, 16, 16, 16, 16,
24
16, 16, 16, 16, 16, 16, 16, 16,
25
16, 16, 16, 16, 16, 16, 16, 16,
28
static const unsigned char vlc_dc_table[256] = {
31
4, 4, 4, 4, 4, 4, 4, 4,
32
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
33
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
34
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
36
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
37
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
38
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
39
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
41
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
42
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
43
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
44
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
45
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
46
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
47
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
48
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
28
const uint16_t ff_mpeg1_default_intra_matrix[64] = {
29
8, 16, 19, 22, 26, 27, 29, 34,
30
16, 16, 22, 24, 27, 29, 34, 37,
31
19, 22, 26, 27, 29, 34, 34, 38,
32
22, 22, 26, 27, 29, 34, 37, 40,
33
22, 26, 27, 29, 32, 35, 40, 48,
34
26, 27, 29, 32, 35, 40, 48, 58,
35
26, 27, 29, 34, 38, 46, 56, 69,
36
27, 29, 35, 38, 46, 56, 69, 83
39
const uint16_t ff_mpeg1_default_non_intra_matrix[64] = {
40
16, 16, 16, 16, 16, 16, 16, 16,
41
16, 16, 16, 16, 16, 16, 16, 16,
42
16, 16, 16, 16, 16, 16, 16, 16,
43
16, 16, 16, 16, 16, 16, 16, 16,
44
16, 16, 16, 16, 16, 16, 16, 16,
45
16, 16, 16, 16, 16, 16, 16, 16,
46
16, 16, 16, 16, 16, 16, 16, 16,
47
16, 16, 16, 16, 16, 16, 16, 16,
51
50
static const uint16_t vlc_dc_lum_code[12] = {
110
109
{0x20, 8}, {0x16,13}, {0x15,13}, {0x1f,15},
111
110
{0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15},
112
111
{0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16},
113
{0x11,16}, {0x10,16}, {0x05, 5}, {0x07, 7},
114
{0xfc, 8}, {0x0c,10}, {0x14,13}, {0x07, 5},
115
{0x26, 8}, {0x1c,12}, {0x13,13}, {0x06, 6},
116
{0xfd, 8}, {0x12,12}, {0x07, 6}, {0x04, 9},
117
{0x12,13}, {0x06, 7}, {0x1e,12}, {0x14,16},
118
{0x04, 7}, {0x15,12}, {0x05, 7}, {0x11,12},
119
{0x78, 7}, {0x11,13}, {0x7a, 7}, {0x10,13},
120
{0x21, 8}, {0x1a,16}, {0x25, 8}, {0x19,16},
121
{0x24, 8}, {0x18,16}, {0x05, 9}, {0x17,16},
122
{0x07, 9}, {0x16,16}, {0x0d,10}, {0x15,16},
123
{0x1f,12}, {0x1a,12}, {0x19,12}, {0x17,12},
124
{0x16,12}, {0x1f,13}, {0x1e,13}, {0x1d,13},
125
{0x1c,13}, {0x1b,13}, {0x1f,16}, {0x1e,16},
126
{0x1d,16}, {0x1c,16}, {0x1b,16},
112
{0x11,16}, {0x10,16}, {0x05, 5}, {0x07, 7},
113
{0xfc, 8}, {0x0c,10}, {0x14,13}, {0x07, 5},
114
{0x26, 8}, {0x1c,12}, {0x13,13}, {0x06, 6},
115
{0xfd, 8}, {0x12,12}, {0x07, 6}, {0x04, 9},
116
{0x12,13}, {0x06, 7}, {0x1e,12}, {0x14,16},
117
{0x04, 7}, {0x15,12}, {0x05, 7}, {0x11,12},
118
{0x78, 7}, {0x11,13}, {0x7a, 7}, {0x10,13},
119
{0x21, 8}, {0x1a,16}, {0x25, 8}, {0x19,16},
120
{0x24, 8}, {0x18,16}, {0x05, 9}, {0x17,16},
121
{0x07, 9}, {0x16,16}, {0x0d,10}, {0x15,16},
122
{0x1f,12}, {0x1a,12}, {0x19,12}, {0x17,12},
123
{0x16,12}, {0x1f,13}, {0x1e,13}, {0x1d,13},
124
{0x1c,13}, {0x1b,13}, {0x1f,16}, {0x1e,16},
125
{0x1d,16}, {0x1c,16}, {0x1b,16},
127
126
{0x01,6}, /* escape */
128
127
{0x06,4}, /* EOB */
387
381
56,64,72,80,88,96,104,112,
390
uint8_t ff_mpeg1_dc_scale_table[128]={ // MN: mpeg2 really can have such large qscales?
391
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
392
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
393
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
394
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
395
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
384
const uint8_t ff_mpeg1_dc_scale_table[128]={
385
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
386
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
387
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
388
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
389
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
392
static const uint8_t mpeg2_dc_scale_table1[128]={
393
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
394
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
395
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
396
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
397
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
400
static const uint8_t mpeg2_dc_scale_table2[128]={
401
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
402
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408
static const uint8_t mpeg2_dc_scale_table3[128]={
409
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
410
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
411
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
412
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
413
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
416
static const uint8_t *mpeg2_dc_scale_table[4]={
417
ff_mpeg1_dc_scale_table,
418
mpeg2_dc_scale_table1,
419
mpeg2_dc_scale_table2,
420
mpeg2_dc_scale_table3,
398
423
static const float mpeg1_aspect[16]={