annotate mpeg12decdata.h @ 12028:2caea98f5711 libavcodec

Do not skip one of three bits zero padding. Patch by Daniel Kristjansson, danielk cuymedia net
author cehoyos
date Wed, 30 Jun 2010 21:46:03 +0000
parents 7dd2a45249a9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5208
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
1 /*
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
2 * MPEG1/2 decoder tables
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
3 * copyright (c) 2000,2001 Fabrice Bellard
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
4 * copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
5 *
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
6 * This file is part of FFmpeg.
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
7 *
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
12 *
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
16 * Lesser General Public License for more details.
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
17 *
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
21 */
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
22
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
23 /**
11644
7dd2a45249a9 Remove explicit filename from Doxygen @file commands.
diego
parents: 11494
diff changeset
24 * @file
5208
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
25 * MPEG1/2 decoder tables.
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
26 */
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
27
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 7129
diff changeset
28 #ifndef AVCODEC_MPEG12DECDATA_H
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 7129
diff changeset
29 #define AVCODEC_MPEG12DECDATA_H
5208
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
30
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
31 #include <stdint.h>
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
32 #include "mpegvideo.h"
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
33
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
34
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
35 #define MB_TYPE_ZERO_MV 0x20000000
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
36 #define IS_ZERO_MV(a) ((a)&MB_TYPE_ZERO_MV)
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
37
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
38 static const uint8_t table_mb_ptype[7][2] = {
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
39 { 3, 5 }, // 0x01 MB_INTRA
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
40 { 1, 2 }, // 0x02 MB_PAT
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
41 { 1, 3 }, // 0x08 MB_FOR
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
42 { 1, 1 }, // 0x0A MB_FOR|MB_PAT
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
43 { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
44 { 1, 5 }, // 0x12 MB_QUANT|MB_PAT
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
45 { 2, 5 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
46 };
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
47
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
48 static const uint32_t ptype2mb_type[7] = {
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
49 MB_TYPE_INTRA,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
50 MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
51 MB_TYPE_L0,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
52 MB_TYPE_L0 | MB_TYPE_CBP,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
53 MB_TYPE_QUANT | MB_TYPE_INTRA,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
54 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
55 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
56 };
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
57
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
58 static const uint8_t table_mb_btype[11][2] = {
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
59 { 3, 5 }, // 0x01 MB_INTRA
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
60 { 2, 3 }, // 0x04 MB_BACK
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
61 { 3, 3 }, // 0x06 MB_BACK|MB_PAT
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
62 { 2, 4 }, // 0x08 MB_FOR
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
63 { 3, 4 }, // 0x0A MB_FOR|MB_PAT
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
64 { 2, 2 }, // 0x0C MB_FOR|MB_BACK
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
65 { 3, 2 }, // 0x0E MB_FOR|MB_BACK|MB_PAT
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
66 { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
67 { 2, 6 }, // 0x16 MB_QUANT|MB_BACK|MB_PAT
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
68 { 3, 6 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
69 { 2, 5 }, // 0x1E MB_QUANT|MB_FOR|MB_BACK|MB_PAT
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
70 };
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
71
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
72 static const uint32_t btype2mb_type[11] = {
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
73 MB_TYPE_INTRA,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
74 MB_TYPE_L1,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
75 MB_TYPE_L1 | MB_TYPE_CBP,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
76 MB_TYPE_L0,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
77 MB_TYPE_L0 | MB_TYPE_CBP,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
78 MB_TYPE_L0L1,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
79 MB_TYPE_L0L1 | MB_TYPE_CBP,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
80 MB_TYPE_QUANT | MB_TYPE_INTRA,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
81 MB_TYPE_QUANT | MB_TYPE_L1 | MB_TYPE_CBP,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
82 MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
83 MB_TYPE_QUANT | MB_TYPE_L0L1 | MB_TYPE_CBP,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
84 };
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
85
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
86 static const uint8_t non_linear_qscale[32] = {
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
87 0, 1, 2, 3, 4, 5, 6, 7,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
88 8,10,12,14,16,18,20,22,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
89 24,28,32,36,40,44,48,52,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
90 56,64,72,80,88,96,104,112,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
91 };
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
92
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 7129
diff changeset
93 #endif /* AVCODEC_MPEG12DECDATA_H */