[x265-commits] [x265] Merge with default, prepare for 0.7 tag

Steve Borho steve at borho.org
Wed Jan 8 20:09:50 CET 2014


details:   http://hg.videolan.org/x265/rev/0d70188e80bc
branches:  stable
changeset: 5811:0d70188e80bc
user:      Steve Borho <steve at borho.org>
date:      Wed Jan 08 13:00:53 2014 -0600
description:
Merge with default, prepare for 0.7 tag

diffstat:

 .hgignore                                     |     1 +
 source/CMakeLists.txt                         |   110 +-
 source/Lib/TLibCommon/CommonDef.h             |     6 +-
 source/Lib/TLibCommon/TComBitStream.cpp       |    13 +-
 source/Lib/TLibCommon/TComDataCU.cpp          |    62 +
 source/Lib/TLibCommon/TComDataCU.h            |     2 +
 source/Lib/TLibCommon/TComPicYuv.cpp          |     6 +-
 source/Lib/TLibCommon/TComPrediction.cpp      |    62 +-
 source/Lib/TLibCommon/TComPrediction.h        |     4 +-
 source/Lib/TLibCommon/TComRom.cpp             |    17 +-
 source/Lib/TLibCommon/TComRom.h               |     6 +-
 source/Lib/TLibCommon/TComSlice.cpp           |     1 +
 source/Lib/TLibCommon/TComSlice.h             |    89 +-
 source/Lib/TLibCommon/TComTrQuant.cpp         |    38 +-
 source/Lib/TLibCommon/TComYuv.cpp             |     4 +-
 source/Lib/TLibEncoder/TEncCfg.h              |     3 +
 source/Lib/TLibEncoder/TEncCu.cpp             |   202 +-
 source/Lib/TLibEncoder/TEncCu.h               |    10 +-
 source/Lib/TLibEncoder/TEncSearch.cpp         |   634 ++-
 source/Lib/TLibEncoder/TEncSearch.h           |    32 +-
 source/Lib/TLibEncoder/WeightPredAnalysis.cpp |     2 +-
 source/VectorClass/README.txt                 |     1 -
 source/VectorClass/instrset.h                 |   177 -
 source/VectorClass/vectorclass.h              |    45 -
 source/VectorClass/vectori128.h               |  5574 -----------------------
 source/VectorClass/vectori256.h               |  4738 -------------------
 source/VectorClass/vectori256e.h              |  3545 --------------
 source/cmake/version.cmake                    |    21 +-
 source/common/CMakeLists.txt                  |   104 +-
 source/common/TShortYUV.cpp                   |     2 +
 source/common/TShortYUV.h                     |     1 +
 source/common/common.cpp                      |   113 +-
 source/common/cpu.cpp                         |    61 -
 source/common/intrapred.cpp                   |    50 +-
 source/common/ipfilter.cpp                    |    68 +-
 source/common/lowres.cpp                      |     6 +-
 source/common/lowres.h                        |     4 +
 source/common/pixel.cpp                       |    55 +-
 source/common/primitives.cpp                  |    86 +-
 source/common/primitives.h                    |    24 +-
 source/common/vec/blockcopy-sse3.cpp          |     1 +
 source/common/vec/dct-sse3.cpp                |   100 +-
 source/common/vec/dct-sse41.cpp               |   114 -
 source/common/vec/dct-ssse3.cpp               |   254 +-
 source/common/vec/intra-sse41.cpp             |   302 +-
 source/common/vec/intra-ssse3.cpp             |   251 +-
 source/common/vec/ipfilter-sse41.cpp          |   208 +-
 source/common/vec/ipfilter-ssse3.cpp          |   145 -
 source/common/vec/pixel-sse41.cpp             |   694 --
 source/common/vec/pixel-ssse3.cpp             |   101 -
 source/common/vec/pixel16-sse41.cpp           |  1863 -------
 source/common/vec/vec-primitives.cpp          |    13 +-
 source/common/x86/asm-primitives.cpp          |   460 +-
 source/common/x86/blockcopy8.asm              |  1813 ++++--
 source/common/x86/blockcopy8.h                |     7 +-
 source/common/x86/const-a.asm                 |    21 +-
 source/common/x86/dct8.asm                    |   540 ++
 source/common/x86/dct8.h                      |     4 +
 source/common/x86/intrapred.asm               |   492 --
 source/common/x86/intrapred.h                 |    41 +-
 source/common/x86/intrapred16.asm             |  1335 +++++
 source/common/x86/intrapred8.asm              |  3527 ++++++++++++++
 source/common/x86/ipfilter8.asm               |   316 +-
 source/common/x86/ipfilter8.h                 |     9 +-
 source/common/x86/mc-a.asm                    |    60 +
 source/common/x86/mc.h                        |    33 +
 source/common/x86/pixel-a.asm                 |  5957 ++++--------------------
 source/common/x86/pixel-util.asm              |   883 ---
 source/common/x86/pixel-util.h                |   149 +
 source/common/x86/pixel-util8.asm             |  4615 +++++++++++++++++++
 source/common/x86/pixel.h                     |   322 +-
 source/common/x86/pixeladd8.asm               |  1011 +++-
 source/common/x86/sad-a.asm                   |   566 +--
 source/common/x86/sad16-a.asm                 |   830 +++
 source/common/x86/ssd-a.asm                   |  2397 ++++++++++
 source/encoder/CMakeLists.txt                 |     3 +-
 source/encoder/compress.cpp                   |   635 +-
 source/encoder/cturow.cpp                     |     2 +-
 source/encoder/encoder.cpp                    |   220 +-
 source/encoder/encoder.h                      |     2 +
 source/encoder/frameencoder.cpp               |    44 +-
 source/encoder/motion.cpp                     |    14 +-
 source/encoder/ratecontrol.cpp                |   411 +-
 source/encoder/ratecontrol.h                  |    50 +-
 source/encoder/slicetype.cpp                  |   324 +-
 source/encoder/slicetype.h                    |    18 +-
 source/encoder/weightPrediction.cpp           |   383 +
 source/encoder/weightPrediction.h             |    88 +
 source/input/y4m.cpp                          |    16 +-
 source/input/yuv.cpp                          |     1 +
 source/output/y4m.cpp                         |     8 +-
 source/output/yuv.cpp                         |     5 +-
 source/test/CMakeLists.txt                    |     3 -
 source/test/intrapredharness.cpp              |   167 +-
 source/test/intrapredharness.h                |     6 +-
 source/test/ipfilterharness.cpp               |   100 +-
 source/test/ipfilterharness.h                 |     2 +
 source/test/pixelharness.cpp                  |   139 +-
 source/test/pixelharness.h                    |     1 +
 source/test/testbench.cpp                     |    16 +-
 source/test/testpool.cpp                      |   241 -
 source/x265.cpp                               |    21 +-
 source/x265.h                                 |    75 +-
 103 files changed, 20558 insertions(+), 27850 deletions(-)

