Breaking Eggs And Making Omelettes

Topics On Multimedia Technology and Reverse Engineering


Archives:

More Weird VP8 Encodings

December 9th, 2010 by Multimedia Mike

When I announced that I had transitioned my VP8 encoder’s status from “toy” to “working”, Jim L. lamented the loss of humorous posts about oddly encoded images output from my encoder. Not so! There are still plenty of features that I have yet to implement, each of which carries the possibility of bizarre images.

For example, I dusted off my work-in-progress intra 4×4 encoding, fixed a few of the more obvious bugs, and told the encoder to encode the first block in 4×4 mode and the rest in the usual, working, debugged 16×16 mode. The results of the first pass surprised me:



The reason this surprised me was that I intuitively expected one of 2 outcomes:

  • Perfect image right away since everything is correct (very unlikely but not outside the realm of possibility)
  • Total garbage with, at most, the first macroblock looking somewhat legible; this would be due to having some of the first macroblock correct but completely desynchronizing the bitstream for the purpose of decoding the rest of the coefficients.

I absolutely did not expect the first macroblock to look messed up but for the rest of the picture to look fine. For fun, I reversed the logic and encoded the first block as 16×16 and the rest with the experimental 4×4 mode:



If you examine carefully, you will see that the color planes are correct (though faint). There just isn’t much going on in the luma plane. This made sense when I noticed the encoder was encoding a blank (undefined, actually) set of luma coefficients for 4×4 mode macroblocks due to a bug. This helps to rationalize the first image as well– the first macroblock was encoding nonsense for the first macroblock which messed up the macroblocks which immediately surrounded it. Eventually, macroblock decoding got back on track when the prediction modes weren’t relying on the errantly decoded macroblocks.

After I fixed that bug, I let the 4×4 mode rip through the whole image. That’s when I got what I am terming the “dark and gritty reboot of Big Buck Bunny”:



Fortunately, this also turned out to be traceable to a pretty obvious code bug.

One day, this VP8 encoder might do the right thing while implementing all of the algorithm’s features. In the meantime, it’s at least entertaining to watch it make mistakes.

Posted in VP8 | 5 Comments »

5 Responses

  1. Jonathan Wilson Says:

    Good work, having a 3rd party encoder for VP8 is a good thing IMO.

  2. Gideon "Gnafu" Mayhak Says:

    @3rd image: Zalgo, he comes!

    I’d be interested to watch all of Big Bug Bunny encoded like that. Think you might be willing to do that and upload it to YouTube or something? :-D

  3. Jim Leonard Says:

    Big LOLs on the first image — I saw it and made a mental note that something is undefined somewhere.

  4. Azeem Says:

    The “Dark and gritty” looked really nice actually. You should save a copy of your code with that bug because the effects look quite nice.

  5. Gideon "Gnafu" Mayhak Says:

    Wow, “Big /Bug/ Bunny”? Not sure how I made that typo…

    I couldn’t let it go uncorrected:

    *Big Buck Bunny