[x265] [PATCH] TComDataCU: remove redundant functions
Steve Borho
steve at borho.org
Wed Jul 2 17:39:58 CEST 2014
On Wed, Jul 2, 2014 at 10:00 AM, <ashok at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Ashok Kumar Mishra<ashok at multicorewareinc.com>
> # Date 1404283815 -19800
> # Wed Jul 02 12:20:15 2014 +0530
> # Node ID efa2f64a1565ae40dac666e81d268e7ac4432c3f
> # Parent a18972fd05b1d6242a881bef979b9e1ff17543d9
> TComDataCU: remove redundant functions
>
> diff -r a18972fd05b1 -r efa2f64a1565 source/Lib/TLibCommon/TComDataCU.cpp
> --- a/source/Lib/TLibCommon/TComDataCU.cpp Tue Jul 01 14:58:35 2014 -0500
> +++ b/source/Lib/TLibCommon/TComDataCU.cpp Wed Jul 02 12:20:15 2014 +0530
> @@ -1615,117 +1615,6 @@
> outMvField.setMvField(cuMvField->getMv(absPartIdx), cuMvField->getRefIdx(absPartIdx));
> }
>
> -void TComDataCU::deriveLeftRightTopIdxGeneral(uint32_t absPartIdx, uint32_t partIdx, uint32_t& outPartIdxLT, uint32_t& outPartIdxRT)
> -{
> - outPartIdxLT = m_absIdxInLCU + absPartIdx;
> - uint32_t cuSize = m_cuSize[absPartIdx];
> - uint32_t puWidth = 0;
> -
> - switch (m_partSizes[absPartIdx])
> - {
> - case SIZE_2Nx2N: puWidth = cuSize;
> - break;
> - case SIZE_2NxN: puWidth = cuSize;
> - break;
> - case SIZE_Nx2N: puWidth = cuSize >> 1;
> - break;
> - case SIZE_NxN: puWidth = cuSize >> 1;
> - break;
> - case SIZE_2NxnU: puWidth = cuSize;
> - break;
> - case SIZE_2NxnD: puWidth = cuSize;
> - break;
> - case SIZE_nLx2N:
> - if (partIdx == 0)
> - {
> - puWidth = cuSize >> 2;
> - }
> - else if (partIdx == 1)
> - {
> - puWidth = (cuSize >> 1) + (cuSize >> 2);
> - }
> - else
> - {
> - X265_CHECK(0, "unexpected part index\n");
> - }
> - break;
> - case SIZE_nRx2N:
> - if (partIdx == 0)
> - {
> - puWidth = (cuSize >> 1) + (cuSize >> 2);
> - }
> - else if (partIdx == 1)
> - {
> - puWidth = cuSize >> 2;
> - }
> - else
> - {
> - X265_CHECK(0, "unexpected part index\n");
> - }
> - break;
> - default:
> - X265_CHECK(0, "unexpected part type\n");
> - break;
> - }
> -
> - outPartIdxRT = g_rasterToZscan[g_zscanToRaster[outPartIdxLT] + (puWidth >> m_pic->getLog2UnitSize()) - 1];
> -}
> -
> -void TComDataCU::deriveLeftBottomIdxGeneral(uint32_t absPartIdx, uint32_t partIdx, uint32_t& outPartIdxLB)
> -{
> - uint32_t cuSize = m_cuSize[absPartIdx];
> - uint32_t puHeight = 0;
> -
> - switch (m_partSizes[absPartIdx])
> - {
> - case SIZE_2Nx2N: puHeight = cuSize;
> - break;
> - case SIZE_2NxN: puHeight = cuSize >> 1;
> - break;
> - case SIZE_Nx2N: puHeight = cuSize;
> - break;
> - case SIZE_NxN: puHeight = cuSize >> 1;
> - break;
> - case SIZE_2NxnU:
> - if (partIdx == 0)
> - {
> - puHeight = cuSize >> 2;
> - }
> - else if (partIdx == 1)
> - {
> - puHeight = (cuSize >> 1) + (cuSize >> 2);
> - }
> - else
> - {
> - X265_CHECK(0, "unexpected part index\n");
> - }
> - break;
> - case SIZE_2NxnD:
> - if (partIdx == 0)
> - {
> - puHeight = (cuSize >> 1) + (cuSize >> 2);
> - }
> - else if (partIdx == 1)
> - {
> - puHeight = cuSize >> 2;
> - }
> - else
> - {
> - X265_CHECK(0, "unexpected part index\n");
> - }
> - break;
> - case SIZE_nLx2N: puHeight = cuSize;
> - break;
> - case SIZE_nRx2N: puHeight = cuSize;
> - break;
> - default:
> - X265_CHECK(0, "unexpected part type\n");
> - break;
> - }
> -
> - outPartIdxLB = g_rasterToZscan[g_zscanToRaster[m_absIdxInLCU + absPartIdx] + ((puHeight >> m_pic->getLog2UnitSize()) - 1) * m_pic->getNumPartInCUSize()];
> -}
> -
> void TComDataCU::deriveLeftRightTopIdx(uint32_t partIdx, uint32_t& ruiPartIdxLT, uint32_t& ruiPartIdxRT)
> {
> ruiPartIdxLT = m_absIdxInLCU;
> @@ -1889,9 +1778,9 @@
> {
> uint32_t absPartAddr = m_absIdxInLCU + absPartIdx;
> const bool isInterB = getSlice()->isInterB();
> -
> +#if 0
> maxNumMergeCand = getSlice()->getMaxNumMergeCand();
> -
> +#endif
we don't want to litter the code with #if 0; if the lines are no
longer useful or valid, just remove them. If we want them back later
we can find them in the revision history.
> for (uint32_t i = 0; i < maxNumMergeCand; ++i)
> {
> mvFieldNeighbours[i][0].refIdx = NOT_VALID;
> @@ -1906,7 +1795,12 @@
>
> uint32_t partIdxLT, partIdxRT, partIdxLB;
> PartSize curPS = getPartitionSize(absPartIdx);
> +
> +#if 0
> deriveLeftBottomIdxGeneral(absPartIdx, puIdx, partIdxLB);
> +#endif
> + //Left Bottom Idx
> + deriveLeftBottomIdx(puIdx, partIdxLB);
>
> //left
> uint32_t leftPartIdx = 0;
> @@ -1934,7 +1828,11 @@
> }
> }
>
> + //Left Right Top Idx
> +#if 0
> deriveLeftRightTopIdxGeneral(absPartIdx, puIdx, partIdxLT, partIdxRT);
> +#endif
> + deriveLeftRightTopIdx(puIdx, partIdxLT, partIdxRT);
>
> // above
> uint32_t abovePartIdx = 0;
> @@ -1944,6 +1842,7 @@
> cuAbove->isDiffMER(xP + nPSW - 1, yP - 1, xP, yP) &&
> !(puIdx == 1 && (curPS == SIZE_2NxN || curPS == SIZE_2NxnU || curPS == SIZE_2NxnD)) &&
> !cuAbove->isIntra(abovePartIdx);
> +
> if (isAvailableB1 && (!isAvailableA1 || !cuLeft->hasEqualMotion(leftPartIdx, cuAbove, abovePartIdx)))
> {
> // get Inter Dir
> @@ -2209,6 +2108,7 @@
> {
> return true;
> }
> +
> return false;
> }
>
> @@ -2770,8 +2670,8 @@
>
> outPartIdxCenter = m_absIdxInLCU + partAddr; // partition origin.
> outPartIdxCenter = g_rasterToZscan[g_zscanToRaster[outPartIdxCenter]
> - + (partHeight >> m_pic->getLog2UnitSize()) / 2 * m_pic->getNumPartInCUSize()
> - + (partWidth >> m_pic->getLog2UnitSize()) / 2];
> + + ((partHeight >> m_pic->getLog2UnitSize()) >> 1) * m_pic->getNumPartInCUSize()
> + + ((partWidth >> m_pic->getLog2UnitSize()) >> 1)];
> }
>
> uint32_t TComDataCU::getCoefScanIdx(uint32_t absPartIdx, uint32_t log2TrSize, bool bIsLuma, bool bIsIntra)
> diff -r a18972fd05b1 -r efa2f64a1565 source/Lib/TLibCommon/TComDataCU.h
> --- a/source/Lib/TLibCommon/TComDataCU.h Tue Jul 01 14:58:35 2014 -0500
> +++ b/source/Lib/TLibCommon/TComDataCU.h Wed Jul 02 12:20:15 2014 +0530
> @@ -425,8 +425,6 @@
>
> bool hasEqualMotion(uint32_t absPartIdx, TComDataCU* candCU, uint32_t candAbsPartIdx);
> void getInterMergeCandidates(uint32_t absPartIdx, uint32_t puIdx, TComMvField (*mvFieldNeighbours)[2], uint8_t* interDirNeighbours, uint32_t& maxNumMergeCand);
> - void deriveLeftRightTopIdxGeneral(uint32_t absPartIdx, uint32_t partIdx, uint32_t& partIdxLT, uint32_t& partIdxRT);
> - void deriveLeftBottomIdxGeneral(uint32_t absPartIdx, uint32_t partIdx, uint32_t& partIdxLB);
>
> // -------------------------------------------------------------------------------------------------------------------
> // member functions for modes
> diff -r a18972fd05b1 -r efa2f64a1565 source/Lib/TLibEncoder/TEncSearch.cpp
> --- a/source/Lib/TLibEncoder/TEncSearch.cpp Tue Jul 01 14:58:35 2014 -0500
> +++ b/source/Lib/TLibEncoder/TEncSearch.cpp Wed Jul 02 12:20:15 2014 +0530
> @@ -2064,12 +2064,11 @@
> {
> AMVPInfo amvpInfo[2][MAX_NUM_REF];
>
> - TComPicYuv *fenc = cu->getSlice()->getPic()->getPicYuvOrg();
> - PartSize partSize = cu->getPartitionSize(0);
> - int numPart = cu->getNumPartInter();
> - int numPredDir = cu->getSlice()->isInterP() ? 1 : 2;
> + TComPicYuv *fenc = cu->getSlice()->getPic()->getPicYuvOrg();
> + PartSize partSize = cu->getPartitionSize(0);
> uint32_t lastMode = 0;
> - int totalmebits = 0;
> + int numPart = cu->getNumPartInter();
> + int totalmebits = 0;
>
> const int* numRefIdx = cu->getSlice()->getNumRefIdx();
>
> @@ -2129,6 +2128,7 @@
> xGetBlkBits(partSize, cu->getSlice()->isInterP(), partIdx, lastMode, listSelBits);
>
> // Uni-directional prediction
> + int numPredDir = cu->getSlice()->isInterP() ? 1 : 2;
> for (int l = 0; l < numPredDir; l++)
> {
> for (int ref = 0; ref < numRefIdx[l]; ref++)
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
--
Steve Borho
More information about the x265-devel
mailing list