diffs (truncated from 54185 to 300 lines):

diff -r bca251133e70 -r 0d70188e80bc .hgignore
--- a/.hgignore	Sat Dec 14 23:26:14 2013 +0530
+++ b/.hgignore	Wed Jan 08 13:00:53 2014 -0600
@@ -7,3 +7,4 @@ build/
 **.yuv
 **.y4m
 **.out
+**.swp
diff -r bca251133e70 -r 0d70188e80bc source/CMakeLists.txt
--- a/source/CMakeLists.txt	Sat Dec 14 23:26:14 2013 +0530
+++ b/source/CMakeLists.txt	Wed Jan 08 13:00:53 2014 -0600
@@ -13,7 +13,7 @@ include(CheckFunctionExists)
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 3)
+set(X265_BUILD 4)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
@@ -83,12 +83,6 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
         add_definitions(-mstackrealign)
     endif()
     execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
-    if(NOT GCC_VERSION VERSION_LESS 4.7)
-        # this is necessary to avoid name conflicts in vector class
-        # library.  if vector classes are removed/replaced this can
-        # likely be removed as well.
-        add_definitions(-fabi-version=6)
-    endif()
 endif()
 if (GCC)
     option(WARNINGS_AS_ERRORS "Stop compiles on first warning" OFF)
@@ -107,15 +101,21 @@ else(HIGH_BIT_DEPTH)
     add_definitions(-DHIGH_BIT_DEPTH=0)
 endif(HIGH_BIT_DEPTH)
 
