I just had to express that. Recently I’ve opportunity to examine two DVD disks – one with 8 films-in-one and another one is 7 films-in-one (our pirates usually pack at least two films on each disk). Every DVD has a proud label ‘Real DVD Quality’ (but sometimes even VHS tapes are marked so).
As expected, those films had slightly lesser resolution than 720×576, one disk had 352×576 films, but another one… 352×288 !!! If disk was labeled ‘Real VCD Quality’ – that should be fair.
Real DVD Quality
May 13th, 2006Goal complete.
April 7th, 2006I’ve committed today another decoder – for KMVC codec, used in Worms games. This is the final step to the completion of my task.
Multimedia Mike has a simple goal – to have a player which will play any multimedia file you like. My task for now is much simpler – have a decoder for each letter of alphabet.
With the latest addition there are only two letters left: E and Y. But considering that TSCC is now called Ensharpen and only known formats on Y are YUV variants, I declare this task complete. Future RE’ing will be just for fun 😉
KMVC codec
March 27th, 2006I have looked at about dozen of codecs and for me KMVC (codec used for FMV in Worms games) is surely the kinkiest.
Here is what I think is kinky:
- Usability – there are two version of codecs, one uses for decoding kmvidc32.dll, other can be played by DOS player (player and samples for second type can be found atMPlayer samples repository). DLL cannot play files played by DOS player and vice versa and all these two types differ is just extradata (another 12 bytes), frame format is the same!
- Strange bit reading policy: read 8 bits at once, when this bit buffer exhausts, read another byte (and a lot of data may be read between those two bitbuffer reads). I understand that was made to avoid bit reading issues, but it’s still very strange.
- Another credit goes straight to m$ visual C. I cannot make myself think that any more or less sane coder would write this:
jmp L2
L1:
; load something into al
jmp L3
L2:
add al, al
jz L1
L3:
And that is the simplest example of this – sometimes block L2 occurs in the beginning of function and L1 is near the end of it! Is this some kind of disoptimization to run the code on modern CPUs (which don’t like branching) with the speed of ol’ good i486?
I hope to finish spec and decoder to May.
Another codec in FFmpeg
March 22nd, 2006Yesterday I’ve added implementation of Smacker demuxer and decoder, so you can enjoy you favourite pieces of video from various games.
I cannot credit the person who did the actual reverse engineering as he prefers to stay anonymous. Anyway, thank you very much!
The most interesting things in Smacker are Huffman trees. Smacker has trees by principle “every byte must have a tree”. Video operates with 16-bits values from Huffman trees, every of this trees stores values as two codes from Huffman trees. So you must construct two smaller Huffman trees before decoding large one. And packed audio data has also 1,2 or 4 Huffman trees depending if we have 8-bit or 16-bit data and stereo or not.
And now spotted inefficiencies in Smacker:
- Smacker stores header information for 7 audio streams (!) yet I’ve never seen Smacker with two audio streams. Was that intended for internationalization?
- Due to weird Huffman tree decoding procedure one bit is constantly wasted on stream. That means global Huffman trees for video lack 12 bits of waste (two support Huffman trees, one large Huffman tree, repeat four times) and audio chunks waste 1-4 bits depending on size. Not a big deal though.
And the final thought – the main difference between Smacker and M$ Video 1 is the packing scheme, block structure is almost identical. Anyone volunteering to write convertor from one format to another?
DosBox
March 4th, 2006I think there is no need to introduce DosBox. And to make it even more usable DosBox developer niknamed Harekiet added screen output recording capability with his own codec ZMBV – Zip Motion Blocks Video.
This codec employs intraframes and motion compensation (and XOR’ing instead of substracting/adding difference). ZLib is used for packing. For more detailed description go
here.
For now, 8-bit, 16-bit and 32-bit depths are supported by codec as for recording. And FFmpeg decoder is already available – I could not miss that codec and not port it.
JPEG-LS: decoder issues
January 18th, 2006I’ve recently written a very baseline JPEG-LS decoder (grayscale lossless only) and had to deal with some issues, some of them listed in JPEG-LS standard (ISO 14495, ITU T.87), some are not:
- Bitstream is escape-coded (after each byte 0xFF another zero-bit must be stuffed to avoid false JPEG markers detection). That requires special bitstream reader or another unescaped buffer.
- There is no definite way to reverse error-mapping of run termination symbol. Even the reference code use another technique.
- A lot of different modes (different bpps, pallettised images, two interleaving modes)
For now, lossless and near-lossless decoding is OK, plane and line interleaving are supported. With working decoder it will be simplier to write JPEG-LS encoder.
As I recently discovered, there is also ISO/IEC 14495-2 (or ITU T.870) standard – JPEG-LS extensions. For unknown reason ITU don’t send me another 3 free recs ID, yet I’ve managed to find some draft of this standard. Main changes: new mode – visual quantisation, new coding schemes – modified Golomb codes and arithmetic coding. I’m not sure if somebody support this anyway.
February: now grayscale/colour lossless/near-lossless JPEG-LS encoder and decoder are working (or simulate working well enough).
TrueSpeech – 97% complete
December 30th, 2005Now my TrueSpeech decoder decodes compressed audio almost as well as original decoder. Why not 100% complete? It decodes audio slightly different from original decoder, so it may take some time in future to make my decoder identical.
I hope to see it in FFmpeg source tree soon.
A Brief Summary
December 30th, 2005Here is a list of codecs I reverse engineered in some way.
Codecs RE’d by format analyzing
- Apple QuickDraw
- Autodesk RLE
- Sierra On-line Audio
- TechSmith capturing codec (aka Ensharpen)
- Pinnacle/Miro XL
Most of those are RLE variants (actually 2 of 3 are MS RLE variants).
Sources->Description->New Code
- LOCO codec
- Duck TrueMotion 2
- IBM Ultimotion
- Winnov WNV1
The last one is re-created from tuner driver.
Binary RE’d
- Creative ADPCM
- Intel Indeo 2
- Q-team QPEG
- DSP Group TrueSpeech
TM2 and Final Fantasy
October 14th, 2005There are a lot of variants of first two TrueMotion codecs. Final Fantasy (some number here) for PC uses TM2.
Differences from reference decoder: delta table size must be greater (64 instead of 32) and sometimes there is no data in stream, which means you should fill it with value from Huffman table).
Well, there is also TM2X awaiting.
VMWare Codec
October 13th, 2005Recent VMWare virtual machines are able to capture their screen output and store it into AVI packed with their own codec. A quick study showed that this codec stores captured image in special type blocks, most of them are labeled WMVx (maybe VMW spelled backwards, but who knows 😉 ). Every block type has its own function to handle it. Blocks with labels WMVi or 0x00000005 can be found in almost every frame.