annotate h264data.h @ 1552:26c6ecba99a1 libavcodec

dynamic alloc of picture structs instead of putting them in MpegEncContext
author michael
date Tue, 21 Oct 2003 19:55:31 +0000
parents dd544554ed42
children 4e8ed93524f6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
1 /*
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
2 * H26L/H264/AVC/JVT/14496-10/... encoder/decoder
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
3 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
4 *
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
9 *
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
13 * Lesser General Public License for more details.
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
14 *
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
18 *
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
19 */
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
20
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
21 /**
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
22 * @file h264data.h
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
23 * @brief
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
24 * H264 / AVC / MPEG4 part10 codec data table
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
25 * @author Michael Niedermayer <michaelni@gmx.at>
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
26 */
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
27
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
28 #define VERT_PRED 0
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
29 #define HOR_PRED 1
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
30 #define DC_PRED 2
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
31 #define DIAG_DOWN_LEFT_PRED 3
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
32 #define DIAG_DOWN_RIGHT_PRED 4
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
33 #define VERT_RIGHT_PRED 5
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
34 #define HOR_DOWN_PRED 6
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
35 #define VERT_LEFT_PRED 7
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
36 #define HOR_UP_PRED 8
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
37
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
38 #define LEFT_DC_PRED 9
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
39 #define TOP_DC_PRED 10
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
40 #define DC_128_PRED 11
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
41
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
42
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
43 #define DC_PRED8x8 0
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
44 #define HOR_PRED8x8 1
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
45 #define VERT_PRED8x8 2
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
46 #define PLANE_PRED8x8 3
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
47
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
48 #define LEFT_DC_PRED8x8 4
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
49 #define TOP_DC_PRED8x8 5
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
50 #define DC_128_PRED8x8 6
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
51
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
52 #define EXTENDED_SAR 255
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
53
1548
dd544554ed42 AVRational
michael
parents: 1178
diff changeset
54 static const AVRational pixel_aspect[14]={
dd544554ed42 AVRational
michael
parents: 1178
diff changeset
55 {0, 1},
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
56 {1, 1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
57 {12, 11},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
58 {10, 11},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
59 {16, 11},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
60 {40, 33},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
61 {24, 11},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
62 {20, 11},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
63 {32, 11},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
64 {80, 33},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
65 {18, 11},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
66 {15, 11},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
67 {64, 33},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
68 {160,99},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
69 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
70
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
71 static const uint8_t golomb_to_pict_type[5]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
72 {P_TYPE, B_TYPE, I_TYPE, SP_TYPE, SI_TYPE};
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
73
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
74 static const uint8_t pict_type_to_golomb[7]=
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
75 {-1, 2, 0, 1, -1, 4, 3};
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
76
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
77 static const uint8_t chroma_qp[52]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
78 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
79 12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
80 28,29,29,30,31,32,32,33,34,34,35,35,36,36,37,37,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
81 37,38,38,38,39,39,39,39
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
82
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
83 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
84
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
85 static const uint8_t golomb_to_intra4x4_cbp[48]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
86 47, 31, 15, 0, 23, 27, 29, 30, 7, 11, 13, 14, 39, 43, 45, 46,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
87 16, 3, 5, 10, 12, 19, 21, 26, 28, 35, 37, 42, 44, 1, 2, 4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
88 8, 17, 18, 20, 24, 6, 9, 22, 25, 32, 33, 34, 36, 40, 38, 41
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
89 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
90
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
91 static const uint8_t golomb_to_inter_cbp[48]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
92 0, 16, 1, 2, 4, 8, 32, 3, 5, 10, 12, 15, 47, 7, 11, 13,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
93 14, 6, 9, 31, 35, 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
94 17, 18, 20, 24, 19, 21, 26, 28, 23, 27, 29, 30, 22, 25, 38, 41
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
95 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
96
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
97 static const uint8_t intra4x4_cbp_to_golomb[48]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
98 3, 29, 30, 17, 31, 18, 37, 8, 32, 38, 19, 9, 20, 10, 11, 2,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
99 16, 33, 34, 21, 35, 22, 39, 4, 36, 40, 23, 5, 24, 6, 7, 1,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
100 41, 42, 43, 25, 44, 26, 46, 12, 45, 47, 27, 13, 28, 14, 15, 0
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
101 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
102
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
103 static const uint8_t inter_cbp_to_golomb[48]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
104 0, 2, 3, 7, 4, 8, 17, 13, 5, 18, 9, 14, 10, 15, 16, 11,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
105 1, 32, 33, 36, 34, 37, 44, 40, 35, 45, 38, 41, 39, 42, 43, 19,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
106 6, 24, 25, 20, 26, 21, 46, 28, 27, 47, 22, 29, 23, 30, 31, 12
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
107 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
108
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
109 static const uint8_t chroma_dc_coeff_token_len[4*5]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
110 2, 0, 0, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
111 6, 1, 0, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
112 6, 6, 3, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
113 6, 7, 7, 6,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
114 6, 8, 8, 7,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
115 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
116
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
117 static const uint8_t chroma_dc_coeff_token_bits[4*5]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
118 1, 0, 0, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
119 7, 1, 0, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
120 4, 6, 1, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
121 3, 3, 2, 5,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
122 2, 3, 2, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
123 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
124
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
125 static const uint8_t coeff_token_len[4][4*17]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
126 {
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
127 1, 0, 0, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
128 6, 2, 0, 0, 8, 6, 3, 0, 9, 8, 7, 5, 10, 9, 8, 6,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
129 11,10, 9, 7, 13,11,10, 8, 13,13,11, 9, 13,13,13,10,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
130 14,14,13,11, 14,14,14,13, 15,15,14,14, 15,15,15,14,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
131 16,15,15,15, 16,16,16,15, 16,16,16,16, 16,16,16,16,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
132 },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
133 {
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
134 2, 0, 0, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
135 6, 2, 0, 0, 6, 5, 3, 0, 7, 6, 6, 4, 8, 6, 6, 4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
136 8, 7, 7, 5, 9, 8, 8, 6, 11, 9, 9, 6, 11,11,11, 7,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
137 12,11,11, 9, 12,12,12,11, 12,12,12,11, 13,13,13,12,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
138 13,13,13,13, 13,14,13,13, 14,14,14,13, 14,14,14,14,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
139 },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
140 {
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
141 4, 0, 0, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
142 6, 4, 0, 0, 6, 5, 4, 0, 6, 5, 5, 4, 7, 5, 5, 4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
143 7, 5, 5, 4, 7, 6, 6, 4, 7, 6, 6, 4, 8, 7, 7, 5,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
144 8, 8, 7, 6, 9, 8, 8, 7, 9, 9, 8, 8, 9, 9, 9, 8,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
145 10, 9, 9, 9, 10,10,10,10, 10,10,10,10, 10,10,10,10,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
146 },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
147 {
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
148 6, 0, 0, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
149 6, 6, 0, 0, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 6,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
150 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
151 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
152 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
153 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
154 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
155
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
156 static const uint8_t coeff_token_bits[4][4*17]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
157 {
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
158 1, 0, 0, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
159 5, 1, 0, 0, 7, 4, 1, 0, 7, 6, 5, 3, 7, 6, 5, 3,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
160 7, 6, 5, 4, 15, 6, 5, 4, 11,14, 5, 4, 8,10,13, 4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
161 15,14, 9, 4, 11,10,13,12, 15,14, 9,12, 11,10,13, 8,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
162 15, 1, 9,12, 11,14,13, 8, 7,10, 9,12, 4, 6, 5, 8,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
163 },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
164 {
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
165 3, 0, 0, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
166 11, 2, 0, 0, 7, 7, 3, 0, 7,10, 9, 5, 7, 6, 5, 4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
167 4, 6, 5, 6, 7, 6, 5, 8, 15, 6, 5, 4, 11,14,13, 4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
168 15,10, 9, 4, 11,14,13,12, 8,10, 9, 8, 15,14,13,12,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
169 11,10, 9,12, 7,11, 6, 8, 9, 8,10, 1, 7, 6, 5, 4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
170 },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
171 {
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
172 15, 0, 0, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
173 15,14, 0, 0, 11,15,13, 0, 8,12,14,12, 15,10,11,11,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
174 11, 8, 9,10, 9,14,13, 9, 8,10, 9, 8, 15,14,13,13,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
175 11,14,10,12, 15,10,13,12, 11,14, 9,12, 8,10,13, 8,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
176 13, 7, 9,12, 9,12,11,10, 5, 8, 7, 6, 1, 4, 3, 2,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
177 },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
178 {
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
179 3, 0, 0, 0,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
180 0, 1, 0, 0, 4, 5, 6, 0, 8, 9,10,11, 12,13,14,15,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
181 16,17,18,19, 20,21,22,23, 24,25,26,27, 28,29,30,31,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
182 32,33,34,35, 36,37,38,39, 40,41,42,43, 44,45,46,47,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
183 48,49,50,51, 52,53,54,55, 56,57,58,59, 60,61,62,63,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
184 }
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
185 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
186
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
187 static const uint8_t total_zeros_len[16][16]= {
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
188 {1,3,3,4,4,5,5,6,6,7,7,8,8,9,9,9},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
189 {3,3,3,3,3,4,4,4,4,5,5,6,6,6,6},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
190 {4,3,3,3,4,4,3,3,4,5,5,6,5,6},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
191 {5,3,4,4,3,3,3,4,3,4,5,5,5},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
192 {4,4,4,3,3,3,3,3,4,5,4,5},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
193 {6,5,3,3,3,3,3,3,4,3,6},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
194 {6,5,3,3,3,2,3,4,3,6},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
195 {6,4,5,3,2,2,3,3,6},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
196 {6,6,4,2,2,3,2,5},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
197 {5,5,3,2,2,2,4},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
198 {4,4,3,3,1,3},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
199 {4,4,2,1,3},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
200 {3,3,1,2},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
201 {2,2,1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
202 {1,1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
203 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
204
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
205 static const uint8_t total_zeros_bits[16][16]= {
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
206 {1,3,2,3,2,3,2,3,2,3,2,3,2,3,2,1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
207 {7,6,5,4,3,5,4,3,2,3,2,3,2,1,0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
208 {5,7,6,5,4,3,4,3,2,3,2,1,1,0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
209 {3,7,5,4,6,5,4,3,3,2,2,1,0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
210 {5,4,3,7,6,5,4,3,2,1,1,0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
211 {1,1,7,6,5,4,3,2,1,1,0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
212 {1,1,5,4,3,3,2,1,1,0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
213 {1,1,1,3,3,2,2,1,0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
214 {1,0,1,3,2,1,1,1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
215 {1,0,1,3,2,1,1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
216 {0,1,1,2,1,3},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
217 {0,1,1,1,1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
218 {0,1,1,1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
219 {0,1,1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
220 {0,1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
221 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
222
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
223 static const uint8_t chroma_dc_total_zeros_len[3][4]= {
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
224 { 1, 2, 3, 3,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
225 { 1, 2, 2, 0,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
226 { 1, 1, 0, 0,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
227 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
228
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
229 static const uint8_t chroma_dc_total_zeros_bits[3][4]= {
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
230 { 1, 1, 1, 0,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
231 { 1, 1, 0, 0,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
232 { 1, 0, 0, 0,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
233 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
234
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
235 static const uint8_t run_len[7][16]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
236 {1,1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
237 {1,2,2},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
238 {2,2,2,2},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
239 {2,2,2,3,3},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
240 {2,2,3,3,3,3},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
241 {2,3,3,3,3,3,3},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
242 {3,3,3,3,3,3,3,4,5,6,7,8,9,10,11},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
243 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
244
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
245 static const uint8_t run_bits[7][16]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
246 {1,0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
247 {1,1,0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
248 {3,2,1,0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
249 {3,2,1,1,0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
250 {3,2,3,2,1,0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
251 {3,0,1,3,2,5,4},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
252 {7,6,5,4,3,2,1,1,1,1,1,1,1,1,1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
253 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
254
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
255 /*
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
256 o-o o-o
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
257 / / /
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
258 o-o o-o
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
259 ,---'
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
260 o-o o-o
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
261 / / /
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
262 o-o o-o
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
263 */
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
264
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
265 static const uint8_t scan8[16 + 2*4]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
266 4+1*8, 5+1*8, 4+2*8, 5+2*8,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
267 6+1*8, 7+1*8, 6+2*8, 7+2*8,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
268 4+3*8, 5+3*8, 4+4*8, 5+4*8,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
269 6+3*8, 7+3*8, 6+4*8, 7+4*8,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
270 1+1*8, 2+1*8,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
271 1+2*8, 2+2*8,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
272 1+4*8, 2+4*8,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
273 1+5*8, 2+5*8,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
274 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
275
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
276 static const uint8_t zigzag_scan[16]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
277 0+0*4, 1+0*4, 0+1*4, 0+2*4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
278 1+1*4, 2+0*4, 3+0*4, 2+1*4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
279 1+2*4, 0+3*4, 1+3*4, 2+2*4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
280 3+1*4, 3+2*4, 2+3*4, 3+3*4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
281 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
282
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
283 static const uint8_t field_scan[16]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
284 0+0*4, 0+1*4, 1+0*4, 0+2*4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
285 0+3*4, 1+1*4, 1+2*4, 1+3*4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
286 2+0*4, 2+1*4, 2+2*4, 2+3*4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
287 3+0*4, 3+1*4, 3+2*4, 3+3*4,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
288 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
289
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
290 static const uint8_t luma_dc_zigzag_scan[16]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
291 0*16 + 0*64, 1*16 + 0*64, 2*16 + 0*64, 0*16 + 2*64,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
292 3*16 + 0*64, 0*16 + 1*64, 1*16 + 1*64, 2*16 + 1*64,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
293 1*16 + 2*64, 2*16 + 2*64, 3*16 + 2*64, 0*16 + 3*64,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
294 3*16 + 1*64, 1*16 + 3*64, 2*16 + 3*64, 3*16 + 3*64,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
295 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
296
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
297 static const uint8_t luma_dc_field_scan[16]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
298 0*16 + 0*64, 2*16 + 0*64, 1*16 + 0*64, 0*16 + 2*64,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
299 2*16 + 2*64, 3*16 + 0*64, 1*16 + 2*64, 3*16 + 2*64,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
300 0*16 + 1*64, 2*16 + 1*64, 0*16 + 3*64, 2*16 + 3*64,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
301 1*16 + 1*64, 3*16 + 1*64, 1*16 + 3*64, 3*16 + 3*64,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
302 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
303
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
304 static const uint8_t chroma_dc_scan[4]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
305 (0+0*2)*16, (1+0*2)*16,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
306 (0+1*2)*16, (1+1*2)*16, //FIXME
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
307 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
308
1178
michaelni
parents: 1177
diff changeset
309 #define MB_TYPE_REF0 MB_TYPE_ACPRED //dirty but it fits in 16bit
1177
fea03d2c4946 simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents: 1168
diff changeset
310 #define IS_REF0(a) ((a)&MB_TYPE_REF0)
fea03d2c4946 simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents: 1168
diff changeset
311
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
312 typedef struct IMbInfo{
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
313 uint16_t type;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
314 uint8_t pred_mode;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
315 uint8_t cbp;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
316 } IMbInfo;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
317
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
318 static const IMbInfo i_mb_type_info[26]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
319 {MB_TYPE_INTRA4x4 , -1, -1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
320 {MB_TYPE_INTRA16x16, 2, 0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
321 {MB_TYPE_INTRA16x16, 1, 0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
322 {MB_TYPE_INTRA16x16, 0, 0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
323 {MB_TYPE_INTRA16x16, 3, 0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
324 {MB_TYPE_INTRA16x16, 2, 16},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
325 {MB_TYPE_INTRA16x16, 1, 16},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
326 {MB_TYPE_INTRA16x16, 0, 16},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
327 {MB_TYPE_INTRA16x16, 3, 16},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
328 {MB_TYPE_INTRA16x16, 2, 32},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
329 {MB_TYPE_INTRA16x16, 1, 32},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
330 {MB_TYPE_INTRA16x16, 0, 32},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
331 {MB_TYPE_INTRA16x16, 3, 32},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
332 {MB_TYPE_INTRA16x16, 2, 15+0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
333 {MB_TYPE_INTRA16x16, 1, 15+0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
334 {MB_TYPE_INTRA16x16, 0, 15+0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
335 {MB_TYPE_INTRA16x16, 3, 15+0},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
336 {MB_TYPE_INTRA16x16, 2, 15+16},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
337 {MB_TYPE_INTRA16x16, 1, 15+16},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
338 {MB_TYPE_INTRA16x16, 0, 15+16},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
339 {MB_TYPE_INTRA16x16, 3, 15+16},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
340 {MB_TYPE_INTRA16x16, 2, 15+32},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
341 {MB_TYPE_INTRA16x16, 1, 15+32},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
342 {MB_TYPE_INTRA16x16, 0, 15+32},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
343 {MB_TYPE_INTRA16x16, 3, 15+32},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
344 {MB_TYPE_INTRA_PCM , -1, -1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
345 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
346
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
347 typedef struct PMbInfo{
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
348 uint16_t type;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
349 uint8_t partition_count;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
350 } PMbInfo;
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
351
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
352 static const PMbInfo p_mb_type_info[5]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
353 {MB_TYPE_16x16|MB_TYPE_P0L0 , 1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
354 {MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P1L0, 2},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
355 {MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P1L0, 2},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
356 {MB_TYPE_8x8 , 4},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
357 {MB_TYPE_8x8 |MB_TYPE_REF0 , 4},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
358 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
359
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
360 static const PMbInfo p_sub_mb_type_info[4]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
361 {MB_TYPE_16x16|MB_TYPE_P0L0 , 1},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
362 {MB_TYPE_16x8 |MB_TYPE_P0L0 , 2},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
363 {MB_TYPE_8x16 |MB_TYPE_P0L0 , 2},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
364 {MB_TYPE_8x8 |MB_TYPE_P0L0 , 4},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
365 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
366
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
367 static const PMbInfo b_mb_type_info[23]={
1177
fea03d2c4946 simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents: 1168
diff changeset
368 {MB_TYPE_DIRECT2 , 1, },
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
369 {MB_TYPE_16x16|MB_TYPE_P0L0 , 1, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
370 {MB_TYPE_16x16 |MB_TYPE_P0L1 , 1, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
371 {MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1 , 1, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
372 {MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
373 {MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
374 {MB_TYPE_16x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
375 {MB_TYPE_8x16 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
376 {MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
377 {MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
378 {MB_TYPE_16x8 |MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
379 {MB_TYPE_8x16 |MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
380 {MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
381 {MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
382 {MB_TYPE_16x8 |MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
383 {MB_TYPE_8x16 |MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
384 {MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
385 {MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
386 {MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
387 {MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
388 {MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
389 {MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
390 {MB_TYPE_8x8 , 4, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
391 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
392
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
393 static const PMbInfo b_sub_mb_type_info[13]={
1177
fea03d2c4946 simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents: 1168
diff changeset
394 {MB_TYPE_DIRECT2 , 1, },
1168
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
395 {MB_TYPE_16x16|MB_TYPE_P0L0 , 1, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
396 {MB_TYPE_16x16 |MB_TYPE_P0L1 , 1, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
397 {MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1 , 1, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
398 {MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
399 {MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
400 {MB_TYPE_16x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
401 {MB_TYPE_8x16 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
402 {MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
403 {MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
404 {MB_TYPE_8x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 4, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
405 {MB_TYPE_8x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 4, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
406 {MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 4, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
407 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
408
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
409
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
410 static const uint8_t rem6[52]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
411 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
412 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
413
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
414 static const uint8_t div6[52]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
415 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
416 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
417
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
418 static const uint16_t dequant_coeff[52][16]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
419 { 10, 13, 10, 13, 13, 16, 13, 16, 10, 13, 10, 13, 13, 16, 13, 16, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
420 { 11, 14, 11, 14, 14, 18, 14, 18, 11, 14, 11, 14, 14, 18, 14, 18, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
421 { 13, 16, 13, 16, 16, 20, 16, 20, 13, 16, 13, 16, 16, 20, 16, 20, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
422 { 14, 18, 14, 18, 18, 23, 18, 23, 14, 18, 14, 18, 18, 23, 18, 23, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
423 { 16, 20, 16, 20, 20, 25, 20, 25, 16, 20, 16, 20, 20, 25, 20, 25, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
424 { 18, 23, 18, 23, 23, 29, 23, 29, 18, 23, 18, 23, 23, 29, 23, 29, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
425 { 20, 26, 20, 26, 26, 32, 26, 32, 20, 26, 20, 26, 26, 32, 26, 32, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
426 { 22, 28, 22, 28, 28, 36, 28, 36, 22, 28, 22, 28, 28, 36, 28, 36, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
427 { 26, 32, 26, 32, 32, 40, 32, 40, 26, 32, 26, 32, 32, 40, 32, 40, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
428 { 28, 36, 28, 36, 36, 46, 36, 46, 28, 36, 28, 36, 36, 46, 36, 46, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
429 { 32, 40, 32, 40, 40, 50, 40, 50, 32, 40, 32, 40, 40, 50, 40, 50, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
430 { 36, 46, 36, 46, 46, 58, 46, 58, 36, 46, 36, 46, 46, 58, 46, 58, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
431 { 40, 52, 40, 52, 52, 64, 52, 64, 40, 52, 40, 52, 52, 64, 52, 64, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
432 { 44, 56, 44, 56, 56, 72, 56, 72, 44, 56, 44, 56, 56, 72, 56, 72, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
433 { 52, 64, 52, 64, 64, 80, 64, 80, 52, 64, 52, 64, 64, 80, 64, 80, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
434 { 56, 72, 56, 72, 72, 92, 72, 92, 56, 72, 56, 72, 72, 92, 72, 92, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
435 { 64, 80, 64, 80, 80, 100, 80, 100, 64, 80, 64, 80, 80, 100, 80, 100, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
436 { 72, 92, 72, 92, 92, 116, 92, 116, 72, 92, 72, 92, 92, 116, 92, 116, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
437 { 80, 104, 80, 104, 104, 128, 104, 128, 80, 104, 80, 104, 104, 128, 104, 128, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
438 { 88, 112, 88, 112, 112, 144, 112, 144, 88, 112, 88, 112, 112, 144, 112, 144, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
439 { 104, 128, 104, 128, 128, 160, 128, 160, 104, 128, 104, 128, 128, 160, 128, 160, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
440 { 112, 144, 112, 144, 144, 184, 144, 184, 112, 144, 112, 144, 144, 184, 144, 184, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
441 { 128, 160, 128, 160, 160, 200, 160, 200, 128, 160, 128, 160, 160, 200, 160, 200, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
442 { 144, 184, 144, 184, 184, 232, 184, 232, 144, 184, 144, 184, 184, 232, 184, 232, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
443 { 160, 208, 160, 208, 208, 256, 208, 256, 160, 208, 160, 208, 208, 256, 208, 256, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
444 { 176, 224, 176, 224, 224, 288, 224, 288, 176, 224, 176, 224, 224, 288, 224, 288, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
445 { 208, 256, 208, 256, 256, 320, 256, 320, 208, 256, 208, 256, 256, 320, 256, 320, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
446 { 224, 288, 224, 288, 288, 368, 288, 368, 224, 288, 224, 288, 288, 368, 288, 368, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
447 { 256, 320, 256, 320, 320, 400, 320, 400, 256, 320, 256, 320, 320, 400, 320, 400, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
448 { 288, 368, 288, 368, 368, 464, 368, 464, 288, 368, 288, 368, 368, 464, 368, 464, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
449 { 320, 416, 320, 416, 416, 512, 416, 512, 320, 416, 320, 416, 416, 512, 416, 512, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
450 { 352, 448, 352, 448, 448, 576, 448, 576, 352, 448, 352, 448, 448, 576, 448, 576, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
451 { 416, 512, 416, 512, 512, 640, 512, 640, 416, 512, 416, 512, 512, 640, 512, 640, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
452 { 448, 576, 448, 576, 576, 736, 576, 736, 448, 576, 448, 576, 576, 736, 576, 736, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
453 { 512, 640, 512, 640, 640, 800, 640, 800, 512, 640, 512, 640, 640, 800, 640, 800, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
454 { 576, 736, 576, 736, 736, 928, 736, 928, 576, 736, 576, 736, 736, 928, 736, 928, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
455 { 640, 832, 640, 832, 832,1024, 832,1024, 640, 832, 640, 832, 832,1024, 832,1024, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
456 { 704, 896, 704, 896, 896,1152, 896,1152, 704, 896, 704, 896, 896,1152, 896,1152, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
457 { 832,1024, 832,1024, 1024,1280,1024,1280, 832,1024, 832,1024, 1024,1280,1024,1280, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
458 { 896,1152, 896,1152, 1152,1472,1152,1472, 896,1152, 896,1152, 1152,1472,1152,1472, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
459 {1024,1280,1024,1280, 1280,1600,1280,1600, 1024,1280,1024,1280, 1280,1600,1280,1600, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
460 {1152,1472,1152,1472, 1472,1856,1472,1856, 1152,1472,1152,1472, 1472,1856,1472,1856, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
461 {1280,1664,1280,1664, 1664,2048,1664,2048, 1280,1664,1280,1664, 1664,2048,1664,2048, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
462 {1408,1792,1408,1792, 1792,2304,1792,2304, 1408,1792,1408,1792, 1792,2304,1792,2304, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
463 {1664,2048,1664,2048, 2048,2560,2048,2560, 1664,2048,1664,2048, 2048,2560,2048,2560, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
464 {1792,2304,1792,2304, 2304,2944,2304,2944, 1792,2304,1792,2304, 2304,2944,2304,2944, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
465 {2048,2560,2048,2560, 2560,3200,2560,3200, 2048,2560,2048,2560, 2560,3200,2560,3200, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
466 {2304,2944,2304,2944, 2944,3712,2944,3712, 2304,2944,2304,2944, 2944,3712,2944,3712, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
467 {2560,3328,2560,3328, 3328,4096,3328,4096, 2560,3328,2560,3328, 3328,4096,3328,4096, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
468 {2816,3584,2816,3584, 3584,4608,3584,4608, 2816,3584,2816,3584, 3584,4608,3584,4608, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
469 {3328,4096,3328,4096, 4096,5120,4096,5120, 3328,4096,3328,4096, 4096,5120,4096,5120, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
470 {3584,4608,3584,4608, 4608,5888,4608,5888, 3584,4608,3584,4608, 4608,5888,4608,5888, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
471 //{4096,5120,4096,5120, 5120,6400,5120,6400, 4096,5120,4096,5120, 5120,6400,5120,6400, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
472 //{4608,5888,4608,5888, 5888,7424,5888,7424, 4608,5888,4608,5888, 5888,7424,5888,7424, },
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
473 };
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
474
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
475 #define QUANT_SHIFT 22
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
476
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
477 static const int quant_coeff[52][16]={
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
478 { 419430,258111,419430,258111,258111,167772,258111,167772,419430,258111,419430,258111,258111,167772,258111,167772,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
479 { 381300,239675,381300,239675,239675,149131,239675,149131,381300,239675,381300,239675,239675,149131,239675,149131,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
480 { 322639,209715,322639,209715,209715,134218,209715,134218,322639,209715,322639,209715,209715,134218,209715,134218,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
481 { 299593,186414,299593,186414,186414,116711,186414,116711,299593,186414,299593,186414,186414,116711,186414,116711,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
482 { 262144,167772,262144,167772,167772,107374,167772,107374,262144,167772,262144,167772,167772,107374,167772,107374,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
483 { 233017,145889,233017,145889,145889, 92564,145889, 92564,233017,145889,233017,145889,145889, 92564,145889, 92564,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
484 { 209715,129056,209715,129056,129056, 83886,129056, 83886,209715,129056,209715,129056,129056, 83886,129056, 83886,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
485 { 190650,119837,190650,119837,119837, 74565,119837, 74565,190650,119837,190650,119837,119837, 74565,119837, 74565,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
486 { 161319,104858,161319,104858,104858, 67109,104858, 67109,161319,104858,161319,104858,104858, 67109,104858, 67109,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
487 { 149797, 93207,149797, 93207, 93207, 58356, 93207, 58356,149797, 93207,149797, 93207, 93207, 58356, 93207, 58356,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
488 { 131072, 83886,131072, 83886, 83886, 53687, 83886, 53687,131072, 83886,131072, 83886, 83886, 53687, 83886, 53687,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
489 { 116508, 72944,116508, 72944, 72944, 46282, 72944, 46282,116508, 72944,116508, 72944, 72944, 46282, 72944, 46282,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
490 { 104858, 64528,104858, 64528, 64528, 41943, 64528, 41943,104858, 64528,104858, 64528, 64528, 41943, 64528, 41943,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
491 { 95325, 59919, 95325, 59919, 59919, 37283, 59919, 37283, 95325, 59919, 95325, 59919, 59919, 37283, 59919, 37283,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
492 { 80660, 52429, 80660, 52429, 52429, 33554, 52429, 33554, 80660, 52429, 80660, 52429, 52429, 33554, 52429, 33554,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
493 { 74898, 46603, 74898, 46603, 46603, 29178, 46603, 29178, 74898, 46603, 74898, 46603, 46603, 29178, 46603, 29178,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
494 { 65536, 41943, 65536, 41943, 41943, 26844, 41943, 26844, 65536, 41943, 65536, 41943, 41943, 26844, 41943, 26844,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
495 { 58254, 36472, 58254, 36472, 36472, 23141, 36472, 23141, 58254, 36472, 58254, 36472, 36472, 23141, 36472, 23141,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
496 { 52429, 32264, 52429, 32264, 32264, 20972, 32264, 20972, 52429, 32264, 52429, 32264, 32264, 20972, 32264, 20972,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
497 { 47663, 29959, 47663, 29959, 29959, 18641, 29959, 18641, 47663, 29959, 47663, 29959, 29959, 18641, 29959, 18641,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
498 { 40330, 26214, 40330, 26214, 26214, 16777, 26214, 16777, 40330, 26214, 40330, 26214, 26214, 16777, 26214, 16777,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
499 { 37449, 23302, 37449, 23302, 23302, 14589, 23302, 14589, 37449, 23302, 37449, 23302, 23302, 14589, 23302, 14589,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
500 { 32768, 20972, 32768, 20972, 20972, 13422, 20972, 13422, 32768, 20972, 32768, 20972, 20972, 13422, 20972, 13422,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
501 { 29127, 18236, 29127, 18236, 18236, 11570, 18236, 11570, 29127, 18236, 29127, 18236, 18236, 11570, 18236, 11570,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
502 { 26214, 16132, 26214, 16132, 16132, 10486, 16132, 10486, 26214, 16132, 26214, 16132, 16132, 10486, 16132, 10486,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
503 { 23831, 14980, 23831, 14980, 14980, 9321, 14980, 9321, 23831, 14980, 23831, 14980, 14980, 9321, 14980, 9321,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
504 { 20165, 13107, 20165, 13107, 13107, 8389, 13107, 8389, 20165, 13107, 20165, 13107, 13107, 8389, 13107, 8389,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
505 { 18725, 11651, 18725, 11651, 11651, 7294, 11651, 7294, 18725, 11651, 18725, 11651, 11651, 7294, 11651, 7294,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
506 { 16384, 10486, 16384, 10486, 10486, 6711, 10486, 6711, 16384, 10486, 16384, 10486, 10486, 6711, 10486, 6711,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
507 { 14564, 9118, 14564, 9118, 9118, 5785, 9118, 5785, 14564, 9118, 14564, 9118, 9118, 5785, 9118, 5785,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
508 { 13107, 8066, 13107, 8066, 8066, 5243, 8066, 5243, 13107, 8066, 13107, 8066, 8066, 5243, 8066, 5243,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
509 { 11916, 7490, 11916, 7490, 7490, 4660, 7490, 4660, 11916, 7490, 11916, 7490, 7490, 4660, 7490, 4660,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
510 { 10082, 6554, 10082, 6554, 6554, 4194, 6554, 4194, 10082, 6554, 10082, 6554, 6554, 4194, 6554, 4194,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
511 { 9362, 5825, 9362, 5825, 5825, 3647, 5825, 3647, 9362, 5825, 9362, 5825, 5825, 3647, 5825, 3647,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
512 { 8192, 5243, 8192, 5243, 5243, 3355, 5243, 3355, 8192, 5243, 8192, 5243, 5243, 3355, 5243, 3355,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
513 { 7282, 4559, 7282, 4559, 4559, 2893, 4559, 2893, 7282, 4559, 7282, 4559, 4559, 2893, 4559, 2893,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
514 { 6554, 4033, 6554, 4033, 4033, 2621, 4033, 2621, 6554, 4033, 6554, 4033, 4033, 2621, 4033, 2621,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
515 { 5958, 3745, 5958, 3745, 3745, 2330, 3745, 2330, 5958, 3745, 5958, 3745, 3745, 2330, 3745, 2330,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
516 { 5041, 3277, 5041, 3277, 3277, 2097, 3277, 2097, 5041, 3277, 5041, 3277, 3277, 2097, 3277, 2097,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
517 { 4681, 2913, 4681, 2913, 2913, 1824, 2913, 1824, 4681, 2913, 4681, 2913, 2913, 1824, 2913, 1824,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
518 { 4096, 2621, 4096, 2621, 2621, 1678, 2621, 1678, 4096, 2621, 4096, 2621, 2621, 1678, 2621, 1678,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
519 { 3641, 2280, 3641, 2280, 2280, 1446, 2280, 1446, 3641, 2280, 3641, 2280, 2280, 1446, 2280, 1446,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
520 { 3277, 2016, 3277, 2016, 2016, 1311, 2016, 1311, 3277, 2016, 3277, 2016, 2016, 1311, 2016, 1311,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
521 { 2979, 1872, 2979, 1872, 1872, 1165, 1872, 1165, 2979, 1872, 2979, 1872, 1872, 1165, 1872, 1165,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
522 { 2521, 1638, 2521, 1638, 1638, 1049, 1638, 1049, 2521, 1638, 2521, 1638, 1638, 1049, 1638, 1049,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
523 { 2341, 1456, 2341, 1456, 1456, 912, 1456, 912, 2341, 1456, 2341, 1456, 1456, 912, 1456, 912,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
524 { 2048, 1311, 2048, 1311, 1311, 839, 1311, 839, 2048, 1311, 2048, 1311, 1311, 839, 1311, 839,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
525 { 1820, 1140, 1820, 1140, 1140, 723, 1140, 723, 1820, 1140, 1820, 1140, 1140, 723, 1140, 723,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
526 { 1638, 1008, 1638, 1008, 1008, 655, 1008, 655, 1638, 1008, 1638, 1008, 1008, 655, 1008, 655,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
527 { 1489, 936, 1489, 936, 936, 583, 936, 583, 1489, 936, 1489, 936, 936, 583, 936, 583,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
528 { 1260, 819, 1260, 819, 819, 524, 819, 524, 1260, 819, 1260, 819, 819, 524, 819, 524,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
529 { 1170, 728, 1170, 728, 728, 456, 728, 456, 1170, 728, 1170, 728, 728, 456, 728, 456,},
5af9aeadbdc3 H264 decoder & demuxer
michaelni
parents:
diff changeset
530 };