-option(ENABLE_PRIMITIVES_VEC "Enable use of SIMD vector class primitives" ON)
+option(LOG_CU_STATISTICS "Log Mode Decision Statistics at the CU Level" OFF)
+if(LOG_CU_STATISTICS)
+    add_definitions(-DLOG_CU_STATISTICS=1)
+else(LOG_CU_STATISTICS)
+    add_definitions(-DLOG_CU_STATISTICS=0)
+endif(LOG_CU_STATISTICS)
+
 find_package(Yasm)
 if(YASM_FOUND)
     if (YASM_VERSION_STRING VERSION_LESS "1.2.0")
         message(STATUS "Yasm version ${YASM_VERSION_STRING} is too old. 1.2.0 or later required")
-        option(ENABLE_PRIMITIVES_ASM "Enable use of assembly coded primitives" OFF)
+        option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" OFF)
     else()
         message(STATUS "Found Yasm ${YASM_VERSION_STRING} to build assembly primitives")
-        option(ENABLE_PRIMITIVES_ASM "Enable use of assembly coded primitives" ON)
+        option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" ON)
     endif()
 endif(YASM_FOUND)
 
@@ -157,19 +157,19 @@ include_directories(. Lib common encoder
 add_subdirectory(common)
 add_subdirectory(encoder)
 
-if((MSVC_IDE OR XCODE) AND ENABLE_PRIMITIVES_ASM)
+if((MSVC_IDE OR XCODE) AND ENABLE_ASSEMBLY)
     # this is horrible. ugly, and hacky, and it reproduces logic found
     # in the yasm CMake modules, but this is required because of this cmake bug
     # http://www.cmake.org/Bug/print_bug_page.php?bug_id=8170
     if (X64)
         if(APPLE)
-            set(FLAGS -f macho64 -m amd64 -DPREFIX -DPIC -DARCH_X86_64=1 -DHAVE_ALIGNED_STACK=0)
+            set(FLAGS -f macho64 -m amd64 -DPREFIX -DPIC -DARCH_X86_64=1 -DHAVE_ALIGNED_STACK=1)
         else()
             set(FLAGS -f win64 -m amd64 -DARCH_X86_64=1 -DHAVE_ALIGNED_STACK=0)
         endif()
     else()
         if(APPLE)
-            set(FLAGS -f macho -DARCH_X86_64=0 -DHAVE_ALIGNED_STACK=0 -DPREFIX)
+            set(FLAGS -f macho -DARCH_X86_64=0 -DHAVE_ALIGNED_STACK=1 -DPREFIX)
         else()
             set(FLAGS -f win32 -DARCH_X86_64=0 -DHAVE_ALIGNED_STACK=0 -DPREFIX)
         endif()
@@ -196,43 +196,45 @@ if((MSVC_IDE OR XCODE) AND ENABLE_PRIMIT
 endif()
 
 add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${YASM_OBJS} ${YASM_SRCS})
-add_library(x265-shared SHARED dllmain.cpp "${PROJECT_BINARY_DIR}/x265.def" ${YASM_OBJS}
-                               $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>)
-target_link_libraries(x265-shared ${PLATFORM_LIBS})
-set_target_properties(x265-shared PROPERTIES OUTPUT_NAME x265)
 if(NOT MSVC)
     set_target_properties(x265-static PROPERTIES OUTPUT_NAME x265)
 endif()
-if(UNIX AND NOT APPLE)
-    set_target_properties(x265-shared PROPERTIES LINK_FLAGS "-Wl,-Bsymbolic")
-endif()
-# WIN32 builds static: x265-static.lib  shared: x265.dll + x265.lib (shim loader)
-# 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)
-
-    # convert lists of link libraries into -lstdc++ -lm etc..
-    foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
-        set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}")
-    endforeach()
-    # Produce a pkg-config file for linking against the shared lib
-    configure_file("x265.pc.in" "x265.pc" @ONLY)
-    install(FILES       "${CMAKE_CURRENT_BINARY_DIR}/x265.pc"
-            DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
-endif()
 install(TARGETS x265-static
         RUNTIME DESTINATION bin
         LIBRARY DESTINATION lib
         ARCHIVE DESTINATION lib)
 install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
 
+option(ENABLE_SHARED "Build shared library" ON)
+if(ENABLE_SHARED)
+    add_library(x265-shared SHARED dllmain.cpp "${PROJECT_BINARY_DIR}/x265.def" ${YASM_OBJS}
+                                   $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>)
+    target_link_libraries(x265-shared ${PLATFORM_LIBS})
+    set_target_properties(x265-shared PROPERTIES OUTPUT_NAME x265)
+    if(UNIX AND NOT APPLE)
+        set_target_properties(x265-shared PROPERTIES LINK_FLAGS "-Wl,-Bsymbolic")
+    endif()
+    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)
+    endif()
+endif()
+
+if(X265_LATEST_TAG)
+    # convert lists of link libraries into -lstdc++ -lm etc..
+    foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
+        set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}")
+    endforeach()
+    # Produce a pkg-config file
+    configure_file("x265.pc.in" "x265.pc" @ONLY)
+    install(FILES       "${CMAKE_CURRENT_BINARY_DIR}/x265.pc"
+            DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
+endif()
+
 if(NOT WIN32)
     configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
                    "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
@@ -258,21 +260,21 @@ if(ENABLE_CLI)
         set(GETOPT compat/getopt/getopt.c compat/getopt/getopt.h)
     endif(NOT HAVE_GETOPT_H)
 
-    add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} x265.cpp x265.h)
-    target_link_libraries(cli x265-static ${PLATFORM_LIBS})
+    if(XCODE)
+        add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} x265.cpp x265.h
+                           $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${YASM_OBJS} ${YASM_SRCS})
+    else()
+        add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} x265.cpp x265.h)
+        target_link_libraries(cli x265-static ${PLATFORM_LIBS})
+    endif()
     set_target_properties(cli PROPERTIES OUTPUT_NAME x265)
 
     install(TARGETS cli DESTINATION bin)
 endif(ENABLE_CLI)
 
