<div dir="ltr">Thanks, I will re-send the fixed patch!</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 10, 2015 at 11:30 PM, chen <span dir="ltr"><<a href="mailto:chenm003@163.com" target="_blank">chenm003@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><div><div class="h5"><div><br></div><pre><br>At 2015-11-10 16:47:42,"Ximing Cheng" <<a href="mailto:chengximing1989@foxmail.com" target="_blank">chengximing1989@foxmail.com</a>> wrote:
># HG changeset patch
># User Ximing Cheng <<a href="mailto:ximingcheng@tencent.com" target="_blank">ximingcheng@tencent.com</a>>
># Date 1447145224 -28800
>#      Tue Nov 10 16:47:04 2015 +0800
># Node ID 73414b349436eb0b4793021e4d130b1ac48177b5
># Parent  f11b17b4656a85a15dc82fd04485fbf920848e4d
>entropy: improve exp-Golomb code by CLZ
>
>diff -r f11b17b4656a -r 73414b349436 source/common/bitstream.cpp
>--- a/source/common/bitstream.cpp  Fri Nov 06 16:04:23 2015 +0800
>+++ b/source/common/bitstream.cpp  Tue Nov 10 16:47:04 2015 +0800
>@@ -1,5 +1,6 @@
> #include "common.h"
> #include "bitstream.h"
>+#include "threading.h"

> using namespace X265_NS;

>@@ -112,16 +113,13 @@

> void SyntaxElementWriter::writeUvlc(uint32_t code)
> {
>-    uint32_t length = 1;
>-    uint32_t temp = ++code;
>+    ++code;

>-    X265_CHECK(temp, "writing -1 code, will cause infinite loop\n");
>+    X265_CHECK(code, "writing -1 code, will cause infinite loop\n");

>-    while (1 != temp)
>-    {
>-        temp >>= 1;
>-        length += 2;
>-    }
>+    unsigned long idx;
>+    CLZ(idx, code);
>+    uint32_t length = 1 + (uint32_t)(idx << 1);
</pre></div></div><pre>'idx * 2 + 1' faster on x86, it mapping to LEA</pre></div><br>_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
<br></blockquote></div><br></div>