[x265-commits] [x265] move PPS, SPS, Slice and ScalingList to common/

Steve Borho steve at borho.org
Fri Jul 18 09:04:24 CEST 2014


details:   http://hg.videolan.org/x265/rev/f04c98f33ca5
branches:  
changeset: 7479:f04c98f33ca5
user:      Steve Borho <steve at borho.org>
date:      Fri Jul 18 01:36:23 2014 -0500
description:
move PPS, SPS, Slice and ScalingList to common/
Subject: [x265] picsym: remove getSlice()

details:   http://hg.videolan.org/x265/rev/821c875b2d39
branches:  
changeset: 7480:821c875b2d39
user:      Steve Borho <steve at borho.org>
date:      Fri Jul 18 01:39:15 2014 -0500
description:
picsym: remove getSlice()
Subject: [x265] frame,cu: remove getSlice()

details:   http://hg.videolan.org/x265/rev/ea61fd838115
branches:  
changeset: 7481:ea61fd838115
user:      Steve Borho <steve at borho.org>
date:      Fri Jul 18 01:58:54 2014 -0500
description:
frame,cu: remove getSlice()
Subject: [x265] a copy of POC is cached in the Frame struct

details:   http://hg.videolan.org/x265/rev/e4199c04d78d
branches:  
changeset: 7482:e4199c04d78d
user:      Steve Borho <steve at borho.org>
date:      Fri Jul 18 02:00:19 2014 -0500
description:
a copy of POC is cached in the Frame struct

diffstat:

 source/Lib/TLibCommon/TComDataCU.cpp                |   58 +-
 source/Lib/TLibCommon/TComDataCU.h                  |    8 +-
 source/Lib/TLibCommon/TComLoopFilter.cpp            |   27 +-
 source/Lib/TLibCommon/TComPattern.cpp               |    4 +-
 source/Lib/TLibCommon/TComPicSym.cpp                |    2 +-
 source/Lib/TLibCommon/TComPicSym.h                  |   10 +-
 source/Lib/TLibCommon/TComPrediction.cpp            |   38 +-
 source/Lib/TLibCommon/TComRom.cpp                   |    3 -
 source/Lib/TLibCommon/TComRom.h                     |   19 -
 source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp  |    4 +-
 source/Lib/TLibCommon/TComSlice.cpp                 |  379 -------------------
 source/Lib/TLibCommon/TComSlice.h                   |  397 --------------------
 source/Lib/TLibCommon/TComTrQuant.cpp               |   38 +-
 source/Lib/TLibCommon/TComTrQuant.h                 |   12 +-
 source/Lib/TLibCommon/TComWeightPrediction.cpp      |    8 +-
 source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp |    2 +-
 source/Lib/TLibEncoder/TEncSearch.cpp               |  120 +++---
 source/common/CMakeLists.txt                        |    3 +-
 source/common/common.cpp                            |    4 +-
 source/common/frame.h                               |    2 -
 source/common/param.cpp                             |    3 +-
 source/common/slice.cpp                             |  346 +++++++++++++++++
 source/common/slice.h                               |  378 +++++++++++++++++++
 source/encoder/analysis.cpp                         |   46 +-
 source/encoder/cturow.h                             |    2 +-
 source/encoder/dpb.cpp                              |   46 +-
 source/encoder/dpb.h                                |    2 +-
 source/encoder/encoder.cpp                          |   39 +-
 source/encoder/encoder.h                            |   16 +-
 source/encoder/entropy.cpp                          |   90 ++--
 source/encoder/entropy.h                            |   28 +-
 source/encoder/frameencoder.cpp                     |   30 +-
 source/encoder/framefilter.cpp                      |    2 +-
 source/encoder/ratecontrol.cpp                      |   46 +-
 source/encoder/ratecontrol.h                        |   17 +-
 source/encoder/reference.cpp                        |    8 +-
 source/encoder/sei.cpp                              |    4 +-
 source/encoder/sei.h                                |   24 +-
 source/encoder/slicetype.cpp                        |   15 +-
 source/encoder/weightPrediction.cpp                 |    8 +-
 40 files changed, 1109 insertions(+), 1179 deletions(-)

diffs (truncated from 4291 to 300 lines):

