[x265-commits] [x265] TComWeightPrediction: add braces to prevent errors for an...

Deepthi Nandakumar deepthi at multicorewareinc.com
Mon Jul 21 23:53:55 CEST 2014


details:   http://hg.videolan.org/x265/rev/a30e3bd53959
branches:  
changeset: 7489:a30e3bd53959
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Mon Jul 21 22:12:28 2014 +0530
description:
TComWeightPrediction: add braces to prevent errors for an optional else statement
Subject: [x265] TComWeightPrediction: initialising pointers to NULL

details:   http://hg.videolan.org/x265/rev/aa651ea5673c
branches:  
changeset: 7490:aa651ea5673c
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Mon Jul 21 22:19:26 2014 +0530
description:
TComWeightPrediction: initialising pointers to NULL

getWPScaling will assign appropriate weight pred tables to these.
Subject: [x265] scan order tables

details:   http://hg.videolan.org/x265/rev/88310701f857
branches:  
changeset: 7491:88310701f857
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Sat Jul 19 20:17:40 2014 +0900
description:
scan order tables
Subject: [x265] trquant: store QpParam for each component

details:   http://hg.videolan.org/x265/rev/4d2c3d09e836
branches:  
changeset: 7492:4d2c3d09e836
user:      Satoshi Nakagawa <nakagawa424 at oki.com>
date:      Mon Jul 21 10:24:02 2014 +0900
description:
trquant: store QpParam for each component
Subject: [x265] rc: add 2 pass logic in rateEstimateQscale

details:   http://hg.videolan.org/x265/rev/0461e091a7b5
branches:  
changeset: 7493:0461e091a7b5
user:      Aarthi Thirumalai
date:      Fri Jul 18 17:19:20 2014 +0530
description:
rc: add 2 pass logic in rateEstimateQscale
Subject: [x265] rc: fix sliceType of 2nd pass from prev pass stats

details:   http://hg.videolan.org/x265/rev/1b2fbf3208ca
branches:  
changeset: 7494:1b2fbf3208ca
user:      Aarthi Thirumalai
date:      Fri Jul 18 17:22:24 2014 +0530
description:
rc: fix sliceType of 2nd pass from prev pass stats

avoid doing sliceAnalyse in lookahead for 2nd pass
Subject: [x265] rc: generate cutree offsets for 2nd pass from stats

details:   http://hg.videolan.org/x265/rev/2f87f3c24b4a
branches:  
changeset: 7495:2f87f3c24b4a
user:      Aarthi Thirumalai
date:      Fri Jul 18 11:01:33 2014 +0530
description:
rc: generate cutree offsets for 2nd pass from stats
Subject: [x265] rc: fix warnings in ratecontrol

details:   http://hg.videolan.org/x265/rev/3801142d080d
branches:  
changeset: 7496:3801142d080d
user:      Aarthi Thirumalai
date:      Mon Jul 21 12:14:09 2014 +0530
description:
rc: fix warnings in ratecontrol
Subject: [x265] rc: prevent deadlock on encoder flush or close

details:   http://hg.videolan.org/x265/rev/a2fd8a71de61
branches:  
changeset: 7497:a2fd8a71de61
user:      Steve Borho <steve at borho.org>
date:      Mon Jul 21 15:12:32 2014 -0500
description:
rc: prevent deadlock on encoder flush or close

1. add a terminate() function to unblock any blocked rate control methods
2. never block if the order ordinal is already above the required ordinal
3. simulate start events when encoder is flushing

