[x265-commits] [x265] testbench fix: short buffers now have short values

Deepthi Nandakumar deepthi at multicorewareinc.com
Mon Oct 14 00:06:31 CEST 2013


details:   http://hg.videolan.org/x265/rev/aef52403ed5a
branches:  
changeset: 4426:aef52403ed5a
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Sat Oct 12 13:40:55 2013 +0530
description:
testbench fix: short buffers now have short values
Subject: [x265] common: properly report clang compiled by version

details:   http://hg.videolan.org/x265/rev/28690748ab1d
branches:  
changeset: 4427:28690748ab1d
user:      Steve Borho <steve at borho.org>
date:      Sat Oct 12 14:51:04 2013 -0500
description:
common: properly report clang compiled by version
Subject: [x265] cmake: add install targets, machine generate x265.def and x265_config.h

details:   http://hg.videolan.org/x265/rev/1097e547c441
branches:  
changeset: 4428:1097e547c441
user:      Steve Borho <steve at borho.org>
date:      Sat Oct 12 14:44:18 2013 -0500
description:
cmake: add install targets, machine generate x265.def and x265_config.h

Now X265_BUILD is maintained in just a single place, souce/CMakeLists.txt.

The shared library is only installed if a valid tag is found; meaning the user
must be building a Mercurial clone or a release tarball with .hg_archive.txt
file in it (otherwise they must install the shared library themselves)
Subject: [x265] cmake: nit cleanups in version.cmake

details:   http://hg.videolan.org/x265/rev/c032a0fbc863
branches:  
changeset: 4429:c032a0fbc863
user:      Steve Borho <steve at borho.org>
date:      Sat Oct 12 14:51:23 2013 -0500
description:
cmake: nit cleanups in version.cmake
Subject: [x265] cmake: enable vim syntax hightlighting

details:   http://hg.videolan.org/x265/rev/ec98f30c5185
branches:  
changeset: 4430:ec98f30c5185
user:      Steve Borho <steve at borho.org>
date:      Sat Oct 12 14:52:46 2013 -0500
description:
cmake: enable vim syntax hightlighting
Subject: [x265] cmake: add uninstall rule for non-Windows platforms

details:   http://hg.videolan.org/x265/rev/c18a09b9d2d3
branches:  
changeset: 4431:c18a09b9d2d3
user:      Steve Borho <steve at borho.org>
date:      Sat Oct 12 16:30:00 2013 -0500
description:
cmake: add uninstall rule for non-Windows platforms

CMake on Windows doesn't appear to generate an install manifest file
Subject: [x265] api: add exported strings which describe version and build info

details:   http://hg.videolan.org/x265/rev/6d5df4858df6
branches:  
changeset: 4432:6d5df4858df6
user:      Steve Borho <steve at borho.org>
date:      Sat Oct 12 17:46:03 2013 -0500
description:
api: add exported strings which describe version and build info

It seemed more useful for this data to be in the x265 library rather than the
CLI app
Subject: [x265] asm: adopt x264 CPU detection and flags

details:   http://hg.videolan.org/x265/rev/76260e1b472d
branches:  
changeset: 4433:76260e1b472d
user:      Steve Borho <steve at borho.org>
date:      Thu Oct 10 02:25:12 2013 -0500
description:
asm: adopt x264 CPU detection and flags
Subject: [x265] ipfilter: move 16bpp primitives into a separate area of the file

details:   http://hg.videolan.org/x265/rev/7196914eff8f
branches:  
changeset: 4434:7196914eff8f
user:      Steve Borho <steve at borho.org>
date:      Sat Oct 12 18:11:00 2013 -0500
description:
ipfilter: move 16bpp primitives into a separate area of the file

This isolates the remaining vector primitives from the intrinsic primitives
Subject: [x265] testbench: repair --cpuid command line argument

details:   http://hg.videolan.org/x265/rev/c1acbd493213
branches:  
changeset: 4435:c1acbd493213
user:      Steve Borho <steve at borho.org>
date:      Sat Oct 12 18:20:49 2013 -0500
description:
testbench: repair --cpuid command line argument
Subject: [x265] primitives: show capabilities used even when cpuid is specified

details:   http://hg.videolan.org/x265/rev/4423fc3fcd08
branches:  
changeset: 4436:4423fc3fcd08
user:      Steve Borho <steve at borho.org>
date:      Sat Oct 12 18:48:59 2013 -0500
description:
primitives: show capabilities used even when cpuid is specified
Subject: [x265] vec: it seems clang has its own set of intrinsic generation bugs

