[x265-commits] [x265] cmake: icpc is unable to link cli to shared lib

Steve Borho steve at borho.org
Wed Mar 19 17:51:49 CET 2014


details:   http://hg.videolan.org/x265/rev/f58d9c3840a3
branches:  
changeset: 6548:f58d9c3840a3
user:      Steve Borho <steve at borho.org>
date:      Tue Mar 18 22:04:40 2014 -0500
description:
cmake: icpc is unable to link cli to shared lib
Subject: [x265] TComDataCU: add QP-independent initEstData

details:   http://hg.videolan.org/x265/rev/d566947b5493
branches:  
changeset: 6549:d566947b5493
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Wed Mar 19 15:31:43 2014 +0530
description:
TComDataCU: add QP-independent initEstData
Subject: [x265] TComDataCU: add QP-independent initSubCU

details:   http://hg.videolan.org/x265/rev/de4eb4d4bd01
branches:  
changeset: 6550:de4eb4d4bd01
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Wed Mar 19 16:13:03 2014 +0530
description:
TComDataCU: add QP-independent initSubCU
Subject: [x265] TEncCU: all SUbCUs will now copy QP array directly from parent CU, instead of resetting to qp(0).

details:   http://hg.videolan.org/x265/rev/648db5e86622
branches:  
changeset: 6551:648db5e86622
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Wed Mar 19 16:14:56 2014 +0530
description:
TEncCU: all SUbCUs will now copy QP array directly from parent CU, instead of resetting to qp(0).
Subject: [x265] TEncCU: further refine qp offsets

details:   http://hg.videolan.org/x265/rev/148553629f2a
branches:  
changeset: 6552:148553629f2a
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Wed Mar 19 20:18:09 2014 +0530
description:
TEncCU: further refine qp offsets
Subject: [x265] thread: add an incr() method to ThreadSafeInteger to avoid redundant locks

details:   http://hg.videolan.org/x265/rev/1b57d57ff2d9
branches:  
changeset: 6553:1b57d57ff2d9
user:      Steve Borho <steve at borho.org>
date:      Wed Mar 19 09:42:32 2014 -0500
description:
thread: add an incr() method to ThreadSafeInteger to avoid redundant locks
Subject: [x265] cmake: pkgconfig file must be installed in user-specified lib folder (refs #40)

details:   http://hg.videolan.org/x265/rev/ab9c23ebb527
branches:  
changeset: 6554:ab9c23ebb527
user:      Steve Borho <steve at borho.org>
date:      Wed Mar 19 10:12:57 2014 -0500
description:
cmake: pkgconfig file must be installed in user-specified lib folder (refs #40)
Subject: [x265] cmake: tabs to spaces

details:   http://hg.videolan.org/x265/rev/459c96998a62
branches:  
changeset: 6555:459c96998a62
user:      Steve Borho <steve at borho.org>
date:      Wed Mar 19 10:19:30 2014 -0500
description:
cmake: tabs to spaces
Subject: [x265] TEncBinCoderCABAC: fix MingGW build "declaration of 'byte' shadows a global declaration"

details:   http://hg.videolan.org/x265/rev/7bb421429129
branches:  
changeset: 6556:7bb421429129
user:      Gopu Govindaswamy
date:      Wed Mar 19 12:55:56 2014 +0530
description:
TEncBinCoderCABAC: fix MingGW build "declaration of 'byte' shadows a global declaration"
Subject: [x265] y4m: use ThreadSafeInteger to manage ring buffer

details:   http://hg.videolan.org/x265/rev/bbf6010764be
branches:  
changeset: 6557:bbf6010764be
user:      Steve Borho <steve at borho.org>
date:      Wed Mar 19 11:17:28 2014 -0500
description:
y4m: use ThreadSafeInteger to manage ring buffer
Subject: [x265] encoder: keep copy of input parameters (refs #43)

details:   http://hg.videolan.org/x265/rev/56a382eb1b72
branches:  
changeset: 6558:56a382eb1b72
user:      Steve Borho <steve at borho.org>
date:      Wed Mar 19 11:24:00 2014 -0500
description:
encoder: keep copy of input parameters (refs #43)

We do not want to allow the user to change the param used by the encoder during
the encode, nor do we want to suffer from cleanup ordering issues. We can't
crash if the user released the param struct they allocated prior to closing the
encoder
Subject: [x265] yuv: use ThreadSafeInteger to manage ring buffer

details:   http://hg.videolan.org/x265/rev/96d1d690d2ab
branches:  
changeset: 6559:96d1d690d2ab
user:      Steve Borho <steve at borho.org>
date:      Wed Mar 19 11:46:10 2014 -0500
description:
yuv: use ThreadSafeInteger to manage ring buffer

diffstat:

 source/CMakeLists.txt                        |    4 +-
 source/Lib/TLibCommon/TComDataCU.cpp         |  105 +++++++++++++++++++++++++++
 source/Lib/TLibCommon/TComDataCU.h           |    2 +
 source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp |    8 +-
 source/Lib/TLibEncoder/TEncCu.cpp            |   13 +-
 source/common/threading.h                    |   16 ++++
 source/encoder/api.cpp                       |    8 ++
 source/encoder/encoder.cpp                   |    4 +-
 source/encoder/framefilter.cpp               |    2 +-
 source/input/y4m.cpp                         |   41 ++++++---
 source/input/y4m.h                           |    8 +-
 source/input/yuv.cpp                         |   41 ++++++----
 source/input/yuv.h                           |    8 +-
 13 files changed, 201 insertions(+), 59 deletions(-)

diffs (truncated from 574 to 300 lines):

diff -r 45af76338c8e -r 96d1d690d2ab source/CMakeLists.txt
--- a/source/CMakeLists.txt	Tue Mar 18 21:35:37 2014 -0500
+++ b/source/CMakeLists.txt	Wed Mar 19 11:46:10 2014 -0500
@@ -303,7 +303,7 @@ if(X265_LATEST_TAG)
     # 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")
+            DESTINATION "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/pkgconfig")
 endif()
 
 if(NOT WIN32)
@@ -337,7 +337,7 @@ if(ENABLE_CLI)
                            $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${YASM_OBJS} ${YASM_SRCS})
     else()
         add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} ${X265_RC_FILE} x265.cpp x265.h)
