[x265] [PATCH] remove getNumPartInCU() and replace it with macro
Deepthi Nandakumar
deepthi at multicorewareinc.com
Mon Sep 22 10:08:45 CEST 2014
Not sure what the objective here is. Regardless of param->maxCUSize, we are
always creating and managing data structures for the largest size (64).
Ultrafast performance will reduce.
On Mon, Sep 22, 2014 at 10:11 AM, <santhoshini at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Santhoshini Sekar <santhoshini at multicorewareinc.com>
> # Date 1411360621 -19800
> # Mon Sep 22 10:07:01 2014 +0530
> # Node ID 37343a4ceced834aa89316c5307a6353fb546337
> # Parent 817abe294c8b3e60f88093841d208fbb96bf8403
> remove getNumPartInCU() and replace it with macro
>
> diff -r 817abe294c8b -r 37343a4ceced source/Lib/TLibCommon/TComDataCU.cpp
> --- a/source/Lib/TLibCommon/TComDataCU.cpp Sun Sep 21 23:18:49 2014
> +0530
> +++ b/source/Lib/TLibCommon/TComDataCU.cpp Mon Sep 22 10:07:01 2014
> +0530
> @@ -320,7 +320,7 @@
> m_totalBits = 0;
> m_mvBits = 0;
> m_coeffBits = 0;
> - m_numPartitions = pic->getNumPartInCU();
> + m_numPartitions = NUM_CU_PARTITIONS;
> char* qp = pic->getCU(getAddr())->getQP();
> m_baseQp = pic->getCU(getAddr())->m_baseQp;
> for (int i = 0; i < 4; i++)
> @@ -772,7 +772,7 @@
> if (planarAtLCUBoundary)
> return NULL;
>
> - aPartUnitIdx = g_rasterToZscan[absPartIdx + m_pic->getNumPartInCU() -
> numPartInCUSize];
> + aPartUnitIdx = g_rasterToZscan[absPartIdx + NUM_CU_PARTITIONS -
> numPartInCUSize];
> return m_cuAbove;
> }
>
> @@ -797,7 +797,7 @@
> return this;
> }
> }
> - alPartUnitIdx = g_rasterToZscan[absPartIdx +
> m_pic->getNumPartInCU() - numPartInCUSize - 1];
> + alPartUnitIdx = g_rasterToZscan[absPartIdx + NUM_CU_PARTITIONS -
> numPartInCUSize - 1];
> return m_cuAbove;
> }
>
> @@ -807,7 +807,7 @@
> return m_cuLeft;
> }
>
> - alPartUnitIdx = g_rasterToZscan[m_pic->getNumPartInCU() - 1];
> + alPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - 1];
> return m_cuAboveLeft;
> }
>
> @@ -839,7 +839,7 @@
> }
> return NULL;
> }
> - arPartUnitIdx = g_rasterToZscan[absPartIdxRT +
> m_pic->getNumPartInCU() - numPartInCUSize + 1];
> + arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_CU_PARTITIONS
> - numPartInCUSize + 1];
> return m_cuAbove;
> }
>
> @@ -848,7 +848,7 @@
> return NULL;
> }
>
> - arPartUnitIdx = g_rasterToZscan[m_pic->getNumPartInCU() -
> numPartInCUSize];
> + arPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - numPartInCUSize];
> return m_cuAboveRight;
> }
>
> @@ -960,7 +960,7 @@
> }
> return NULL;
> }
> - arPartUnitIdx = g_rasterToZscan[absPartIdxRT +
> m_pic->getNumPartInCU() - numPartInCUSize + partUnitOffset];
> + arPartUnitIdx = g_rasterToZscan[absPartIdxRT + NUM_CU_PARTITIONS
> - numPartInCUSize + partUnitOffset];
> if (m_cuAbove == NULL || m_cuAbove->m_slice == NULL)
> {
> return NULL;
> @@ -973,7 +973,7 @@
> return NULL;
> }
>
> - arPartUnitIdx = g_rasterToZscan[m_pic->getNumPartInCU() -
> numPartInCUSize + partUnitOffset - 1];
> + arPartUnitIdx = g_rasterToZscan[NUM_CU_PARTITIONS - numPartInCUSize +
> partUnitOffset - 1];
> if ((m_cuAboveRight == NULL || m_cuAboveRight->m_slice == NULL ||
> (m_cuAboveRight->getAddr()) > getAddr()))
> {
> @@ -1074,7 +1074,7 @@
> else if (getAddr() > 0 &&
> !(m_slice->m_pps->bEntropyCodingSyncEnabled &&
> getAddr() %
> m_pic->getFrameWidthInCU() == 0))
> {
> - return m_pic->getCU(getAddr() -
> 1)->getLastCodedQP(m_pic->getNumPartInCU());
> + return m_pic->getCU(getAddr() -
> 1)->getLastCodedQP(NUM_CU_PARTITIONS);
> }
> else
> {
> @@ -1214,7 +1214,7 @@
>
> void TComDataCU::clearCbf(uint32_t absPartIdx, uint32_t depth)
> {
> - uint32_t curPartNum = m_pic->getNumPartInCU() >> (depth << 1);
> + uint32_t curPartNum = NUM_CU_PARTITIONS >> (depth << 1);
>
> memset(m_cbf[0] + absPartIdx, 0, sizeof(uint8_t) * curPartNum);
> memset(m_cbf[1] + absPartIdx, 0, sizeof(uint8_t) * curPartNum);
> @@ -1223,7 +1223,7 @@
>
> void TComDataCU::setCbfSubParts(uint32_t cbf, TextType ttype, uint32_t
> absPartIdx, uint32_t depth)
> {
> - uint32_t curPartNum = m_pic->getNumPartInCU() >> (depth << 1);
> + uint32_t curPartNum = NUM_CU_PARTITIONS >> (depth << 1);
>
> memset(m_cbf[ttype] + absPartIdx, cbf, sizeof(uint8_t) * curPartNum);
> }
> @@ -1236,14 +1236,14 @@
> void TComDataCU::setDepthSubParts(uint32_t depth)
> {
> /*All 4x4 partitions in current CU have the CU depth saved*/
> - uint32_t curPartNum = m_pic->getNumPartInCU() >> (depth << 1);
> + uint32_t curPartNum = NUM_CU_PARTITIONS >> (depth << 1);
>
> memset(m_depth, depth, sizeof(uint8_t) * curPartNum);
> }
>
> bool TComDataCU::isFirstAbsZorderIdxInDepth(uint32_t absPartIdx, uint32_t
> depth)
> {
> - uint32_t curPartNum = m_pic->getNumPartInCU() >> (depth << 1);
> + uint32_t curPartNum = NUM_CU_PARTITIONS >> (depth << 1);
>
> return ((m_absIdxInLCU + absPartIdx) & (curPartNum - 1)) == 0;
> }
> @@ -1251,29 +1251,29 @@
> void TComDataCU::setPartSizeSubParts(PartSize mode, uint32_t absPartIdx,
> uint32_t depth)
> {
> X265_CHECK(sizeof(*m_partSizes) == 1, "size check failure\n");
> - memset(m_partSizes + absPartIdx, mode, m_pic->getNumPartInCU() >>
> (depth << 1));
> + memset(m_partSizes + absPartIdx, mode, NUM_CU_PARTITIONS >> (depth <<
> 1));
> }
>
> void TComDataCU::setCUTransquantBypassSubParts(bool flag, uint32_t
> absPartIdx, uint32_t depth)
> {
> - memset(m_cuTransquantBypass + absPartIdx, flag,
> m_pic->getNumPartInCU() >> (depth << 1));
> + memset(m_cuTransquantBypass + absPartIdx, flag, NUM_CU_PARTITIONS >>
> (depth << 1));
> }
>
> void TComDataCU::setSkipFlagSubParts(bool skip, uint32_t absPartIdx,
> uint32_t depth)
> {
> X265_CHECK(sizeof(*m_skipFlag) == 1, "size check failure\n");
> - memset(m_skipFlag + absPartIdx, skip, m_pic->getNumPartInCU() >>
> (depth << 1));
> + memset(m_skipFlag + absPartIdx, skip, NUM_CU_PARTITIONS >> (depth <<
> 1));
> }
>
> void TComDataCU::setPredModeSubParts(PredMode eMode, uint32_t absPartIdx,
> uint32_t depth)
> {
> X265_CHECK(sizeof(*m_predModes) == 1, "size check failure\n");
> - memset(m_predModes + absPartIdx, eMode, m_pic->getNumPartInCU() >>
> (depth << 1));
> + memset(m_predModes + absPartIdx, eMode, NUM_CU_PARTITIONS >> (depth
> << 1));
> }
>
> void TComDataCU::setQPSubCUs(int qp, TComDataCU* cu, uint32_t absPartIdx,
> uint32_t depth, bool &foundNonZeroCbf)
> {
> - uint32_t curPartNumb = m_pic->getNumPartInCU() >> (depth << 1);
> + uint32_t curPartNumb = NUM_CU_PARTITIONS >> (depth << 1);
> uint32_t curPartNumQ = curPartNumb >> 2;
>
> if (!foundNonZeroCbf)
> @@ -1301,7 +1301,7 @@
>
> void TComDataCU::setQPSubParts(int qp, uint32_t absPartIdx, uint32_t
> depth)
> {
> - uint32_t curPartNum = m_pic->getNumPartInCU() >> (depth << 1);
> + uint32_t curPartNum = NUM_CU_PARTITIONS >> (depth << 1);
>
> for (uint32_t scuIdx = absPartIdx; scuIdx < absPartIdx + curPartNum;
> scuIdx++)
> {
> @@ -1311,7 +1311,7 @@
>
> void TComDataCU::setLumaIntraDirSubParts(uint32_t dir, uint32_t
> absPartIdx, uint32_t depth)
> {
> - uint32_t curPartNum = m_pic->getNumPartInCU() >> (depth << 1);
> + uint32_t curPartNum = NUM_CU_PARTITIONS >> (depth << 1);
>
> memset(m_lumaIntraDir + absPartIdx, dir, sizeof(uint8_t) *
> curPartNum);
> }
> @@ -1321,7 +1321,7 @@
> {
> X265_CHECK(sizeof(T) == 1, "size check failure\n"); // Using memset()
> works only for types of size 1
>
> - uint32_t curPartNumQ = (m_pic->getNumPartInCU() >> (2 * cuDepth)) >>
> 2;
> + uint32_t curPartNumQ = (NUM_CU_PARTITIONS >> (2 * cuDepth)) >> 2;
> switch (m_partSizes[cuAddr])
> {
> case SIZE_2Nx2N:
> @@ -1416,7 +1416,7 @@
>
> void TComDataCU::setChromIntraDirSubParts(uint32_t dir, uint32_t
> absPartIdx, uint32_t depth)
> {
> - uint32_t curPartNum = m_pic->getNumPartInCU() >> (depth << 1);
> + uint32_t curPartNum = NUM_CU_PARTITIONS >> (depth << 1);
>
> memset(m_chromaIntraDir + absPartIdx, dir, sizeof(uint8_t) *
> curPartNum);
> }
> @@ -1428,14 +1428,14 @@
>
> void TComDataCU::setTrIdxSubParts(uint32_t trIdx, uint32_t absPartIdx,
> uint32_t depth)
> {
> - uint32_t curPartNum = m_pic->getNumPartInCU() >> (depth << 1);
> + uint32_t curPartNum = NUM_CU_PARTITIONS >> (depth << 1);
>
> memset(m_trIdx + absPartIdx, trIdx, sizeof(uint8_t) * curPartNum);
> }
>
> void TComDataCU::setTransformSkipSubParts(uint32_t useTransformSkipY,
> uint32_t useTransformSkipU, uint32_t useTransformSkipV, uint32_t
> absPartIdx, uint32_t depth)
> {
> - uint32_t curPartNum = m_pic->getNumPartInCU() >> (depth << 1);
> + uint32_t curPartNum = NUM_CU_PARTITIONS >> (depth << 1);
>
> memset(m_transformSkip[0] + absPartIdx, useTransformSkipY,
> sizeof(uint8_t) * curPartNum);
> memset(m_transformSkip[1] + absPartIdx, useTransformSkipU,
> sizeof(uint8_t) * curPartNum);
> @@ -1444,7 +1444,7 @@
>
> void TComDataCU::setTransformSkipSubParts(uint32_t useTransformSkip,
> TextType ttype, uint32_t absPartIdx, uint32_t depth)
> {
> - uint32_t curPartNum = m_pic->getNumPartInCU() >> (depth << 1);
> + uint32_t curPartNum = NUM_CU_PARTITIONS >> (depth << 1);
>
> memset(m_transformSkip[ttype] + absPartIdx, useTransformSkip,
> sizeof(uint8_t) * curPartNum);
> }
> diff -r 817abe294c8b -r 37343a4ceced source/common/deblock.cpp
> --- a/source/common/deblock.cpp Sun Sep 21 23:18:49 2014 +0530
> +++ b/source/common/deblock.cpp Mon Sep 22 10:07:01 2014 +0530
> @@ -48,7 +48,7 @@
> return;
>
> Frame* pic = cu->m_pic;
> - uint32_t curNumParts = pic->getNumPartInCU() >> (depth << 1);
> + uint32_t curNumParts = NUM_CU_PARTITIONS >> (depth << 1);
>
> if (cu->getDepth(absZOrderIdx) > depth)
> {
> @@ -119,7 +119,7 @@
> {
> if (cu->getTransformIdx(absZOrderIdx) + cu->getDepth(absZOrderIdx) >
> (uint8_t)depth)
> {
> - const uint32_t curNumParts = cu->m_pic->getNumPartInCU() >>
> (depth << 1);
> + const uint32_t curNumParts = NUM_CU_PARTITIONS >> (depth << 1);
> const uint32_t qNumParts = curNumParts >> 2;
>
> for (uint32_t partIdx = 0; partIdx < 4; partIdx++, absZOrderIdx
> += qNumParts)
> diff -r 817abe294c8b -r 37343a4ceced source/common/frame.h
> --- a/source/common/frame.h Sun Sep 21 23:18:49 2014 +0530
> +++ b/source/common/frame.h Mon Sep 22 10:07:01 2014 +0530
> @@ -23,6 +23,7 @@
>
> #ifndef X265_FRAME_H
> #define X265_FRAME_H
> +#define NUM_CU_PARTITIONS 256
>
> #include "common.h"
> #include "TLibCommon/TComPicSym.h"
> @@ -117,8 +118,6 @@
>
> uint32_t getNumPartInCUSize() const { return
> m_picSym->getNumPartInCUSize(); }
>
> - uint32_t getNumPartInCU() const { return
> m_picSym->getNumPartition(); }
> -
> uint32_t getFrameWidthInCU() const { return
> m_picSym->getFrameWidthInCU(); }
>
> uint32_t getFrameHeightInCU() const { return
> m_picSym->getFrameHeightInCU(); }
> diff -r 817abe294c8b -r 37343a4ceced source/common/slice.cpp
> --- a/source/common/slice.cpp Sun Sep 21 23:18:49 2014 +0530
> +++ b/source/common/slice.cpp Mon Sep 22 10:07:01 2014 +0530
> @@ -182,8 +182,8 @@
> uint32_t Slice::realEndAddress(uint32_t endCUAddr)
> {
> // Calculate end address
> - uint32_t internalAddress = (endCUAddr - 1) % m_pic->getNumPartInCU();
> - uint32_t externalAddress = (endCUAddr - 1) / m_pic->getNumPartInCU();
> + uint32_t internalAddress = (endCUAddr - 1) % NUM_CU_PARTITIONS;
> + uint32_t externalAddress = (endCUAddr - 1) / NUM_CU_PARTITIONS;
> uint32_t xmax = m_sps->picWidthInLumaSamples - (externalAddress %
> m_pic->getFrameWidthInCU()) * g_maxCUSize;
> uint32_t ymax = m_sps->picHeightInLumaSamples - (externalAddress /
> m_pic->getFrameWidthInCU()) * g_maxCUSize;
>
> @@ -191,13 +191,13 @@
> internalAddress--;
>
> internalAddress++;
> - if (internalAddress == m_pic->getNumPartInCU())
> + if (internalAddress == NUM_CU_PARTITIONS)
> {
> internalAddress = 0;
> externalAddress++;
> }
>
> - return externalAddress * m_pic->getNumPartInCU() + internalAddress;
> + return externalAddress * NUM_CU_PARTITIONS + internalAddress;
> }
>
>
> diff -r 817abe294c8b -r 37343a4ceced source/encoder/analysis.cpp
> --- a/source/encoder/analysis.cpp Sun Sep 21 23:18:49 2014 +0530
> +++ b/source/encoder/analysis.cpp Mon Sep 22 10:07:01 2014 +0530
> @@ -2066,7 +2066,7 @@
> Slice* slice = cu->m_slice;
> uint32_t nextDepth = depth + 1;
> TComDataCU* subTempPartCU = m_tempCU[nextDepth];
> - uint32_t qNumParts = (pic->getNumPartInCU() >> (depth << 1)) >> 2;
> + uint32_t qNumParts = (NUM_CU_PARTITIONS >> (depth << 1)) >> 2;
> uint32_t xmax = slice->m_sps->picWidthInLumaSamples -
> lcu->getCUPelX();
> uint32_t ymax = slice->m_sps->picHeightInLumaSamples -
> lcu->getCUPelY(); for (uint32_t partUnitIdx = 0; partUnitIdx < 4;
> partUnitIdx++, absPartIdx += qNumParts)
> {
> diff -r 817abe294c8b -r 37343a4ceced source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp Sun Sep 21 23:18:49 2014 +0530
> +++ b/source/encoder/encoder.cpp Mon Sep 22 10:07:01 2014 +0530
> @@ -458,7 +458,7 @@
> slice->m_sps = &m_sps;
> slice->m_pps = &m_pps;
> slice->m_maxNumMergeCand = m_param->maxNumMergeCand;
> - slice->m_endCUAddr =
> slice->realEndAddress(fenc->getNumCUsInFrame() * fenc->getNumPartInCU());
> + slice->m_endCUAddr =
> slice->realEndAddress(fenc->getNumCUsInFrame() * NUM_CU_PARTITIONS);
> }
> curEncoder->m_rce.encodeOrder = m_encodedFrameNum++;
> if (m_bframeDelay)
> diff -r 817abe294c8b -r 37343a4ceced source/encoder/entropy.cpp
> --- a/source/encoder/entropy.cpp Sun Sep 21 23:18:49 2014 +0530
> +++ b/source/encoder/entropy.cpp Mon Sep 22 10:07:01 2014 +0530
> @@ -490,7 +490,6 @@
> /* encode a CU block recursively */
> void Entropy::encodeCU(TComDataCU* cu, uint32_t absPartIdx, uint32_t
> depth, bool& bEncodeDQP, CU* cuData)
> {
> - Frame* pic = cu->m_pic;
> Slice* slice = cu->m_slice;
>
> if (depth <= slice->m_pps->maxCuDQPDepth && slice->m_pps->bUseDQP)
> @@ -501,7 +500,7 @@
>
> if (!cuUnsplitFlag)
> {
> - uint32_t qNumParts = (pic->getNumPartInCU() >> (depth << 1)) >> 2;
> + uint32_t qNumParts = (NUM_CU_PARTITIONS >> (depth << 1)) >> 2;
> for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++,
> absPartIdx += qNumParts)
> {
> CU *childCU = cu->m_CULocalData + cuData->childIdx +
> partUnitIdx;
> @@ -518,7 +517,7 @@
>
> if (depth < cu->getDepth(absPartIdx) && depth < g_maxCUDepth)
> {
> - uint32_t qNumParts = (pic->getNumPartInCU() >> (depth << 1)) >> 2;
> + uint32_t qNumParts = (NUM_CU_PARTITIONS >> (depth << 1)) >> 2;
>
> for (uint32_t partUnitIdx = 0; partUnitIdx < 4; partUnitIdx++,
> absPartIdx += qNumParts)
> {
> @@ -580,7 +579,7 @@
> {
> // Encode slice finish
> bool bTerminateSlice = false;
> - if (cuAddr + (cu->m_pic->getNumPartInCU() >> (depth << 1)) ==
> realEndAddress)
> + if (cuAddr + (NUM_CU_PARTITIONS >> (depth << 1)) ==
> realEndAddress)
> bTerminateSlice = true;
>
> // The 1-terminating bit is added to all streams, so don't add it
> here when it's 1.
> @@ -607,7 +606,7 @@
>
> if ((log2TrSize == 2) && !(cu->getChromaFormat() == X265_CSP_I444))
> {
> - uint32_t partNum = cu->m_pic->getNumPartInCU() >> ((depth - 1) <<
> 1);
> + uint32_t partNum = NUM_CU_PARTITIONS >> ((depth - 1) << 1);
> if ((absPartIdx & (partNum - 1)) == 0)
> {
> state.bakAbsPartIdx = absPartIdx;
> @@ -684,7 +683,7 @@
> trIdx++;
> ++depth;
> absPartIdxStep >>= 2;
> - const uint32_t partNum = cu->m_pic->getNumPartInCU() >> (depth <<
> 1);
> + const uint32_t partNum = NUM_CU_PARTITIONS >> (depth << 1);
>
> encodeTransform(cu, state, offsetLuma, offsetChroma, absPartIdx,
> absPartIdxStep, depth, log2TrSize, trIdx, bCodeDQP, depthRange);
>
> @@ -730,13 +729,13 @@
> int chFmt = cu->getChromaFormat();
> if ((log2TrSize == 2) && !(chFmt == X265_CSP_I444))
> {
> - uint32_t partNum = cu->m_pic->getNumPartInCU() >> ((depth -
> 1) << 1);
> + uint32_t partNum = NUM_CU_PARTITIONS >> ((depth - 1) << 1);
> if ((absPartIdx & (partNum - 1)) == (partNum - 1))
> {
> const uint32_t log2TrSizeC = 2;
> const bool splitIntoSubTUs = (chFmt == X265_CSP_I422);
>
> - uint32_t curPartNum = cu->m_pic->getNumPartInCU() >>
> ((depth - 1) << 1);
> + uint32_t curPartNum = NUM_CU_PARTITIONS >> ((depth - 1)
> << 1);
>
> for (uint32_t chromaId = TEXT_CHROMA_U; chromaId <=
> TEXT_CHROMA_V; chromaId++)
> {
> @@ -759,7 +758,7 @@
> {
> uint32_t log2TrSizeC = log2TrSize - hChromaShift;
> const bool splitIntoSubTUs = (chFmt == X265_CSP_I422);
> - uint32_t curPartNum = cu->m_pic->getNumPartInCU() >> (depth
> << 1);
> + uint32_t curPartNum = NUM_CU_PARTITIONS >> (depth << 1);
> for (uint32_t chromaId = TEXT_CHROMA_U; chromaId <=
> TEXT_CHROMA_V; chromaId++)
> {
> TURecurse tuIterator(splitIntoSubTUs ? VERTICAL_SPLIT :
> DONT_SPLIT, curPartNum, absPartIdx);
> @@ -791,7 +790,7 @@
>
> if ((chFmt == X265_CSP_I444) &&
> (cu->getPartitionSize(absPartIdx) == SIZE_NxN))
> {
> - uint32_t partOffset = (cu->m_pic->getNumPartInCU() >>
> (cu->getDepth(absPartIdx) << 1)) >> 2;
> + uint32_t partOffset = (NUM_CU_PARTITIONS >>
> (cu->getDepth(absPartIdx) << 1)) >> 2;
> codeIntraDirChroma(cu, absPartIdx + partOffset);
> codeIntraDirChroma(cu, absPartIdx + partOffset * 2);
> codeIntraDirChroma(cu, absPartIdx + partOffset * 3);
> @@ -860,7 +859,7 @@
> uint32_t log2CUSize = cu->getLog2CUSize(absPartIdx);
> uint32_t lumaOffset = absPartIdx << LOG2_UNIT_SIZE * 2;
> uint32_t chromaOffset = lumaOffset >> (cu->getHorzChromaShift() +
> cu->getVertChromaShift());
> - uint32_t absPartIdxStep = cu->m_pic->getNumPartInCU() >> (depth << 1);
> + uint32_t absPartIdxStep = NUM_CU_PARTITIONS >> (depth << 1);
> CoeffCodeState state;
> encodeTransform(cu, state, lumaOffset, chromaOffset, absPartIdx,
> absPartIdxStep, depth, log2CUSize, 0, bCodeDQP, depthRange);
> }
> @@ -1291,7 +1290,7 @@
> int predIdx[4];
> PartSize mode = cu->getPartitionSize(absPartIdx);
> uint32_t partNum = isMultiple ? (mode == SIZE_NxN ? 4 : 1) : 1;
> - uint32_t partOffset = (cu->m_pic->getNumPartInCU() >>
> (cu->getDepth(absPartIdx) << 1)) >> 2;
> + uint32_t partOffset = (NUM_CU_PARTITIONS >> (cu->getDepth(absPartIdx)
> << 1)) >> 2;
>
> for (j = 0; j < partNum; j++)
> {
> diff -r 817abe294c8b -r 37343a4ceced source/encoder/frameencoder.cpp
> --- a/source/encoder/frameencoder.cpp Sun Sep 21 23:18:49 2014 +0530
> +++ b/source/encoder/frameencoder.cpp Mon Sep 22 10:07:01 2014 +0530
> @@ -422,7 +422,7 @@
> {
> Slice* slice = m_frame->m_picSym->m_slice;
> const uint32_t widthInLCUs =
> m_frame->getPicSym()->getFrameWidthInCU();
> - const uint32_t lastCUAddr = (slice->m_endCUAddr +
> m_frame->getNumPartInCU() - 1) / m_frame->getNumPartInCU();
> + const uint32_t lastCUAddr = (slice->m_endCUAddr + NUM_CU_PARTITIONS -
> 1) / NUM_CU_PARTITIONS;
> const int numSubstreams = m_param->bEnableWavefront ?
> m_frame->getPicSym()->getFrameHeightInCU() : 1;
>
> SAOParam *saoParam = slice->m_pic->getPicSym()->m_saoParam;
> diff -r 817abe294c8b -r 37343a4ceced source/encoder/sao.cpp
> --- a/source/encoder/sao.cpp Sun Sep 21 23:18:49 2014 +0530
> +++ b/source/encoder/sao.cpp Mon Sep 22 10:07:01 2014 +0530
> @@ -2457,8 +2457,7 @@
> // go to sub-CU
> if (cu->getDepth(absZOrderIdx) > depth)
> {
> - Frame* pic = cu->m_pic;
> - uint32_t curNumParts = pic->getNumPartInCU() >> (depth << 1);
> + uint32_t curNumParts = NUM_CU_PARTITIONS >> (depth << 1);
> uint32_t qNumParts = curNumParts >> 2;
> uint32_t xmax = cu->m_slice->m_sps->picWidthInLumaSamples -
> cu->getCUPelX();
> uint32_t ymax = cu->m_slice->m_sps->picHeightInLumaSamples -
> cu->getCUPelY();
> diff -r 817abe294c8b -r 37343a4ceced source/encoder/search.cpp
> --- a/source/encoder/search.cpp Sun Sep 21 23:18:49 2014 +0530
> +++ b/source/encoder/search.cpp Mon Sep 22 10:07:01 2014 +0530
> @@ -136,7 +136,7 @@
> width >>= 1;
> height >>= 1;
>
> - uint32_t qtPartNum = cu->m_pic->getNumPartInCU() >> ((fullDepth +
> 1) << 1);
> + uint32_t qtPartNum = NUM_CU_PARTITIONS >> ((fullDepth + 1) << 1);
> for (uint32_t part = 0; part < 4; part++)
> xEncSubdivCbfQTChroma(cu, trDepth + 1, absPartIdx + part *
> qtPartNum, absPartIdxStep, width, height);
> }
> @@ -152,7 +152,7 @@
>
> if (trMode > trDepth)
> {
> - uint32_t qtPartNum = cu->m_pic->getNumPartInCU() >> ((fullDepth +
> 1) << 1);
> + uint32_t qtPartNum = NUM_CU_PARTITIONS >> ((fullDepth + 1) << 1);
> for (uint32_t part = 0; part < 4; part++)
> xEncCoeffQTChroma(cu, trDepth + 1, absPartIdx + part *
> qtPartNum, ttype);
>
> @@ -170,7 +170,7 @@
> X265_CHECK(trDepth > 0, "transform size too small\n");
> trDepthC--;
> log2TrSizeC++;
> - uint32_t qpdiv = cu->m_pic->getNumPartInCU() >> ((cu->getDepth(0)
> + trDepthC) << 1);
> + uint32_t qpdiv = NUM_CU_PARTITIONS >> ((cu->getDepth(0) +
> trDepthC) << 1);
> bool bFirstQ = ((absPartIdx & (qpdiv - 1)) == 0);
> if (!bFirstQ)
> return;
> @@ -190,7 +190,7 @@
> uint32_t coeffOffset = absPartIdx << (LOG2_UNIT_SIZE * 2 - 1);
> coeff_t* coeff = m_qtTempCoeff[ttype][qtLayer] + coeffOffset;
> uint32_t subTUSize = 1 << (log2TrSizeC * 2);
> - uint32_t partIdxesPerSubTU = cu->m_pic->getNumPartInCU() >>
> (((cu->getDepth(absPartIdx) + trDepthC) << 1) + 1);
> + uint32_t partIdxesPerSubTU = NUM_CU_PARTITIONS >>
> (((cu->getDepth(absPartIdx) + trDepthC) << 1) + 1);
> if (cu->getCbf(absPartIdx, ttype, trDepth + 1))
> m_entropyCoder->codeCoeffNxN(cu, coeff, absPartIdx,
> log2TrSizeC, ttype);
> if (cu->getCbf(absPartIdx + partIdxesPerSubTU, ttype, trDepth +
> 1))
> @@ -592,7 +592,7 @@
> uint64_t splitCost = 0;
> uint32_t splitDistY = 0;
> uint32_t splitPsyEnergyY = 0;
> - uint32_t qPartsDiv = cu->m_pic->getNumPartInCU() >>
> ((fullDepth + 1) << 1);
> + uint32_t qPartsDiv = NUM_CU_PARTITIONS >> ((fullDepth + 1) <<
> 1);
> uint32_t absPartIdxSub = absPartIdx;
> uint32_t splitCbfY = 0;
> uint32_t splitBits = 0;
> @@ -739,7 +739,7 @@
> {
> // code splitted block
>
> - uint32_t qPartsDiv = cu->m_pic->getNumPartInCU() >>
> ((fullDepth + 1) << 1);
> + uint32_t qPartsDiv = NUM_CU_PARTITIONS >> ((fullDepth + 1) <<
> 1);
> uint32_t absPartIdxSub = absPartIdx;
> uint32_t splitCbfY = 0;
>
> @@ -775,7 +775,7 @@
> }
> else
> {
> - uint32_t numQPart = cu->m_pic->getNumPartInCU() >> ((fullDepth +
> 1) << 1);
> + uint32_t numQPart = NUM_CU_PARTITIONS >> ((fullDepth + 1) << 1);
> for (uint32_t part = 0; part < 4; part++)
> xSetIntraResultQT(cu, trDepth + 1, absPartIdx + part *
> numQPart, reconYuv);
> }
> @@ -817,7 +817,7 @@
> trDepthC--;
> }
>
> - uint32_t partIdxesPerSubTU = (cu->m_pic->getNumPartInCU() >> ((depth
> + trDepthC) << 1)) >> 1;
> + uint32_t partIdxesPerSubTU = (NUM_CU_PARTITIONS >> ((depth +
> trDepthC) << 1)) >> 1;
>
> // move the CBFs down a level and set the parent CBF
> uint8_t subTUCBF[2];
> @@ -860,7 +860,7 @@
> X265_CHECK(trDepth > 0, "invalid trDepth\n");
> trDepthC--;
> log2TrSizeC++;
> - uint32_t qpdiv = cu->m_pic->getNumPartInCU() >>
> ((cu->getDepth(0) + trDepthC) << 1);
> + uint32_t qpdiv = NUM_CU_PARTITIONS >> ((cu->getDepth(0) +
> trDepthC) << 1);
> bool bFirstQ = ((absPartIdx & (qpdiv - 1)) == 0);
> if (!bFirstQ)
> return outDist;
> @@ -890,7 +890,7 @@
> uint32_t singlePsyEnergy = 0;
> for (uint32_t chromaId = TEXT_CHROMA_U; chromaId <=
> TEXT_CHROMA_V; chromaId++)
> {
> - uint32_t curPartNum = cu->m_pic->getNumPartInCU() >>
> ((cu->getDepth(0) + trDepthC) << 1);
> + uint32_t curPartNum = NUM_CU_PARTITIONS >> ((cu->getDepth(0)
> + trDepthC) << 1);
> TURecurse tuIterator(splitIntoSubTUs ? VERTICAL_SPLIT :
> DONT_SPLIT, curPartNum, absPartIdx);
>
> do
> @@ -1023,7 +1023,7 @@
> uint32_t splitCbfU = 0;
> uint32_t splitCbfV = 0;
> uint32_t splitPsyEnergy = 0;
> - uint32_t qPartsDiv = cu->m_pic->getNumPartInCU() >>
> ((fullDepth + 1) << 1);
> + uint32_t qPartsDiv = NUM_CU_PARTITIONS >> ((fullDepth + 1) <<
> 1);
> uint32_t absPartIdxSub = absPartIdx;
> for (uint32_t part = 0; part < 4; part++, absPartIdxSub +=
> qPartsDiv)
> {
> @@ -1061,7 +1061,7 @@
> X265_CHECK(trDepth > 0, "invalid trDepth\n");
> trDepth--;
> log2TrSizeC++;
> - uint32_t qpdiv = cu->m_pic->getNumPartInCU() >>
> ((cu->getDepth(0) + trDepth) << 1);
> + uint32_t qpdiv = NUM_CU_PARTITIONS >> ((cu->getDepth(0) +
> trDepth) << 1);
> if (absPartIdx & (qpdiv - 1))
> return;
> }
> @@ -1084,7 +1084,7 @@
> }
> else
> {
> - uint32_t numQPart = cu->m_pic->getNumPartInCU() >> ((fullDepth +
> 1) << 1);
> + uint32_t numQPart = NUM_CU_PARTITIONS >> ((fullDepth + 1) << 1);
> for (uint32_t part = 0; part < 4; part++)
> xSetIntraResultChromaQT(cu, trDepth + 1, absPartIdx + part *
> numQPart, reconYuv);
> }
> @@ -1108,7 +1108,7 @@
> X265_CHECK(trDepth > 0, "invalid trDepth\n");
> trDepthC--;
> log2TrSizeC++;
> - uint32_t qpdiv = cu->m_pic->getNumPartInCU() >>
> ((cu->getDepth(0) + trDepthC) << 1);
> + uint32_t qpdiv = NUM_CU_PARTITIONS >> ((cu->getDepth(0) +
> trDepthC) << 1);
> bool bFirstQ = ((absPartIdx & (qpdiv - 1)) == 0);
> if (!bFirstQ)
> return;
> @@ -1121,7 +1121,7 @@
>
> for (uint32_t chromaId = TEXT_CHROMA_U; chromaId <=
> TEXT_CHROMA_V; chromaId++)
> {
> - uint32_t curPartNum = cu->m_pic->getNumPartInCU() >>
> ((cu->getDepth(0) + trDepthC) << 1);
> + uint32_t curPartNum = NUM_CU_PARTITIONS >> ((cu->getDepth(0)
> + trDepthC) << 1);
> TURecurse tuIterator(splitIntoSubTUs ? VERTICAL_SPLIT :
> DONT_SPLIT, curPartNum, absPartIdx);
>
> do
> @@ -1193,7 +1193,7 @@
> {
> uint32_t splitCbfU = 0;
> uint32_t splitCbfV = 0;
> - uint32_t qPartsDiv = cu->m_pic->getNumPartInCU() >>
> ((fullDepth + 1) << 1);
> + uint32_t qPartsDiv = NUM_CU_PARTITIONS >> ((fullDepth + 1) <<
> 1);
> uint32_t absPartIdxSub = absPartIdx;
> for (uint32_t part = 0; part < 4; part++, absPartIdxSub +=
> qPartsDiv)
> {
> @@ -1499,7 +1499,7 @@
> uint32_t depth = cu->getDepth(0);
> uint32_t initTrDepth = (cu->getPartitionSize(0) != SIZE_2Nx2N) &&
> (cu->getChromaFormat() == X265_CSP_I444 ? 1 : 0);
> uint32_t log2TrSize = cu->getLog2CUSize(0) - initTrDepth;
> - uint32_t absPartIdx = (cu->m_pic->getNumPartInCU() >> (depth << 1));
> + uint32_t absPartIdx = (NUM_CU_PARTITIONS >> (depth << 1));
>
> int part = partitionFromLog2Size(log2TrSize);
>
> @@ -2160,7 +2160,7 @@
> distortion = zeroDistortion;
> cu->m_psyEnergy = zeroPsyEnergyY;
>
> - const uint32_t qpartnum = cu->m_pic->getNumPartInCU() >>
> (depth << 1);
> + const uint32_t qpartnum = NUM_CU_PARTITIONS >> (depth << 1);
> ::memset(cu->getTransformIdx(), 0, qpartnum *
> sizeof(uint8_t));
> ::memset(cu->getCbf(TEXT_LUMA), 0, qpartnum *
> sizeof(uint8_t));
> ::memset(cu->getCbf(TEXT_CHROMA_U), 0, qpartnum *
> sizeof(uint8_t));
> @@ -2297,12 +2297,12 @@
> {
> log2TrSizeC++;
> trModeC--;
> - uint32_t qpdiv = cu->m_pic->getNumPartInCU() >> ((depth - 1)
> << 1);
> + uint32_t qpdiv = NUM_CU_PARTITIONS >> ((depth - 1) << 1);
> bCodeChroma = ((absPartIdx & (qpdiv - 1)) == 0);
> }
>
> const bool splitIntoSubTUs = (m_csp == X265_CSP_I422);
> - uint32_t absPartIdxStep = cu->m_pic->getNumPartInCU() >>
> ((cu->getDepth(0) + trModeC) << 1);
> + uint32_t absPartIdxStep = NUM_CU_PARTITIONS >> ((cu->getDepth(0)
> + trModeC) << 1);
>
> uint32_t coeffOffsetY = absPartIdx << LOG2_UNIT_SIZE * 2;
> uint32_t coeffOffsetC = coeffOffsetY >> (hChromaShift +
> vChromaShift);
> @@ -2377,7 +2377,7 @@
> // code sub-blocks
> if (bCheckSplit && !bCheckFull)
> {
> - const uint32_t qPartNumSubdiv = cu->m_pic->getNumPartInCU() >>
> ((depth + 1) << 1);
> + const uint32_t qPartNumSubdiv = NUM_CU_PARTITIONS >> ((depth + 1)
> << 1);
> for (uint32_t i = 0; i < 4; ++i)
> residualTransformQuantInter(cu, absPartIdx + i *
> qPartNumSubdiv, fencYuv, resiYuv, depth + 1, depthRange);
>
> @@ -2429,7 +2429,7 @@
> {
> log2TrSizeC++;
> trModeC--;
> - uint32_t qpdiv = cu->m_pic->getNumPartInCU() >> ((depth - 1) <<
> 1);
> + uint32_t qpdiv = NUM_CU_PARTITIONS >> ((depth - 1) << 1);
> bCodeChroma = ((absPartIdx & (qpdiv - 1)) == 0);
> }
>
> @@ -2451,7 +2451,7 @@
>
> uint32_t trSize = 1 << log2TrSize;
> const bool splitIntoSubTUs = (m_csp == X265_CSP_I422);
> - uint32_t absPartIdxStep = cu->m_pic->getNumPartInCU() >>
> ((cu->getDepth(0) + trModeC) << 1);
> + uint32_t absPartIdxStep = NUM_CU_PARTITIONS >> ((cu->getDepth(0) +
> trModeC) << 1);
>
> // code full block
> if (bCheckFull)
> @@ -3123,7 +3123,7 @@
> }
> }
>
> - const uint32_t qPartNumSubdiv = cu->m_pic->getNumPartInCU() >>
> ((depth + 1) << 1);
> + const uint32_t qPartNumSubdiv = NUM_CU_PARTITIONS >> ((depth + 1)
> << 1);
> for (uint32_t i = 0; i < 4; ++i)
> {
> cu->m_psyEnergy = 0;
> @@ -3260,7 +3260,7 @@
> const bool bFirstCbfOfCU = curTrMode == 0;
> if (bFirstCbfOfCU || mCodeAll)
> {
> - uint32_t absPartIdxStep = cu->m_pic->getNumPartInCU() >>
> ((cu->getDepth(0) + curTrMode) << 1);
> + uint32_t absPartIdxStep = NUM_CU_PARTITIONS >>
> ((cu->getDepth(0) + curTrMode) << 1);
> if (bFirstCbfOfCU || cu->getCbf(absPartIdx, TEXT_CHROMA_U,
> curTrMode - 1))
> m_entropyCoder->codeQtCbf(cu, absPartIdx, absPartIdxStep,
> trWidthC, trHeightC, TEXT_CHROMA_U, curTrMode, !bSubdiv);
> if (bFirstCbfOfCU || cu->getCbf(absPartIdx, TEXT_CHROMA_V,
> curTrMode - 1))
> @@ -3287,7 +3287,7 @@
> {
> log2TrSizeC++;
> trModeC--;
> - uint32_t qpdiv = cu->m_pic->getNumPartInCU() >> ((depth - 1)
> << 1);
> + uint32_t qpdiv = NUM_CU_PARTITIONS >> ((depth - 1) << 1);
> bCodeChroma = ((absPartIdx & (qpdiv - 1)) == 0);
> }
>
> @@ -3313,7 +3313,7 @@
> }
> else
> {
> - uint32_t partIdxesPerSubTU =
> cu->m_pic->getNumPartInCU() >> (((cu->getDepth(absPartIdx) + trModeC) << 1)
> + 1);
> + uint32_t partIdxesPerSubTU = NUM_CU_PARTITIONS >>
> (((cu->getDepth(absPartIdx) + trModeC) << 1) + 1);
> uint32_t subTUSize = 1 << (log2TrSizeC * 2);
> if (ttype == TEXT_CHROMA_U && cu->getCbf(absPartIdx,
> TEXT_CHROMA_U, trMode))
> {
> @@ -3337,7 +3337,7 @@
> {
> if (bSubdivAndCbf || cu->getCbf(absPartIdx, ttype, curTrMode))
> {
> - const uint32_t qpartNumSubdiv = cu->m_pic->getNumPartInCU()
> >> ((depth + 1) << 1);
> + const uint32_t qpartNumSubdiv = NUM_CU_PARTITIONS >> ((depth
> + 1) << 1);
> for (uint32_t i = 0; i < 4; ++i)
> xEncodeResidualQT(cu, absPartIdx + i * qpartNumSubdiv,
> depth + 1, bSubdivAndCbf, ttype, depthRange);
> }
> @@ -3365,7 +3365,7 @@
> {
> log2TrSizeC++;
> trModeC--;
> - uint32_t qpdiv = cu->m_pic->getNumPartInCU() >>
> ((cu->getDepth(0) + trModeC) << 1);
> + uint32_t qpdiv = NUM_CU_PARTITIONS >> ((cu->getDepth(0) +
> trModeC) << 1);
> bCodeChroma = ((absPartIdx & (qpdiv - 1)) == 0);
> }
>
> @@ -3398,7 +3398,7 @@
> }
> else
> {
> - const uint32_t qPartNumSubdiv = cu->m_pic->getNumPartInCU() >>
> ((depth + 1) << 1);
> + const uint32_t qPartNumSubdiv = NUM_CU_PARTITIONS >> ((depth +
> 1) << 1);
> for (uint32_t i = 0; i < 4; ++i)
> xSetResidualQTData(cu, absPartIdx + i * qPartNumSubdiv,
> resiYuv, depth + 1, bSpatial);
> }
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20140922/565f5513/attachment-0001.html>
More information about the x265-devel
mailing list