-# Test applications
-option(ENABLE_TESTS "Enable Unit Tests" OFF)
-if(ENABLE_TESTS)
-    if(ENABLE_PRIMITIVES_VEC)
-        add_definitions(-DENABLE_VECTOR_PRIMITIVES=1)
-    endif(ENABLE_PRIMITIVES_VEC)
-    if(ENABLE_PRIMITIVES_ASM)
-        add_definitions(-DENABLE_ASM_PRIMITIVES=1)
-    endif(ENABLE_PRIMITIVES_ASM)
-    add_subdirectory(test)
-endif(ENABLE_TESTS)
+if(ENABLE_ASSEMBLY AND NOT XCODE)
+    option(ENABLE_TESTS "Enable Unit Tests" OFF)
+    if(ENABLE_TESTS)
+        add_subdirectory(test)
+    endif()
+endif()
diff -r bca251133e70 -r 0d70188e80bc source/Lib/TLibCommon/CommonDef.h
--- a/source/Lib/TLibCommon/CommonDef.h	Sat Dec 14 23:26:14 2013 +0530
+++ b/source/Lib/TLibCommon/CommonDef.h	Wed Jan 08 13:00:53 2014 -0600
@@ -98,11 +98,6 @@
 
 #define FAST_UDI_MAX_RDMODE_NUM     35 ///< maximum number of RD comparison in fast-UDI estimation loop
 
-#define NUM_INTRA_MODE 36
-#if !REMOVE_LM_CHROMA
-#define LM_CHROMA_IDX  35
-#endif
-
 #define PLANAR_IDX                  0
 #define VER_IDX                     26 // index for intra VERTICAL   mode
 #define HOR_IDX                     10 // index for intra HORIZONTAL mode
@@ -138,6 +133,7 @@
 
 #define MIN_QP                      0
 #define MAX_QP                      51
+#define MAX_MAX_QP                  69
 
 #define NOT_VALID                  -1
 
