{"id":795,"date":"2013-10-17T15:14:19","date_gmt":"2013-10-17T07:14:19","guid":{"rendered":"http:\/\/guoh.ai\/lifelog\/?p=795"},"modified":"2013-10-17T15:37:11","modified_gmt":"2013-10-17T07:37:11","slug":"exp-golomb-coding","status":"publish","type":"post","link":"https:\/\/guoh.ai\/lifelog\/2013\/10\/exp-golomb-coding\/","title":{"rendered":"Exponential-Golomb coding"},"content":{"rendered":"<p>\u53c2\u8003\u8d44\u6599\uff1a<br \/>\nhttp:\/\/en.wikipedia.org\/wiki\/Exponential-Golomb_coding<br \/>\nhttp:\/\/zh.wikipedia.org\/zh\/\u6307\u6570\u54e5\u4f26\u5e03\u7801<br \/>\nInformation technology \u2014 Coding of audio-visual objects \u2014 Part 10: Advanced Video Coding<\/p>\n<p>\u6458\u6284\u81ea\u4ee5\u4e0a\u8d44\u6599\uff0c\u7b80\u5355\u603b\u7ed3\u3002<\/p>\n<p>\u6307\u6578\u54e5\u502b\u5e03\u78bc(Exp-Golomb code)\uff0c\u4e00\u79cd\u58d3\u7e2e\u7de8\u78bc\u65b9\u6cd5\u3002<br \/>\n\u7528\u6765\u8868\u793a\u975e\u8d1f\u6574\u6570\u7684k\u9636\u6307\u6570\u54e5\u4f26\u5e03\u7801\u53ef\u7528\u5982\u4e0b\u6b65\u9aa4\u751f\u6210\uff1a<br \/>\n    1. \u5c06\u6570\u5b57\u4ee5\u4e8c\u8fdb\u5236\u5f62\u5f0f\u5199\u51fa\uff0c\u53bb\u6389\u6700\u4f4e\u7684k\u4e2a\u6bd4\u7279\u4f4d\uff0c\u4e4b\u540e\u52a01<br \/>\n    2. \u8ba1\u7b97\u7559\u4e0b\u7684\u6bd4\u7279\u6570\uff0c\u5c06\u6b64\u6570\u51cf\u4e00\uff0c\u5373\u662f\u9700\u8981\u589e\u52a0\u7684\u524d\u5bfc\u96f6\u4e2a\u6570<strong>(\u6ce8\u610f\u662f\u6bd4\u7279\u4f4d\u6570\uff0c\u975e\u8be5\u6bd4\u7279\u4e32\u8868\u793a\u7684\u503c)<\/strong><br \/>\n    3. \u5c06\u7b2c\u4e00\u6b65\u4e2d\u53bb\u6389\u7684\u6700\u4f4ek\u4e2a\u6bd4\u7279\u4f4d\u8865\u56de\u6bd4\u7279\u4e32\u5c3e\u90e8<br \/>\n0\u9636\u6307\u6570\u54e5\u4f26\u5e03\u7801\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n0 =&gt; 1 =&gt; 1\r\n1 =&gt; 10 =&gt; 010\r\n2 =&gt; 11 =&gt; 011\r\n3 =&gt; 100 =&gt; 00100\r\n4 =&gt; 101 =&gt; 00101\r\n5 =&gt; 110 =&gt; 00110\r\n6 =&gt; 111 =&gt; 00111\r\n7 =&gt; 1000 =&gt; 0001000\r\n8 =&gt; 1001 =&gt; 0001001\r\n...\r\n<\/pre>\n<p>\u4ece\u4e8c\u8fdb\u5236\u6bd4\u7279\u4e32\u5f62\u5f0f\u6765\u770b\uff0c0\u9636\u54e5\u4f26\u5e03\u7f16\u7801\u7684\u7801\u5b57(codeword)\u75313\u90e8\u5206\u6784\u6210\uff1a<br \/>\n\u7801\u5b57 = [M\u4e2a0] + [1] + [\u5185\u5bb9]<br \/>\n\u5185\u5bb9\u4e5f\u662fM\u4f4d\u6570\u636e\uff0c\u6240\u4ee5\u6bcf\u4e2a0\u9636\u54e5\u4f26\u5e03\u7801\u7684\u4f4d\u7684\u957f\u5ea6\u4e3a2M + 1\uff0c\u6bcf\u4e2a\u7801\u5b57\u7531\u539f\u59cb\u7684\u6570\u5b57(codenumber)\u4ea7\u751f\u3002<\/p>\n<p>\u6bd4\u5982\u4e0a\u9762\u7684\u6570\u5b577\uff0c\u4e8c\u8fdb\u5236\u8868\u793a\u4e3a111\uff0c0\u9636\u7f16\u7801\uff0c\u6240\u4ee5\u4e0d\u7528\u53bb\u6700\u540e\u7684\u6bd4\u7279\u4e3a\uff0c\u52a01\u4e4b\u540e\u53d8\u62101000\uff0c\u6bd4\u7279\u6570\u4e3a4\u4f4d\uff0c\u6240\u4ee5\u524d\u7f00\u9700\u8981\u589e\u52a03(4-1)\u4e2a0\uff0c\u53730001000\uff0c0\u9636\u6240\u4ee5\u7ed3\u5c3e\u4e5f\u4e0d\u9700\u8981\u8865\u7801\uff0c\u4e8e\u662f\u6700\u7ec8\u7801\u5b57\u5c31\u4e3a0001000\u3002<\/p>\n<p>\u90a3\u5982\u4f55\u89e3\u7801\u5462\uff1f<br \/>\n\u53c2\u89c1\u5982\u4e0b\u4f2a\u4ee3\u7801<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\nleadingZeroBits = \u22121\r\nfor (b = 0; !b; leadingZeroBits++)\r\n\tb = read_bits(1)\r\n\r\ncodeNum = 2^(leadingZeroBits + k) \u2212 2^k + read_bits(leadingZeroBits + k)\r\n<\/pre>\n<p><strong>\u8fd9\u91cc\u7c7b\u4f3c\u4e8e2^k\u8fd9\u79cd\u5199\u6cd5\u8868\u793a\u5e42\u8fd0\u7b97<\/strong>\uff0c\u5bf9\u4e8e\u901a\u5e38H.264\u5f53\u4e2d\u7528\u7684\u662f0\u9636\u7684\uff0c\u6240\u4ee5\u53ef\u4ee5\u7b80\u5316\u6210\u5982\u4e0b\u56fe<\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/46848122@N08\/10323806716\/\" title=\"Exponential-Golomb Decoding by DeliberateKids, on Flickr\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/farm4.staticflickr.com\/3728\/10323806716_05298938a1_c.jpg\" width=\"800\" height=\"302\" alt=\"Exponential-Golomb Decoding\"><\/a><\/p>\n<p>\u8fd9\u91ccread_bits(&#8230;)\u7684\u8fd4\u56de\u503c\u4f7f\u7528\u9ad8\u4f4d\u5728\u5148\u7684\u4e8c\u8fdb\u5236\u65e0\u7b26\u53f7\u6574\u6570\u8868\u793a<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\u4e8c\u8fdb\u5236\u6bd4\u7279\u4e32       \u957f\u5ea6             \u89e3\u6790\u503c\r\n1001             1               0\r\n001 1001         5               5\r\n01 1010          3               2\r\n010              3               1\r\n000 1011         7               10\r\n0001 001         7               8\r\n<\/pre>\n<p>\u5982\u4e0a\u8868\uff0c\u4f20\u5165\u7684\u6bd4\u7279\u4e32\u53ef\u80fd\u591a\u4f59\u5b9e\u9645\u9700\u8981\u7684\u6570\u636e\uff0c\u6211\u4eec\u53ea\u9700\u8981\u89e3\u6790\u9700\u8981\u7684\u90e8\u5206\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>P.S.<br \/>\n\u4e3a\u4ec0\u4e48\u53eb\u505a\u6307\u6570\u54e5\u4f26\u5e03\u7f16\u7801\uff1f<br \/>\n\u56e0\u4e3a\u5b83\u5bf9\u4fe1\u6e90\u7b26\u53f7\u7684\u5206\u7ec4\u5927\u5c0f\u6309\u7167\u6307\u6570\u589e\u957f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53c2\u8003\u8d44\u6599\uff1a http:\/\/en.wikipedia.org\/wiki\/Exponential-Golomb_coding http:\/\/zh.wikipedia.org\/zh\/\u6307\u6570\u54e5\u4f26\u5e03\u7801 Information technology \u2014 Coding of audio-visual objects \u2014 Part 10: Advanced Video Coding \u6458\u6284\u81ea\u4ee5\u4e0a\u8d44\u6599\uff0c\u7b80\u5355\u603b\u7ed3\u3002 \u6307\u6578\u54e5\u502b\u5e03\u78bc(Exp-Golomb code)\uff0c\u4e00\u79cd\u58d3\u7e2e\u7de8\u78bc\u65b9\u6cd5\u3002 \u7528\u6765\u8868\u793a\u975e\u8d1f\u6574\u6570\u7684k\u9636\u6307\u6570\u54e5\u4f26\u5e03\u7801\u53ef\u7528\u5982\u4e0b\u6b65\u9aa4\u751f\u6210\uff1a 1. \u5c06\u6570\u5b57\u4ee5\u4e8c\u8fdb\u5236\u5f62\u5f0f\u5199\u51fa\uff0c\u53bb\u6389\u6700\u4f4e\u7684k\u4e2a\u6bd4\u7279\u4f4d\uff0c\u4e4b\u540e\u52a01 2. \u8ba1\u7b97\u7559\u4e0b\u7684\u6bd4\u7279\u6570\uff0c\u5c06\u6b64\u6570\u51cf\u4e00\uff0c\u5373\u662f\u9700\u8981\u589e\u52a0\u7684\u524d\u5bfc\u96f6\u4e2a\u6570(\u6ce8\u610f\u662f\u6bd4\u7279\u4f4d\u6570\uff0c\u975e\u8be5\u6bd4\u7279\u4e32\u8868\u793a\u7684\u503c) 3. \u5c06\u7b2c\u4e00\u6b65\u4e2d\u53bb\u6389\u7684\u6700\u4f4ek\u4e2a\u6bd4\u7279\u4f4d\u8865\u56de\u6bd4\u7279\u4e32\u5c3e\u90e8 0\u9636\u6307\u6570\u54e5\u4f26\u5e03\u7801\u5982\u4e0b\u6240\u793a\uff1a 0 =&gt; 1 =&gt; 1 1 =&gt; 10 =&gt; 010 2 =&gt; 11 =&gt; 011 3 =&gt; 100 =&gt; 00100 4 =&gt; 101 =&gt; 00101 5 =&gt; 110 &hellip; <a href=\"https:\/\/guoh.ai\/lifelog\/2013\/10\/exp-golomb-coding\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Exponential-Golomb coding<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_gfmr_meta_descriptions":[],"_gfmr_multilingual_taxonomy_terms":[],"footnotes":""},"categories":[5,8],"tags":[],"class_list":["post-795","post","type-post","status-publish","format-standard","hentry","category-cs","category-paste"],"_links":{"self":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts\/795","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/comments?post=795"}],"version-history":[{"count":8,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts\/795\/revisions"}],"predecessor-version":[{"id":803,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/posts\/795\/revisions\/803"}],"wp:attachment":[{"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/media?parent=795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/categories?post=795"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/guoh.ai\/lifelog\/wp-json\/wp\/v2\/tags?post=795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}