[XviD-devel] bs_get_matrix() buglet

Radek Czyz syskin at ihug.com.au
Fri Jul 9 16:58:42 CEST 2004


Hi,

It seems that xvid was reading mpeg matrix incorrectly. The code was:

	do {
		last = value;
		value = BitstreamGetBits(bs, 8);
		matrix[scan_tables[0][i++]] = value;
	}
	while (value != 0 && i < 64);

         i--;
	while (i < 64) {
		matrix[scan_tables[0][i++]] = last;
	}

Now, if the matrix was fully in the bitstream (and "value" is never 
zero), it reads the matrix correctly, then decreases i by one and 
overwrites matrix[63] with "last" which is the same as matrix[62] (since 
"last" is updated before the read operation).

Pretty evil heh?

I just commited fixes to both branches. Credit for finding it goes to 
Moitah.

Radek


More information about the XviD-devel mailing list