details:   http://hg.videolan.org/x265/rev/db12b4bf3ffd
branches:  
changeset: 4437:db12b4bf3ffd
user:      Steve Borho <steve at borho.org>
date:      Sat Oct 12 19:04:31 2013 -0500
description:
vec: it seems clang has its own set of intrinsic generation bugs

If clang is allowed to run the instrinsic functions it builds in these two files
it causes SEGVs
Subject: [x265] cabac: cleanup TEncBinCoderCABACCounter to reduce C++ feature

details:   http://hg.videolan.org/x265/rev/6d351ec699e5
branches:  
changeset: 4438:6d351ec699e5
user:      Min Chen <chenm003 at 163.com>
date:      Sun Oct 13 11:06:05 2013 +0800
description:
cabac: cleanup TEncBinCoderCABACCounter to reduce C++ feature
Subject: [x265] cabac: cleanup unused code

details:   http://hg.videolan.org/x265/rev/1eeac78dbddb
branches:  
changeset: 4439:1eeac78dbddb
user:      Min Chen <chenm003 at 163.com>
date:      Sun Oct 13 11:50:16 2013 +0800
description:
cabac: cleanup unused code
Subject: [x265] cpu: disable -Wnarrowing for cpu.cpp

details:   http://hg.videolan.org/x265/rev/8011064113f7
branches:  
changeset: 4440:8011064113f7
user:      Steve Borho <steve at borho.org>
date:      Sun Oct 13 11:53:20 2013 -0500
description:
cpu: disable -Wnarrowing for cpu.cpp

This C99 code from x264 causes warnings when compiled for C++

diffstat:

 source/CMakeLists.txt                               |    44 +-
 source/Lib/TLibCommon/TComDataCU.cpp                |     6 -
 source/Lib/TLibCommon/TComDataCU.h                  |     1 -
 source/Lib/TLibEncoder/TEncBinCoder.h               |     2 -
 source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp        |    51 +-
 source/Lib/TLibEncoder/TEncBinCoderCABAC.h          |    15 +-
 source/Lib/TLibEncoder/TEncBinCoderCABACCounter.cpp |   111 -
 source/Lib/TLibEncoder/TEncBinCoderCABACCounter.h   |    68 -
 source/Lib/TLibEncoder/TEncCu.cpp                   |     7 -
 source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp |     6 +-
 source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h   |     2 +-
 source/Lib/TLibEncoder/TEncSbac.h                   |     1 -
 source/VectorClass/instrset.h                       |     6 -
 source/VectorClass/instrset_detect.cpp              |   185 --
 source/cmake/cmake_uninstall.cmake.in               |    19 +
 source/cmake/version.cmake                          |    10 +-
 source/common/CMakeLists.txt                        |     9 +-
 source/common/common.cpp                            |    63 +-
 source/common/common.h                              |    37 -
 source/common/cpu.cpp                               |   291 ++++
 source/common/cpu.h                                 |    61 +
 source/common/primitives.cpp                        |    59 +-
 source/common/primitives.h                          |    17 +-
 source/common/vec/ipfilter-sse41.cpp                |  1278 +++++++++---------
 source/common/vec/vec-primitives.cpp                |    39 +-
 source/common/x86/asm-primitives.cpp                |    56 +-
 source/encoder/CMakeLists.txt                       |     3 +-
 source/encoder/compress.cpp                         |     4 -
 source/encoder/cturow.cpp                           |    16 +-
 source/encoder/cturow.h                             |     5 +-
 source/encoder/framefilter.cpp                      |     3 +-
 source/encoder/framefilter.h                        |     2 +-
 source/test/pixelharness.cpp                        |     4 +-
 source/test/testbench.cpp                           |    62 +-
 source/test/testharness.h                           |     4 +
 source/x265.cpp                                     |    17 +-
 source/x265.def                                     |    12 -
 source/x265.def.in                                  |    14 +
 source/x265.h                                       |    61 +-
 source/x265_config.h.in                             |    34 +
 40 files changed, 1414 insertions(+), 1271 deletions(-)

diffs (truncated from 3555 to 300 lines):