diff -r 9cbd9fc1710a -r e4199c04d78d source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Thu Jul 17 23:48:38 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Fri Jul 18 02:00:19 2014 -0500
@@ -316,7 +316,7 @@ void TComDataCU::destroy()
 void TComDataCU::initCU(Frame* pic, uint32_t cuAddr)
 {
     m_pic              = pic;
-    m_slice            = pic->getSlice();
+    m_slice            = pic->m_picSym->m_slice;
     m_cuAddr           = cuAddr;
     m_cuPelX           = (cuAddr % pic->getFrameWidthInCU()) << g_maxLog2CUSize;
     m_cuPelY           = (cuAddr / pic->getFrameWidthInCU()) << g_maxLog2CUSize;
@@ -363,7 +363,7 @@ void TComDataCU::initCU(Frame* pic, uint
     m_cuMvField[0].clearMvField();
     m_cuMvField[1].clearMvField();
 
-    if (getSlice()->m_pps->bTransquantBypassEnabled)
+    if (m_slice->m_pps->bTransquantBypassEnabled)
     {
         uint32_t y_tmp = 1 << (g_maxLog2CUSize * 2);
         uint32_t c_tmp = 1 << (g_maxLog2CUSize * 2 - m_hChromaShift - m_vChromaShift);
@@ -403,7 +403,7 @@ void TComDataCU::initSubCU(TComDataCU* c
     uint32_t partOffset = (cu->getTotalNumPart() >> 2) * partUnitIdx;
 
     m_pic              = cu->m_pic;
-    m_slice            = m_pic->getSlice();
+    m_slice            = cu->m_slice;
     m_cuAddr           = cu->getAddr();
     m_absIdxInLCU      = cu->getZorderIdxInCU() + partOffset;
 
@@ -447,7 +447,7 @@ void TComDataCU::initSubCU(TComDataCU* c
     memset(m_skipFlag,           false, sizeInBool);
     memset(m_cuTransquantBypass, false, sizeInBool);
 
-    if (getSlice()->m_sliceType != I_SLICE)
+    if (m_slice->m_sliceType != I_SLICE)
     {
         memset(m_bMergeFlags,      0, sizeInBool);
         memset(m_interDir,         0, sizeInChar);
@@ -469,7 +469,7 @@ void TComDataCU::copyToSubCU(TComDataCU*
     uint32_t partOffset = (cu->getTotalNumPart() >> 2) * partUnitIdx;
 
     m_pic              = cu->m_pic;
-    m_slice            = m_pic->getSlice();
+    m_slice            = cu->m_slice;
     m_cuAddr           = cu->getAddr();
     m_absIdxInLCU      = cu->getZorderIdxInCU() + partOffset;
 
@@ -566,7 +566,7 @@ void TComDataCU::copyPartFrom(TComDataCU
     memcpy(m_trCoeff[1] + tmpC2, cu->m_trCoeff[1], sizeof(coeff_t) * tmpC);
     memcpy(m_trCoeff[2] + tmpC2, cu->m_trCoeff[2], sizeof(coeff_t) * tmpC);
 
-    if (getSlice()->m_pps->bTransquantBypassEnabled)
+    if (m_slice->m_pps->bTransquantBypassEnabled)
     {
         memcpy(m_tqBypassOrigYuv[0] + tmp2, cu->getLumaOrigYuv(), sizeof(pixel) * tmp);
 
@@ -630,7 +630,7 @@ void TComDataCU::copyToPic(uint8_t depth
     memcpy(cu->m_trCoeff[1] + tmpC2, m_trCoeff[1], sizeof(coeff_t) * tmpC);
     memcpy(cu->m_trCoeff[2] + tmpC2, m_trCoeff[2], sizeof(coeff_t) * tmpC);
 
-    if (getSlice()->m_pps->bTransquantBypassEnabled)
+    if (m_slice->m_pps->bTransquantBypassEnabled)
     {
         uint32_t tmp  = 1 << ((g_maxLog2CUSize - depth) * 2);
         uint32_t tmp2 = m_absIdxInLCU << m_pic->getLog2UnitSize() * 2;
@@ -721,7 +721,7 @@ void TComDataCU::copyToPic(uint8_t depth
     memcpy(cu->m_trCoeff[1] + tmpC2, m_trCoeff[1], sizeof(coeff_t) * tmpC);
     memcpy(cu->m_trCoeff[2] + tmpC2, m_trCoeff[2], sizeof(coeff_t) * tmpC);
 
-    if (getSlice()->m_pps->bTransquantBypassEnabled)
+    if (m_slice->m_pps->bTransquantBypassEnabled)
     {
         memcpy(cu->getLumaOrigYuv() + tmpY2, m_tqBypassOrigYuv[0], sizeof(pixel) * tmpY);
 
@@ -932,7 +932,7 @@ TComDataCU* TComDataCU::getPUBelowLeftAd
             return NULL;
         }
         blPartUnitIdx = g_rasterToZscan[absPartIdxLB + (1 + partUnitOffset) * numPartInCUSize - 1];
-        if (m_cuLeft == NULL || m_cuLeft->getSlice() == NULL)
+        if (m_cuLeft == NULL || m_cuLeft->m_slice == NULL)
         {
             return NULL;
         }
@@ -975,7 +975,7 @@ TComDataCU* TComDataCU::getPUAboveRightA
             return NULL;
         }
         arPartUnitIdx = g_rasterToZscan[absPartIdxRT + m_pic->getNumPartInCU() - numPartInCUSize + partUnitOffset];
-        if (m_cuAbove == NULL || m_cuAbove->getSlice() == NULL)
+        if (m_cuAbove == NULL || m_cuAbove->m_slice == NULL)
         {
             return NULL;
         }
@@ -988,7 +988,7 @@ TComDataCU* TComDataCU::getPUAboveRightA
     }
 
     arPartUnitIdx = g_rasterToZscan[m_pic->getNumPartInCU() - numPartInCUSize + partUnitOffset - 1];
-    if ((m_cuAboveRight == NULL || m_cuAboveRight->getSlice() == NULL ||
+    if ((m_cuAboveRight == NULL || m_cuAboveRight->m_slice == NULL ||
          (m_cuAboveRight->getAddr()) > getAddr()))
     {
         return NULL;
@@ -1004,8 +1004,8 @@ TComDataCU* TComDataCU::getPUAboveRightA
 TComDataCU* TComDataCU::getQpMinCuLeft(uint32_t& lPartUnitIdx, uint32_t curAbsIdxInLCU)
 {
     uint32_t numPartInCUSize = m_pic->getNumPartInCUSize();
-    uint32_t absZorderQpMinCUIdx = (curAbsIdxInLCU >> ((g_maxCUDepth - getSlice()->m_pps->maxCuDQPDepth) << 1)) <<
-        ((g_maxCUDepth - getSlice()->m_pps->maxCuDQPDepth) << 1);
+    uint32_t absZorderQpMinCUIdx = (curAbsIdxInLCU >> ((g_maxCUDepth - m_slice->m_pps->maxCuDQPDepth) << 1)) <<
+        ((g_maxCUDepth - m_slice->m_pps->maxCuDQPDepth) << 1);
     uint32_t absRorderQpMinCUIdx = g_zscanToRaster[absZorderQpMinCUIdx];
 
     // check for left LCU boundary
@@ -1029,8 +1029,8 @@ TComDataCU* TComDataCU::getQpMinCuLeft(u
 TComDataCU* TComDataCU::getQpMinCuAbove(uint32_t& aPartUnitIdx, uint32_t curAbsIdxInLCU)
 {
     uint32_t numPartInCUSize = m_pic->getNumPartInCUSize();
-    uint32_t absZorderQpMinCUIdx = (curAbsIdxInLCU >> ((g_maxCUDepth - getSlice()->m_pps->maxCuDQPDepth) << 1)) <<
-        ((g_maxCUDepth - getSlice()->m_pps->maxCuDQPDepth) << 1);
+    uint32_t absZorderQpMinCUIdx = (curAbsIdxInLCU >> ((g_maxCUDepth - m_slice->m_pps->maxCuDQPDepth) << 1)) <<
+        ((g_maxCUDepth - m_slice->m_pps->maxCuDQPDepth) << 1);
     uint32_t absRorderQpMinCUIdx = g_zscanToRaster[absZorderQpMinCUIdx];
 
     // check for top LCU boundary
@@ -1074,7 +1074,7 @@ int TComDataCU::getLastValidPartIdx(int 
 
 char TComDataCU::getLastCodedQP(uint32_t absPartIdx)
 {
-    uint32_t quPartIdxMask = ~((1 << ((g_maxCUDepth - getSlice()->m_pps->maxCuDQPDepth) << 1)) - 1);
+    uint32_t quPartIdxMask = ~((1 << ((g_maxCUDepth - m_slice->m_pps->maxCuDQPDepth) << 1)) - 1);
     int lastValidPartIdx = getLastValidPartIdx(absPartIdx & quPartIdxMask);
 
     if (lastValidPartIdx >= 0)
@@ -1087,14 +1087,14 @@ char TComDataCU::getLastCodedQP(uint32_t
         {
             return m_pic->getCU(getAddr())->getLastCodedQP(getZorderIdxInCU());
         }
-        else if (getAddr() > 0 && !(getSlice()->m_pps->bEntropyCodingSyncEnabled &&
+        else if (getAddr() > 0 && !(m_slice->m_pps->bEntropyCodingSyncEnabled &&
                                     getAddr() % m_pic->getFrameWidthInCU() == 0))
         {
             return m_pic->getCU(getAddr() - 1)->getLastCodedQP(m_pic->getNumPartInCU());
         }
         else
         {
-            return getSlice()->m_sliceQp;
+            return m_slice->m_sliceQp;
         }
     }
 }
@@ -1105,7 +1105,7 @@ char TComDataCU::getLastCodedQP(uint32_t
  */
 bool TComDataCU::isLosslessCoded(uint32_t absPartIdx)
 {
-    return getSlice()->m_pps->bTransquantBypassEnabled && getCUTransquantBypass(absPartIdx);
+    return m_slice->m_pps->bTransquantBypassEnabled && getCUTransquantBypass(absPartIdx);
 }
 
 /** Get allowed chroma intra modes
@@ -1864,9 +1864,9 @@ void TComDataCU::getInterMergeCandidates
                                          uint32_t& maxNumMergeCand)
 {
     uint32_t absPartAddr = m_absIdxInLCU + absPartIdx;
-    const bool isInterB = getSlice()->isInterB();
+    const bool isInterB = m_slice->isInterB();
 
-    maxNumMergeCand = getSlice()->m_maxNumMergeCand;
+    maxNumMergeCand = m_slice->m_maxNumMergeCand;
 
     for (uint32_t i = 0; i < maxNumMergeCand; ++i)
     {
@@ -2483,7 +2483,7 @@ bool TComDataCU::xAddMVPCand(MV& mvp, in
         return false;
 
     int refPOC = m_slice->m_refPOCList[picList][refIdx];
-    int otherPOC = tmpCU->getSlice()->m_refPOCList[picList][tmpCU->getCUMvField(picList)->getRefIdx(idx)];
+    int otherPOC = tmpCU->m_slice->m_refPOCList[picList][tmpCU->getCUMvField(picList)->getRefIdx(idx)];
     if (tmpCU->getCUMvField(picList)->getRefIdx(idx) >= 0 && refPOC == otherPOC)
     {
         mvp = tmpCU->getCUMvField(picList)->getMv(idx);
@@ -2501,7 +2501,7 @@ bool TComDataCU::xAddMVPCand(MV& mvp, in
 
     if (tmpCU->getCUMvField(refPicList2nd)->getRefIdx(idx) >= 0)
     {
-        neibRefPOC = tmpCU->getSlice()->m_refPOCList[refPicList2nd][tmpCU->getCUMvField(refPicList2nd)->getRefIdx(idx)];
+        neibRefPOC = tmpCU->m_slice->m_refPOCList[refPicList2nd][tmpCU->getCUMvField(refPicList2nd)->getRefIdx(idx)];
         if (neibRefPOC == curRefPOC)
         {
             // Same reference frame but different list
@@ -2563,7 +2563,7 @@ bool TComDataCU::xAddMVPCandOrder(MV& ou
     //---------------  V1 (END) ------------------//
     if (tmpCU->getCUMvField(picList)->getRefIdx(idx) >= 0)
     {
-        neibRefPOC = tmpCU->getSlice()->m_refPOCList[picList][tmpCU->getCUMvField(picList)->getRefIdx(idx)];
+        neibRefPOC = tmpCU->m_slice->m_refPOCList[picList][tmpCU->getCUMvField(picList)->getRefIdx(idx)];
         MV mvp = tmpCU->getCUMvField(picList)->getMv(idx);
 
         int scale = xGetDistScaleFactor(curPOC, curRefPOC, neibPOC, neibRefPOC);
@@ -2578,7 +2578,7 @@ bool TComDataCU::xAddMVPCandOrder(MV& ou
     //---------------------- V2(END) --------------------//
     if (tmpCU->getCUMvField(refPicList2nd)->getRefIdx(idx) >= 0)
     {
-        neibRefPOC = tmpCU->getSlice()->m_refPOCList[refPicList2nd][tmpCU->getCUMvField(refPicList2nd)->getRefIdx(idx)];
+        neibRefPOC = tmpCU->m_slice->m_refPOCList[refPicList2nd][tmpCU->getCUMvField(refPicList2nd)->getRefIdx(idx)];
         MV mvp = tmpCU->getCUMvField(refPicList2nd)->getMv(idx);
 
         int scale = xGetDistScaleFactor(curPOC, curRefPOC, neibPOC, neibRefPOC);
@@ -2610,19 +2610,19 @@ bool TComDataCU::xGetColMVP(int picList,
     MV colmv;
 
     // use coldir.
-    Frame *colPic = getSlice()->m_refPicList[getSlice()->isInterB() ? 1 - getSlice()->m_colFromL0Flag : 0][getSlice()->m_colRefIdx];
+    Frame *colPic = m_slice->m_refPicList[m_slice->isInterB() ? 1 - m_slice->m_colFromL0Flag : 0][m_slice->m_colRefIdx];
     TComDataCU *colCU = colPic->getCU(cuAddr);
 
     if (colCU->m_pic == 0 || colCU->getPartitionSize(partUnitIdx) == SIZE_NONE)
         return false;
 
     curPOC = m_slice->m_poc;
-    colPOC = colCU->getSlice()->m_poc;
+    colPOC = colCU->m_slice->m_poc;
 
     if (colCU->isIntra(absPartAddr))
         return false;
 
-    colRefPicList = getSlice()->m_bCheckLDC ? picList : getSlice()->m_colFromL0Flag;
+    colRefPicList = m_slice->m_bCheckLDC ? picList : m_slice->m_colFromL0Flag;
 
     int colRefIdx = colCU->getCUMvField(colRefPicList)->getRefIdx(absPartAddr);
 
@@ -2636,7 +2636,7 @@ bool TComDataCU::xGetColMVP(int picList,
     }
 
     // Scale the vector.
-    colRefPOC = colCU->getSlice()->m_refPOCList[colRefPicList][colRefIdx];
+    colRefPOC = colCU->m_slice->m_refPOCList[colRefPicList][colRefIdx];
     colmv = colCU->getCUMvField(colRefPicList)->getMv(absPartAddr);
 
     curRefPOC = m_slice->m_refPOCList[picList][outRefIdx];
diff -r 9cbd9fc1710a -r e4199c04d78d source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h	Thu Jul 17 23:48:38 2014 -0500
+++ b/source/Lib/TLibCommon/TComDataCU.h	Fri Jul 18 02:00:19 2014 -0500
@@ -40,15 +40,15 @@
 #define X265_TCOMDATACU_H
 
 #include "common.h"
+#include "slice.h"
 #include "TComMotionInfo.h"
-#include "TComSlice.h"
 #include "TComPattern.h"
 
 namespace x265 {
 // private namespace
 
 class Frame;
-class TComSlice;
+class Slice;
 
 //! \ingroup TLibCommon
 //! \{
@@ -108,7 +108,7 @@ public:
     // -------------------------------------------------------------------------------------------------------------------
 
     Frame*        m_pic;            ///< picture class pointer
-    TComSlice*    m_slice;          ///< slice header pointer
+    Slice*        m_slice;          ///< slice header pointer
 
     // -------------------------------------------------------------------------------------------------------------------
     // CU description
@@ -224,8 +224,6 @@ public:
     // member functions for CU description
     // -------------------------------------------------------------------------------------------------------------------
 
-    TComSlice*    getSlice()                       { return m_slice; }
-
     uint32_t&     getAddr()                        { return m_cuAddr; }
 
     uint32_t&     getZorderIdxInCU()               { return m_absIdxInLCU; }
diff -r 9cbd9fc1710a -r e4199c04d78d source/Lib/TLibCommon/TComLoopFilter.cpp
--- a/source/Lib/TLibCommon/TComLoopFilter.cpp	Thu Jul 17 23:48:38 2014 -0500
+++ b/source/Lib/TLibCommon/TComLoopFilter.cpp	Fri Jul 18 02:00:19 2014 -0500
@@ -35,8 +35,9 @@
     \brief    deblocking filter
 */
 
+#include "common.h"
 #include "TComLoopFilter.h"
-#include "TComSlice.h"
+#include "slice.h"
 #include "mv.h"
 
 using namespace x265;
@@ -120,7 +121,7 @@ void TComLoopFilter::xDeblockCU(TComData
         {
             uint32_t lpelx = cu->getCUPelX() + g_rasterToPelX[g_zscanToRaster[absZOrderIdx]];
             uint32_t tpely = cu->getCUPelY() + g_rasterToPelY[g_zscanToRaster[absZOrderIdx]];
-            if ((lpelx < cu->getSlice()->m_sps->picWidthInLumaSamples) && (tpely < cu->getSlice()->m_sps->picHeightInLumaSamples))
+            if ((lpelx < cu->m_slice->m_sps->picWidthInLumaSamples) && (tpely < cu->m_slice->m_sps->picHeightInLumaSamples))
             {
                 xDeblockCU(cu, absZOrderIdx, depth + 1, dir, edgeFilter, blockingStrength);


More information about the x265-commits mailing list