-        if(WIN32 OR NOT ENABLE_SHARED)
+        if(WIN32 OR NOT ENABLE_SHARED OR INTEL_CXX)
             # The CLI cannot link to the shared library on Windows, it
             # requires internal APIs not exported from the DLL
             target_link_libraries(cli x265-static ${PLATFORM_LIBS})
diff -r 45af76338c8e -r 96d1d690d2ab source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Tue Mar 18 21:35:37 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Wed Mar 19 11:46:10 2014 -0500
@@ -359,6 +359,41 @@ void TComDataCU::initEstData(uint32_t de
     m_cuMvField[1].clearMvField();
 }
 
+void TComDataCU::initEstData(uint32_t depth)
+{
+    m_totalCost        = MAX_INT64;
+    m_sa8dCost         = MAX_INT64;
+    m_totalDistortion  = 0;
+    m_totalBits        = 0;
+
+    UChar cuSize = g_maxCUSize >> depth;
+
+    for (uint32_t i = 0; i < m_numPartitions; i++)
+    {
+        m_depth[i] = depth;
+        m_cuSize[i] = cuSize;
+        m_trIdx[i] = 0;
+        m_transformSkip[0][i] = 0;
+        m_transformSkip[1][i] = 0;
+        m_transformSkip[2][i] = 0;
+        m_skipFlag[i]   = false;
+        m_partSizes[i] = SIZE_NONE;
+        m_predModes[i] = MODE_NONE;
+        m_cuTransquantBypass[i] = false;
+        m_iPCMFlags[i] = 0;
+        m_bMergeFlags[i] = 0;
+        m_lumaIntraDir[i] = DC_IDX;
+        m_chromaIntraDir[i] = 0;
+        m_interDir[i] = 0;
+        m_cbf[0][i] = 0;
+        m_cbf[1][i] = 0;
+        m_cbf[2][i] = 0;
+    }
+
+    m_cuMvField[0].clearMvField();
+    m_cuMvField[1].clearMvField();
+}
+
 // initialize Sub partition
 void TComDataCU::initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth, int qp)
 {
@@ -428,6 +463,76 @@ void TComDataCU::initSubCU(TComDataCU* c
     m_cuColocated[1] = cu->getCUColocated(REF_PIC_LIST_1);
 }
 
+// initialize Sub partition
+void TComDataCU::initSubCU(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_maxCUSize >> depth) * (partUnitIdx &  1);
+    m_cuPelY           = cu->getCUPelY() + (g_maxCUSize >> depth) * (partUnitIdx >> 1);
+
+    m_totalCost        = MAX_INT64;
+    m_sa8dCost         = MAX_INT64;
+    m_totalDistortion  = 0;
+    m_totalBits        = 0;
+    m_numPartitions    = cu->getTotalNumPart() >> 2;
+
+    for (int i = 0; i < 4; i++)
+    {
+        m_avgCost[i] = cu->m_avgCost[i];
+        m_count[i] = cu->m_count[i];
+    }
+
+    int iSizeInUchar = sizeof(UChar) * m_numPartitions;
+    int iSizeInBool  = sizeof(bool) * m_numPartitions;
+
+    int sizeInChar = sizeof(char) * m_numPartitions;
+
+    memcpy(m_qp, cu->getQP() + partOffset, sizeInChar);
+    memset(m_bMergeFlags,     0, iSizeInBool);
+    memset(m_lumaIntraDir,    DC_IDX, iSizeInUchar);
+    memset(m_chromaIntraDir,  0, iSizeInUchar);
+    memset(m_interDir,        0, iSizeInUchar);
+    memset(m_trIdx,           0, iSizeInUchar);
+    memset(m_transformSkip[0], 0, iSizeInUchar);
+    memset(m_transformSkip[1], 0, iSizeInUchar);
+    memset(m_transformSkip[2], 0, iSizeInUchar);
+    memset(m_cbf[0],          0, iSizeInUchar);
+    memset(m_cbf[1],          0, iSizeInUchar);
+    memset(m_cbf[2],          0, iSizeInUchar);
+    memset(m_depth, depth, iSizeInUchar);
+
+    UChar cuSize = g_maxCUSize >> depth;
+    memset(m_cuSize,    cuSize,  iSizeInUchar);
+    memset(m_iPCMFlags, 0, iSizeInBool);
+    for (uint32_t i = 0; i < m_numPartitions; i++)
+    {
+        m_skipFlag[i]   = false;
+        m_partSizes[i] = SIZE_NONE;
+        m_predModes[i] = MODE_NONE;
+        m_cuTransquantBypass[i] = false;
+    }
+
+    m_cuMvField[0].clearMvField();
+    m_cuMvField[1].clearMvField();
+
+    m_cuLeft        = cu->getCULeft();
+    m_cuAbove       = cu->getCUAbove();
+    m_cuAboveLeft   = cu->getCUAboveLeft();
+    m_cuAboveRight  = cu->getCUAboveRight();
+
+    m_cuColocated[0] = cu->getCUColocated(REF_PIC_LIST_0);
+    m_cuColocated[1] = cu->getCUColocated(REF_PIC_LIST_1);
+}
+
+
 void TComDataCU::copyToSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth)
 {
     assert(partUnitIdx < 4);
diff -r 45af76338c8e -r 96d1d690d2ab source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Tue Mar 18 21:35:37 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.h	Wed Mar 19 11:46:10 2014 -0500
@@ -185,7 +185,9 @@ public:
     void          destroy();
 
     void          initCU(TComPic* pic, uint32_t cuAddr);
+    void          initEstData(uint32_t depth);
     void          initEstData(uint32_t depth, int qp);
+    void          initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth);
     void          initSubCU(TComDataCU* cu, uint32_t partUnitIdx, uint32_t depth, int qp);
 
     void          copyToSubCU(TComDataCU* lcu, uint32_t partUnitIdx, uint32_t depth);
