2 * MPEG1/2 decoder tables
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
25 * MPEG1/2 decoder tables.
28 #ifndef AVCODEC_MPEG12DECDATA_H
29 #define AVCODEC_MPEG12DECDATA_H
32 #include "mpegvideo.h"
35 #define MB_TYPE_ZERO_MV 0x20000000
36 #define IS_ZERO_MV(a) ((a)&MB_TYPE_ZERO_MV)
38 static const uint8_t table_mb_ptype[7][2] = {
39 { 3, 5 }, // 0x01 MB_INTRA
40 { 1, 2 }, // 0x02 MB_PAT
41 { 1, 3 }, // 0x08 MB_FOR
42 { 1, 1 }, // 0x0A MB_FOR|MB_PAT
43 { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA
44 { 1, 5 }, // 0x12 MB_QUANT|MB_PAT
45 { 2, 5 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
48 static const uint32_t ptype2mb_type[7] = {
50 MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
52 MB_TYPE_L0 | MB_TYPE_CBP,
53 MB_TYPE_QUANT | MB_TYPE_INTRA,
54 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
55 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP,
58 static const uint8_t table_mb_btype[11][2] = {
59 { 3, 5 }, // 0x01 MB_INTRA
60 { 2, 3 }, // 0x04 MB_BACK
61 { 3, 3 }, // 0x06 MB_BACK|MB_PAT
62 { 2, 4 }, // 0x08 MB_FOR
63 { 3, 4 }, // 0x0A MB_FOR|MB_PAT
64 { 2, 2 }, // 0x0C MB_FOR|MB_BACK
65 { 3, 2 }, // 0x0E MB_FOR|MB_BACK|MB_PAT
66 { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA
67 { 2, 6 }, // 0x16 MB_QUANT|MB_BACK|MB_PAT
68 { 3, 6 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
69 { 2, 5 }, // 0x1E MB_QUANT|MB_FOR|MB_BACK|MB_PAT
72 static const uint32_t btype2mb_type[11] = {
75 MB_TYPE_L1 | MB_TYPE_CBP,
77 MB_TYPE_L0 | MB_TYPE_CBP,
79 MB_TYPE_L0L1 | MB_TYPE_CBP,
80 MB_TYPE_QUANT | MB_TYPE_INTRA,
81 MB_TYPE_QUANT | MB_TYPE_L1 | MB_TYPE_CBP,
82 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP,
83 MB_TYPE_QUANT | MB_TYPE_L0L1 | MB_TYPE_CBP,
86 static const uint8_t non_linear_qscale[32] = {
87 0, 1, 2, 3, 4, 5, 6, 7,
88 8,10,12,14,16,18,20,22,
89 24,28,32,36,40,44,48,52,
90 56,64,72,80,88,96,104,112,
93 #endif /* AVCODEC_MPEG12DECDATA_H */