{"id":1799,"date":"2009-09-18T21:46:08","date_gmt":"2009-09-19T04:46:08","guid":{"rendered":"http:\/\/multimedia.cx\/eggs\/?p=1799"},"modified":"2020-07-25T22:47:08","modified_gmt":"2020-07-26T05:47:08","slug":"python-bit-classes","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/python-bit-classes\/","title":{"rendered":"Python Bit Classes"},"content":{"rendered":"<p>Here&#8217;s a little project of absolutely no use to anyone (a specialty of mine, as if you didn&#8217;t know): Pure Python classes for writing and reading bitstreams. This was just one of those things where I was sitting around wondering what it would take to accomplish, and a cursory Google search didn&#8217;t reveal anything useful (though it&#8217;s probably out there, in all likelihood), so I sat down and pounded out the code.<\/p>\n<p>To what end? Oh, I don&#8217;t know&#8211; reimplement <a href=\"http:\/\/ffmpeg.org\/\">FFmpeg<\/a> in Python; go crazy. Behold brute force bit banging in Python:<\/p>\n<p><!--more--><\/p>\n<p><script src=\"https:\/\/gist.github.com\/multimediamike\/7a6cc8bf8ef7432fe54d9916b62874da.js\"><\/script><\/p>\n<p>Then there is the small matter of testing this slop. At first, I was creating some simple cases, easily verifiable via visual inspection. Then I remembered that I&#8217;m a fan of making computers do heavy and thorough testing on my behalf. With that, here&#8217;s the testing code:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/multimediamike\/d6147f4520b2c16632ecafc0f7d98328.js\"><\/script><\/p>\n<p>Writing and reading 100,000 random bit combinations seems to turn out okay, even though it feels like an eternity. I didn&#8217;t say I was aiming for the <em>fastest<\/em>, just <em>any<\/em> Python solution.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bit I\/O classes in Python<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[],"class_list":["post-1799","post","type-post","status-publish","format-standard","hentry","category-python"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/1799","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=1799"}],"version-history":[{"count":12,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/1799\/revisions"}],"predecessor-version":[{"id":4598,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/1799\/revisions\/4598"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=1799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=1799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=1799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}