• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * RealVideo 4 decoder
3  * copyright (c) 2007 Konstantin Shishkov
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * RV40 VLC tables used for macroblock information decoding
25  */
26 
27 #ifndef AVCODEC_RV40VLC2_H
28 #define AVCODEC_RV40VLC2_H
29 
30 #include <stdint.h>
31 
32 /**
33  * codes used for the first four block types
34  */
35 //@{
36 #define AIC_TOP_BITS  7
37 #define AIC_TOP_SIZE 16
38 static const uint8_t rv40_aic_top_vlc_tab[AIC_TOP_SIZE][2] = {
39     { 0x3, 5 }, { 0x2, 5 }, { 0x7, 5 }, { 0x4, 5 }, { 0xF, 3 }, { 0x8, 4 },
40     { 0x1, 4 }, { 0xE, 5 }, { 0xC, 5 }, { 0xB, 6 }, { 0x6, 6 }, { 0x9, 7 },
41     { 0x5, 7 }, { 0xD, 7 }, { 0xA, 7 }, { 0x0, 1 },
42 };
43 //@}
44 
45 /**
46  * codes used for determining a pair of block types
47  */
48 //@{
49 #define AIC_MODE2_NUM  20
50 #define AIC_MODE2_SIZE 81
51 #define AIC_MODE2_BITS  9
52 
53 static const uint8_t aic_mode2_vlc_syms[AIC_MODE2_NUM][AIC_MODE2_SIZE] = {
54     {
55         0x06, 0x01, 0x28, 0x11, 0x22, 0x20, 0x04, 0x07, 0x05, 0x16, 0x08, 0x60,
56         0x02, 0x66, 0x61, 0x23, 0x15, 0x31, 0x26, 0x77, 0x12, 0x10, 0x42, 0x21,
57         0x72, 0x50, 0x88, 0x82, 0x27, 0x24, 0x44, 0x40, 0x62, 0x55, 0x18, 0x13,
58         0x53, 0x52, 0x64, 0x46, 0x41, 0x51, 0x47, 0x33, 0x32, 0x74, 0x67, 0x14,
59         0x03, 0x30, 0x25, 0x36, 0x34, 0x45, 0x37, 0x78, 0x85, 0x84, 0x75, 0x73,
60         0x57, 0x86, 0x65, 0x58, 0x71, 0x68, 0x70, 0x56, 0x54, 0x17, 0x76, 0x63,
61         0x87, 0x81, 0x80, 0x38, 0x35, 0x48, 0x43, 0x83, 0x00,
62     },
63     {
64         0x77, 0x62, 0x46, 0x33, 0x68, 0x52, 0x18, 0x05, 0x31, 0x25, 0x42, 0x04,
65         0x51, 0x44, 0x40, 0x32, 0x55, 0x41, 0x26, 0x24, 0x30, 0x27, 0x57, 0x36,
66         0x84, 0x76, 0x81, 0x83, 0x78, 0x73, 0x45, 0x85, 0x75, 0x86, 0x87, 0x56,
67         0x53, 0x80, 0x67, 0x35, 0x34, 0x43, 0x37, 0x82, 0x70, 0x65, 0x74, 0x71,
68         0x54, 0x48, 0x63, 0x58, 0x72, 0x64, 0x07, 0x03, 0x47, 0x38, 0x88, 0x20,
69         0x01, 0x60, 0x28, 0x16, 0x02, 0x61, 0x50, 0x13, 0x08, 0x23, 0x17, 0x66,
70         0x14, 0x06, 0x21, 0x15, 0x10, 0x00, 0x22, 0x12, 0x11,
71     },
72     {
73         0x10, 0x01, 0x24, 0x12, 0x88, 0x83, 0x70, 0x14, 0x08, 0x46, 0x25, 0x87,
74         0x44, 0x42, 0x60, 0x50, 0x61, 0x51, 0x71, 0x66, 0x15, 0x04, 0x41, 0x33,
75         0x17, 0x03, 0x34, 0x18, 0x86, 0x68, 0x67, 0x63, 0x57, 0x75, 0x65, 0x45,
76         0x36, 0x58, 0x54, 0x43, 0x37, 0x56, 0x53, 0x74, 0x62, 0x85, 0x78, 0x07,
77         0x05, 0x35, 0x13, 0x84, 0x64, 0x55, 0x76, 0x73, 0x47, 0x38, 0x52, 0x48,
78         0x11, 0x00, 0x21, 0x20, 0x82, 0x28, 0x81, 0x80, 0x31, 0x30, 0x40, 0x32,
79         0x16, 0x06, 0x26, 0x23, 0x27, 0x02, 0x77, 0x72, 0x22,
80     },
81     {
82         0x88, 0x82, 0x50, 0x47, 0x74, 0x43, 0x76, 0x75, 0x68, 0x24, 0x00, 0x37,
83         0x30, 0x54, 0x44, 0x64, 0x58, 0x36, 0x34, 0x65, 0x40, 0x06, 0x03, 0x20,
84         0x17, 0x08, 0x04, 0x48, 0x45, 0x87, 0x84, 0x71, 0x85, 0x78, 0x80, 0x73,
85         0x07, 0x86, 0x63, 0x57, 0x70, 0x67, 0x77, 0x72, 0x83, 0x81, 0x32, 0x28,
86         0x18, 0x05, 0x42, 0x38, 0x52, 0x14, 0x02, 0x25, 0x23, 0x66, 0x56, 0x53,
87         0x62, 0x60, 0x35, 0x33, 0x46, 0x41, 0x21, 0x12, 0x10, 0x01, 0x26, 0x13,
88         0x61, 0x22, 0x16, 0x27, 0x15, 0x55, 0x31, 0x51, 0x11,
89     },
90     {
91         0x13, 0x10, 0x27, 0x14, 0x66, 0x44, 0x41, 0x53, 0x46, 0x25, 0x18, 0x35,
92         0x33, 0x68, 0x63, 0x88, 0x71, 0x34, 0x24, 0x50, 0x47, 0x37, 0x08, 0x48,
93         0x45, 0x82, 0x74, 0x70, 0x84, 0x76, 0x30, 0x04, 0x57, 0x43, 0x83, 0x78,
94         0x86, 0x85, 0x73, 0x07, 0x80, 0x75, 0x87, 0x65, 0x56, 0x03, 0x00, 0x20,
95         0x06, 0x72, 0x52, 0x31, 0x62, 0x60, 0x21, 0x15, 0x51, 0x22, 0x16, 0x12,
96         0x02, 0x01, 0x23, 0x17, 0x55, 0x77, 0x64, 0x58, 0x54, 0x81, 0x67, 0x36,
97         0x05, 0x40, 0x38, 0x28, 0x26, 0x42, 0x32, 0x61, 0x11,
98     },
99     {
100         0x22, 0x11, 0x23, 0x13, 0x32, 0x25, 0x72, 0x45, 0x40, 0x57, 0x50, 0x03,
101         0x00, 0x30, 0x08, 0x86, 0x75, 0x80, 0x68, 0x43, 0x04, 0x47, 0x07, 0x48,
102         0x65, 0x58, 0x85, 0x84, 0x78, 0x64, 0x67, 0x63, 0x74, 0x73, 0x06, 0x05,
103         0x44, 0x37, 0x87, 0x83, 0x46, 0x42, 0x54, 0x53, 0x18, 0x17, 0x36, 0x34,
104         0x66, 0x55, 0x38, 0x24, 0x56, 0x41, 0x02, 0x01, 0x20, 0x14, 0x16, 0x12,
105         0x61, 0x27, 0x26, 0x15, 0x31, 0x28, 0x21, 0x88, 0x82, 0x62, 0x60, 0x76,
106         0x70, 0x33, 0x10, 0x52, 0x35, 0x71, 0x51, 0x81, 0x77,
107     },
108     {
109         0x16, 0x12, 0x61, 0x22, 0x51, 0x21, 0x15, 0x52, 0x31, 0x55, 0x81, 0x66,
110         0x46, 0x42, 0x62, 0x54, 0x14, 0x01, 0x25, 0x23, 0x27, 0x13, 0x56, 0x41,
111         0x35, 0x33, 0x58, 0x53, 0x26, 0x10, 0x32, 0x28, 0x84, 0x77, 0x43, 0x00,
112         0x68, 0x47, 0x85, 0x45, 0x34, 0x57, 0x50, 0x05, 0x03, 0x37, 0x30, 0x87,
113         0x86, 0x76, 0x08, 0x07, 0x80, 0x75, 0x70, 0x73, 0x04, 0x78, 0x74, 0x63,
114         0x48, 0x71, 0x67, 0x82, 0x65, 0x17, 0x06, 0x24, 0x20, 0x88, 0x83, 0x60,
115         0x44, 0x40, 0x72, 0x64, 0x18, 0x02, 0x38, 0x36, 0x11,
116     },
117     {
118         0x66, 0x01, 0x14, 0x03, 0x24, 0x23, 0x62, 0x08, 0x04, 0x35, 0x20, 0x72,
119         0x63, 0x58, 0x70, 0x68, 0x48, 0x45, 0x54, 0x53, 0x26, 0x25, 0x65, 0x44,
120         0x13, 0x05, 0x51, 0x41, 0x61, 0x16, 0x12, 0x10, 0x06, 0x28, 0x27, 0x60,
121         0x40, 0x32, 0x56, 0x52, 0x17, 0x00, 0x31, 0x18, 0x73, 0x30, 0x75, 0x74,
122         0x88, 0x84, 0x83, 0x86, 0x80, 0x85, 0x43, 0x38, 0x87, 0x47, 0x76, 0x71,
123         0x50, 0x37, 0x78, 0x57, 0x82, 0x77, 0x67, 0x33, 0x07, 0x36, 0x34, 0x81,
124         0x46, 0x42, 0x64, 0x55, 0x15, 0x02, 0x22, 0x21, 0x11,
125     },
126     {
127         0x22, 0x00, 0x11, 0x01, 0x20, 0x08, 0x88, 0x62, 0x27, 0x02, 0x07, 0x06,
128         0x21, 0x12, 0x28, 0x87, 0x66, 0x32, 0x30, 0x38, 0x33, 0x15, 0x14, 0x25,
129         0x17, 0x26, 0x24, 0x60, 0x42, 0x78, 0x71, 0x84, 0x81, 0x44, 0x23, 0x52,
130         0x50, 0x80, 0x70, 0x35, 0x13, 0x48, 0x46, 0x83, 0x51, 0x40, 0x64, 0x61,
131         0x55, 0x47, 0x74, 0x58, 0x18, 0x03, 0x41, 0x31, 0x73, 0x68, 0x43, 0x36,
132         0x57, 0x45, 0x85, 0x56, 0x54, 0x67, 0x65, 0x76, 0x75, 0x37, 0x34, 0x63,
133         0x53, 0x86, 0x77, 0x72, 0x05, 0x04, 0x16, 0x10, 0x82,
134     },
135     {
136         0x22, 0x12, 0x27, 0x21, 0x14, 0x01, 0x20, 0x15, 0x62, 0x02, 0x00, 0x16,
137         0x10, 0x60, 0x17, 0x72, 0x66, 0x28, 0x07, 0x06, 0x18, 0x13, 0x82, 0x55,
138         0x40, 0x78, 0x71, 0x25, 0x23, 0x32, 0x31, 0x42, 0x26, 0x61, 0x52, 0x24,
139         0x08, 0x50, 0x44, 0x77, 0x37, 0x34, 0x63, 0x57, 0x87, 0x84, 0x80, 0x86,
140         0x83, 0x45, 0x36, 0x85, 0x73, 0x70, 0x68, 0x81, 0x74, 0x33, 0x03, 0x38,
141         0x35, 0x88, 0x56, 0x54, 0x76, 0x75, 0x46, 0x43, 0x53, 0x48, 0x64, 0x51,
142         0x58, 0x47, 0x67, 0x65, 0x05, 0x04, 0x41, 0x30, 0x11,
143     },
144     {
145         0x44, 0x40, 0x66, 0x60, 0x23, 0x16, 0x32, 0x30, 0x07, 0x06, 0x18, 0x14,
146         0x86, 0x50, 0x47, 0x75, 0x55, 0x33, 0x31, 0x41, 0x35, 0x80, 0x70, 0x84,
147         0x83, 0x78, 0x71, 0x87, 0x81, 0x77, 0x12, 0x38, 0x25, 0x52, 0x51, 0x08,
148         0x01, 0x17, 0x15, 0x58, 0x54, 0x68, 0x67, 0x34, 0x13, 0x48, 0x46, 0x04,
149         0x03, 0x36, 0x05, 0x85, 0x56, 0x45, 0x65, 0x57, 0x73, 0x43, 0x37, 0x63,
150         0x53, 0x64, 0x61, 0x76, 0x74, 0x24, 0x10, 0x62, 0x42, 0x21, 0x11, 0x02,
151         0x00, 0x26, 0x20, 0x88, 0x28, 0x27, 0x82, 0x72, 0x22,
152     },
153     {
154         0x28, 0x27, 0x71, 0x70, 0x87, 0x78, 0x82, 0x22, 0x77, 0x72, 0x07, 0x01,
155         0x14, 0x08, 0x81, 0x66, 0x62, 0x80, 0x75, 0x40, 0x25, 0x51, 0x50, 0x02,
156         0x00, 0x26, 0x20, 0x42, 0x24, 0x52, 0x44, 0x16, 0x10, 0x23, 0x17, 0x64,
157         0x60, 0x86, 0x83, 0x46, 0x41, 0x55, 0x54, 0x48, 0x47, 0x58, 0x56, 0x18,
158         0x04, 0x35, 0x31, 0x57, 0x38, 0x34, 0x03, 0x63, 0x53, 0x67, 0x13, 0x05,
159         0x36, 0x33, 0x73, 0x61, 0x43, 0x37, 0x68, 0x65, 0x45, 0x85, 0x76, 0x74,
160         0x15, 0x06, 0x32, 0x30, 0x84, 0x12, 0x11, 0x88, 0x21,
161     },
162     {
163         0x82, 0x27, 0x08, 0x07, 0x16, 0x10, 0x62, 0x76, 0x74, 0x50, 0x41, 0x86,
164         0x67, 0x15, 0x14, 0x38, 0x17, 0x40, 0x23, 0x61, 0x42, 0x11, 0x02, 0x26,
165         0x20, 0x72, 0x77, 0x28, 0x12, 0x01, 0x60, 0x24, 0x88, 0x52, 0x44, 0x75,
166         0x64, 0x25, 0x06, 0x32, 0x30, 0x55, 0x51, 0x68, 0x58, 0x46, 0x33, 0x48,
167         0x47, 0x43, 0x37, 0x56, 0x54, 0x13, 0x03, 0x35, 0x34, 0x85, 0x73, 0x65,
168         0x63, 0x45, 0x36, 0x57, 0x53, 0x83, 0x80, 0x05, 0x04, 0x31, 0x18, 0x84,
169         0x70, 0x66, 0x87, 0x81, 0x21, 0x00, 0x78, 0x71, 0x22,
170     },
171     {
172         0x84, 0x81, 0x32, 0x25, 0x86, 0x83, 0x10, 0x04, 0x23, 0x14, 0x62, 0x26,
173         0x70, 0x66, 0x42, 0x24, 0x64, 0x44, 0x87, 0x75, 0x71, 0x85, 0x80, 0x55,
174         0x52, 0x67, 0x61, 0x50, 0x48, 0x58, 0x51, 0x18, 0x15, 0x38, 0x30, 0x33,
175         0x31, 0x65, 0x41, 0x05, 0x03, 0x13, 0x08, 0x37, 0x36, 0x53, 0x43, 0x60,
176         0x73, 0x68, 0x63, 0x57, 0x45, 0x35, 0x56, 0x54, 0x78, 0x76, 0x40, 0x34,
177         0x47, 0x46, 0x06, 0x01, 0x17, 0x07, 0x77, 0x28, 0x02, 0x00, 0x12, 0x11,
178         0x88, 0x72, 0x27, 0x20, 0x16, 0x74, 0x21, 0x82, 0x22,
179     },
180     {
181         0x77, 0x12, 0x81, 0x78, 0x72, 0x38, 0x33, 0x50, 0x44, 0x23, 0x01, 0x31,
182         0x25, 0x34, 0x13, 0x37, 0x35, 0x86, 0x58, 0x55, 0x73, 0x68, 0x43, 0x04,
183         0x54, 0x53, 0x64, 0x46, 0x65, 0x63, 0x57, 0x45, 0x67, 0x05, 0x03, 0x56,
184         0x36, 0x62, 0x52, 0x83, 0x66, 0x42, 0x32, 0x80, 0x71, 0x10, 0x08, 0x24,
185         0x16, 0x87, 0x18, 0x17, 0x47, 0x41, 0x07, 0x06, 0x15, 0x14, 0x75, 0x74,
186         0x85, 0x76, 0x51, 0x48, 0x61, 0x60, 0x40, 0x30, 0x84, 0x70, 0x22, 0x82,
187         0x28, 0x21, 0x11, 0x02, 0x00, 0x26, 0x20, 0x27, 0x88,
188     },
189     {
190         0x72, 0x27, 0x87, 0x81, 0x42, 0x33, 0x52, 0x50, 0x16, 0x08, 0x31, 0x23,
191         0x02, 0x00, 0x78, 0x20, 0x82, 0x88, 0x28, 0x38, 0x32, 0x71, 0x62, 0x24,
192         0x10, 0x30, 0x26, 0x64, 0x61, 0x76, 0x75, 0x44, 0x18, 0x58, 0x55, 0x54,
193         0x48, 0x45, 0x43, 0x57, 0x46, 0x73, 0x35, 0x34, 0x37, 0x36, 0x04, 0x03,
194         0x13, 0x05, 0x85, 0x65, 0x63, 0x68, 0x67, 0x47, 0x41, 0x56, 0x53, 0x70,
195         0x60, 0x07, 0x06, 0x15, 0x14, 0x84, 0x83, 0x80, 0x66, 0x51, 0x86, 0x74,
196         0x17, 0x01, 0x40, 0x25, 0x12, 0x11, 0x77, 0x21, 0x22,
197     },
198     {
199         0x27, 0x21, 0x88, 0x72, 0x28, 0x12, 0x11, 0x83, 0x77, 0x82, 0x80, 0x78,
200         0x25, 0x24, 0x38, 0x32, 0x08, 0x01, 0x18, 0x16, 0x20, 0x02, 0x26, 0x23,
201         0x81, 0x74, 0x86, 0x84, 0x10, 0x00, 0x62, 0x61, 0x04, 0x03, 0x13, 0x06,
202         0x76, 0x58, 0x51, 0x64, 0x60, 0x31, 0x17, 0x41, 0x35, 0x44, 0x42, 0x70,
203         0x66, 0x33, 0x15, 0x48, 0x40, 0x87, 0x65, 0x55, 0x67, 0x63, 0x54, 0x07,
204         0x57, 0x56, 0x46, 0x45, 0x50, 0x47, 0x73, 0x68, 0x30, 0x14, 0x53, 0x43,
205         0x75, 0x71, 0x52, 0x34, 0x05, 0x37, 0x36, 0x85, 0x22,
206     },
207     {
208         0x21, 0x14, 0x32, 0x27, 0x10, 0x72, 0x67, 0x82, 0x77, 0x44, 0x40, 0x54,
209         0x45, 0x41, 0x37, 0x68, 0x56, 0x08, 0x01, 0x24, 0x13, 0x78, 0x48, 0x04,
210         0x03, 0x43, 0x05, 0x81, 0x25, 0x07, 0x47, 0x35, 0x34, 0x06, 0x46, 0x36,
211         0x88, 0x84, 0x83, 0x75, 0x74, 0x76, 0x73, 0x86, 0x85, 0x70, 0x65, 0x80,
212         0x71, 0x57, 0x53, 0x87, 0x63, 0x51, 0x50, 0x23, 0x18, 0x33, 0x31, 0x61,
213         0x12, 0x62, 0x22, 0x02, 0x00, 0x17, 0x15, 0x66, 0x55, 0x42, 0x64, 0x58,
214         0x26, 0x20, 0x38, 0x30, 0x28, 0x16, 0x60, 0x52, 0x11,
215     },
216     {
217         0x61, 0x15, 0x27, 0x25, 0x32, 0x28, 0x06, 0x01, 0x24, 0x17, 0x78, 0x75,
218         0x87, 0x80, 0x85, 0x08, 0x07, 0x73, 0x70, 0x48, 0x47, 0x84, 0x83, 0x81,
219         0x71, 0x88, 0x86, 0x76, 0x74, 0x30, 0x04, 0x43, 0x37, 0x82, 0x72, 0x67,
220         0x20, 0x03, 0x57, 0x45, 0x77, 0x52, 0x36, 0x41, 0x38, 0x68, 0x58, 0x05,
221         0x00, 0x34, 0x33, 0x55, 0x26, 0x60, 0x56, 0x11, 0x66, 0x16, 0x64, 0x51,
222         0x10, 0x02, 0x23, 0x18, 0x62, 0x54, 0x53, 0x65, 0x63, 0x40, 0x35, 0x50,
223         0x42, 0x31, 0x13, 0x46, 0x44, 0x14, 0x12, 0x22, 0x21,
224     },
225     {
226         0x22, 0x21, 0x12, 0x01, 0x16, 0x15, 0x82, 0x88, 0x87, 0x42, 0x40, 0x60,
227         0x44, 0x06, 0x05, 0x31, 0x10, 0x66, 0x61, 0x83, 0x76, 0x26, 0x25, 0x72,
228         0x27, 0x81, 0x11, 0x46, 0x41, 0x84, 0x62, 0x13, 0x02, 0x24, 0x20, 0x80,
229         0x75, 0x65, 0x63, 0x68, 0x54, 0x37, 0x07, 0x57, 0x30, 0x50, 0x52, 0x48,
230         0x73, 0x67, 0x74, 0x55, 0x53, 0x47, 0x58, 0x56, 0x34, 0x04, 0x43, 0x38,
231         0x70, 0x64, 0x17, 0x00, 0x45, 0x36, 0x78, 0x86, 0x85, 0x33, 0x32, 0x51,
232         0x35, 0x08, 0x03, 0x18, 0x14, 0x28, 0x23, 0x77, 0x71,
233     },
234 };
235 
236 static const uint8_t aic_mode2_vlc_bits[AIC_MODE2_NUM][AIC_MODE2_SIZE] = {
237     {
238          5,  5,  5,  5,  3,  6,  6,  8,  8,  8,  8,  6,  4,  7,  7,  9,  9,
239          9,  9,  7,  7,  7,  7,  7,  8,  8,  8,  8,  8,  8,  8,  8,  9,  9,
240         11, 11, 11, 11,  9,  9,  9,  9,  9, 10, 10, 10, 10, 10, 10, 10, 10,
241         14, 14, 14, 14, 12, 13, 13, 15, 15, 14, 13, 12, 12, 12, 12, 11, 11,
242         13, 13, 13, 13, 11, 10, 10, 12, 12, 12, 12, 10,  1,
243     },
244     {
245          8,  8, 10, 10, 10, 10, 10, 10, 10, 10,  8,  8,  8,  8,  9,  9,  9,
246          9,  9,  9,  9,  9, 13, 13, 13, 13, 11, 12, 12, 14, 14, 15, 15, 14,
247         12, 11, 11, 11, 11, 12, 12, 12, 12, 10, 12, 12, 12, 12, 12, 12, 12,
248         12,  9,  9, 11, 11, 11, 11,  9,  6,  6,  6,  6,  5,  5,  7,  7,  9,
249          9,  9,  9,  7,  7,  7,  7,  7,  4,  4,  4,  4,  1,
250     },
251     {
252          7,  7,  7,  7,  5,  8,  8, 10, 10, 10, 10,  8,  8,  8,  8,  8,  9,
253          9,  9,  9,  9,  9,  9,  9, 12, 12, 12, 12, 10, 13, 13, 14, 14, 14,
254         14, 13, 13, 13, 13, 12, 12, 12, 12, 10, 10, 10, 10, 11, 11, 11, 11,
255          9, 11, 11, 11, 11, 11, 11, 11, 11,  5,  5,  5,  5,  4,  4,  6,  6,
256          8,  8,  8,  8,  8,  8,  8,  8,  6,  6,  6,  6,  1,
257     },
258     {
259          9,  9, 11, 11, 13, 13, 13, 13, 11, 11, 11, 11, 11,  9,  9,  9,  9,
260         10, 10, 10, 10, 10, 10, 10, 10, 12, 12, 12, 12, 10, 12, 12, 13, 13,
261         15, 15, 14, 13, 12, 12, 12, 12, 10, 10, 10, 10,  7,  7,  9,  9,  9,
262          9,  7,  8,  8,  8,  8,  6,  8,  8,  8,  8,  8,  8,  8,  8,  5,  5,
263          7,  7,  7,  7,  5,  4,  4,  6,  6,  6,  6,  4,  1,
264     },
265     {
266          7,  7,  7,  7,  5,  9,  9,  9,  9,  9,  9,  9,  9, 11, 11, 11, 11,
267         11, 11, 11, 11, 12, 12, 12, 12, 10, 13, 13, 13, 13, 13, 13, 13, 13,
268         12, 12, 14, 14, 15, 15, 15, 15, 12,  9,  9, 11, 11, 11, 11,  9,  7,
269          7,  7,  7,  5,  5,  5,  5,  4,  4,  8,  8,  8,  8,  6,  8,  8, 10,
270         10, 10, 10, 10, 10, 10, 10,  8,  8,  8,  8,  4,  1,
271     },
272     {
273          2,  2,  7,  7,  7,  7,  5, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11,
274         12, 12, 13, 13, 14, 14, 13, 10, 10, 10, 10,  9,  9, 11, 11, 11, 11,
275         11, 11, 11, 11,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10,  7,  7,  9,
276          9,  9,  9,  9,  9,  9,  9,  5,  5,  5,  5,  6,  6,  6,  6,  4,  6,
277          6,  8,  8,  8,  8,  8,  8,  8,  8,  6,  6,  6,  6,
278     },
279     {
280          5,  5,  5,  5,  3,  6,  6,  6,  6,  4,  7,  7,  9,  9,  9,  9,  9,
281          9,  9,  9,  7,  7,  7,  7,  8,  8,  8,  8,  8,  8,  8,  8, 11, 11,
282         13, 13, 13, 13, 11, 11, 11, 11, 11, 12, 12, 12, 12, 10, 12, 12, 15,
283         15, 15, 15, 13, 14, 14, 14, 14, 12, 12, 12, 12,  9,  9, 11, 11, 11,
284         11,  9,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10,  1,
285     },
286     {
287          5,  5,  9,  9,  9,  9,  7, 11, 11, 11, 11,  9, 11, 11, 11, 11, 11,
288         11, 11, 11,  9,  9,  9,  9,  7,  7,  7,  7,  3,  4,  4,  8,  8,  8,
289          8,  6, 10, 10, 10, 10, 10, 10, 10, 10, 14, 14, 14, 14, 12, 13, 13,
290         14, 14, 13, 12, 12, 12, 12, 11, 11, 13, 13, 13, 13, 11, 10, 10, 12,
291         12, 12, 12, 10,  8,  8,  8,  8,  6,  6,  6,  6,  1,
292     },
293     {
294          2,  2,  5,  5,  7,  7,  7,  7,  5,  3,  6,  6,  6,  6,  4,  8,  8,
295         10, 10, 10, 10, 10, 10, 10, 10,  8,  8,  8,  8,  9,  9,  9,  9,  9,
296          9,  9,  9, 10, 10, 12, 12, 12, 12, 10, 10, 10, 10, 10, 11, 11, 11,
297         11, 11, 11, 11, 11, 12, 12, 14, 14, 14, 14, 12, 12, 12, 12, 12, 11,
298         11, 13, 13, 13, 13, 11,  6,  6,  8,  8,  8,  8,  6,
299     },
300     {
301          3,  3,  6,  6,  8,  8,  8,  8,  6,  6,  6,  6,  6,  7,  7,  7,  7,
302          5, 10, 10, 10, 10,  8, 10, 10, 10, 10, 10, 10, 10, 10,  8,  8,  8,
303          8,  9,  9,  9,  9,  7, 13, 13, 13, 13, 11, 12, 12, 13, 13, 14, 14,
304         14, 14, 11, 11, 11, 11, 12, 12, 12, 12, 10, 12, 12, 12, 12, 12, 12,
305         12, 12,  9,  9, 11, 11, 11, 11, 11, 11, 11, 11,  1,
306     },
307     {
308          9,  9,  9,  9,  9,  9,  9,  9, 11, 11, 11, 11,  9, 11, 11, 11, 11,
309         11, 11, 11, 11,  9,  9,  9,  9,  7,  7,  7,  7,  6,  6, 10, 10, 10,
310         10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
311         11, 14, 14, 14, 14, 12, 13, 13, 13, 13, 10, 10, 10, 10,  8,  8,  8,
312          8,  5,  5,  7,  7,  7,  7,  5,  4,  4,  4,  4,  1,
313     },
314     {
315          4,  4,  6,  6,  6,  6,  4,  2,  3,  3,  9,  9,  9,  9,  7,  9,  9,
316          9,  9,  9,  9,  9,  9,  7,  7,  7,  7,  8,  8,  8,  8,  8,  8,  8,
317          8, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11,
318         12, 12, 14, 14, 14, 14, 12, 12, 12, 12, 12, 11, 11, 13, 13, 14, 14,
319         13, 11,  8,  8, 10, 10, 10, 10,  8,  5,  5,  5,  5,
320     },
321     {
322          5,  5,  9,  9,  9,  9,  7,  9,  9, 11, 11, 11, 11, 11, 11, 11, 11,
323          9,  9,  9,  9,  7,  7,  7,  7,  3,  4,  4,  8,  8,  8,  8,  6, 10,
324         10, 10, 10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13,
325         13, 13, 13, 13, 13, 13, 12, 12, 13, 13, 14, 14, 14, 14, 10, 10, 12,
326         12, 12, 12, 10,  8,  8,  8,  8,  6,  6,  6,  6,  1,
327     },
328     {
329          7,  7,  9,  9,  9,  9,  9,  9,  9,  9,  7,  7,  7,  7,  8,  8,  8,
330          8,  6, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11,
331         11, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 11, 12, 12, 13,
332         13, 14, 14, 14, 14,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10,  5,  5,
333          7,  7,  7,  7,  5,  4,  4,  6,  6,  6,  6,  4,  1,
334     },
335     {
336          6,  6,  6,  6,  4,  9,  9,  9,  9,  9,  9,  9,  9, 11, 11, 11, 11,
337          9, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 13, 13, 14, 14, 13, 13,
338         13, 13, 13,  9,  9,  9,  9,  7,  7,  7,  7,  8,  8,  8,  8,  6, 10,
339         10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,  8,  8,
340          8,  8,  2,  3,  3,  5,  5,  7,  7,  7,  7,  5,  3,
341     },
342     {
343          5,  5,  7,  7,  9,  9,  9,  9,  9,  9,  9,  9,  7,  7,  7,  7,  3,
344          4,  4,  8,  8,  8,  8,  8,  8,  8,  8, 11, 11, 11, 11, 11, 11, 11,
345         11, 12, 12, 14, 14, 14, 14, 12, 12, 12, 12, 12, 13, 13, 13, 13, 11,
346         13, 13, 13, 13, 13, 13, 13, 13,  9,  9, 11, 11, 11, 11,  9,  8,  8,
347         10, 10, 10, 10, 10, 10, 10, 10,  6,  6,  6,  6,  1,
348     },
349     {
350          5,  5,  5,  5,  3,  6,  6,  6,  6,  4,  7,  7,  9,  9,  9,  9,  9,
351          9,  9,  9,  7,  7,  7,  7,  8,  8,  8,  8,  8,  8,  8,  8, 11, 11,
352         11, 11,  9, 11, 11, 11, 11, 11, 11, 11, 11,  9,  9,  9,  9, 10, 10,
353         10, 10,  8, 12, 12, 13, 13, 14, 14, 14, 14, 12, 12, 12, 12, 11, 11,
354         13, 13, 13, 13, 11, 10, 10, 12, 12, 12, 12, 10,  1,
355     },
356     {
357          7,  7,  7,  7,  5,  9,  9,  9,  9,  9,  9,  9,  9, 10, 10, 10, 10,
358         10, 10, 10, 10, 11, 11, 13, 13, 13, 13, 11, 11, 11, 11, 11, 12, 12,
359         12, 12, 10, 13, 13, 14, 14, 15, 15, 15, 15, 13, 13, 13, 13, 12, 12,
360         12, 12,  7,  7,  9,  9,  9,  9,  7,  3,  4,  4,  8,  8,  8,  8,  6,
361          8,  8,  8,  8,  8,  8,  8,  8,  6,  6,  6,  6,  1,
362     },
363     {
364          4,  4,  8,  8,  8,  8,  8,  8,  8,  8, 13, 13, 14, 14, 13, 13, 13,
365         13, 13, 12, 12, 12, 12, 11, 11, 11, 11, 10, 10, 12, 12, 12, 12, 10,
366          9,  9, 11, 11, 11, 11,  9,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10,
367          6,  6,  6,  6,  2,  3,  3,  5,  5,  9,  9,  9,  9,  7,  9,  9,  9,
368          9,  9,  9,  9,  9,  7,  7,  7,  7,  5,  5,  5,  5,
369     },
370     {
371          2,  2,  7,  7,  7,  7,  5,  7,  7,  9,  9,  9,  9,  9,  9,  9,  9,
372          7,  7,  7,  7,  5,  5,  5,  5,  4,  4,  8,  8,  8,  8,  8,  8,  8,
373          8, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 14, 11, 11, 11, 11, 10,
374         10, 12, 12, 12, 12, 12, 12, 12, 12,  9,  9, 11, 11, 11, 11,  9,  8,
375          8, 10, 10, 10, 10, 10, 10, 10, 10,  6,  6,  6,  6,
376     },
377 };
378 //@}
379 
380 /**
381  * Codes used for determining block type
382  */
383 //@{
384 #define AIC_MODE1_NUM  90
385 #define AIC_MODE1_SIZE  9
386 #define AIC_MODE1_BITS  7
387 
388 static const uint8_t aic_mode1_vlc_tabs[AIC_MODE1_NUM][AIC_MODE1_SIZE][2] = {
389     { { 4, 4 }, { 1, 4 }, { 7, 7 }, { 3, 7 }, { 5, 6 },
390       { 8, 5 }, { 6, 4 }, { 2, 2 }, { 0, 1 } },
391     { { 5, 3 }, { 2, 3 }, { 8, 7 }, { 7, 7 }, { 4, 6 },
392       { 0, 5 }, { 3, 4 }, { 6, 3 }, { 1, 1 } },
393     { { 7, 4 }, { 1, 4 }, { 5, 7 }, { 3, 7 }, { 4, 6 },
394       { 6, 5 }, { 8, 4 }, { 2, 2 }, { 0, 1 } },
395     { { 2, 3 }, { 1, 3 }, { 7, 7 }, { 4, 7 }, { 8, 6 },
396       { 6, 5 }, { 5, 4 }, { 3, 3 }, { 0, 1 } },
397     { { 2, 2 }, { 0, 2 }, { 4, 4 }, { 1, 4 }, { 8, 6 },
398       { 3, 6 }, { 5, 5 }, { 7, 4 }, { 6, 2 } },
399     { { 4, 7 }, { 0, 7 }, { 8, 7 }, { 7, 7 }, { 6, 5 },
400       { 3, 4 }, { 2, 3 }, { 1, 2 }, { 5, 1 } },
401     { { 4, 5 }, { 0, 5 }, { 8, 7 }, { 7, 7 }, { 3, 6 },
402       { 5, 5 }, { 2, 3 }, { 6, 2 }, { 1, 1 } },
403     { { 6, 5 }, { 1, 5 }, { 5, 7 }, { 3, 7 }, { 8, 6 },
404       { 7, 5 }, { 4, 3 }, { 0, 2 }, { 2, 1 } },
405     { { 3, 4 }, { 1, 4 }, { 7, 7 }, { 5, 7 }, { 6, 6 },
406       { 4, 5 }, { 8, 4 }, { 0, 2 }, { 2, 1 } },
407     { { 0 } }, /* unused */
408     { { 5, 5 }, { 4, 5 }, { 8, 7 }, { 7, 7 }, { 3, 6 },
409       { 6, 5 }, { 2, 3 }, { 0, 2 }, { 1, 1 } },
410     { { 5, 3 }, { 2, 3 }, { 8, 7 }, { 7, 7 }, { 4, 6 },
411       { 0, 5 }, { 3, 4 }, { 6, 3 }, { 1, 1 } },
412     { { 6, 4 }, { 0, 4 }, { 5, 5 }, { 4, 5 }, { 8, 6 },
413       { 3, 6 }, { 7, 5 }, { 2, 2 }, { 1, 1 } },
414     { { 2, 3 }, { 0, 3 }, { 8, 7 }, { 7, 7 }, { 4, 6 },
415       { 6, 5 }, { 3, 4 }, { 5, 3 }, { 1, 1 } },
416     { { 4, 3 }, { 2, 3 }, { 8, 7 }, { 7, 7 }, { 3, 6 },
417       { 5, 5 }, { 0, 4 }, { 6, 3 }, { 1, 1 } },
418     { { 3, 4 }, { 2, 4 }, { 8, 7 }, { 7, 7 }, { 0, 6 },
419       { 4, 5 }, { 6, 4 }, { 5, 2 }, { 1, 1 } },
420     { { 3, 7 }, { 0, 7 }, { 8, 7 }, { 7, 7 }, { 2, 5 },
421       { 4, 4 }, { 5, 3 }, { 6, 2 }, { 1, 1 } },
422     { { 4, 5 }, { 0, 5 }, { 8, 7 }, { 3, 7 }, { 5, 6 },
423       { 7, 5 }, { 1, 3 }, { 2, 2 }, { 6, 1 } },
424     { { 6, 4 }, { 0, 4 }, { 7, 7 }, { 4, 7 }, { 3, 6 },
425       { 5, 5 }, { 8, 4 }, { 2, 2 }, { 1, 1 } },
426     { { 2, 1 }, { 0, 1 } }, /* Unused */
427     { { 1, 3 }, { 0, 3 }, { 4, 5 }, { 3, 5 }, { 6, 6 },
428       { 5, 6 }, { 7, 5 }, { 8, 3 }, { 2, 1 } },
429     { { 7, 4 }, { 6, 4 }, { 5, 5 }, { 3, 5 }, { 4, 6 },
430       { 0, 6 }, { 8, 5 }, { 1, 2 }, { 2, 1 } },
431     { { 4, 6 }, { 0, 6 }, { 5, 7 }, { 3, 7 }, { 6, 6 },
432       { 1, 4 }, { 7, 3 }, { 8, 2 }, { 2, 1 } },
433     { { 8, 3 }, { 1, 3 }, { 3, 4 }, { 0, 4 }, { 6, 6 },
434       { 4, 6 }, { 7, 5 }, { 5, 4 }, { 2, 1 } },
435     { { 7, 3 }, { 6, 3 }, { 5, 7 }, { 3, 7 }, { 0, 6 },
436       { 1, 5 }, { 4, 4 }, { 8, 3 }, { 2, 1 } },
437     { { 2, 2 }, { 1, 2 }, { 4, 7 }, { 0, 7 }, { 7, 6 },
438       { 8, 5 }, { 6, 4 }, { 3, 3 }, { 5, 2 } },
439     { { 2, 2 }, { 1, 2 }, { 7, 4 }, { 4, 4 }, { 3, 6 },
440       { 0, 6 }, { 5, 5 }, { 8, 4 }, { 6, 2 } },
441     { { 1, 4 }, { 0, 4 }, { 5, 7 }, { 3, 7 }, { 4, 6 },
442       { 6, 5 }, { 8, 4 }, { 7, 2 }, { 2, 1 } },
443     { { 7, 4 }, { 1, 4 }, { 3, 5 }, { 0, 5 }, { 5, 6 },
444       { 4, 6 }, { 6, 5 }, { 8, 2 }, { 2, 1 } },
445     { { 0 } }, /* unused */
446     { { 1, 2 }, { 0, 2 }, { 5, 5 }, { 4, 5 }, { 7, 6 },
447       { 6, 6 }, { 8, 5 }, { 3, 3 }, { 2, 2 } },
448     { { 3, 3 }, { 2, 3 }, { 7, 7 }, { 0, 7 }, { 4, 6 },
449       { 8, 5 }, { 6, 4 }, { 5, 3 }, { 1, 1 } },
450     { { 3, 4 }, { 1, 4 }, { 6, 7 }, { 5, 7 }, { 4, 6 },
451       { 7, 5 }, { 8, 4 }, { 0, 2 }, { 2, 1 } },
452     { { 5, 3 }, { 2, 3 }, { 7, 7 }, { 0, 7 }, { 6, 6 },
453       { 4, 5 }, { 1, 4 }, { 8, 3 }, { 3, 1 } },
454     { { 2, 3 }, { 1, 3 }, { 3, 4 }, { 0, 4 }, { 7, 6 },
455       { 5, 6 }, { 8, 5 }, { 6, 4 }, { 4, 1 } },
456     { { 2, 4 }, { 1, 4 }, { 7, 7 }, { 0, 7 }, { 4, 6 },
457       { 8, 5 }, { 6, 4 }, { 3, 2 }, { 5, 1 } },
458     { { 6, 2 }, { 1, 2 }, { 5, 3 }, { 2, 3 }, { 4, 4 },
459       { 3, 4 }, { 7, 5 }, { 0, 5 }, { 8, 4 } },
460     { { 4, 2 }, { 2, 2 }, { 3, 3 }, { 0, 3 }, { 5, 5 },
461       { 1, 5 }, { 7, 5 }, { 6, 5 }, { 8, 3 } },
462     { { 2, 4 }, { 1, 4 }, { 7, 7 }, { 6, 7 }, { 0, 6 },
463       { 4, 5 }, { 5, 4 }, { 3, 2 }, { 8, 1 } },
464     { { 0 } }, /* unused */
465     { { 1, 2 }, { 0, 2 }, { 5, 7 }, { 3, 7 }, { 8, 6 },
466       { 7, 5 }, { 6, 4 }, { 4, 3 }, { 2, 2 } },
467     { { 6, 3 }, { 2, 3 }, { 4, 4 }, { 0, 4 }, { 7, 6 },
468       { 3, 6 }, { 8, 5 }, { 5, 4 }, { 1, 1 } },
469     { { 7, 6 }, { 6, 6 }, { 5, 7 }, { 3, 7 }, { 8, 6 },
470       { 1, 4 }, { 4, 3 }, { 0, 2 }, { 2, 1 } },
471     { { 2, 3 }, { 0, 3 }, { 5, 4 }, { 1, 4 }, { 8, 6 },
472       { 7, 6 }, { 3, 5 }, { 6, 4 }, { 4, 1 } },
473     { { 5, 7 }, { 3, 7 }, { 8, 7 }, { 7, 7 }, { 1, 5 },
474       { 0, 4 }, { 6, 3 }, { 2, 2 }, { 4, 1 } },
475     { { 6, 2 }, { 1, 2 }, { 4, 3 }, { 2, 3 }, { 7, 6 },
476       { 0, 6 }, { 3, 5 }, { 8, 4 }, { 5, 3 } },
477     { { 1, 4 }, { 0, 4 }, { 8, 7 }, { 3, 7 }, { 7, 6 },
478       { 5, 5 }, { 2, 4 }, { 4, 2 }, { 6, 1 } },
479     { { 6, 4 }, { 0, 4 }, { 5, 7 }, { 3, 7 }, { 8, 6 },
480       { 1, 5 }, { 7, 4 }, { 2, 2 }, { 4, 1 } },
481     { { 2, 2 }, { 0, 2 }, { 5, 4 }, { 1, 4 }, { 6, 6 },
482       { 3, 6 }, { 7, 5 }, { 8, 4 }, { 4, 2 } },
483     { { 0 } }, /* unused */
484     { { 2, 3 }, { 1, 3 }, { 6, 5 }, { 3, 5 }, { 7, 6 },
485       { 4, 6 }, { 8, 5 }, { 5, 3 }, { 0, 1 } },
486     { { 3, 4 }, { 2, 4 }, { 7, 7 }, { 0, 7 }, { 4, 6 },
487       { 8, 5 }, { 6, 4 }, { 5, 2 }, { 1, 1 } },
488     { { 1, 2 }, { 0, 2 }, { 6, 5 }, { 4, 5 }, { 7, 6 },
489       { 3, 6 }, { 8, 5 }, { 5, 3 }, { 2, 2 } },
490     { { 2, 4 }, { 1, 4 }, { 7, 7 }, { 0, 7 }, { 4, 6 },
491       { 6, 5 }, { 8, 4 }, { 3, 2 }, { 5, 1 } },
492     { { 2, 2 }, { 1, 2 }, { 5, 3 }, { 0, 3 }, { 4, 4 },
493       { 3, 4 }, { 8, 5 }, { 7, 5 }, { 6, 4 } },
494     { { 4, 7 }, { 0, 7 }, { 8, 7 }, { 7, 7 }, { 2, 5 },
495       { 6, 4 }, { 3, 3 }, { 1, 2 }, { 5, 1 } },
496     { { 5, 2 }, { 1, 2 }, { 8, 7 }, { 7, 7 }, { 0, 6 },
497       { 4, 5 }, { 3, 4 }, { 2, 3 }, { 6, 2 } },
498     { { 2, 2 }, { 1, 2 }, { 8, 3 }, { 0, 3 }, { 6, 4 },
499       { 5, 4 }, { 4, 5 }, { 3, 5 }, { 7, 4 } },
500     { { 2, 2 }, { 1, 2 }, { 5, 3 }, { 0, 3 }, { 7, 6 },
501       { 4, 6 }, { 6, 5 }, { 3, 4 }, { 8, 3 } },
502     { { 0 } }, /* unused */
503     { { 2, 3 }, { 1, 3 }, { 8, 7 }, { 3, 7 }, { 5, 6 },
504       { 7, 5 }, { 4, 4 }, { 6, 3 }, { 0, 1 } },
505     { { 2, 4 }, { 0, 4 }, { 8, 7 }, { 3, 7 }, { 7, 6 },
506       { 5, 5 }, { 4, 4 }, { 6, 2 }, { 1, 1 } },
507     { { 5, 7 }, { 3, 7 }, { 8, 7 }, { 7, 7 }, { 4, 5 },
508       { 1, 4 }, { 6, 3 }, { 0, 2 }, { 2, 1 } },
509     { { 6, 2 }, { 1, 2 }, { 2, 3 }, { 0, 3 }, { 8, 6 },
510       { 7, 6 }, { 3, 5 }, { 5, 4 }, { 4, 3 } },
511     { { 5, 7 }, { 3, 7 }, { 8, 7 }, { 7, 7 }, { 1, 5 },
512       { 2, 4 }, { 0, 3 }, { 4, 2 }, { 6, 1 } },
513     { { 5, 3 }, { 2, 3 }, { 8, 7 }, { 7, 7 }, { 3, 6 },
514       { 4, 5 }, { 0, 4 }, { 6, 3 }, { 1, 1 } },
515     { { 5, 7 }, { 3, 7 }, { 8, 7 }, { 7, 7 }, { 2, 5 },
516       { 0, 4 }, { 4, 3 }, { 1, 2 }, { 6, 1 } },
517     { { 3, 7 }, { 0, 7 }, { 8, 7 }, { 5, 7 }, { 7, 5 },
518       { 1, 4 }, { 4, 3 }, { 6, 2 }, { 2, 1 } },
519     { { 2, 2 }, { 1, 2 }, { 4, 4 }, { 0, 4 }, { 7, 6 },
520       { 3, 6 }, { 5, 5 }, { 8, 4 }, { 6, 2 } },
521     { { 0 } }, /* unused */
522     { { 6, 6 }, { 4, 6 }, { 5, 7 }, { 3, 7 }, { 8, 6 },
523       { 1, 4 }, { 0, 3 }, { 7, 2 }, { 2, 1 } },
524     { { 2, 2 }, { 1, 2 }, { 6, 4 }, { 0, 4 }, { 4, 6 },
525       { 3, 6 }, { 5, 5 }, { 8, 4 }, { 7, 2 } },
526     { { 1, 4 }, { 0, 4 }, { 5, 7 }, { 3, 7 }, { 6, 6 },
527       { 4, 5 }, { 8, 4 }, { 7, 2 }, { 2, 1 } },
528     { { 7, 2 }, { 2, 2 }, { 1, 3 }, { 0, 3 }, { 5, 4 },
529       { 4, 4 }, { 6, 5 }, { 3, 5 }, { 8, 4 } },
530     { { 4, 2 }, { 2, 2 }, { 5, 7 }, { 3, 7 }, { 8, 6 },
531       { 1, 5 }, { 0, 4 }, { 6, 3 }, { 7, 2 } },
532     { { 7, 2 }, { 2, 2 }, { 6, 3 }, { 1, 3 }, { 5, 4 },
533       { 0, 4 }, { 4, 5 }, { 3, 5 }, { 8, 4 } },
534     { { 4, 2 }, { 2, 2 }, { 3, 7 }, { 0, 7 }, { 8, 6 },
535       { 5, 5 }, { 1, 4 }, { 6, 3 }, { 7, 2 } },
536     { { 6, 6 }, { 1, 6 }, { 5, 7 }, { 3, 7 }, { 8, 6 },
537       { 0, 4 }, { 4, 3 }, { 2, 2 }, { 7, 1 } },
538     { { 8, 4 }, { 4, 4 }, { 1, 5 }, { 0, 5 }, { 5, 6 },
539       { 3, 6 }, { 6, 5 }, { 7, 2 }, { 2, 1 } },
540     { { 0 } }, /* unused */
541     { { 8, 2 }, { 2, 2 }, { 1, 3 }, { 0, 3 }, { 6, 6 },
542       { 5, 6 }, { 4, 5 }, { 7, 4 }, { 3, 3 } },
543     { { 3, 3 }, { 2, 3 }, { 6, 7 }, { 0, 7 }, { 4, 6 },
544       { 5, 5 }, { 7, 4 }, { 8, 3 }, { 1, 1 } },
545     { { 7, 4 }, { 1, 4 }, { 3, 5 }, { 0, 5 }, { 6, 6 },
546       { 5, 6 }, { 4, 5 }, { 8, 2 }, { 2, 1 } },
547     { { 3, 2 }, { 2, 2 }, { 4, 6 }, { 0, 6 }, { 7, 6 },
548       { 6, 6 }, { 1, 4 }, { 5, 3 }, { 8, 2 } },
549     { { 8, 2 }, { 2, 2 }, { 6, 3 }, { 4, 3 }, { 5, 6 },
550       { 0, 6 }, { 3, 5 }, { 1, 4 }, { 7, 3 } },
551     { { 5, 2 }, { 2, 2 }, { 3, 3 }, { 1, 3 }, { 7, 6 },
552       { 0, 6 }, { 4, 5 }, { 6, 4 }, { 8, 3 } },
553     { { 2, 2 }, { 1, 2 }, { 6, 3 }, { 4, 3 }, { 7, 6 },
554       { 0, 6 }, { 5, 5 }, { 3, 4 }, { 8, 3 } },
555     { { 3, 7 }, { 0, 7 }, { 6, 7 }, { 5, 7 }, { 1, 5 },
556       { 4, 4 }, { 7, 3 }, { 8, 2 }, { 2, 1 } },
557     { { 1, 5 }, { 0, 5 }, { 6, 7 }, { 5, 7 }, { 4, 6 },
558       { 7, 5 }, { 3, 3 }, { 2, 2 }, { 8, 1 } },
559     { { 0 } }, /* unused */
560 };
561 
562 //@}
563 
564 #define PBTYPE_ESCAPE 0xFF
565 
566 /** tables used for P-frame macroblock type decoding */
567 //@{
568 #define NUM_PTYPE_VLCS 7
569 #define PTYPE_VLC_SIZE 8
570 #define PTYPE_VLC_BITS 7
571 
572 static const uint8_t ptype_vlc_tabs[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE][2] = {
573     { { PBTYPE_ESCAPE, 7 }, { 11, 7 }, { 3, 6 }, { 8, 5 },
574       { 9, 4 }, { 2, 3 }, { 1, 2 }, { 0, 1 } },
575     { { PBTYPE_ESCAPE, 7 }, { 3, 7 }, { 8, 6 }, { 9, 5 },
576       { 11, 4 }, { 0, 3 }, { 2, 2 }, { 1, 1 } },
577     { { 9, 3 }, { 8, 3 }, { 3, 4 }, { 1, 4 }, { PBTYPE_ESCAPE, 5 },
578       { 0, 5 }, { 11, 4 }, { 2, 1 } },
579     { { 3, 2 }, { 2, 2 }, { PBTYPE_ESCAPE, 6 }, { 11, 6 },
580       { 1, 5 }, { 0, 4 }, { 8, 3 }, { 9, 2 } },
581     { { PBTYPE_ESCAPE, 7 }, { 11, 7 }, { 1, 6 }, { 0, 5 },
582       { 3, 4 }, { 9, 3 }, { 8, 2 }, { 2, 1 } },
583     { { PBTYPE_ESCAPE, 7 }, { 11, 7 }, { 1, 6 }, { 0, 5 },
584       { 3, 4 }, { 8, 3 }, { 9, 2 }, { 2, 1 } },
585     { { PBTYPE_ESCAPE, 7 }, { 3, 7 }, { 0, 6 }, { 8, 5 },
586       { 9, 4 }, { 1, 3 }, { 2, 2 }, { 11, 1 } },
587 };
588 
589 static const uint8_t block_num_to_ptype_vlc_num[12] = {
590  0, 1, 2, 3, 0, 0, 2, 0, 4, 5, 0, 6
591 };
592 //@}
593 
594 /** tables used for P-frame macroblock type decoding */
595 //@{
596 #define NUM_BTYPE_VLCS 6
597 #define BTYPE_VLC_SIZE 7
598 #define BTYPE_VLC_BITS 6
599 
600 static const uint8_t btype_vlc_tabs[NUM_BTYPE_VLCS][BTYPE_VLC_SIZE][2] = {
601     { { 4, 2 }, { 0, 2 }, { PBTYPE_ESCAPE, 5 },
602       { 10, 5 }, { 7, 4 }, { 1, 3 }, { 5, 2 } },
603     { { PBTYPE_ESCAPE, 6 }, { 10, 6 }, { 7, 5 },
604       { 0, 4 }, { 4, 3 }, { 5, 2 }, { 1, 1 } },
605     { { PBTYPE_ESCAPE, 6 }, { 0, 6 }, { 10, 5 },
606       { 1, 4 }, { 7, 3 }, { 5, 2 }, { 4, 1 } },
607     { { 4, 3 }, { 1, 3 }, { PBTYPE_ESCAPE, 5 },
608       { 0, 5 }, { 10, 4 }, { 7, 3 }, { 5, 1 } },
609     { { PBTYPE_ESCAPE, 6 }, { 0, 6 }, { 1, 5 },
610       { 10, 4 }, { 4, 3 }, { 5, 2 }, { 7, 1 } },
611     { { PBTYPE_ESCAPE, 6 }, { 0, 6 }, { 1, 5 },
612       { 10, 4 }, { 4, 3 }, { 7, 2 }, { 5, 1 } },
613 };
614 
615 static const uint8_t block_num_to_btype_vlc_num[12] = {
616  0, 1, 0, 0, 2, 3, 0, 5, 0, 0, 4, 0
617 };
618 //@}
619 #endif /* AVCODEC_RV40VLC2_H */
620