1c71bd90b95cfdb7c25cbb2f9266f19df47a7716
[libav.git] / libavcodec / mpeg12decdata.h
1 /*
2 * MPEG1/2 decoder tables
3 * copyright (c) 2000,2001 Fabrice Bellard
4 * copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
5 *
6 * This file is part of Libav.
7 *
8 * Libav 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.
12 *
13 * Libav 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.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with Libav; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 /**
24 * @file
25 * MPEG1/2 decoder tables.
26 */
27
28 #ifndef AVCODEC_MPEG12DECDATA_H
29 #define AVCODEC_MPEG12DECDATA_H
30
31 #include <stdint.h>
32 #include "mpegvideo.h"
33
34
35 #define MB_TYPE_ZERO_MV 0x20000000
36
37 static const uint8_t table_mb_ptype[7][2] = {
38 { 3, 5 }, // 0x01 MB_INTRA
39 { 1, 2 }, // 0x02 MB_PAT
40 { 1, 3 }, // 0x08 MB_FOR
41 { 1, 1 }, // 0x0A MB_FOR|MB_PAT
42 { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA
43 { 1, 5 }, // 0x12 MB_QUANT|MB_PAT
44 { 2, 5 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
45 };
46
47 static const uint32_t ptype2mb_type[7] = {
48 MB_TYPE_INTRA,
49 MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
50 MB_TYPE_L0,
51 MB_TYPE_L0 | MB_TYPE_CBP,
52 MB_TYPE_QUANT | MB_TYPE_INTRA,
53 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
54 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP,
55 };
56
57 static const uint8_t table_mb_btype[11][2] = {
58 { 3, 5 }, // 0x01 MB_INTRA
59 { 2, 3 }, // 0x04 MB_BACK
60 { 3, 3 }, // 0x06 MB_BACK|MB_PAT
61 { 2, 4 }, // 0x08 MB_FOR
62 { 3, 4 }, // 0x0A MB_FOR|MB_PAT
63 { 2, 2 }, // 0x0C MB_FOR|MB_BACK
64 { 3, 2 }, // 0x0E MB_FOR|MB_BACK|MB_PAT
65 { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA
66 { 2, 6 }, // 0x16 MB_QUANT|MB_BACK|MB_PAT
67 { 3, 6 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
68 { 2, 5 }, // 0x1E MB_QUANT|MB_FOR|MB_BACK|MB_PAT
69 };
70
71 static const uint32_t btype2mb_type[11] = {
72 MB_TYPE_INTRA,
73 MB_TYPE_L1,
74 MB_TYPE_L1 | MB_TYPE_CBP,
75 MB_TYPE_L0,
76 MB_TYPE_L0 | MB_TYPE_CBP,
77 MB_TYPE_L0L1,
78 MB_TYPE_L0L1 | MB_TYPE_CBP,
79 MB_TYPE_QUANT | MB_TYPE_INTRA,
80 MB_TYPE_QUANT | MB_TYPE_L1 | MB_TYPE_CBP,
81 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP,
82 MB_TYPE_QUANT | MB_TYPE_L0L1 | MB_TYPE_CBP,
83 };
84
85 static const uint8_t non_linear_qscale[32] = {
86 0, 1, 2, 3, 4, 5, 6, 7,
87 8,10,12,14,16,18,20,22,
88 24,28,32,36,40,44,48,52,
89 56,64,72,80,88,96,104,112,
90 };
91
92 #endif /* AVCODEC_MPEG12DECDATA_H */