diff -r 9a02765f182e -r 8011064113f7 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Fri Oct 11 23:41:41 2013 -0500
+++ b/source/CMakeLists.txt	Sun Oct 13 11:53:20 2013 -0500
@@ -1,3 +1,4 @@
+# vim: syntax=cmake
 if(NOT CMAKE_BUILD_TYPE)
     # default to Release build for GCC builds
     set(CMAKE_BUILD_TYPE Release CACHE STRING
@@ -143,12 +144,21 @@ if (WIN32)
     endif(WINXP_SUPPORT)
 endif()
 
-include_directories(. Lib common encoder)
+# X265_BUILD must be incremented each time the public API is changed
+set(X265_BUILD 1)
+configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
+               "${PROJECT_BINARY_DIR}/x265.def")
+configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
+               "${PROJECT_BINARY_DIR}/x265_config.h")
+
+include(version) # determine X265_VERSION and X265_LATEST_TAG
+include_directories(. Lib common encoder "${PROJECT_BINARY_DIR}")
 add_subdirectory(common)
 add_subdirectory(encoder)
 
-add_library(x265-shared SHARED dllmain.cpp x265.def $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>)
 add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>)
+add_library(x265-shared SHARED dllmain.cpp "${PROJECT_BINARY_DIR}/x265.def"
+                               $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>)
 if(ENABLE_PRIMITIVES_ASM AND (MSVC_IDE OR XCODE))
     SET(EXTRA_LIBS ${EXTRA_LIBS} assembly)
 endif()
@@ -165,6 +175,28 @@ endif()
 # MINGW builds static: libx265-static.a shared: libx265.dll + libx265.dll.a
 # *NIX  builds static: libx265.a        shared: libx265.so
 
+if(X265_LATEST_TAG)
+    # shared library is not installed if a tag is not found
+    set_target_properties(x265-shared PROPERTIES VERSION ${X265_LATEST_TAG} SOVERSION ${X265_BUILD})
+    install(TARGETS x265-shared
+            RUNTIME DESTINATION bin
+            LIBRARY DESTINATION lib
+            ARCHIVE DESTINATION lib/x265)
+endif()
+install(TARGETS x265-static
+        RUNTIME DESTINATION bin
+        LIBRARY DESTINATION lib
+        ARCHIVE DESTINATION lib/x265)
+install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
+
+if(NOT WIN32)
+    configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+                   "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
+                   IMMEDIATE @ONLY)
+    add_custom_target(uninstall
+                      "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake")
+endif()
+
 # Main CLI application
 option(ENABLE_CLI "Build standalone CLI application" ON)
 if(ENABLE_CLI)
@@ -178,13 +210,13 @@ if(ENABLE_CLI)
         set_source_files_properties(compat/msvc/getopt.c PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter")
     endif()
 
-    include(version) # determine X265_VERSION
-    set_source_files_properties(x265.cpp PROPERTIES COMPILE_FLAGS -DX265_VERSION=${X265_VERSION})
     add_executable(cli ../COPYING ${InputFiles} ${OutputFiles}
-        x265.cpp x265opts.h x265.h
-        compat/msvc/getopt.c compat/msvc/getopt.h)
+                   x265.cpp x265opts.h x265.h
+                   compat/msvc/getopt.c compat/msvc/getopt.h)
     target_link_libraries(cli x265-static ${PLATFORM_LIBS})
     set_target_properties(cli PROPERTIES OUTPUT_NAME x265)
+
+    install(TARGETS cli DESTINATION bin)
 endif(ENABLE_CLI)
 
 # Test applications
