View Full Version : Bad Decoding using DGIndex
SquallMX
9th September 2007, 00:38
DGIndex:
http://spanish.doom9.org/Bad.png
http://rapidshare.com/files/54334455/sample.m2v
VirtualDub Mod/WinDVD/PowerDVD decodes the file with no problems:
http://spanish.doom9.org/Good.png
:thanks:
Guest
9th September 2007, 04:20
That's interesting! I'll investigate. Thanks for pointing it out.
Guest
11th September 2007, 23:52
Investigation complete. Oy, that was a PITA to find. :)
This problem goes all the way back to the MPEG2 specification, the original MSSG reference decoder, and the first version of DVD2AVI! If you implement next_start_code() as specified, this bad decoding will occur in some cases where a slice ends abnormally. It needs to be done like this:
void CMPEG2Decoder::next_start_code()
{
unsigned int show;
Flush_Buffer(BitsLeft & 7);
while (1)
{
show = Show_Bits(24);
if (Fault_Flag == OUT_OF_BITS)
return;
if (show == 0x000001)
return;
// Special case for error resiliency at a bad slice termination.
if (show == 0x000100 && BitsLeft <= 24)
{
BitsLeft += 8;
return;
}
Flush_Buffer(8);
}
} The special case handling is the key.
I have implemented and tested it, and it fixes your decoding errors. I will release a new beta later tonight.
Once again, thank you for pointing this out.
Guest
12th September 2007, 01:26
Fixed beta available now in the main thread.
SquallMX
14th September 2007, 03:20
:thanks::thanks::thanks:
You´re the best.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.