[x265] [PATCH] TComDataCU: remove redundant functions
ashok at multicorewareinc.com
ashok at multicorewareinc.com
Thu Jul 3 16:24:46 CEST 2014
# HG changeset patch
# User Ashok Kumar Mishra<ashok at multicorewareinc.com>
# Date 1404283815 -19800
# Wed Jul 02 12:20:15 2014 +0530
# Node ID b546653344ca4f81845d44b2f0b86d56dcb853d3
# Parent e3f9acd4ff88eee82b7554baaab512bc1fd8e840
TComDataCU: remove redundant functions
diff -r e3f9acd4ff88 -r b546653344ca source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp Thu Jul 03 16:24:26 2014 +0530
+++ 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;
@@ -1890,8 +1779,6 @@
uint32_t absPartAddr = m_absIdxInLCU + absPartIdx;
const bool isInterB = getSlice()->isInterB();
- maxNumMergeCand = getSlice()->getMaxNumMergeCand();
-
for (uint32_t i = 0; i < maxNumMergeCand; ++i)
{
mvFieldNeighbours[i][0].refIdx = NOT_VALID;
@@ -1906,7 +1793,9 @@
uint32_t partIdxLT, partIdxRT, partIdxLB;
PartSize curPS = getPartitionSize(absPartIdx);
- deriveLeftBottomIdxGeneral(absPartIdx, puIdx, partIdxLB);
+
+ //Left Bottom Idx
+ deriveLeftBottomIdx(puIdx, partIdxLB);
//left
uint32_t leftPartIdx = 0;
@@ -1934,7 +1823,8 @@
}
}
- deriveLeftRightTopIdxGeneral(absPartIdx, puIdx, partIdxLT, partIdxRT);
+ //Left Right Top Idx
+ deriveLeftRightTopIdx(puIdx, partIdxLT, partIdxRT);
// above
uint32_t abovePartIdx = 0;
@@ -1944,6 +1834,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 +2100,7 @@
{
return true;
}
+
return false;
}
@@ -2770,8 +2662,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 e3f9acd4ff88 -r b546653344ca source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h Thu Jul 03 16:24:26 2014 +0530
+++ 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 e3f9acd4ff88 -r b546653344ca source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp Thu Jul 03 16:24:26 2014 +0530
+++ 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++)
More information about the x265-devel
mailing list