annotate mpeg12decdata.h @ 5208:430f60820b21 libavcodec

split mpeg12 encoder out of mpeg12.c
author aurel
date Thu, 05 Jul 2007 09:08:28 +0000
parents
children 1d83e9c34641
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 /**
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
24 * @file mpeg12decdata.h
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
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
28 #ifndef AVCODEC_MPEG12DECDATA_H
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
29 #define AVCODEC_MPEG12DECDATA_H
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
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
93 static const uint8_t mpeg2_dc_scale_table1[128]={
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
94 // 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
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
95 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,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
96 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,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
97 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,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
98 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,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
99 };
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
100
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
101 static const uint8_t mpeg2_dc_scale_table2[128]={
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
102 // 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
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
103 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,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
104 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,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
105 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,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
106 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,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
107 };
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
108
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
109 static const uint8_t mpeg2_dc_scale_table3[128]={
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
110 // 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
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
111 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,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
112 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,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
113 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,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
114 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,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
115 };
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
116
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
117 static const uint8_t *mpeg2_dc_scale_table[4]={
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
118 ff_mpeg1_dc_scale_table,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
119 mpeg2_dc_scale_table1,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
120 mpeg2_dc_scale_table2,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
121 mpeg2_dc_scale_table3,
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
122 };
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
123
430f60820b21 split mpeg12 encoder out of mpeg12.c
aurel
parents:
diff changeset
124 #endif // AVCODEC_MPEG12DECDATA_H