[x265] [PATCH] entropy: improve exp-Golomb code by CLZ

Ximing Cheng chengximing1989 at gmail.com
Tue Nov 10 16:57:09 CET 2015


Thanks, I will re-send the fixed patch!

On Tue, Nov 10, 2015 at 11:30 PM, chen <chenm003 at 163.com> wrote:

>
>
> At 2015-11-10 16:47:42,"Ximing Cheng" <chengximing1989 at foxmail.com> wrote:
> ># HG changeset patch
> ># User Ximing Cheng <ximingcheng at tencent.com>
> ># 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);
>
> 'idx * 2 + 1' faster on x86, it mapping to LEA
>
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20151110/04c1e427/attachment.html>


More information about the x265-devel mailing list