50 |
* exception also makes it possible to release a modified version which |
* exception also makes it possible to release a modified version which |
51 |
* carries forward this exception. |
* carries forward this exception. |
52 |
* |
* |
53 |
* $Id: mbcoding.c,v 1.39 2003-01-26 01:44:07 suxen_drol Exp $ |
* $Id: mbcoding.c,v 1.40 2003-02-06 00:48:08 edgomez Exp $ |
54 |
* |
* |
55 |
****************************************************************************/ |
****************************************************************************/ |
56 |
|
|
94 |
void |
void |
95 |
init_vlc_tables(void) |
init_vlc_tables(void) |
96 |
{ |
{ |
97 |
ptr_t i, j, intra, last, run, run_esc, level, level_esc, escape, escape_len, offset; |
uint32_t i, j, intra, last, run, run_esc, level, level_esc, escape, escape_len, offset; |
98 |
|
|
99 |
#ifdef BIGLUT |
#ifdef BIGLUT |
100 |
intra_table = (VLC*)coeff_VLC[1]; |
intra_table = (VLC*)coeff_VLC[1]; |
129 |
#else |
#else |
130 |
offset = !intra * LEVELOFFSET; |
offset = !intra * LEVELOFFSET; |
131 |
#endif |
#endif |
132 |
for (j = 0; j < 1 << (12 - coeff_tab[intra][i].vlc.len); j++) |
for (j = 0; j < (uint32_t)(1 << (12 - coeff_tab[intra][i].vlc.len)); j++) |
133 |
{ |
{ |
134 |
DCT3D[intra][(coeff_tab[intra][i].vlc.code << (12 - coeff_tab[intra][i].vlc.len)) | j].len = coeff_tab[intra][i].vlc.len; |
DCT3D[intra][(coeff_tab[intra][i].vlc.code << (12 - coeff_tab[intra][i].vlc.len)) | j].len = coeff_tab[intra][i].vlc.len; |
135 |
DCT3D[intra][(coeff_tab[intra][i].vlc.code << (12 - coeff_tab[intra][i].vlc.len)) | j].event = coeff_tab[intra][i].event; |
DCT3D[intra][(coeff_tab[intra][i].vlc.code << (12 - coeff_tab[intra][i].vlc.len)) | j].event = coeff_tab[intra][i].event; |
154 |
for (last = 0; last < 2; last++) |
for (last = 0; last < 2; last++) |
155 |
for (run = 0; run < 63 + last; run++) |
for (run = 0; run < 63 + last; run++) |
156 |
{ |
{ |
157 |
for (level = 1; level < 32 << intra; level++) |
for (level = 1; level < (uint32_t)(32 << intra); level++) |
158 |
{ |
{ |
159 |
if (level <= max_level[intra][last][run] && run <= max_run[intra][last][level]) |
if (level <= max_level[intra][last][run] && run <= max_run[intra][last][level]) |
160 |
continue; |
continue; |
166 |
#endif |
#endif |
167 |
level_esc = level - max_level[intra][last][run]; |
level_esc = level - max_level[intra][last][run]; |
168 |
run_esc = run - 1 - max_run[intra][last][level]; |
run_esc = run - 1 - max_run[intra][last][level]; |
|
/*use this test to use shorter esc2 codes when possible |
|
|
if (level_esc <= max_level[intra][last][run] && run <= max_run[intra][last][level_esc] |
|
|
&& !(coeff_VLC[intra][last][level_esc + offset][run].len + 7 + 1 |
|
|
> coeff_VLC[intra][last][level + offset][run_esc].code + 7 + 2))*/ |
|
169 |
|
|
170 |
if (level_esc <= max_level[intra][last][run] && run <= max_run[intra][last][level_esc]) |
if (level_esc <= max_level[intra][last][run] && run <= max_run[intra][last][level_esc]) |
171 |
{ |
{ |
175 |
} |
} |
176 |
else |
else |
177 |
{ |
{ |
178 |
if (level <= max_level[intra][last][run_esc] && run_esc <= max_run[intra][last][level]) |
if (run_esc <= max_run[intra][last][level] && level <= max_level[intra][last][run_esc]) |
179 |
{ |
{ |
180 |
escape = ESCAPE2; |
escape = ESCAPE2; |
181 |
escape_len = 7 + 2; |
escape_len = 7 + 2; |
216 |
} |
} |
217 |
|
|
218 |
#ifdef BIGLUT |
#ifdef BIGLUT |
219 |
for (level = 32 << intra; level < 2048; level++) |
for (level = (uint32_t)(32 << intra); level < 2048; level++) |
220 |
{ |
{ |
221 |
coeff_VLC[intra][last][level + offset][run].code |
coeff_VLC[intra][last][level + offset][run].code |
222 |
= (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) | ((level & 0xfff) << 1) | 1; |
= (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) | ((level & 0xfff) << 1) | 1; |