{"id":453,"date":"2007-08-26T17:56:23","date_gmt":"2007-08-27T00:56:23","guid":{"rendered":"http:\/\/multimedia.cx\/eggs\/duck-hieroglyphics\/"},"modified":"2010-02-19T16:53:06","modified_gmt":"2010-02-20T00:53:06","slug":"duck-hieroglyphics","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/duck-hieroglyphics\/","title":{"rendered":"Duck Hieroglyphics"},"content":{"rendered":"<p>It&#8217;s like digital archaeology&#8211; understanding the ancient (by internet time) workings of less advanced engineering efforts. Pop culture depictions of archaeology would have us believe that those who toil in the field are searching for that one artifact that would neatly solve the entire puzzle at hand. Historically, perhaps the artifact that came closest to fitting this archetype was the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Rosetta_stone\">Rosetta Stone<\/a>, and even that was incomplete (if I&#8217;m observing the pictures correctly).<\/p>\n<p>So it is with my current investigation. Much like Sean Connery playing Indiana Jones&#8217; dad searching for the Holy Grail in <a href=\"http:\/\/www.imdb.com\/title\/tt0097576\/\">The Last Crusade<\/a>, I run the risk of making the <a href=\"http:\/\/wiki.multimedia.cx\/index.php?title=Duck_TrueMotion_1\">Duck TrueMotion 1 algorithm<\/a> my lifelong obsession. I got that Duck TM1 source code into a state where I could compile it against a standalone program. It only required 38 C source files from the original <a href=\"http:\/\/www.duck.com\/vpvision\/\">vpvision<\/a> source tree and a mess of attendant header files to boot.<\/p>\n<p><!--more--><\/p>\n<p>Eventually, I noticed a .txt file somewhere in the original source tree. I have no idea what &#8216;hfb&#8217; means in the tree so I&#8217;ll have a look in hfb\/corelibs\/hfb\/generic\/readme.txt:<\/p>\n<pre>\r\n Testing\r\n<\/pre>\n<p>Not so useful. Let&#8217;s try a file called iva\/iva.txt:<\/p>\n<pre>\r\n no documentation yet\r\n<\/pre>\n<p><em>Why do I bother? Why do I devote time to a hobby of interpreting the scrawlings that cavemen engineers splattered on their cube walls?<\/em><\/p>\n<p>There are 2 copies of a file called ccreadme.txt that have statistics on the performance of various optimized colorspace converters. Someone was obviously proud of that work and saw fit to preserve the numbers for future generations.<\/p>\n<p>Perhaps the only semi-useful document file I found is b_readme.txt, in the main tm1.0 source directory. See, there are 25 of these files in the tm1.0 source directory that have the format bXYmn.c &#8216;b&#8217; is &#8216;b&#8217;. As for the remainder of the characters, well, here&#8217;s where we get into the hieroglyphics&#8211; the letters &#8216;X&#8217; and &#8216;Y&#8217; represent a character, either s, f, t, or e. What do they mean? 16, 24, 32, or 8 bits, respectively. Huh? Your guess on the mapping logic is as valid as mine. &#8216;m&#8217; is a number 0-3. This has to do with stretching mode, apparently, but what the modes exactly represent is not clearly explained (&#8220;Next character is a mode (0-3) such as same, stretch, and bright (implemented with interpolation or otherwise).&#8221;). &#8216;n&#8217; is a number (0-2) indicating, I suppose, a stretching algorithm (&#8220;dumb, smart, or fat-freddy&#8221;). I googled for a fat freddy algorithm but only found reference to an aberrant <a href=\"http:\/\/en.wikipedia.org\/wiki\/Fat_Freddy\">cartoon character<\/a>. Apparently, even Duck\/On2&#8217;s algorithms are inside jokes.<\/p>\n<p>The file singles out a particular engineer, one Scott LaVarnway, for his exemplary work in the blitter department, and for one blitter in particular which is extra special and deviates from the naming convention somewhat.<\/p>\n<p>I don&#8217;t know how, or if, I missed this file when I studied this codec the first time around. I do remember that it was painful to figure out which of the b????.c files I was supposed to RE. I could tell that different ones were used for 16- or 24-bit source data and implemented different interpolation modes. Now I recognize that, for understanding 24-bit decoding, bft00.c is perhaps my best bet (24-bit source data, 32-bit output target, no stretching, no interpolation algorithm).<\/p>\n<p>So hopefully, that will help in figuring out the 24-bit mode. There is still the matter of many corrupted DUCK TM1 files that don&#8217;t work with the libavcodec TM1 decoder. It will be useful to feed them into this decoder somehow and see if it can handle them, and then figure out what the official decoder is doing that the lavc decoder needs to do. I thought I had a good idea of what the relevant functions were until I noticed that these particular functions were static within the file.<\/p>\n<p>Now I think I have the real API figured out, at least partially&#8211; I believe I know how the data goes in, though I&#8217;m not clear on where the data comes out just yet. The initialization also doesn&#8217;t get very far before erroring out. Now I&#8217;m just debugging the thing using gdb to figure out why it&#8217;s not responding as expected.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s like digital archaeology&#8211; understanding the ancient (by internet time) workings of less advanced engineering efforts. Pop culture depictions of archaeology would have us believe that those who toil in the field are searching for that one artifact that would neatly solve the entire puzzle at hand. Historically, perhaps the artifact that came closest to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,4],"tags":[],"class_list":["post-453","post","type-post","status-publish","format-standard","hentry","category-on2duck","category-reverse-engineering"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/453","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=453"}],"version-history":[{"count":1,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/453\/revisions"}],"predecessor-version":[{"id":2253,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/453\/revisions\/2253"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}