[x265] [PATCH 3 of 3] bitstream: hoist trivial methods to the header so they may be easier inlined

Steve Borho steve at borho.org
Thu Jul 10 23:44:01 CEST 2014


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1405019610 18000
#      Thu Jul 10 14:13:30 2014 -0500
# Node ID 57a4c1c2274ec6b40f4a138523c6b67ffa853e09
# Parent  b96714bdda859e6be60c9e2056e3d5296e20d2dc
bitstream: hoist trivial methods to the header so they may be easier inlined

diff -r b96714bdda85 -r 57a4c1c2274e source/common/bitstream.cpp
--- a/source/common/bitstream.cpp	Thu Jul 10 14:07:03 2014 -0500
+++ b/source/common/bitstream.cpp	Thu Jul 10 14:13:30 2014 -0500
@@ -106,12 +106,6 @@
     writeAlignZero();
 }
 
-void SyntaxElementWriter::writeCode(uint32_t code, uint32_t length)
-{
-    X265_CHECK(length, "wrote zero length code\n");
-    m_bitIf->write(code, length);
-}
-
 void SyntaxElementWriter::writeUvlc(uint32_t code)
 {
     uint32_t length = 1;
@@ -129,15 +123,3 @@
     m_bitIf->write(0, length >> 1);
     m_bitIf->write(code, (length + 1) >> 1);
 }
-
-void SyntaxElementWriter::writeSvlc(int32_t code)
-{
-    uint32_t ucode = (code <= 0) ? -code << 1 : (code << 1) - 1;
-
-    writeUvlc(ucode);
-}
-
-void SyntaxElementWriter::writeFlag(uint32_t code)
-{
-    m_bitIf->write(code, 1);
-}
diff -r b96714bdda85 -r 57a4c1c2274e source/common/bitstream.h
--- a/source/common/bitstream.h	Thu Jul 10 14:07:03 2014 -0500
+++ b/source/common/bitstream.h	Thu Jul 10 14:13:30 2014 -0500
@@ -147,10 +147,10 @@
     inline void WRITE_SVLC(int32_t  code,                  const char *) { writeSvlc(code); }
     inline void WRITE_FLAG(uint32_t code,                  const char *) { writeFlag(code); }
 
-    void writeCode(uint32_t code, uint32_t length);
+    void writeCode(uint32_t code, uint32_t length) { m_bitIf->write(code, length); }
     void writeUvlc(uint32_t code);
-    void writeSvlc(int32_t code);
-    void writeFlag(uint32_t code);
+    void writeSvlc(int32_t code)                   { uint32_t ucode = (code <= 0) ? -code << 1 : (code << 1) - 1; writeUvlc(ucode); }
+    void writeFlag(uint32_t code)                  { m_bitIf->write(code, 1); }
 };
 
 }


More information about the x265-devel mailing list