[x265] [PATCH 6 of 6] cleanup: remove unused function and process row once
Min Chen
chenm003 at 163.com
Tue Aug 20 08:18:44 CEST 2013
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1376979300 -28800
# Node ID 8620c2d756efa04c0cd1c00717bbb90e50a2a78e
# Parent a0b9c577aa0f8d3d2c027f52112624266e0c89a3
cleanup: remove unused function and process row once
diff -r a0b9c577aa0f -r 8620c2d756ef source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
--- a/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp Tue Aug 20 14:14:45 2013 +0800
+++ b/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp Tue Aug 20 14:15:00 2013 +0800
@@ -1192,7 +1192,7 @@
}
}
-Void TEncSampleAdaptiveOffset::calcSaoStatsCu_BeforeDblk(TComPic* pic)
+Void TEncSampleAdaptiveOffset::calcSaoStatsRowCus_BeforeDblk(TComPic* pic, Int idxY)
{
Int addr, yCbCr;
Int x, y;
@@ -1216,9 +1216,7 @@
Int endY;
Int firstX, firstY;
- Int idxY;
Int idxX;
- Int frameHeightInCU = m_numCuInHeight;
Int frameWidthInCU = m_numCuInWidth;
Int j, k;
@@ -1230,7 +1228,6 @@
Pel* pTableBo;
Int *tmp_swap;
- for (idxY = 0; idxY < frameHeightInCU; idxY++)
{
for (idxX = 0; idxX < frameWidthInCU; idxX++)
{
@@ -1505,308 +1502,6 @@
}
}
-Void TEncSampleAdaptiveOffset::calcSaoStatsLCu_BeforeDblk(TComPic* pic, Int addr)
-{
- Int yCbCr;
- Int x, y;
- TComSPS *pTmpSPS = pic->getSlice()->getSPS();
-
- Pel* fenc;
- Pel* pRec;
- Int stride;
- Int lcuHeight = pTmpSPS->getMaxCUHeight();
- Int lcuWidth = pTmpSPS->getMaxCUWidth();
- UInt rPelX;
- UInt bPelY;
- Int64* stats;
- Int64* count;
- Int classIdx;
- Int picWidthTmp = 0;
- Int picHeightTmp = 0;
- Int startX;
- Int startY;
- Int endX;
- Int endY;
- Int firstX, firstY;
-
- Int j, k;
-
- Int isChroma;
- Int numSkipLine, numSkipLineRight;
-
- UInt lPelX, tPelY;
- TComDataCU *pTmpCu;
- Pel* pTableBo;
- Int *tmp_swap;
-
- lcuHeight = pTmpSPS->getMaxCUHeight();
- lcuWidth = pTmpSPS->getMaxCUWidth();
- pTmpCu = pic->getCU(addr);
- lPelX = pTmpCu->getCUPelX();
- tPelY = pTmpCu->getCUPelY();
- for (yCbCr = 0; yCbCr < 3; yCbCr++)
- {
- isChroma = (yCbCr != 0) ? 1 : 0;
-
- for (j = 0; j < MAX_NUM_SAO_TYPE; j++)
- {
- for (k = 0; k < MAX_NUM_SAO_CLASS; k++)
- {
- TEncSampleAdaptiveOffset::m_countPreDblk[addr][yCbCr][j][k] = 0;
- TEncSampleAdaptiveOffset::m_offsetOrgPreDblk[addr][yCbCr][j][k] = 0;
- }
- }
-
- if (yCbCr == 0)
- {
- picWidthTmp = m_picWidth;
- picHeightTmp = m_picHeight;
- }
- else if (yCbCr == 1)
- {
- picWidthTmp = m_picWidth >> isChroma;
- picHeightTmp = m_picHeight >> isChroma;
- lcuWidth = lcuWidth >> isChroma;
- lcuHeight = lcuHeight >> isChroma;
- lPelX = lPelX >> isChroma;
- tPelY = tPelY >> isChroma;
- }
- rPelX = lPelX + lcuWidth;
- bPelY = tPelY + lcuHeight;
- rPelX = rPelX > picWidthTmp ? picWidthTmp : rPelX;
- bPelY = bPelY > picHeightTmp ? picHeightTmp : bPelY;
- lcuWidth = rPelX - lPelX;
- lcuHeight = bPelY - tPelY;
-
- stride = (yCbCr == 0) ? pic->getStride() : pic->getCStride();
- pTableBo = (yCbCr == 0) ? m_lumaTableBo : m_chromaTableBo;
-
- //if(iSaoType == BO)
-
- numSkipLine = isChroma ? 1 : 3;
- numSkipLineRight = isChroma ? 2 : 4;
-
- stats = TEncSampleAdaptiveOffset::m_offsetOrgPreDblk[addr][yCbCr][SAO_BO];
- count = TEncSampleAdaptiveOffset::m_countPreDblk[addr][yCbCr][SAO_BO];
-
- fenc = getPicYuvAddr(pic->getPicYuvOrg(), yCbCr, addr);
- pRec = getPicYuvAddr(pic->getPicYuvRec(), yCbCr, addr);
-
- startX = (rPelX == picWidthTmp) ? lcuWidth : lcuWidth - numSkipLineRight;
- startY = (bPelY == picHeightTmp) ? lcuHeight : lcuHeight - numSkipLine;
-
- for (y = 0; y < lcuHeight; y++)
- {
- for (x = 0; x < lcuWidth; x++)
- {
- if (x < startX && y < startY)
- continue;
-
- classIdx = pTableBo[pRec[x]];
- if (classIdx)
- {
- stats[classIdx] += (fenc[x] - pRec[x]);
- count[classIdx]++;
- }
- }
-
- fenc += stride;
- pRec += stride;
- }
-
- Int signLeft;
- Int signRight;
- Int signDown;
- Int signDown1;
- Int signDown2;
-
- UInt uiEdgeType;
-
- //if (iSaoType == EO_0)
-
- numSkipLine = isChroma ? 1 : 3;
- numSkipLineRight = isChroma ? 3 : 5;
-
- stats = TEncSampleAdaptiveOffset::m_offsetOrgPreDblk[addr][yCbCr][SAO_EO_0];
- count = TEncSampleAdaptiveOffset::m_countPreDblk[addr][yCbCr][SAO_EO_0];
-
- fenc = getPicYuvAddr(pic->getPicYuvOrg(), yCbCr, addr);
- pRec = getPicYuvAddr(pic->getPicYuvRec(), yCbCr, addr);
-
- startX = (rPelX == picWidthTmp) ? lcuWidth - 1 : lcuWidth - numSkipLineRight;
- startY = (bPelY == picHeightTmp) ? lcuHeight : lcuHeight - numSkipLine;
- firstX = (lPelX == 0) ? 1 : 0;
- endX = (rPelX == picWidthTmp) ? lcuWidth - 1 : lcuWidth;
-
- for (y = 0; y < lcuHeight; y++)
- {
- signLeft = xSign(pRec[firstX] - pRec[firstX - 1]);
- for (x = firstX; x < endX; x++)
- {
- signRight = xSign(pRec[x] - pRec[x + 1]);
- uiEdgeType = signRight + signLeft + 2;
- signLeft = -signRight;
-
- if (x < startX && y < startY)
- continue;
-
- stats[m_eoTable[uiEdgeType]] += (fenc[x] - pRec[x]);
- count[m_eoTable[uiEdgeType]]++;
- }
-
- fenc += stride;
- pRec += stride;
- }
-
- //if (iSaoType == EO_1)
-
- numSkipLine = isChroma ? 2 : 4;
- numSkipLineRight = isChroma ? 2 : 4;
-
- stats = TEncSampleAdaptiveOffset::m_offsetOrgPreDblk[addr][yCbCr][SAO_EO_1];
- count = TEncSampleAdaptiveOffset::m_countPreDblk[addr][yCbCr][SAO_EO_1];
-
- fenc = getPicYuvAddr(pic->getPicYuvOrg(), yCbCr, addr);
- pRec = getPicYuvAddr(pic->getPicYuvRec(), yCbCr, addr);
-
- startX = (rPelX == picWidthTmp) ? lcuWidth : lcuWidth - numSkipLineRight;
- startY = (bPelY == picHeightTmp) ? lcuHeight - 1 : lcuHeight - numSkipLine;
- firstY = (tPelY == 0) ? 1 : 0;
- endY = (bPelY == picHeightTmp) ? lcuHeight - 1 : lcuHeight;
- if (firstY == 1)
- {
- fenc += stride;
- pRec += stride;
- }
-
- for (x = 0; x < lcuWidth; x++)
- {
- m_upBuff1[x] = xSign(pRec[x] - pRec[x - stride]);
- }
-
- for (y = firstY; y < endY; y++)
- {
- for (x = 0; x < lcuWidth; x++)
- {
- signDown = xSign(pRec[x] - pRec[x + stride]);
- uiEdgeType = signDown + m_upBuff1[x] + 2;
- m_upBuff1[x] = -signDown;
-
- if (x < startX && y < startY)
- continue;
-
- stats[m_eoTable[uiEdgeType]] += (fenc[x] - pRec[x]);
- count[m_eoTable[uiEdgeType]]++;
- }
-
- fenc += stride;
- pRec += stride;
- }
-
- //if (iSaoType == EO_2)
-
- numSkipLine = isChroma ? 2 : 4;
- numSkipLineRight = isChroma ? 3 : 5;
-
- stats = TEncSampleAdaptiveOffset::m_offsetOrgPreDblk[addr][yCbCr][SAO_EO_2];
- count = TEncSampleAdaptiveOffset::m_countPreDblk[addr][yCbCr][SAO_EO_2];
-
- fenc = getPicYuvAddr(pic->getPicYuvOrg(), yCbCr, addr);
- pRec = getPicYuvAddr(pic->getPicYuvRec(), yCbCr, addr);
-
- startX = (rPelX == picWidthTmp) ? lcuWidth - 1 : lcuWidth - numSkipLineRight;
- startY = (bPelY == picHeightTmp) ? lcuHeight - 1 : lcuHeight - numSkipLine;
- firstX = (lPelX == 0) ? 1 : 0;
- firstY = (tPelY == 0) ? 1 : 0;
- endX = (rPelX == picWidthTmp) ? lcuWidth - 1 : lcuWidth;
- endY = (bPelY == picHeightTmp) ? lcuHeight - 1 : lcuHeight;
- if (firstY == 1)
- {
- fenc += stride;
- pRec += stride;
- }
-
- for (x = firstX; x < endX; x++)
- {
- m_upBuff1[x] = xSign(pRec[x] - pRec[x - stride - 1]);
- }
-
- for (y = firstY; y < endY; y++)
- {
- signDown2 = xSign(pRec[stride + startX] - pRec[startX - 1]);
- for (x = firstX; x < endX; x++)
- {
- signDown1 = xSign(pRec[x] - pRec[x + stride + 1]);
- uiEdgeType = signDown1 + m_upBuff1[x] + 2;
- m_upBufft[x + 1] = -signDown1;
-
- if (x < startX && y < startY)
- continue;
-
- stats[m_eoTable[uiEdgeType]] += (fenc[x] - pRec[x]);
- count[m_eoTable[uiEdgeType]]++;
- }
-
- m_upBufft[firstX] = signDown2;
- tmp_swap = m_upBuff1;
- m_upBuff1 = m_upBufft;
- m_upBufft = tmp_swap;
-
- pRec += stride;
- fenc += stride;
- }
-
- //if (iSaoType == EO_3)
-
- numSkipLine = isChroma ? 2 : 4;
- numSkipLineRight = isChroma ? 3 : 5;
-
- stats = TEncSampleAdaptiveOffset::m_offsetOrgPreDblk[addr][yCbCr][SAO_EO_3];
- count = TEncSampleAdaptiveOffset::m_countPreDblk[addr][yCbCr][SAO_EO_3];
-
- fenc = getPicYuvAddr(pic->getPicYuvOrg(), yCbCr, addr);
- pRec = getPicYuvAddr(pic->getPicYuvRec(), yCbCr, addr);
-
- startX = (rPelX == picWidthTmp) ? lcuWidth - 1 : lcuWidth - numSkipLineRight;
- startY = (bPelY == picHeightTmp) ? lcuHeight - 1 : lcuHeight - numSkipLine;
- firstX = (lPelX == 0) ? 1 : 0;
- firstY = (tPelY == 0) ? 1 : 0;
- endX = (rPelX == picWidthTmp) ? lcuWidth - 1 : lcuWidth;
- endY = (bPelY == picHeightTmp) ? lcuHeight - 1 : lcuHeight;
- if (firstY == 1)
- {
- fenc += stride;
- pRec += stride;
- }
-
- for (x = firstX - 1; x < endX; x++)
- {
- m_upBuff1[x] = xSign(pRec[x] - pRec[x - stride + 1]);
- }
-
- for (y = firstY; y < endY; y++)
- {
- for (x = firstX; x < endX; x++)
- {
- signDown1 = xSign(pRec[x] - pRec[x + stride - 1]);
- uiEdgeType = signDown1 + m_upBuff1[x] + 2;
- m_upBuff1[x - 1] = -signDown1;
-
- if (x < startX && y < startY)
- continue;
-
- stats[m_eoTable[uiEdgeType]] += (fenc[x] - pRec[x]);
- count[m_eoTable[uiEdgeType]]++;
- }
-
- m_upBuff1[endX - 1] = xSign(pRec[endX - 1 + stride] - pRec[endX]);
-
- pRec += stride;
- fenc += stride;
- }
- }
-}
-
/** get SAO statistics
* \param *psQTPart, yCbCr
*/
diff -r a0b9c577aa0f -r 8620c2d756ef source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h
--- a/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h Tue Aug 20 14:14:45 2013 +0800
+++ b/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h Tue Aug 20 14:15:00 2013 +0800
@@ -95,8 +95,7 @@
Void calcSaoStatsCu(Int addr, Int partIdx, Int yCbCr);
Void calcSaoStatsBlock(Pel* recStart, Pel* orgStart, Int stride, Int64** stats, Int64** counts, UInt width, UInt height, Bool* bBorderAvail, Int yCbCr);
Void calcSaoStatsCuOrg(Int addr, Int partIdx, Int yCbCr);
- Void calcSaoStatsCu_BeforeDblk(TComPic* pic);
- Void calcSaoStatsLCu_BeforeDblk(TComPic* pic, Int addr);
+ Void calcSaoStatsRowCus_BeforeDblk(TComPic* pic, Int idxY);
Void destroyEncBuffer();
Void createEncBuffer();
Void assignSaoUnitSyntax(SaoLcuParam* saoLcuParam, SAOQTPart* saoPart, Bool &oneUnitFlag);
diff -r a0b9c577aa0f -r 8620c2d756ef source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp Tue Aug 20 14:14:45 2013 +0800
+++ b/source/encoder/framefilter.cpp Tue Aug 20 14:15:00 2013 +0800
@@ -139,11 +139,7 @@
// SAO parameter estimation using non-deblocked pixels for LCU bottom and right boundary areas
if (m_cfg->param.saoLcuBasedOptimization && m_cfg->param.saoLcuBoundary)
{
- for (UInt col = 0; col < numCols; col++)
- {
- const uint32_t cuAddr = lineStartCUAddr + col;
- m_sao.calcSaoStatsLCu_BeforeDblk(m_pic, cuAddr);
- }
+ m_sao.calcSaoStatsRowCus_BeforeDblk(m_pic, row);
}
for (UInt col = 0; col < numCols; col++)
More information about the x265-devel
mailing list