{"id":2950,"date":"2010-10-14T22:49:25","date_gmt":"2010-10-15T05:49:25","guid":{"rendered":"http:\/\/multimedia.cx\/eggs\/?p=2950"},"modified":"2011-12-02T11:38:57","modified_gmt":"2011-12-02T19:38:57","slug":"gallery-of-vp8-encoding-naivete","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/gallery-of-vp8-encoding-naivete\/","title":{"rendered":"Gallery of VP8 Encoding Naivete"},"content":{"rendered":"<p>I&#8217;ve been toiling away as a multimedia technology generalist for so long that it&#8217;s easy for me to forget that not everyone is as versed in the minutiae of the domain as I am. But I recently experienced what it&#8217;s like to be such an outsider when I posted about <a href=\"http:\/\/multimedia.cx\/eggs\/the-worst-vp8-encoder\/\">my toy VP8 encoder<\/a>, expressing that it&#8217;s one of the hardest things I have ever tried to do. I heard from a number of people who do have extensive experience in video encoding, particularly with the H.264 and VP8 codecs. Their reactions were predictable: <em>What&#8217;s so hard?<\/em> Look, you might be a little too immersed in the area to really understand a relative beginner&#8217;s perspective.<\/p>\n<p>And to all the people who suggested that I should get the encoder into <a href=\"http:\/\/ffmpeg.org\/\">FFmpeg<\/a> ASAP: <em>Are you crazy?!<\/em> Did you <em>see<\/em> what the first pass of the encoder produced? Do you have lower standards than even I do?<\/p>\n<p><center><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/09\/bbb-title.jpg\" alt=\"\" title=\"Big Buck Bunny title\" width=\"400\" height=\"225\" class=\"aligncenter size-full wp-image-2892\" srcset=\"https:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/09\/bbb-title.jpg 400w, https:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/09\/bbb-title-300x168.jpg 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><br \/>\n<\/center><\/p>\n<p><strong>Not Giving Up<\/strong><br \/>\nI worked a little more on the toy encoder. Remember that the above image is what I&#8217;m hoping to encode somewhat faithfully for this experiment. In my first pass, I attempted vertical prediction for all planes. For my next pass, I forced the chroma planes to mid-level (which results in a greyscale image) and played with the 16&#215;16 luma prediction modes. When implementing an extremely naive algorithm to decide which 16&#215;16 prediction mode would be the best for a particular block, this is what the program produced:<\/p>\n<p><center><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-greedy-16x16.jpg\" alt=\"\" title=\"Big Buck Bunny logo - VP8 greedy 16x16 luma decision algorithm\" width=\"640\" height=\"360\" class=\"aligncenter size-full wp-image-2952\" srcset=\"https:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-greedy-16x16.jpg 640w, https:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-greedy-16x16-300x168.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><br \/>\n<\/center><\/p>\n<p>For fun, here is what the image encodes to when forcing various prediction modes:<br \/>\n<!--more--><\/p>\n<p>I think the DC-only prediction mode actually looks a little better than the image that the naive algorithm produced:<\/p>\n<p><center><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-dc-pred.jpg\" alt=\"\" title=\"Big Buck Bunny title -- VP8 encoding with all DC prediction\" width=\"640\" height=\"360\" class=\"aligncenter size-full wp-image-2955\" srcset=\"https:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-dc-pred.jpg 640w, https:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-dc-pred-300x168.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><br \/>\n<\/center><\/p>\n<p>Vertical 16&#215;16 prediction, similar to the image from the last post (just in black and white):<br \/>\n<center><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-vert-pred.jpg\" alt=\"\" title=\"Big Buck Bunny title -- VP8 encoding with all vertical 16x16 prediction\" width=\"640\" height=\"360\" class=\"aligncenter size-full wp-image-2956\" srcset=\"https:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-vert-pred.jpg 640w, https:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-vert-pred-300x168.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><br \/>\n<\/center><\/p>\n<p>Horizontal 16&#215;16 prediction:<br \/>\n<center><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-horiz-pred.jpg\" alt=\"\" title=\"Big Buck Bunny title -- VP8 encoding with all horizontal prediction\" width=\"640\" height=\"360\" class=\"aligncenter size-full wp-image-2957\" srcset=\"https:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-horiz-pred.jpg 640w, https:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-horiz-pred-300x168.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><br \/>\n<\/center><\/p>\n<p>This is the 16&#215;16 prediction mode unique to VP8, the TrueMotion mode (based on On2\/Duck&#8217;s <a href=\"http:\/\/wiki.multimedia.cx\/index.php?title=Duck_TrueMotion_1\">very first video codec<\/a>):<br \/>\n<center><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-tm-pred.jpg\" alt=\"\" title=\"Big Buck Bunny title -- VP8 encoding with all TrueMotion 16x16 prediction\" width=\"640\" height=\"360\" class=\"aligncenter size-full wp-image-2958\" srcset=\"https:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-tm-pred.jpg 640w, https:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2010\/10\/bbb-vp8-tm-pred-300x168.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><br \/>\n<\/center><\/p>\n<p>Wow, these encodings really bring down the cheerful tone of the original image. <\/p>\n<p><strong>Next Steps<\/strong><br \/>\nI have little reason to believe that I am encoding and subsequently reconstructing the image correctly (i.e., error is likely propagating through the entire encoding). If I have time, the next step is to validate my reconstruction against the encoder. Then I need to get the entropy considerations correct so that I actually get some compression out of this format.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I worked a little more on my toy VP8 encoder; here are some interesting pictures from my efforts.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[219],"tags":[],"class_list":["post-2950","post","type-post","status-publish","format-standard","hentry","category-vp8"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/2950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/comments?post=2950"}],"version-history":[{"count":8,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/2950\/revisions"}],"predecessor-version":[{"id":3646,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/2950\/revisions\/3646"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=2950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=2950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=2950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}