{"id":458,"date":"2007-09-06T19:57:51","date_gmt":"2007-09-07T02:57:51","guid":{"rendered":"http:\/\/multimedia.cx\/eggs\/how-many-multiplications\/"},"modified":"2007-09-06T19:58:23","modified_gmt":"2007-09-07T02:58:23","slug":"how-many-multiplications","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/","title":{"rendered":"How Many Multiplications?"},"content":{"rendered":"<p>While many are still dogged by the quandary of how many licks it takes to get to the chewy center of a <a href=\"http:\/\/www.tootsie.com\/howmany.html\">certain popular confection<\/a>, I found myself wondering how many multiplication operations it takes to decode a frame of certain video codecs. Multiplication tends to be one of the more intensive parts of video decoding and much effort is spent minimizing the number of multiplications that are absolutely necessary. If my numbers and assumptions are correct, a 320&#215;240 <a href=\"http:\/\/wiki.multimedia.cx\/index.php?title=VP3\">VP3<\/a>\/<a href=\"http:\/\/wiki.multimedia.cx\/index.php?title=Theora\">Theora<\/a> intraframe requires <strong>747,680<\/strong> multiplications to decode. It goes something like this:<\/p>\n<p>Each 8&#215;8 block of the image needs to be transformed and dequantized. How many blocks are in the image?<\/p>\n<pre>\r\n Y plane: (320 * 240) pixels \/ (8 * 8) pixels\/block = 1200 blocks\r\n U plane: (160 * 120) pixels \/ (8 * 8) pixels\/block =  300 blocks\r\n V plane: (160 * 120) pixels \/ (8 * 8) pixels\/block =  300 blocks\r\n<\/pre>\n<p>So there are <strong>1800 blocks<\/strong> in the frame. Each block needs to be run through an inverse discrete cosine transform (IDCT). Each of the 64 samples requires 64 mults. That means each block requires 64<sup>2<\/sup> mults. However, optimizations (usually by factoring out redundant mults) result in a transform that can be performed with N*log<sub>2<\/sub>(N) mults.<\/p>\n<pre>\r\n  64 * log<sub>2<\/sub>(64) = <strong>384 mults\/block<\/strong>\r\n<\/pre>\n<p>This assumes that all of the blocks in the intraframe have enough non-zero coefficients that more optimal IDCTs (like 1-, 3-, and 10-element) are not warranted. Then there is the matter of dequantization. Assuming an average of 16 non-zero coefficients in need of dequantization, the number of mults per block rises to <strong>400<\/strong>.<\/p>\n<pre>\r\n 400 mults\/block * 1800 blocks\/frame = <strong>720000 mults\/frame<\/strong>\r\n<\/pre>\n<p>The same number would hold true for JPEG images or MPEG-1 intraframes, given the same (possibly fraudulent) assumptions. I am not sure if 16 non-zero coefficients per block is too generous and too conservative an estimate. However, the vast majority of the blocks in a VP3\/Theora intraframe will also require 3 multiplications in order to reverse the DC prediction. So I&#8217;ll just wave my hand and factor DC prediction in with the dequantization budget of 16 mults\/block.<\/p>\n<p>Now, if we want to deploy the recommended post processing method, that requires 8 more multiplications per edge, where &#8216;edge&#8217; is a boundary between 2 blocks that have been rendered in this frame (and all blocks are rendered for an intraframe). How many edges are in the frame?<\/p>\n<ul>\n<li>vertical edges = (width_in_blocks &#8211; 1) * (height_in_blocks)<\/li>\n<li>horizontal edges = (width_in_blocks) * (height_in_blocks &#8211; 1)<\/li>\n<\/ul>\n<pre>\r\n Y plane: 40x30 blocks, (40 - 1) * 30 + 40 * (30 - 1) = 1170 + 1160 = 2330 edges\r\n U plane: 20x15 blocks, (20 - 1) * 15 + 20 * (15 - 1) =  285 +  280 =  565 edges\r\n V plane: 20x15 blocks, (20 - 1) * 15 + 20 * (15 - 1) =  285 +  280 =  565 edges\r\n \r\n 3460 edges\/frame * 8 PP mults\/edge = <strong>27680 PP mults\/frame<\/strong>\r\n<\/pre>\n<p>Thus:<\/p>\n<pre>\r\n 720000 mults\/frame + 27680 mults\/frame = <strong>747680 mults\/frame<\/strong>\r\n<\/pre>\n<p>It should be noted that VP3\/Theora&#8217;s method for post-processing involves a 4-tap filter with coefficients of (1, -1, 3, -3). Trivially, the multiplication by 3 can be factored out (which is how the assumption of one mult per sample, or 8 per edge, is derived). Further, it can easily be broken down to a bit shift and addition (3*n = (n << 1) + n) so that the post processing phase does not strictly require any multiplications.\n\nNaturally, the parameters for a nominal VP3\/Theora interframe vary wildly and it's a little harder to produce an average number of multiplications for that case.\n\nI'm sure someone will be along in the comments if I messed up the math or, more likely, the assumptions.\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While many are still dogged by the quandary of how many licks it takes to get to the chewy center of a certain popular confection, I found myself wondering how many multiplication operations it takes to decode a frame of certain video codecs. Multiplication tends to be one of the more intensive parts of video [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[],"class_list":["post-458","post","type-post","status-publish","format-standard","hentry","category-vp3theora"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"While many are still dogged by the quandary of how many licks it takes to get to the chewy center of a certain popular confection, I found myself wondering how many multiplication operations it takes to decode a frame of certain video codecs. Multiplication tends to be one of the more intensive parts of video\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Multimedia Mike\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Breaking Eggs And Making Omelettes | Topics On Multimedia Technology and Reverse Engineering\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"How Many Multiplications? | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta property=\"og:description\" content=\"While many are still dogged by the quandary of how many licks it takes to get to the chewy center of a certain popular confection, I found myself wondering how many multiplication operations it takes to decode a frame of certain video codecs. Multiplication tends to be one of the more intensive parts of video\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2007-09-07T02:57:51+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2007-09-07T02:58:23+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"How Many Multiplications? | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta name=\"twitter:description\" content=\"While many are still dogged by the quandary of how many licks it takes to get to the chewy center of a certain popular confection, I found myself wondering how many multiplication operations it takes to decode a frame of certain video codecs. Multiplication tends to be one of the more intensive parts of video\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/how-many-multiplications\\\/#article\",\"name\":\"How Many Multiplications? | Breaking Eggs And Making Omelettes\",\"headline\":\"How Many Multiplications?\",\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"},\"datePublished\":\"2007-09-06T19:57:51-07:00\",\"dateModified\":\"2007-09-06T19:58:23-07:00\",\"inLanguage\":\"en-US\",\"commentCount\":2,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/how-many-multiplications\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/how-many-multiplications\\\/#webpage\"},\"articleSection\":\"VP3\\\/Theora\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/how-many-multiplications\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/vp3theora\\\/#listItem\",\"name\":\"VP3\\\/Theora\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/vp3theora\\\/#listItem\",\"position\":2,\"name\":\"VP3\\\/Theora\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/vp3theora\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/how-many-multiplications\\\/#listItem\",\"name\":\"How Many Multiplications?\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/how-many-multiplications\\\/#listItem\",\"position\":3,\"name\":\"How Many Multiplications?\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/vp3theora\\\/#listItem\",\"name\":\"VP3\\\/Theora\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\",\"name\":\"Breaking Eggs And Making Omelettes\",\"description\":\"Topics On Multimedia Technology and Reverse Engineering\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/\",\"name\":\"Multimedia Mike\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/how-many-multiplications\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2eb93f7cada658f7986b5092062849fa255779eada3342c8f6b9a40764b95fdd?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Multimedia Mike\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/how-many-multiplications\\\/#webpage\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/how-many-multiplications\\\/\",\"name\":\"How Many Multiplications? | Breaking Eggs And Making Omelettes\",\"description\":\"While many are still dogged by the quandary of how many licks it takes to get to the chewy center of a certain popular confection, I found myself wondering how many multiplication operations it takes to decode a frame of certain video codecs. Multiplication tends to be one of the more intensive parts of video\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/how-many-multiplications\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"datePublished\":\"2007-09-06T19:57:51-07:00\",\"dateModified\":\"2007-09-06T19:58:23-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\",\"name\":\"Breaking Eggs And Making Omelettes\",\"description\":\"Topics On Multimedia Technology and Reverse Engineering\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How Many Multiplications? | Breaking Eggs And Making Omelettes","description":"While many are still dogged by the quandary of how many licks it takes to get to the chewy center of a certain popular confection, I found myself wondering how many multiplication operations it takes to decode a frame of certain video codecs. Multiplication tends to be one of the more intensive parts of video","canonical_url":"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/#article","name":"How Many Multiplications? | Breaking Eggs And Making Omelettes","headline":"How Many Multiplications?","author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"},"datePublished":"2007-09-06T19:57:51-07:00","dateModified":"2007-09-06T19:58:23-07:00","inLanguage":"en-US","commentCount":2,"mainEntityOfPage":{"@id":"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/#webpage"},"isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/#webpage"},"articleSection":"VP3\/Theora"},{"@type":"BreadcrumbList","@id":"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs#listItem","position":1,"name":"Home","item":"https:\/\/multimedia.cx\/eggs","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/vp3theora\/#listItem","name":"VP3\/Theora"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/vp3theora\/#listItem","position":2,"name":"VP3\/Theora","item":"https:\/\/multimedia.cx\/eggs\/category\/vp3theora\/","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/#listItem","name":"How Many Multiplications?"},"previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/#listItem","position":3,"name":"How Many Multiplications?","previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/vp3theora\/#listItem","name":"VP3\/Theora"}}]},{"@type":"Organization","@id":"https:\/\/multimedia.cx\/eggs\/#organization","name":"Breaking Eggs And Making Omelettes","description":"Topics On Multimedia Technology and Reverse Engineering","url":"https:\/\/multimedia.cx\/eggs\/"},{"@type":"Person","@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author","url":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/","name":"Multimedia Mike","image":{"@type":"ImageObject","@id":"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/2eb93f7cada658f7986b5092062849fa255779eada3342c8f6b9a40764b95fdd?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Multimedia Mike"}},{"@type":"WebPage","@id":"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/#webpage","url":"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/","name":"How Many Multiplications? | Breaking Eggs And Making Omelettes","description":"While many are still dogged by the quandary of how many licks it takes to get to the chewy center of a certain popular confection, I found myself wondering how many multiplication operations it takes to decode a frame of certain video codecs. Multiplication tends to be one of the more intensive parts of video","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/#website"},"breadcrumb":{"@id":"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/#breadcrumblist"},"author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"creator":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"datePublished":"2007-09-06T19:57:51-07:00","dateModified":"2007-09-06T19:58:23-07:00"},{"@type":"WebSite","@id":"https:\/\/multimedia.cx\/eggs\/#website","url":"https:\/\/multimedia.cx\/eggs\/","name":"Breaking Eggs And Making Omelettes","description":"Topics On Multimedia Technology and Reverse Engineering","inLanguage":"en-US","publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"}}]},"og:locale":"en_US","og:site_name":"Breaking Eggs And Making Omelettes | Topics On Multimedia Technology and Reverse Engineering","og:type":"article","og:title":"How Many Multiplications? | Breaking Eggs And Making Omelettes","og:description":"While many are still dogged by the quandary of how many licks it takes to get to the chewy center of a certain popular confection, I found myself wondering how many multiplication operations it takes to decode a frame of certain video codecs. Multiplication tends to be one of the more intensive parts of video","og:url":"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/","article:published_time":"2007-09-07T02:57:51+00:00","article:modified_time":"2007-09-07T02:58:23+00:00","twitter:card":"summary","twitter:title":"How Many Multiplications? | Breaking Eggs And Making Omelettes","twitter:description":"While many are still dogged by the quandary of how many licks it takes to get to the chewy center of a certain popular confection, I found myself wondering how many multiplication operations it takes to decode a frame of certain video codecs. Multiplication tends to be one of the more intensive parts of video"},"aioseo_meta_data":{"post_id":"458","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-31 21:55:32","updated":"2025-12-31 18:44:44","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\/category\/vp3theora\/\" title=\"VP3\/Theora\">VP3\/Theora<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow Many Multiplications?\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/multimedia.cx\/eggs"},{"label":"VP3\/Theora","link":"https:\/\/multimedia.cx\/eggs\/category\/vp3theora\/"},{"label":"How Many Multiplications?","link":"https:\/\/multimedia.cx\/eggs\/how-many-multiplications\/"}],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/458","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=458"}],"version-history":[{"count":0,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/458\/revisions"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}