Maybe the last word about Bink version b

This codec is a collaborative effort — both me and some bogan from Melbo have been slacking on it for quite a long time.

Strewth, it’s almost the same as its successor, the real Bink known everywhere (Bink-b or 0.5 is not even mentioned in official Bink history). The main differences are lack of Huffman coding (all bundle elements are just stored in predefined number of bits), different scan-run coding (instead of storing it in a separate bundle, run values are stored in bitstream with minimum number of bits needed to code the biggest run from that point, i.e. 6 bits at the beginning but less than five bits for runs in the second half of block) and DCT uses floating-point coefficients (though the same ones for all practical purposes).

The only thing that differs significantly is motion compensation. Bink version b seems to use the same frame for all coming decoding and actually motion compensation in the first frame copies already decoded block from the same frame. After discovering that fact I was able to obtain perfect first frame in many cases and sometimes the rest of video was also decoded fine except for few glitches. The only puzzling thing is that vertical motion vector offset in the first frame seems to have slightly different value, so <-8,15> actually means “copy data from the previous left block” and <0,7> means “copy data from the top block” while such translation is not needed for all next frames.

Since all known samples are from the Heroes of Might and Magic III game and they are duplicated with Smacker samples, there’s not much interest on finishing that decoder and integrating it into current FFmpeg Bink decoder (I’ve done it as a dirty hack). So no prawn cracker for you, mate.

Update: proof-of-a-concept hack (produces minor artifacts too) can be downloaded here.

3 Responses to “Maybe the last word about Bink version b”

  1. Vitor says:

    Any reason not to upload your dirty hack to http://wiki.multimedia.cx/index.php?title=Bink_Video, so if ever someone really wants this implemented he has a starting point?

  2. Ivan says:

    Hi. Is there any chance that one day you’ll find some interest in finishing bink-b decoder?
    The reason I asking is that support for it will be nice to have for our project (VCMI, open-source engine for Heroes 3). Using smacker files instead of bink is not an option – they are not duplicating each other. Some video have only bink file and other ones – only smacker file.

  3. Kostya says:

    Well, it’s all in hands of original REer — Peter Ross.