Without these changes, closing the encoder without flushing (CTRL+C in the CLI)
or encoding fewer frames than frame encoders (-F8 -f4) could cause deadlocks
Subject: [x265] cmake: only create SONAME shared lib on POSIX systems (closes #62)

details:   http://hg.videolan.org/x265/rev/80c1d35e5517
branches:  
changeset: 7498:80c1d35e5517
user:      Steve Borho <steve at borho.org>
date:      Mon Jul 21 16:39:16 2014 -0500
description:
cmake: only create SONAME shared lib on POSIX systems (closes #62)

diffstat:

 source/CMakeLists.txt                          |   11 +-
 source/Lib/TLibCommon/TComLoopFilter.cpp       |   39 +-
 source/Lib/TLibCommon/TComRom.cpp              |  264 ++++++---------
 source/Lib/TLibCommon/TComRom.h                |   10 +-
 source/Lib/TLibCommon/TComTrQuant.cpp          |   67 ++-
 source/Lib/TLibCommon/TComTrQuant.h            |   51 +-
 source/Lib/TLibCommon/TComWeightPrediction.cpp |    6 +-
 source/Lib/TLibCommon/TypeDef.h                |   21 +-
 source/Lib/TLibEncoder/TEncSearch.cpp          |   55 +---
 source/encoder/analysis.cpp                    |   10 +-
 source/encoder/encoder.cpp                     |   33 +-
 source/encoder/encoder.h                       |    1 +
 source/encoder/entropy.cpp                     |    2 +-
 source/encoder/ratecontrol.cpp                 |  405 +++++++++++++++++++-----
 source/encoder/ratecontrol.h                   |   14 +-
 source/encoder/slicetype.cpp                   |   16 +-
 source/encoder/slicetype.h                     |    4 +-
 17 files changed, 592 insertions(+), 417 deletions(-)

diffs (truncated from 1916 to 300 lines):

diff -r eb983d29c11a -r 80c1d35e5517 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Thu Jul 17 09:29:39 2014 +0200
+++ b/source/CMakeLists.txt	Mon Jul 21 16:39:16 2014 -0500
@@ -276,13 +276,18 @@ if(ENABLE_SHARED)
     else()
         set_target_properties(x265-shared PROPERTIES OUTPUT_NAME x265)
     endif()
-    if(UNIX AND NOT APPLE)
-        set_target_properties(x265-shared PROPERTIES LINK_FLAGS "-Wl,-Bsymbolic,-znoexecstack")
+	if(UNIX)
+		set_target_properties(x265-shared PROPERTIES VERSION ${X265_BUILD})
+        if(NOT APPLE)
+            set_target_properties(x265-shared PROPERTIES LINK_FLAGS "-Wl,-Bsymbolic,-znoexecstack")
+        endif()
     endif()
     set_target_properties(x265-shared PROPERTIES SOVERSION ${X265_BUILD})
     if(X265_LATEST_TAG)
+		if(WINDOWS)
+			set_target_properties(x265-shared PROPERTIES VERSION ${X265_LATEST_TAG})
+		endif()
         # shared library is not installed if a tag is not found
-        set_target_properties(x265-shared PROPERTIES VERSION ${X265_LATEST_TAG})
         install(TARGETS x265-shared
                 LIBRARY DESTINATION ${LIB_INSTALL_DIR}
                 ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
diff -r eb983d29c11a -r 80c1d35e5517 source/Lib/TLibCommon/TComLoopFilter.cpp
--- a/source/Lib/TLibCommon/TComLoopFilter.cpp	Thu Jul 17 09:29:39 2014 +0200
+++ b/source/Lib/TLibCommon/TComLoopFilter.cpp	Mon Jul 21 16:39:16 2014 -0500
@@ -48,7 +48,6 @@ using namespace x265;
 // ====================================================================================================================
 // Constants
 // ====================================================================================================================
-#define QpUV(iQpY, chFmt)  (((iQpY) < 0) ? (iQpY) : (((iQpY) > 57) ? ((iQpY) - 6) : g_chromaScale[chFmt][(iQpY)]))
 #define DEFAULT_INTRA_TC_OFFSET 2 ///< Default intra TC offset
 
 // ====================================================================================================================
@@ -441,9 +440,6 @@ void TComLoopFilter::xEdgeFilterLuma(TCo
     pixel* tmpsrc = src;
 
     int stride = reconYuv->getStride();
-    int qp = 0;
-    int qpP = 0;
-    int qpQ = 0;
     uint32_t numParts = cu->m_pic->getNumPartInCUSize() >> depth;
 
     uint32_t log2UnitSize = g_log2UnitSize;
@@ -457,8 +453,8 @@ void TComLoopFilter::xEdgeFilterLuma(TCo
     uint32_t  partQ = 0;
     TComDataCU* cuP = cu;
     TComDataCU* cuQ = cu;
-    int  betaOffsetDiv2 = cuQ->m_slice->m_pps->deblockingFilterBetaOffsetDiv2;
-    int  tcOffsetDiv2 = cuQ->m_slice->m_pps->deblockingFilterTcOffsetDiv2;
+    int  betaOffset = cuQ->m_slice->m_pps->deblockingFilterBetaOffsetDiv2 << 1;
+    int  tcOffset = cuQ->m_slice->m_pps->deblockingFilterTcOffsetDiv2 << 1;
 
     if (dir == EDGE_VER)
     {
@@ -480,7 +476,7 @@ void TComLoopFilter::xEdgeFilterLuma(TCo
         bs = blockingStrength[bsAbsIdx];
         if (bs)
         {
-            qpQ = cu->getQP(bsAbsIdx);
+            int qpQ = cu->getQP(bsAbsIdx);
             partQ = bsAbsIdx;
             // Derive neighboring PU index
             if (dir == EDGE_VER)
@@ -492,12 +488,12 @@ void TComLoopFilter::xEdgeFilterLuma(TCo
                 cuP = cuQ->getPUAbove(partP, partQ);
             }
 
-            qpP = cuP->getQP(partP);
-            qp = (qpP + qpQ + 1) >> 1;
+            int qpP = cuP->getQP(partP);
+            int qp = (qpP + qpQ + 1) >> 1;
             int bitdepthScale = 1 << (X265_DEPTH - 8);
 
-            int indexTC = Clip3(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, int(qp + DEFAULT_INTRA_TC_OFFSET * (bs - 1) + (tcOffsetDiv2 << 1)));
-            int indexB = Clip3(0, MAX_QP, qp + (betaOffsetDiv2 << 1));
+            int indexTC = Clip3(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, int(qp + DEFAULT_INTRA_TC_OFFSET * (bs - 1) + tcOffset));
+            int indexB = Clip3(0, MAX_QP, qp + betaOffset);
 
             int tc =  sm_tcTable[indexTC] * bitdepthScale;
             int beta = sm_betaTable[indexB] * bitdepthScale;
@@ -544,13 +540,11 @@ void TComLoopFilter::xEdgeFilterLuma(TCo
 
 void TComLoopFilter::xEdgeFilterChroma(TComDataCU* cu, uint32_t absZOrderIdx, uint32_t depth, int dir, int edge, uint8_t blockingStrength[])
 {
+    int chFmt = cu->getChromaFormat();
     TComPicYuv* reconYuv = cu->m_pic->getPicYuvRec();
     int stride = reconYuv->getCStride();
     pixel* srcCb = reconYuv->getCbAddr(cu->getAddr(), absZOrderIdx);
     pixel* srcCr = reconYuv->getCrAddr(cu->getAddr(), absZOrderIdx);
-    int qp = 0;
-    int qpP = 0;
-    int qpQ = 0;
     uint32_t log2UnitSizeH = g_log2UnitSize - cu->getHorzChromaShift();
     uint32_t log2UnitSizeV = g_log2UnitSize - cu->getVertChromaShift();
     uint32_t unitSizeChromaH = 1 << log2UnitSizeH;
@@ -565,7 +559,7 @@ void TComLoopFilter::xEdgeFilterChroma(T
     uint32_t  partQ;
     TComDataCU* cuP;
     TComDataCU* cuQ = cu;
-    int tcOffsetDiv2 = cu->m_slice->m_pps->deblockingFilterTcOffsetDiv2;
+    int tcOffset = cu->m_slice->m_pps->deblockingFilterTcOffsetDiv2 << 1;
 
     // Vertical Position
     uint32_t edgeNumInLCUVert = g_zscanToRaster[absZOrderIdx] % lcuWidthInBaseUnits + edge;
@@ -611,7 +605,7 @@ void TComLoopFilter::xEdgeFilterChroma(T
 
         if (bs > 1)
         {
-            qpQ = cu->getQP(bsAbsIdx);
+            int qpQ = cu->getQP(bsAbsIdx);
             partQ = bsAbsIdx;
             // Derive neighboring PU index
             if (dir == EDGE_VER)
@@ -623,7 +617,7 @@ void TComLoopFilter::xEdgeFilterChroma(T
                 cuP = cuQ->getPUAbove(partP, partQ);
             }
 
-            qpP = cuP->getQP(partP);
+            int qpP = cuP->getQP(partP);
 
             if (cu->m_slice->m_pps->bTransquantBypassEnabled)
             {
@@ -636,10 +630,17 @@ void TComLoopFilter::xEdgeFilterChroma(T
             {
                 int chromaQPOffset  = (chromaIdx == 0) ? cu->m_slice->m_pps->chromaCbQpOffset : cu->m_slice->m_pps->chromaCrQpOffset;
                 pixel* piTmpSrcChroma = (chromaIdx == 0) ? tmpSrcCb : tmpSrcCr;
-                qp = QpUV((((qpP + qpQ + 1) >> 1) + chromaQPOffset), cu->getChromaFormat());
+                int qp = ((qpP + qpQ + 1) >> 1) + chromaQPOffset;
+                if (qp >= 30)
+                {
+                    if (chFmt == CHROMA_420)
+                        qp = g_chromaScale[qp];
+                    else
+                        qp = X265_MIN(qp, 51);
+                }
                 int iBitdepthScale = 1 << (X265_DEPTH - 8);
 
-                int iIndexTC = Clip3(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, qp + DEFAULT_INTRA_TC_OFFSET * (bs - 1) + (tcOffsetDiv2 << 1));
+                int iIndexTC = Clip3(0, MAX_QP + DEFAULT_INTRA_TC_OFFSET, qp + DEFAULT_INTRA_TC_OFFSET * (bs - 1) + tcOffset);
                 int iTc =  sm_tcTable[iIndexTC] * iBitdepthScale;
 
                 for (uint32_t uiStep = 0; uiStep < loopLength; uiStep++)
diff -r eb983d29c11a -r 80c1d35e5517 source/Lib/TLibCommon/TComRom.cpp
--- a/source/Lib/TLibCommon/TComRom.cpp	Thu Jul 17 09:29:39 2014 +0200
+++ b/source/Lib/TLibCommon/TComRom.cpp	Mon Jul 21 16:39:16 2014 -0500
@@ -42,86 +42,6 @@
 namespace x265 {
 //! \ingroup TLibCommon
 //! \{
-// scanning order table
-uint16_t* g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_LOG2_TR_SIZE + 1];
-
-class ScanGenerator
-{
-private:
-
-    uint32_t m_line, m_column;
-    uint32_t m_blockWidth, m_blockHeight;
-    uint32_t m_stride;
-    COEFF_SCAN_TYPE m_scanType;
-
-public:
-
-    ScanGenerator(uint32_t blockWidth, uint32_t blockHeight, uint32_t stride, COEFF_SCAN_TYPE scanType)
-        : m_line(0), m_column(0), m_blockWidth(blockWidth), m_blockHeight(blockHeight), m_stride(stride), m_scanType(scanType)
-    { }
-
-    uint32_t GetCurrentX() const { return m_column; }
-
-    uint32_t GetCurrentY() const { return m_line; }
-
-    uint32_t GetNextIndex(uint32_t blockOffsetX, uint32_t blockOffsetY)
-    {
-        int rtn = ((m_line + blockOffsetY) * m_stride) + m_column + blockOffsetX;
-
-        //advance line and column to the next position
-        switch (m_scanType)
-        {
-        case SCAN_DIAG:
-        {
-            if ((m_column == (m_blockWidth - 1)) || (m_line == 0))     //if we reach the end of a rank, go diagonally down to the next one
-            {
-                m_line   += m_column + 1;
-                m_column  = 0;
-
-                if (m_line >= m_blockHeight)     //if that takes us outside the block, adjust so that we are back on the bottom row
-                {
-                    m_column += m_line - (m_blockHeight - 1);
-                    m_line    = m_blockHeight - 1;
-                }
-            }
-            else
-            {
-                m_column++;
-                m_line--;
-            }
-        }
-        break;
-
-        case SCAN_HOR:
-        {
-            if (m_column == (m_blockWidth - 1))
-            {
-                m_line++;
-                m_column = 0;
-            }
-            else m_column++;
-        }
-        break;
-
-        case SCAN_VER:
-        {
-            if (m_line == (m_blockHeight - 1))
-            {
-                m_column++;
-                m_line = 0;
-            }
-            else m_line++;
-        }
-        break;
-
-        default:
-            X265_CHECK(0, "ERROR: Unknown scan type %d in ScanGenerator::GetNextIndex", m_scanType);
-        break;
-        }
-
-        return rtn;
-    }
-};
 
 // lambda = pow(2, (double)q / 6 - 2);
 double x265_lambda_tab[MAX_MAX_QP + 1] =
@@ -190,81 +110,12 @@ void initROM()
         g_convertToBit[i] = c;
         c++;
     }
-
-    // initialise scan orders
-    for (uint32_t log2BlockSize = 0; log2BlockSize <= MAX_LOG2_TR_SIZE; log2BlockSize++)
-    {
-        const uint32_t blockWidth  = 1 << log2BlockSize;
-        const uint32_t blockHeight = 1 << log2BlockSize;
-        const uint32_t totalValues = blockWidth * blockHeight;
-        //non-grouped scan orders
-        for (uint32_t scanTypeIndex = 0; scanTypeIndex < SCAN_NUMBER_OF_TYPES; scanTypeIndex++)
-        {
-            const COEFF_SCAN_TYPE scanType = COEFF_SCAN_TYPE(scanTypeIndex);
-            g_scanOrder[SCAN_UNGROUPED][scanType][log2BlockSize] = X265_MALLOC(uint16_t, totalValues);
-            ScanGenerator fullBlockScan(blockWidth, blockHeight, blockWidth, scanType);
-
-            for (uint32_t scanPosition = 0; scanPosition < totalValues; scanPosition++)
-            {
-                g_scanOrder[SCAN_UNGROUPED][scanType][log2BlockSize][scanPosition] = fullBlockScan.GetNextIndex(0, 0);
-            }
-        }
-
-        //grouped scan orders
-        const uint32_t  groupWidth           = 1 << MLS_CG_LOG2_SIZE;
-        const uint32_t  groupHeight          = 1 << MLS_CG_LOG2_SIZE;
-        const uint32_t  widthInGroups        = blockWidth  >> MLS_CG_LOG2_SIZE;
-        const uint32_t  heightInGroups       = blockHeight >> MLS_CG_LOG2_SIZE;
-
-        const uint32_t  groupSize            = groupWidth    * groupHeight;
-        const uint32_t  totalGroups          = widthInGroups * heightInGroups;
-
-        for (uint32_t scanTypeIndex = 0; scanTypeIndex < SCAN_NUMBER_OF_TYPES; scanTypeIndex++)
-        {
-            const COEFF_SCAN_TYPE scanType = COEFF_SCAN_TYPE(scanTypeIndex);
-
-            g_scanOrder[SCAN_GROUPED_4x4][scanType][log2BlockSize] = X265_MALLOC(uint16_t, totalValues);
-
-            ScanGenerator fullBlockScan(widthInGroups, heightInGroups, groupWidth, scanType);
-
-            for (uint32_t groupIndex = 0; groupIndex < totalGroups; groupIndex++)
-            {
-                const uint32_t groupPositionY  = fullBlockScan.GetCurrentY();
-                const uint32_t groupPositionX  = fullBlockScan.GetCurrentX();
-                const uint32_t groupOffsetX    = groupPositionX * groupWidth;
-                const uint32_t groupOffsetY    = groupPositionY * groupHeight;
-                const uint32_t groupOffsetScan = groupIndex     * groupSize;
-
-                ScanGenerator groupScan(groupWidth, groupHeight, blockWidth, scanType);
-
-                for (uint32_t scanPosition = 0; scanPosition < groupSize; scanPosition++)
-                {
-                    g_scanOrder[SCAN_GROUPED_4x4][scanType][log2BlockSize][groupOffsetScan + scanPosition] = groupScan.GetNextIndex(groupOffsetX, groupOffsetY);
-                }
-
-                fullBlockScan.GetNextIndex(0, 0);
-            }
-        }
-
-        //--------------------------------------------------------------------------------------------------
-    }
 }
 
 void destroyROM()


More information about the x265-commits mailing list