diff -r 9a02765f182e -r 8011064113f7 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Fri Oct 11 23:41:41 2013 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Sun Oct 13 11:53:20 2013 -0500
@@ -237,7 +237,6 @@ void TComDataCU::initCU(TComPic* pic, UI
     m_totalCost        = MAX_INT64;
     m_totalDistortion  = 0;
     m_totalBits        = 0;
-    m_totalBins        = 0;
     m_numPartitions    = pic->getNumPartInCU();
 
     // CHECK_ME: why partStartIdx always negative
@@ -392,7 +391,6 @@ void TComDataCU::initEstData(UInt depth,
     m_totalCost        = MAX_INT64;
     m_totalDistortion  = 0;
     m_totalBits        = 0;
-    m_totalBins        = 0;
 
     UChar width  = g_maxCUWidth  >> depth;
     UChar height = g_maxCUHeight >> depth;
@@ -462,7 +460,6 @@ void TComDataCU::initSubCU(TComDataCU* c
     m_totalCost        = MAX_INT64;
     m_totalDistortion  = 0;
     m_totalBits        = 0;
-    m_totalBins        = 0;
     m_numPartitions    = cu->getTotalNumPart() >> 2;
 
     int iSizeInUchar = sizeof(UChar) * m_numPartitions;
@@ -724,7 +721,6 @@ void TComDataCU::copyPartFrom(TComDataCU
     memcpy(m_trCoeffCr + uiTmp2, cu->getCoeffCr(), sizeof(TCoeff) * uiTmp);
     memcpy(m_iPCMSampleCb + uiTmp2, cu->getPCMSampleCb(), sizeof(Pel) * uiTmp);
     memcpy(m_iPCMSampleCr + uiTmp2, cu->getPCMSampleCr(), sizeof(Pel) * uiTmp);
-    m_totalBins += cu->m_totalBins;
 }
 
 // Copy current predicted part to a CU in picture.
@@ -788,7 +784,6 @@ void TComDataCU::copyToPic(UChar uhDepth
     memcpy(rpcCU->getCoeffCr() + tmp2, m_trCoeffCr, sizeof(TCoeff) * tmp);
     memcpy(rpcCU->getPCMSampleCb() + tmp2, m_iPCMSampleCb, sizeof(Pel) * tmp);
     memcpy(rpcCU->getPCMSampleCr() + tmp2, m_iPCMSampleCr, sizeof(Pel) * tmp);
-    rpcCU->m_totalBins = m_totalBins;
 }
 
 void TComDataCU::copyToPic(UChar depth, UInt partIdx, UInt partDepth)
@@ -850,7 +845,6 @@ void TComDataCU::copyToPic(UChar depth, 
     memcpy(cu->getCoeffCr() + tmp2, m_trCoeffCr, sizeof(TCoeff) * tmp);
     memcpy(cu->getPCMSampleCb() + tmp2, m_iPCMSampleCb, sizeof(Pel) * tmp);
     memcpy(cu->getPCMSampleCr() + tmp2, m_iPCMSampleCr, sizeof(Pel) * tmp);
-    cu->m_totalBins = m_totalBins;
 }
 
 // --------------------------------------------------------------------------------------------------------------------
diff -r 9a02765f182e -r 8011064113f7 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Fri Oct 11 23:41:41 2013 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.h	Sun Oct 13 11:53:20 2013 -0500
@@ -178,7 +178,6 @@ public:
     UInt64        m_totalCost;       ///< sum of partition RD costs
     UInt          m_totalDistortion; ///< sum of partition distortion
     UInt          m_totalBits;       ///< sum of partition signal bits
-    UInt          m_totalBins;       ///< sum of partition bins
     
     // -------------------------------------------------------------------------------------------------------------------
     // create / destroy / initialize / copy
diff -r 9a02765f182e -r 8011064113f7 source/Lib/TLibEncoder/TEncBinCoder.h
--- a/source/Lib/TLibEncoder/TEncBinCoder.h	Fri Oct 11 23:41:41 2013 -0500
+++ b/source/Lib/TLibEncoder/TEncBinCoder.h	Sun Oct 13 11:53:20 2013 -0500
@@ -73,8 +73,6 @@ public:
     virtual void  encodeBinsEP(UInt bins, int numBins) = 0;
     virtual void  encodeBinTrm(UInt bin) = 0;
 
-    virtual TEncBinCABAC*   getTEncBinCABAC()  { return 0; }
-
     virtual ~TEncBinIf() {}
 };
 }
diff -r 9a02765f182e -r 8011064113f7 source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp
--- a/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp	Fri Oct 11 23:41:41 2013 -0500
+++ b/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp	Sun Oct 13 11:53:20 2013 -0500
@@ -43,10 +43,10 @@ using namespace x265;
 //! \ingroup TLibEncoder
 //! \{
 
-TEncBinCABAC::TEncBinCABAC()
+TEncBinCABAC::TEncBinCABAC(bool isCounter)
     : m_pcTComBitIf(0)
-    , m_binCountIncrement(0)
     , m_fracBits(0)
+    , bIsCounter(isCounter)
 {}
 
 TEncBinCABAC::~TEncBinCABAC()
@@ -73,6 +73,14 @@ void TEncBinCABAC::start()
 
 void TEncBinCABAC::finish()
 {
+    if (bIsCounter)
+    {
+        // TODO: why write 0 bits?
+        m_pcTComBitIf->write(0, UInt(m_fracBits >> 15));
+        m_fracBits &= 32767;
+        assert(0);
+    }
+
     if (m_uiLow >> (32 - m_bitsLeft))
     {
         //assert( m_numBufferedBytes > 0 );
@@ -141,7 +149,7 @@ void TEncBinCABAC::xWritePCMCode(UInt ui
 
 void TEncBinCABAC::copyState(TEncBinIf* pcTEncBinIf)
 {
-    TEncBinCABAC* pcTEncBinCABAC = pcTEncBinIf->getTEncBinCABAC();
+    TEncBinCABAC* pcTEncBinCABAC = (TEncBinCABAC*)pcTEncBinIf;
 
     m_uiLow           = pcTEncBinCABAC->m_uiLow;
     m_uiRange         = pcTEncBinCABAC->m_uiRange;
@@ -157,16 +165,15 @@ void TEncBinCABAC::resetBits()
     m_bitsLeft         = 23;
     m_numBufferedBytes = 0;
     m_bufferedByte     = 0xff;
-    if (m_binCountIncrement)
-    {
-        m_uiBinsCoded = 0;
-    }
-    m_fracBits &= 32767;
+    m_fracBits        &= 32767;
 }
 
 UInt TEncBinCABAC::getNumWrittenBits()
 {
-    return m_pcTComBitIf->getNumberOfWrittenBits() + 8 * m_numBufferedBytes + 23 - m_bitsLeft;
+    if (bIsCounter)
+        return m_pcTComBitIf->getNumberOfWrittenBits() + UInt(m_fracBits >> 15);
+    else
+        return m_pcTComBitIf->getNumberOfWrittenBits() + 8 * m_numBufferedBytes + 23 - m_bitsLeft;
 }
 
 /**
@@ -185,7 +192,12 @@ void TEncBinCABAC::encodeBin(UInt binVal
         DTRACE_CABAC_V(binValue)
         DTRACE_CABAC_T("\n")
     }
-    m_uiBinsCoded += m_binCountIncrement;
+    if (bIsCounter)
+    {
+        m_fracBits += rcCtxModel.getEntropyBits(binValue);
+        rcCtxModel.update(binValue);
+        return;
+    }
     rcCtxModel.setBinsCoded(1);
 
     UInt  uiLPS   = g_lpsTable[rcCtxModel.getState()][(m_uiRange >> 6) & 3];
@@ -229,7 +241,11 @@ void TEncBinCABAC::encodeBinEP(UInt binV
         DTRACE_CABAC_V(binValue)
         DTRACE_CABAC_T("\n")
     }
-    m_uiBinsCoded += m_binCountIncrement;
+    if (bIsCounter)
+    {
+        m_fracBits += 32768;
+        return;
+    }
     m_uiLow <<= 1;
     if (binValue)
     {
@@ -248,7 +264,11 @@ void TEncBinCABAC::encodeBinEP(UInt binV
  */
 void TEncBinCABAC::encodeBinsEP(UInt binValues, int numBins)
 {
-    m_uiBinsCoded += numBins & - m_binCountIncrement;
+    if (bIsCounter)
+    {
+        m_fracBits += 32768 * numBins;
+        return;
+    }
 
     for (int i = 0; i < numBins; i++)
     {
@@ -284,7 +304,12 @@ void TEncBinCABAC::encodeBinsEP(UInt bin
  */
 void TEncBinCABAC::encodeBinTrm(UInt binValue)
 {
-    m_uiBinsCoded += m_binCountIncrement;
+    if (bIsCounter)
+    {
+        m_fracBits += ContextModel::getEntropyBitsTrm(binValue);
+        return;
+    }
+
     m_uiRange -= 2;
     if (binValue)
     {
diff -r 9a02765f182e -r 8011064113f7 source/Lib/TLibEncoder/TEncBinCoderCABAC.h
--- a/source/Lib/TLibEncoder/TEncBinCoderCABAC.h	Fri Oct 11 23:41:41 2013 -0500
+++ b/source/Lib/TLibEncoder/TEncBinCoderCABAC.h	Sun Oct 13 11:53:20 2013 -0500
@@ -50,7 +50,7 @@ class TEncBinCABAC : public TEncBinIf
 {
 public:
 
-    TEncBinCABAC();
+    TEncBinCABAC(bool isCounter = false);
     virtual ~TEncBinCABAC();
 
     void  init(TComBitIf* pcTComBitIf);
@@ -73,16 +73,6 @@ public:
     void  encodeBinsEP(UInt binValues, int numBins);
     void  encodeBinTrm(UInt binValue);
 
-    TEncBinCABAC* getTEncBinCABAC() { return this; }
-
-    void  setBinsCoded(UInt val) { m_uiBinsCoded = val; }
-
-    UInt  getBinsCoded() { return m_uiBinsCoded; }
-
-    void  setBinCountingEnableFlag(bool bFlag) { m_binCountIncrement = bFlag ? 1 : 0; }
-
-    bool  getBinCountingEnableFlag() { return m_binCountIncrement != 0; }
-
 protected:
 
     void testAndWriteOut();
@@ -95,9 +85,8 @@ public:
     UInt                m_bufferedByte;


More information about the x265-commits mailing list