[XviD-devel] VLC
Marco Al
xvid-devel@xvid.org
Mon, 6 Jan 2003 14:24:14 +0100
This is a multi-part message in MIME format.
------=_NextPart_000_011E_01C2B58F.49B42A10
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hmm the old init was a bit of a mess, I should have tried to understand the old
code before plodding along ... it worked, but it looks a lot nicer with this
diff. I tested it on a fairly large movie, could someone verify it works
correctly and apply it to stable? (_BIGLUT_ was broken too because of a faulty
#ifdef, fixed now).
Marco
------=_NextPart_000_011E_01C2B58F.49B42A10
Content-Type: text/plain;
name="diff.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="diff.txt"
69c69
< /*#define _BIGLUT_*/
---
> /*#define BIGLUT*/
71c71
< #ifdef _BIGLUT_
---
> #ifdef BIGLUT
83c83
< #ifdef _BIGLUT_
---
> #ifdef BIGLUT
85c85
< VLC *intra_table, *inter_table;=20
---
> static VLC *intra_table, *inter_table;=20
97,99c97
< uint32_t i, j, intra, last, run, offset;
< int32_t level;
< VLC coeff_VLC_temp[2][2][64][64];
---
> uint32_t i, j, intra, last, run, run_esc, level, level_esc, escape, =
escape_len, offset;
101c99
< #ifdef _BIGLUT_
---
> #ifdef BIGLUT
117c115
< #ifdef _BIGLUT_
---
> #ifdef BIGLUT
122d119
< coeff_VLC_temp[intra][last][level][run].len =3D 128;
130c127
< #ifdef _BIGLUT_
---
> #ifdef BIGLUT
141,145d137
< =
coeff_VLC_temp[intra][coeff_tab[intra][i].event.last][coeff_tab[intra][i]=
.event.level][coeff_tab[intra][i].event.run].code
< =3D coeff_tab[intra][i].vlc.code << 1;
< =
coeff_VLC_temp[intra][coeff_tab[intra][i].event.last][coeff_tab[intra][i]=
.event.level][coeff_tab[intra][i].event.run].len
< =3D coeff_tab[intra][i].vlc.len + 1;
<=20
150c142
< #ifndef _BIGLUT_
---
> #ifndef BIGLUT
167c159,162
< #ifdef _BIGLUT_
---
> if (level <=3D max_level[intra][last][run] && run <=3D =
max_run[intra][last][level])
> continue;
>=20
> #ifdef BIGLUT
172,174c167,182
< if ((max_level[intra][last][run]) && (level > =
max_level[intra][last][run]))
< if (coeff_VLC_temp[intra][last][level - =
max_level[intra][last][run]][run].len !=3D 128
< && coeff_VLC[intra][last][level + offset][run].len =3D=3D 128)
---
> level_esc =3D level - max_level[intra][last][run];
> run_esc =3D run - 1 - max_run[intra][last][level];
> /*use this test to use shorter esc2 codes when possible
> if (level_esc <=3D max_level[intra][last][run] && run <=3D =
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))*/
>=20
> if (level_esc <=3D max_level[intra][last][run] && run <=3D =
max_run[intra][last][level_esc])
> {
> escape =3D ESCAPE1;
> escape_len =3D 7 + 1;
> run_esc =3D run;
> }
> else
> {
> if (level <=3D max_level[intra][last][run_esc] && run_esc <=3D =
max_run[intra][last][level])
176,190c184,186
< coeff_VLC[intra][last][level + offset][run].code
< =3D (ESCAPE1 << coeff_VLC_temp[intra][last][level - =
max_level[intra][last][run]][run].len)
< | coeff_VLC_temp[intra][last][level - =
max_level[intra][last][run]][run].code;
< coeff_VLC[intra][last][level + offset][run].len
< =3D coeff_VLC_temp[intra][last][level - =
max_level[intra][last][run]][run].len + 7 + 1;
< #ifndef _BIGLUT_
< if (!intra)
< #endif
< {
< coeff_VLC[intra][last][offset - level][run].code
< =3D (ESCAPE1 << coeff_VLC_temp[intra][last][level - =
max_level[intra][last][run]][run].len)
< | coeff_VLC_temp[intra][last][level - =
max_level[intra][last][run]][run].code | 1;
< coeff_VLC[intra][last][offset - level][run].len
< =3D coeff_VLC_temp[intra][last][level - =
max_level[intra][last][run]][run].len + 7 + 1;
< }
---
> escape =3D ESCAPE2;
> escape_len =3D 7 + 2;
> level_esc =3D level;
192,197c188
< if (run > max_run[intra][last][level])
< if (coeff_VLC_temp[intra][last][level][run - 1 - =
max_run[intra][last][level]].len !=3D 128
< && coeff_VLC[intra][last][level + offset][run].len =3D=3D 128)
< /*use the lower test instead of the upper to use shorter escape =
codes when possible :
< if (coeff_VLC_temp[intra][last][level][run - 1 - =
max_run[intra][last][level]].len + 7 + 2
< < coeff_VLC[intra][last][level + offset][run].len)*/
---
> else
199,204c190
< coeff_VLC[intra][last][level + offset][run].code
< =3D (ESCAPE2 << coeff_VLC_temp[intra][last][level][run - 1 - =
max_run[intra][last][level]].len)
< | coeff_VLC_temp[intra][last][level][run - 1 - =
max_run[intra][last][level]].code;
< coeff_VLC[intra][last][level + offset][run].len
< =3D coeff_VLC_temp[intra][last][level][run - 1 - =
max_run[intra][last][level]].len + 7 + 2;
< #ifndef _BIGLUT_
---
> #ifndef BIGLUT
208,212c194,199
< coeff_VLC[intra][last][offset - level][run].code
< =3D (ESCAPE2 << coeff_VLC_temp[intra][last][level][run - 1 - =
max_run[intra][last][level]].len)
< | coeff_VLC_temp[intra][last][level][run - 1 - =
max_run[intra][last][level]].code | 1;
< coeff_VLC[intra][last][offset - level][run].len
< =3D coeff_VLC_temp[intra][last][level][run - 1 - =
max_run[intra][last][level]].len + 7 + 2;
---
> coeff_VLC[intra][last][level + offset][run].code
> =3D (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) =
| ((level & 0xfff) << 1) | 1;
> coeff_VLC[intra][last][level + offset][run].len =3D 30;
> coeff_VLC[intra][last][offset - level][run].code
> =3D (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) =
| ((-level & 0xfff) << 1) | 1;
> coeff_VLC[intra][last][offset - level][run].len =3D 30;
213a201
> continue;
215c203,210
< #ifndef _BIGLUT_
---
> }
>=20
> coeff_VLC[intra][last][level + offset][run].code
> =3D (escape << coeff_VLC[intra][last][level_esc + =
offset][run_esc].len)
> | coeff_VLC[intra][last][level_esc + offset][run_esc].code;
> coeff_VLC[intra][last][level + offset][run].len
> =3D coeff_VLC[intra][last][level_esc + offset][run_esc].len + =
escape_len;
> #ifndef BIGLUT
218,227c213,219
< if (coeff_VLC[intra][last][level + offset][run].len =3D=3D 128)
< {
< coeff_VLC[intra][last][level + offset][run].code
< =3D (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) | =
((level & 0xfff) << 1) | 1;
< coeff_VLC[intra][last][level + offset][run].len =3D 30;
<=20
< coeff_VLC[intra][last][offset - level][run].code
< =3D (ESCAPE3 << 21) | (last << 20) | (run << 14) | (1 << 13) | =
((-level & 0xfff) << 1) | 1;
< coeff_VLC[intra][last][offset - level][run].len =3D 30;
< }
---
> {
> coeff_VLC[intra][last][offset - level][run].code
> =3D (escape << coeff_VLC[intra][last][level_esc + =
offset][run_esc].len)
> | coeff_VLC[intra][last][level_esc + offset][run_esc].code | =
1;
> coeff_VLC[intra][last][offset - level][run].len
> =3D coeff_VLC[intra][last][level_esc + offset][run_esc].len + =
escape_len;
> }
229c221,222
< #ifdef _BIGLUT_
---
>=20
> #ifdef BIGLUT
310c303
< #ifdef __BIGLUT_
---
> #ifdef BIGLUT
522c515
< #ifdef _BIGLUT_
---
> #ifdef BIGLUT
591c584
< #ifdef _BIGLUT_
---
> #ifdef BIGLUT
------=_NextPart_000_011E_01C2B58F.49B42A10--