diff -r 45af76338c8e -r 96d1d690d2ab source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp
--- a/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp	Tue Mar 18 21:35:37 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp	Wed Mar 19 11:46:10 2014 -0500
@@ -358,14 +358,14 @@ void TEncBinCABAC::writeOut()
         if (m_numBufferedBytes > 0)
         {
             uint32_t carry = leadByte >> 8;
-            uint32_t byte = m_bufferedByte + carry;
+            uint32_t byteTowrite = m_bufferedByte + carry;
             m_bufferedByte = leadByte & 0xff;
-            m_bitIf->writeByte(byte);
+            m_bitIf->writeByte(byteTowrite);
 
-            byte = (0xff + carry) & 0xff;
+            byteTowrite = (0xff + carry) & 0xff;
             while (m_numBufferedBytes > 1)
             {
-                m_bitIf->writeByte(byte);
+                m_bitIf->writeByte(byteTowrite);
                 m_numBufferedBytes--;
             }
         }
diff -r 45af76338c8e -r 96d1d690d2ab source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp	Tue Mar 18 21:35:37 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncCu.cpp	Wed Mar 19 11:46:10 2014 -0500
@@ -579,8 +579,7 @@ void TEncCu::xCompressIntraCU(TComDataCU
     uint32_t rpelx = lpelx + outBestCU->getCUSize(0) - 1;
     uint32_t tpelx = outBestCU->getCUPelY();
     uint32_t bpely = tpelx + outBestCU->getCUSize(0) - 1;
-    int qp = outTempCU->getQP(0);
-
+    
     // If slice start or slice end is within this cu...
     TComSlice * slice = outTempCU->getPic()->getSlice();
     bool bSliceEnd = (slice->getSliceCurEndCUAddr() > outTempCU->getSCUAddr() && slice->getSliceCurEndCUAddr() < outTempCU->getSCUAddr() + outTempCU->getTotalNumPart());
@@ -594,10 +593,10 @@ void TEncCu::xCompressIntraCU(TComDataCU
     //We need to split; so dont try these modes
     if (!bSliceEnd && bInsidePicture)
     {
-        outTempCU->initEstData(depth, qp);
+        outTempCU->initEstData(depth);
 
         xCheckRDCostIntra(outBestCU, outTempCU, SIZE_2Nx2N);
-        outTempCU->initEstData(depth, qp);
+        outTempCU->initEstData(depth);
 
         if (depth == g_maxCUDepth - g_addCUDepth)
         {
@@ -623,7 +622,7 @@ void TEncCu::xCompressIntraCU(TComDataCU
         bBoundary = true;
     }
 
-    outTempCU->initEstData(depth, qp);
+    outTempCU->initEstData(depth);
 
     // further split
     if (bSubBranch && depth < g_maxCUDepth - g_addCUDepth)
@@ -633,8 +632,8 @@ void TEncCu::xCompressIntraCU(TComDataCU
             subBestPartCU[partUnitIdx]     = m_bestCU[nextDepth];
             subTempPartCU[partUnitIdx]     = m_tempCU[nextDepth];
 
-            subBestPartCU[partUnitIdx]->initSubCU(outTempCU, partUnitIdx, nextDepth, qp);     // clear sub partition datas or init.
-            subTempPartCU[partUnitIdx]->initSubCU(outTempCU, partUnitIdx, nextDepth, qp);     // clear sub partition datas or init.
+            subBestPartCU[partUnitIdx]->initSubCU(outTempCU, partUnitIdx, nextDepth);     // clear sub partition datas or init.
+            subTempPartCU[partUnitIdx]->initSubCU(outTempCU, partUnitIdx, nextDepth);     // clear sub partition datas or init.
 
             bool bInSlice = subBestPartCU[partUnitIdx]->getSCUAddr() < slice->getSliceCurEndCUAddr();
             if (bInSlice && (subBestPartCU[partUnitIdx]->getCUPelX() < slice->getSPS()->getPicWidthInLumaSamples()) && (subBestPartCU[partUnitIdx]->getCUPelY() < slice->getSPS()->getPicHeightInLumaSamples()))
diff -r 45af76338c8e -r 96d1d690d2ab source/common/threading.h
--- a/source/common/threading.h	Tue Mar 18 21:35:37 2014 -0500
+++ b/source/common/threading.h	Wed Mar 19 11:46:10 2014 -0500
@@ -250,6 +250,14 @@ public:
         LeaveCriticalSection(&m_cs);
     }
 
+    void incr()
+    {
+        EnterCriticalSection(&m_cs);
+        m_val++;
+        WakeAllConditionVariable(&m_cv);
+        LeaveCriticalSection(&m_cs);
+    }
+
 protected:
 
     CRITICAL_SECTION   m_cs;
@@ -418,6 +426,14 @@ public:
         pthread_mutex_unlock(&m_mutex);
     }
 
+    void incr()
+    {
+        pthread_mutex_lock(&m_mutex);
+        m_val++;
+        pthread_cond_broadcast(&m_cond);
+        pthread_mutex_unlock(&m_mutex);
+    }
+
 protected:
 
     pthread_mutex_t m_mutex;
diff -r 45af76338c8e -r 96d1d690d2ab source/encoder/api.cpp
--- a/source/encoder/api.cpp	Tue Mar 18 21:35:37 2014 -0500
+++ b/source/encoder/api.cpp	Wed Mar 19 11:46:10 2014 -0500
@@ -49,6 +49,14 @@ x265_encoder *x265_encoder_open(x265_par
         encoder->determineLevelAndProfile(param);
         encoder->configure(param);
 
+        encoder->param = X265_MALLOC(x265_param, 1);
+        if (!encoder->param)
+        {
+            encoder->destroy();
+            return NULL;
+        }
+
+        memcpy(encoder->param, param, sizeof(x265_param));
         x265_print_params(param);
         encoder->create();
         encoder->init();
diff -r 45af76338c8e -r 96d1d690d2ab source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Tue Mar 18 21:35:37 2014 -0500
+++ b/source/encoder/encoder.cpp	Wed Mar 19 11:46:10 2014 -0500
@@ -68,6 +68,7 @@ Encoder::Encoder()
     m_packetData = NULL;
     m_outputCount = 0;
     m_csvfpt = NULL;
+    param = NULL;
 
 #if ENC_DEC_TRACE
     g_hTrace = fopen("TraceEnc.txt", "wb");
@@ -165,6 +166,7 @@ void Encoder::destroy()
 
     X265_FREE(m_nals);
     X265_FREE(m_packetData);
+    X265_FREE(param);
     if (m_csvfpt)
         fclose(m_csvfpt);
 }
@@ -1510,8 +1512,6 @@ void Encoder::configure(x265_param *p)
     m_useLossless = false;  // x264 configures this via --qp=0
     m_TransquantBypassEnableFlag = false;
     m_CUTransquantBypassFlagValue = false;
-
-    param = p;


More information about the x265-commits mailing list