diff -r bca251133e70 -r 0d70188e80bc source/Lib/TLibCommon/TComBitStream.cpp
--- a/source/Lib/TLibCommon/TComBitStream.cpp	Sat Dec 14 23:26:14 2013 +0530
+++ b/source/Lib/TLibCommon/TComBitStream.cpp	Wed Jan 08 13:00:53 2014 -0600
@@ -184,21 +184,20 @@ void TComOutputBitstream::writeByteAlign
 
 int TComOutputBitstream::countStartCodeEmulations()
 {
-    uint32_t cnt = 0;
+    int numStartCodes = 0;
     uint8_t *rbsp = getFIFO();
     uint32_t fsize = getByteStreamLength();
 
-    for (uint32_t count = 0; count < fsize; count++)
+    for (uint32_t i = 0; i + 2 < fsize; i++)
     {
-        if ((rbsp[count + 2] == 0x00 || rbsp[count + 2] == 0x01 || rbsp[count + 2] == 0x02 || rbsp[count + 2] == 0x03)
-            && rbsp[count + 1] == 0x00 && rbsp[count] == 0x00)
+        if (!rbsp[i] && !rbsp[i + 1] && rbsp[i + 2] <= 3)
         {
-            cnt++;
-            count = count + 1;
+            numStartCodes++;
+            i++;
         }
     }
 
-    return cnt;
+    return numStartCodes;
 }
 
 void TComOutputBitstream::push_back(uint8_t val)
diff -r bca251133e70 -r 0d70188e80bc source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Sat Dec 14 23:26:14 2013 +0530
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Wed Jan 08 13:00:53 2014 -0600
@@ -464,6 +464,40 @@ void TComDataCU::initSubCU(TComDataCU* c
     m_cuColocated[1] = cu->getCUColocated(REF_PIC_LIST_1);
 }
 
+void TComDataCU::copyToSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth)
+{
+    assert(partUnitIdx < 4);
+
+    uint32_t partOffset = (cu->getTotalNumPart() >> 2) * partUnitIdx;
+
+    m_pic              = cu->getPic();
+    m_slice            = m_pic->getSlice();
+    m_cuAddr           = cu->getAddr();
+    m_absIdxInLCU      = cu->getZorderIdxInCU() + partOffset;
+
+    m_cuPelX           = cu->getCUPelX() + (g_maxCUWidth >> depth) * (partUnitIdx & 1);
+    m_cuPelY           = cu->getCUPelY() + (g_maxCUHeight >> depth) * (partUnitIdx >> 1);
+
+    m_totalCost        = MAX_INT64;
+    m_totalDistortion  = 0;
+    m_totalBits        = 0;
+    m_numPartitions    = cu->getTotalNumPart() >> 2;
+
+    TComDataCU* rpcCU = m_pic->getCU(m_cuAddr);
+    int iSizeInUchar  = sizeof(UChar) * m_numPartitions;
+    int sizeInChar  = sizeof(char) * m_numPartitions;
+
+    memcpy(m_skipFlag, rpcCU->getSkipFlag() + m_absIdxInLCU, sizeof(*m_skipFlag) * m_numPartitions);
+    memcpy(m_qp, rpcCU->getQP() + m_absIdxInLCU, sizeInChar);
+
+    memcpy(m_partSizes, rpcCU->getPartitionSize() + m_absIdxInLCU, sizeof(*m_partSizes) * m_numPartitions);
+    memcpy(m_predModes, rpcCU->getPredictionMode() + m_absIdxInLCU, sizeof(*m_predModes) * m_numPartitions);
+
+    memcpy(m_lumaIntraDir, rpcCU->getLumaIntraDir() + m_absIdxInLCU, iSizeInUchar);
+    memcpy(m_depth, rpcCU->getDepth() + m_absIdxInLCU, iSizeInUchar);
+    memcpy(m_width, rpcCU->getWidth() + m_absIdxInLCU, iSizeInUchar);
+    memcpy(m_height, rpcCU->getHeight() + m_absIdxInLCU, iSizeInUchar);
+}
 // --------------------------------------------------------------------------------------------------------------------
 // Copy
 // --------------------------------------------------------------------------------------------------------------------
@@ -603,6 +637,34 @@ void TComDataCU::copyToPic(UChar uhDepth
     memcpy(rpcCU->getPCMSampleCr() + tmp2, m_iPCMSampleCr, sizeof(Pel) * tmp);
 }
 
+void TComDataCU::copyCodedToPic(UChar depth)
+{
+    TComDataCU* rpcCU = m_pic->getCU(m_cuAddr);
+
+    int iSizeInUchar  = sizeof(UChar) * m_numPartitions;
+
+    memcpy(rpcCU->getSkipFlag() + m_absIdxInLCU, m_skipFlag, sizeof(*m_skipFlag) * m_numPartitions);
+    memcpy(rpcCU->getTransformIdx() + m_absIdxInLCU, m_trIdx, iSizeInUchar);


More information about the x265-commits mailing list