[x265] [PATCH] TShortYUV : Removed all the get() method and moved private data member into Public
gopu at multicorewareinc.com
gopu at multicorewareinc.com
Tue Jul 2 11:38:27 CEST 2013
# HG changeset patch
# User ggopu
# Date 1372757890 -19800
# Node ID 51cb78dccec1f048daa0b1073ad6984a91a2ec45
# Parent 6a97823d1060a4a9fae2fd11b506d1c72b62158c
TShortYUV : Removed all the get() method and moved private data member into Public
diff -r 6a97823d1060 -r 51cb78dccec1 source/Lib/TLibCommon/TComPrediction.cpp
--- a/source/Lib/TLibCommon/TComPrediction.cpp Tue Jul 02 11:42:33 2013 +0530
+++ b/source/Lib/TLibCommon/TComPrediction.cpp Tue Jul 02 15:08:10 2013 +0530
@@ -62,8 +62,7 @@
, m_piPredAngBufs(NULL)
, m_pLumaRecBuffer(0)
, m_iLumaRecStride(0)
-{
-}
+{}
TComPrediction::~TComPrediction()
{
@@ -379,14 +378,14 @@
// Create the prediction
Pel refAbv[3 * MAX_CU_SIZE];
Pel refLft[3 * MAX_CU_SIZE];
- int limit = (uiDirMode <= 25 && uiDirMode >= 11) ? (iWidth + 1) : (2*iWidth+1);
+ int limit = (uiDirMode <= 25 && uiDirMode >= 11) ? (iWidth + 1) : (2 * iWidth + 1);
memcpy(refAbv + iWidth - 1, ptrSrc, (limit) * sizeof(Pel));
for (int k = 0; k < limit; k++)
{
refLft[k + iWidth - 1] = ptrSrc[k * sw];
}
- primitives.getIPredAng(g_bitDepthC, (pixel*)pDst, uiStride, iWidth, uiDirMode, false, (pixel*)refLft + iWidth -1, (pixel*)refAbv + iWidth -1);
+ primitives.getIPredAng(g_bitDepthC, (pixel*)pDst, uiStride, iWidth, uiDirMode, false, (pixel*)refLft + iWidth - 1, (pixel*)refAbv + iWidth - 1);
}
}
@@ -416,7 +415,7 @@
Int iWidth;
Int iHeight;
UInt uiPartAddr;
-
+
if (iPartIdx >= 0)
{
pcCU->getPartIndexAndSize(iPartIdx, uiPartAddr, iWidth, iHeight);
@@ -478,10 +477,9 @@
}
}
-
Void TComPrediction::xPredInterUni(TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi)
{
- assert (bi == false);
+ assert(bi == false);
Int iRefIdx = pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);
assert(iRefIdx >= 0);
@@ -494,7 +492,7 @@
Void TComPrediction::xPredInterUni(TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TShortYUV*& rpcYuvPred, Bool bi)
{
- assert (bi == true);
+ assert(bi == true);
Int iRefIdx = pcCU->getCUMvField(eRefPicList)->getRefIdx(uiPartAddr);
@@ -521,8 +519,9 @@
assert(iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList));
pcMbYuv = &m_acShortPred[iRefList];
- xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, true);
+ xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, true);
}
+
if (pcCU->getSlice()->getPPS()->getWPBiPred() && pcCU->getSlice()->getSliceType() == B_SLICE)
{
xWeightedPredictionBi(pcCU, &m_acShortPred[0], &m_acShortPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred);
@@ -548,8 +547,9 @@
assert(iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList));
pcMbYuv = &m_acShortPred[iRefList];
- xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, true);
+ xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, true);
}
+
xWeightedPredictionBi(pcCU, &m_acShortPred[0], &m_acShortPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred);
}
else if (pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType() == P_SLICE)
@@ -568,8 +568,9 @@
assert(iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList));
pcMbYuv = &m_acShortPred[iRefList];
- xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, true);
+ xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, true);
}
+
xWeightedPredictionUni(pcCU, &m_acShortPred[0], uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, rpcYuvPred);
}
else
@@ -588,8 +589,9 @@
assert(iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList));
pcMbYuv = &m_acYuvPred[iRefList];
- xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv);
+ xPredInterUni(pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv);
}
+
xWeightedAverage(&m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred);
}
}
@@ -607,7 +609,7 @@
* \param bi Flag indicating whether bipred is used
*/
Void TComPrediction::xPredInterLumaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, MV *mv, Int width, Int height, TComYuv *&dstPic, Bool bi)
-{
+{
assert(bi == false);
Int refStride = refPic->getStride();
@@ -635,7 +637,7 @@
Int refOffset = (mv->x >> 2) + (mv->y >> 2) * refStride;
Pel *ref = refPic->getLumaAddr(cu->getAddr(), cu->getZorderIdxInCU() + partAddr) + refOffset;
- Int dstStride = dstPic->getStride();
+ Int dstStride = dstPic->m_width;
Short *dst = dstPic->getLumaAddr(partAddr);
Int xFrac = mv->x & 0x3;
@@ -646,18 +648,18 @@
if (yFrac == 0)
{
- if(xFrac==0)
+ if (xFrac == 0)
{
- x265::primitives.ipfilterConvert_p_s(g_bitDepthY, (pixel*)ref , refStride, dst, dstStride, width, height);
+ x265::primitives.ipfilterConvert_p_s(g_bitDepthY, (pixel*)ref, refStride, dst, dstStride, width, height);
}
else
{
- x265::primitives.ipFilter_p_s[FILTER_H_P_S_8](g_bitDepthY, (pixel*)ref , refStride, dst, dstStride, width, height, TComInterpolationFilter::m_lumaFilter[xFrac]);
+ x265::primitives.ipFilter_p_s[FILTER_H_P_S_8](g_bitDepthY, (pixel*)ref, refStride, dst, dstStride, width, height, TComInterpolationFilter::m_lumaFilter[xFrac]);
}
}
else if (xFrac == 0)
{
- x265::primitives.ipFilter_p_s[FILTER_V_P_S_8](g_bitDepthY, (pixel*)ref , refStride, dst, dstStride, width, height, TComInterpolationFilter::m_lumaFilter[yFrac]);
+ x265::primitives.ipFilter_p_s[FILTER_V_P_S_8](g_bitDepthY, (pixel*)ref, refStride, dst, dstStride, width, height, TComInterpolationFilter::m_lumaFilter[yFrac]);
}
else
{
@@ -666,8 +668,8 @@
Int halfFilterSize = (filterSize >> 1);
Short *tmp = (Short*)xMalloc(Short, width * (height + filterSize - 1));
- x265::primitives.ipFilter_p_s[FILTER_H_P_S_8](g_bitDepthY, (pixel*)(ref - (halfFilterSize - 1) * refStride) , refStride, tmp, tmpStride, width, height + filterSize - 1, TComInterpolationFilter::m_lumaFilter[xFrac]);
- x265::primitives.ipFilter_s_s[FILTER_V_S_S_8](g_bitDepthY, tmp + (halfFilterSize - 1) * tmpStride ,tmpStride, dst, dstStride, width, height, TComInterpolationFilter::m_lumaFilter[yFrac]);
+ x265::primitives.ipFilter_p_s[FILTER_H_P_S_8](g_bitDepthY, (pixel*)(ref - (halfFilterSize - 1) * refStride), refStride, tmp, tmpStride, width, height + filterSize - 1, TComInterpolationFilter::m_lumaFilter[xFrac]);
+ x265::primitives.ipFilter_s_s[FILTER_V_S_S_8](g_bitDepthY, tmp + (halfFilterSize - 1) * tmpStride, tmpStride, dst, dstStride, width, height, TComInterpolationFilter::m_lumaFilter[yFrac]);
xFree(tmp);
}
@@ -745,10 +747,10 @@
//Generate motion compensated block when biprediction
Void TComPrediction::xPredInterChromaBlk(TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, MV *mv, Int width, Int height, TShortYUV *&dstPic, Bool bi)
{
- assert (bi==true);
+ assert(bi == true);
Int refStride = refPic->getCStride();
- Int dstStride = dstPic->getCStride();
+ Int dstStride = dstPic->m_Cwidth;
Int refOffset = (mv->x >> 3) + (mv->y >> 3) * refStride;
@@ -769,15 +771,15 @@
if (yFrac == 0)
{
- if(xFrac==0)
+ if (xFrac == 0)
{
- x265::primitives.ipfilterConvert_p_s(g_bitDepthC, (pixel*)refCb , refStride, dstCb, dstStride, cxWidth, cxHeight);
- x265::primitives.ipfilterConvert_p_s(g_bitDepthC, (pixel*)refCr , refStride, dstCr, dstStride, cxWidth, cxHeight);
+ x265::primitives.ipfilterConvert_p_s(g_bitDepthC, (pixel*)refCb, refStride, dstCb, dstStride, cxWidth, cxHeight);
+ x265::primitives.ipfilterConvert_p_s(g_bitDepthC, (pixel*)refCr, refStride, dstCr, dstStride, cxWidth, cxHeight);
}
else
{
- x265::primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC, (pixel*)refCb , refStride, dstCb, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[xFrac]);
- x265::primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC, (pixel*)refCr , refStride, dstCr, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[xFrac]);
+ x265::primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC, (pixel*)refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[xFrac]);
+ x265::primitives.ipFilter_p_s[FILTER_H_P_S_4](g_bitDepthC, (pixel*)refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, TComInterpolationFilter::m_chromaFilter[xFrac]);
}
}
else if (xFrac == 0)
diff -r 6a97823d1060 -r 51cb78dccec1 source/Lib/TLibCommon/TComWeightPrediction.cpp
--- a/source/Lib/TLibCommon/TComWeightPrediction.cpp Tue Jul 02 11:42:33 2013 +0530
+++ b/source/Lib/TLibCommon/TComWeightPrediction.cpp Tue Jul 02 15:08:10 2013 +0530
@@ -60,7 +60,6 @@
return ClipC(((w0 * (P0 + IF_INTERNAL_OFFS) + round) >> shift) + offset);
}
-
// ====================================================================================================================
// Class definition
// ====================================================================================================================
@@ -216,8 +215,8 @@
Int round = shift ? (1 << (shift - 1)) * bRound : 0;
Int w1 = wp1[0].w;
- UInt iSrc0Stride = pcYuvSrc0->getStride();
- UInt iSrc1Stride = pcYuvSrc1->getStride();
+ UInt iSrc0Stride = pcYuvSrc0->m_width;
+ UInt iSrc1Stride = pcYuvSrc1->m_width;
UInt iDstStride = rpcYuvDst->getStride();
for (y = iHeight - 1; y >= 0; y--)
@@ -248,8 +247,8 @@
round = shift ? (1 << (shift - 1)) : 0;
w1 = wp1[1].w;
- iSrc0Stride = pcYuvSrc0->getCStride();
- iSrc1Stride = pcYuvSrc1->getCStride();
+ iSrc0Stride = pcYuvSrc0->m_Cwidth;
+ iSrc1Stride = pcYuvSrc1->m_Cwidth;
iDstStride = rpcYuvDst->getCStride();
iWidth >>= 1;
@@ -295,7 +294,6 @@
}
}
-
/** weighted averaging for uni-pred
* \param TComYuv* pcYuvSrc0
* \param iPartUnitIdx
@@ -422,7 +420,7 @@
Int shiftNum = IF_INTERNAL_PREC - g_bitDepthY;
Int shift = wp0[0].shift + shiftNum;
Int round = shift ? (1 << (shift - 1)) : 0;
- UInt iSrc0Stride = pcYuvSrc0->getStride();
+ UInt iSrc0Stride = pcYuvSrc0->m_width;
UInt iDstStride = rpcYuvDst->getStride();
for (y = iHeight - 1; y >= 0; y--)
@@ -451,7 +449,7 @@
shift = wp0[1].shift + shiftNum;
round = shift ? (1 << (shift - 1)) : 0;
- iSrc0Stride = pcYuvSrc0->getCStride();
+ iSrc0Stride = pcYuvSrc0->m_Cwidth;
iDstStride = rpcYuvDst->getCStride();
iWidth >>= 1;
@@ -683,7 +681,6 @@
addWeightUni(pcYuvSrc, uiPartAddr, iWidth, iHeight, pwp, rpcYuvPred);
}
-
/** weighted prediction for uni-pred
* \param TComDataCU* pcCU
* \param TShortYuv* pcYuvSrc
diff -r 6a97823d1060 -r 51cb78dccec1 source/Lib/TLibCommon/TComYuv.cpp
--- a/source/Lib/TLibCommon/TComYuv.cpp Tue Jul 02 11:42:33 2013 +0530
+++ b/source/Lib/TLibCommon/TComYuv.cpp Tue Jul 02 15:08:10 2013 +0530
@@ -268,7 +268,7 @@
Short* pDst = pcYuvDst->getLumaAddr(uiPartIdx);
UInt iSrcStride = getStride();
- UInt iDstStride = pcYuvDst->getStride();
+ UInt iDstStride = pcYuvDst->m_width;
x265::primitives.cpyblock_s_p(iWidth, iHeight, pDst, iDstStride, (pixel*)pSrc, iSrcStride);
}
@@ -302,7 +302,7 @@
Short* pDstV = pcYuvDst->getCrAddr(uiPartIdx);
UInt iSrcStride = getCStride();
- UInt iDstStride = pcYuvDst->getCStride();
+ UInt iDstStride = pcYuvDst->m_Cwidth;
x265::primitives.cpyblock_s_p(iWidth, iHeight, pDstU, iDstStride, (pixel*)pSrcU, iSrcStride);
x265::primitives.cpyblock_s_p(iWidth, iHeight, pDstV, iDstStride, (pixel*)pSrcV, iSrcStride);
@@ -362,7 +362,7 @@
Short* pDstU = pcYuvDst->getCbAddr(uiPartIdx);
UInt iSrcStride = getCStride();
- UInt iDstStride = pcYuvDst->getCStride();
+ UInt iDstStride = pcYuvDst->m_Cwidth;
x265::primitives.cpyblock_s_p(iWidth, iHeight, pDstU, iDstStride, (pixel*)pSrcU, iSrcStride);
}
@@ -372,7 +372,7 @@
Short* pDstV = pcYuvDst->getCrAddr(uiPartIdx);
UInt iSrcStride = getCStride();
- UInt iDstStride = pcYuvDst->getCStride();
+ UInt iDstStride = pcYuvDst->m_Cwidth;
x265::primitives.cpyblock_s_p(iWidth, iHeight, pDstV, iDstStride, (pixel*)pSrcV, iSrcStride);
}
@@ -384,7 +384,7 @@
Short* pDstV = pcYuvDst->getCrAddr(uiPartIdx);
UInt iSrcStride = getCStride();
- UInt iDstStride = pcYuvDst->getCStride();
+ UInt iDstStride = pcYuvDst->m_Cwidth;
x265::primitives.cpyblock_s_p(iWidth, iHeight, pDstU, iDstStride, (pixel*)pSrcU, iSrcStride);
x265::primitives.cpyblock_s_p(iWidth, iHeight, pDstV, iDstStride, (pixel*)pSrcV, iSrcStride);
@@ -437,7 +437,7 @@
Pel* pDst = getLumaAddr(uiTrUnitIdx, uiPartSize);
UInt iSrc0Stride = pcYuvSrc0->getStride();
- UInt iSrc1Stride = pcYuvSrc1->getStride();
+ UInt iSrc1Stride = pcYuvSrc1->m_width;
UInt iDstStride = getStride();
for (y = uiPartSize - 1; y >= 0; y--)
@@ -497,7 +497,7 @@
Pel* pDstV = getCrAddr(uiTrUnitIdx, uiPartSize);
UInt iSrc0Stride = pcYuvSrc0->getCStride();
- UInt iSrc1Stride = pcYuvSrc1->getCStride();
+ UInt iSrc1Stride = pcYuvSrc1->m_Cwidth;
UInt iDstStride = getCStride();
for (y = uiPartSize - 1; y >= 0; y--)
@@ -665,8 +665,8 @@
Pel* pDstU = getCbAddr(iPartUnitIdx);
Pel* pDstV = getCrAddr(iPartUnitIdx);
- UInt iSrc0Stride = pcYuvSrc0->getStride();
- UInt iSrc1Stride = pcYuvSrc1->getStride();
+ UInt iSrc0Stride = pcYuvSrc0->m_width;
+ UInt iSrc1Stride = pcYuvSrc1->m_width;
UInt iDstStride = getStride();
Int shiftNum = IF_INTERNAL_PREC + 1 - g_bitDepthY;
Int offset = (1 << (shiftNum - 1)) + 2 * IF_INTERNAL_OFFS;
@@ -689,8 +689,8 @@
shiftNum = IF_INTERNAL_PREC + 1 - g_bitDepthC;
offset = (1 << (shiftNum - 1)) + 2 * IF_INTERNAL_OFFS;
- iSrc0Stride = pcYuvSrc0->getCStride();
- iSrc1Stride = pcYuvSrc1->getCStride();
+ iSrc0Stride = pcYuvSrc0->m_Cwidth;
+ iSrc1Stride = pcYuvSrc1->m_Cwidth;
iDstStride = getCStride();
iWidth >>= 1;
diff -r 6a97823d1060 -r 51cb78dccec1 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp Tue Jul 02 11:42:33 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp Tue Jul 02 15:08:10 2013 +0530
@@ -279,7 +279,7 @@
UInt uiSad;
Pel* piRefSrch = rcStruct.piRefY + iSearchY * rcStruct.iYStride + iSearchX;
-
+
m_pcRdCost->setDistParam(pcPatternKey, piRefSrch, rcStruct.iYStride, m_cDistParam);
if (m_cDistParam.iRows > 12)
@@ -291,7 +291,7 @@
// distortion
m_cDistParam.bitDepth = g_bitDepthY;
uiSad = m_cDistParam.DistFunc(&m_cDistParam);
-
+
// motion cost
uiSad += m_bc.mvcost(MV(iSearchX, iSearchY) << m_pcRdCost->m_iCostScale);
@@ -913,12 +913,13 @@
Int* pcArlCoeff = m_ppcQTTempArlCoeffY[uiQTLayer] + uiNumCoeffPerInc * uiAbsPartIdx;
Short* piRecQt = m_pcQTTempTComYuv[uiQTLayer].getLumaAddr(uiAbsPartIdx);
- UInt uiRecQtStride = m_pcQTTempTComYuv[uiQTLayer].getStride();
+ UInt uiRecQtStride = m_pcQTTempTComYuv[uiQTLayer].m_width;
UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), uiZOrder);
UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride();
Bool useTransformSkip = pcCU->getTransformSkip(uiAbsPartIdx, TEXT_LUMA);
+
//===== init availability pattern =====
if (default0Save1Load2 != 2)
@@ -930,12 +931,12 @@
// save prediction
if (default0Save1Load2 == 1)
{
- primitives.cpyblock((int)uiWidth, uiHeight, (pixel *)m_pSharedPredTransformSkip[0], uiWidth, (pixel *)piPred, uiStride);
+ primitives.cpyblock((int)uiWidth, uiHeight, (pixel*)m_pSharedPredTransformSkip[0], uiWidth, (pixel*)piPred, uiStride);
}
}
else
{
- primitives.cpyblock((int)uiWidth, uiHeight, (pixel *)piPred, uiStride, (pixel *)m_pSharedPredTransformSkip[0], uiWidth);
+ primitives.cpyblock((int)uiWidth, uiHeight, (pixel*)piPred, uiStride, (pixel*)m_pSharedPredTransformSkip[0], uiWidth);
}
//===== get residual signal =====
@@ -978,7 +979,7 @@
}
}
- //===== reconstruction =====
+ //===== reconstruction =====
primitives.calcrecon[(Int)g_aucConvertToBit[uiWidth]]((pixel*)piPred, piResi, (pixel*)piReco, piRecQt, (pixel*)piRecIPred, uiStride, uiRecQtStride, uiRecIPredStride);
@@ -1028,8 +1029,7 @@
TCoeff* pcCoeff = (uiChromaId > 0 ? m_ppcQTTempCoeffCr[uiQTLayer] : m_ppcQTTempCoeffCb[uiQTLayer]) + uiNumCoeffPerInc * uiAbsPartIdx;
Int* pcArlCoeff = (uiChromaId > 0 ? m_ppcQTTempArlCoeffCr[uiQTLayer] : m_ppcQTTempArlCoeffCb[uiQTLayer]) + uiNumCoeffPerInc * uiAbsPartIdx;
Short* piRecQt = (uiChromaId > 0 ? m_pcQTTempTComYuv[uiQTLayer].getCrAddr(uiAbsPartIdx) : m_pcQTTempTComYuv[uiQTLayer].getCbAddr(uiAbsPartIdx));
- UInt uiRecQtStride = m_pcQTTempTComYuv[uiQTLayer].getCStride();
-
+ UInt uiRecQtStride = m_pcQTTempTComYuv[uiQTLayer].m_Cwidth;
UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
Pel* piRecIPred = (uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), uiZOrder) : pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), uiZOrder));
UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getCStride();
@@ -1054,9 +1054,9 @@
if (default0Save1Load2 == 1)
{
Pel* pPred = piPred;
- Pel* pPredBuf = m_pSharedPredTransformSkip[1 + uiChromaId];
-
- primitives.cpyblock((int)uiWidth,uiHeight,(pixel *)pPredBuf,uiWidth, (pixel *)pPred, uiStride);
+ Pel* pPredBuf = m_pSharedPredTransformSkip[1 + uiChromaId];
+
+ primitives.cpyblock((int)uiWidth, uiHeight, (pixel*)pPredBuf, uiWidth, (pixel*)pPred, uiStride);
}
}
else
@@ -1064,12 +1064,12 @@
// load prediction
Pel* pPred = piPred;
Pel* pPredBuf = m_pSharedPredTransformSkip[1 + uiChromaId];
-
- primitives.cpyblock((int)uiWidth,uiHeight,(pixel *)pPred,uiStride,(pixel *)pPredBuf,uiWidth);
+
+ primitives.cpyblock((int)uiWidth, uiHeight, (pixel*)pPred, uiStride, (pixel*)pPredBuf, uiWidth);
}
- //===== get residual signal =====
-
- primitives.calcresidual[(Int)g_aucConvertToBit[uiWidth]]((pixel*)piOrg,(pixel*)piPred,piResi, uiStride);
+ //===== get residual signal =====
+
+ primitives.calcresidual[(Int)g_aucConvertToBit[uiWidth]]((pixel*)piOrg, (pixel*)piPred, piResi, uiStride);
//===== transform and quantization =====
{
@@ -1117,7 +1117,7 @@
}
//===== reconstruction =====
-
+
primitives.calcrecon[(Int)g_aucConvertToBit[uiWidth]]((pixel*)piPred, piResi, (pixel*)piReco, piRecQt, (pixel*)piRecIPred, uiStride, uiRecQtStride, uiRecIPredStride);
//===== update distortion =====
@@ -1435,7 +1435,7 @@
UInt uiQTLayer = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize;
UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
Short* piSrc = m_pcQTTempTComYuv[uiQTLayer].getLumaAddr(uiAbsPartIdx);
- UInt uiSrcStride = m_pcQTTempTComYuv[uiQTLayer].getStride();
+ UInt uiSrcStride = m_pcQTTempTComYuv[uiQTLayer].m_width;
Pel* piDes = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), uiZOrder);
UInt uiDesStride = pcCU->getPic()->getPicYuvRec()->getStride();
for (UInt uiY = 0; uiY < uiHeight; uiY++, piSrc += uiSrcStride, piDes += uiDesStride)
@@ -1451,7 +1451,7 @@
uiWidth >>= 1;
uiHeight >>= 1;
piSrc = m_pcQTTempTComYuv[uiQTLayer].getCbAddr(uiAbsPartIdx);
- uiSrcStride = m_pcQTTempTComYuv[uiQTLayer].getCStride();
+ uiSrcStride = m_pcQTTempTComYuv[uiQTLayer].m_Cwidth;
piDes = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), uiZOrder);
uiDesStride = pcCU->getPic()->getPicYuvRec()->getCStride();
for (UInt uiY = 0; uiY < uiHeight; uiY++, piSrc += uiSrcStride, piDes += uiDesStride)
@@ -1670,7 +1670,7 @@
Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), uiZOrder);
UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride();
Short* piRecQt = m_pcQTTempTComYuv[uiQTLayer].getLumaAddr(uiAbsPartIdx);
- UInt uiRecQtStride = m_pcQTTempTComYuv[uiQTLayer].getStride();
+ UInt uiRecQtStride = m_pcQTTempTComYuv[uiQTLayer].m_width;
UInt uiWidth = pcCU->getWidth(0) >> uiTrDepth;
UInt uiHeight = pcCU->getHeight(0) >> uiTrDepth;
Short* pRecQt = piRecQt;
@@ -1839,7 +1839,7 @@
UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
UInt uiWidth = pcCU->getWidth(0) >> (uiTrDepth + 1);
UInt uiHeight = pcCU->getHeight(0) >> (uiTrDepth + 1);
- UInt uiRecQtStride = m_pcQTTempTComYuv[uiQTLayer].getCStride();
+ UInt uiRecQtStride = m_pcQTTempTComYuv[uiQTLayer].m_Cwidth;
UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getCStride();
if (stateU0V1Both2 == 0 || stateU0V1Both2 == 2)
@@ -2132,6 +2132,7 @@
uiBestMode = uiMode;
}
}
+
x265_emms();
//===== set chroma pred mode =====
@@ -2209,7 +2210,7 @@
uiSads[DC_IDX] = sa8d((pixel*)piOrg, uiStride, (pixel*)piPred, uiStride);
// 0
- if (uiWidth >=8 && uiWidth <=32)
+ if (uiWidth >= 8 && uiWidth <= 32)
{
ptrSrc += ADI_BUF_STRIDE * (2 * uiWidth + 1);
}
@@ -2714,6 +2715,7 @@
{
UInt uiAbsPartIdx;
Int iWidth, iHeight;
+
motionCompensation(pcCU, &m_tmpYuvPred, REF_PIC_LIST_X, iPartIdx);
pcCU->getPartIndexAndSize(iPartIdx, uiAbsPartIdx, iWidth, iHeight);
ruiErr = m_me.bufSA8D((pixel*)m_tmpYuvPred.getLumaAddr(uiAbsPartIdx), m_tmpYuvPred.getStride());
@@ -2872,7 +2874,7 @@
TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists
UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
Int numValidMergeCand = 0;
- if(!m_pcEncCfg->getUseRDO())
+ if (!m_pcEncCfg->getUseRDO())
pcCU->getTotalCost() = 0;
for (Int iPartIdx = 0; iPartIdx < iNumPart; iPartIdx++)
@@ -3319,7 +3321,7 @@
#if CU_STAT_LOGFILE
meCost += uiMRGCost;
#endif
- if(!m_pcEncCfg->getUseRDO())
+ if (!m_pcEncCfg->getUseRDO())
pcCU->getTotalCost() += uiMRGCost;
}
else
@@ -3334,17 +3336,16 @@
#if CU_STAT_LOGFILE
meCost += uiMECost;
#endif
- if(!m_pcEncCfg->getUseRDO())
+ if (!m_pcEncCfg->getUseRDO())
pcCU->getTotalCost() += uiMECost;
}
}
else
{
- if(!m_pcEncCfg->getUseRDO())
+ if (!m_pcEncCfg->getUseRDO())
pcCU->getTotalCost() += uiCostTemp;
}
motionCompensation(pcCU, rpcPredYuv, REF_PIC_LIST_X, iPartIdx);
-
}
setWpScalingDistParam(pcCU, -1, REF_PIC_LIST_X);
@@ -3644,7 +3645,7 @@
// Do integer search
m_pcRdCost->setCostScale(2);
- if (bBi || m_iSearchMethod == X265_FULL_SEARCH )
+ if (bBi || m_iSearchMethod == X265_FULL_SEARCH)
{
xPatternSearch(pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost);
}
@@ -3675,7 +3676,7 @@
{
pcCU->clipMv(mvp);
- MV dist(merange<<2, merange<<2);
+ MV dist(merange << 2, merange << 2);
mvmin = mvp - dist;
mvmax = mvp + dist;
@@ -3953,9 +3954,9 @@
pcYuvPred->copyToPartYuv(rpcYuvRec, 0);
- uiDistortion = primitives.sse_pp[PartitionFromSizes(uiWidth, uiHeight)]((pixel *)pcYuvOrg->getLumaAddr(), (intptr_t)pcYuvOrg->getStride(), (pixel *)rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride());
- uiDistortion += m_pcRdCost->scaleChromaDistCb(primitives.sse_pp[PartitionFromSizes(uiWidth >> 1, uiHeight >> 1)]((pixel *)pcYuvOrg->getCbAddr(), (intptr_t)pcYuvOrg->getCStride(), (pixel *)rpcYuvRec->getCbAddr(), rpcYuvRec->getCStride()));
- uiDistortion += m_pcRdCost->scaleChromaDistCr(primitives.sse_pp[PartitionFromSizes(uiWidth >> 1, uiHeight >> 1)]((pixel *)pcYuvOrg->getCrAddr(), (intptr_t)pcYuvOrg->getCStride(), (pixel *)rpcYuvRec->getCrAddr(), rpcYuvRec->getCStride()));
+ uiDistortion = primitives.sse_pp[PartitionFromSizes(uiWidth, uiHeight)]((pixel*)pcYuvOrg->getLumaAddr(), (intptr_t)pcYuvOrg->getStride(), (pixel*)rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride());
+ uiDistortion += m_pcRdCost->scaleChromaDistCb(primitives.sse_pp[PartitionFromSizes(uiWidth >> 1, uiHeight >> 1)]((pixel*)pcYuvOrg->getCbAddr(), (intptr_t)pcYuvOrg->getCStride(), (pixel*)rpcYuvRec->getCbAddr(), rpcYuvRec->getCStride()));
+ uiDistortion += m_pcRdCost->scaleChromaDistCr(primitives.sse_pp[PartitionFromSizes(uiWidth >> 1, uiHeight >> 1)]((pixel*)pcYuvOrg->getCrAddr(), (intptr_t)pcYuvOrg->getCStride(), (pixel*)rpcYuvRec->getCrAddr(), rpcYuvRec->getCStride()));
m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST]);
m_pcEntropyCoder->resetBits();
@@ -4078,16 +4079,14 @@
rpcYuvRec->addClip(pcYuvPred, rpcYuvResiBest, 0, uiWidth);
// update with clipped distortion and cost (qp estimation loop uses unclipped values)
- uiDistortionBest = primitives.sse_pp[PartitionFromSizes(uiWidth, uiHeight)]((pixel *)pcYuvOrg->getLumaAddr(), (intptr_t)pcYuvOrg->getStride(), (pixel *)rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride());
- uiDistortionBest += m_pcRdCost->scaleChromaDistCb(primitives.sse_pp[PartitionFromSizes(uiWidth >> 1, uiHeight >> 1)]((pixel *)pcYuvOrg->getCbAddr(), (intptr_t)pcYuvOrg->getCStride(), (pixel *)rpcYuvRec->getCbAddr(), rpcYuvRec->getCStride()));
- uiDistortionBest += m_pcRdCost->scaleChromaDistCr(primitives.sse_pp[PartitionFromSizes(uiWidth >> 1, uiHeight >> 1)]((pixel *)pcYuvOrg->getCrAddr(), (intptr_t)pcYuvOrg->getCStride(), (pixel *)rpcYuvRec->getCrAddr(), rpcYuvRec->getCStride()));
+ uiDistortionBest = primitives.sse_pp[PartitionFromSizes(uiWidth, uiHeight)]((pixel*)pcYuvOrg->getLumaAddr(), (intptr_t)pcYuvOrg->getStride(), (pixel*)rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride());
+ uiDistortionBest += m_pcRdCost->scaleChromaDistCb(primitives.sse_pp[PartitionFromSizes(uiWidth >> 1, uiHeight >> 1)]((pixel*)pcYuvOrg->getCbAddr(), (intptr_t)pcYuvOrg->getCStride(), (pixel*)rpcYuvRec->getCbAddr(), rpcYuvRec->getCStride()));
+ uiDistortionBest += m_pcRdCost->scaleChromaDistCr(primitives.sse_pp[PartitionFromSizes(uiWidth >> 1, uiHeight >> 1)]((pixel*)pcYuvOrg->getCrAddr(), (intptr_t)pcYuvOrg->getCStride(), (pixel*)rpcYuvRec->getCrAddr(), rpcYuvRec->getCStride()));
uiCostBest = m_pcRdCost->calcRdCost(uiDistortionBest, uiBitsBest);
-
pcCU->getTotalBits() = uiBitsBest;
pcCU->getTotalDistortion() = uiDistortionBest;
- pcCU->getTotalCost() = uiCostBest;
-
+ pcCU->getTotalCost() = uiCostBest;
if (pcCU->isSkipped(0))
{
@@ -4191,7 +4190,7 @@
m_pcTrQuant->selectLambda(TEXT_LUMA);
- m_pcTrQuant->transformNxN(pcCU, pcResi->getLumaAddr(absTUPartIdx), pcResi->getStride(), pcCoeffCurrY,
+ m_pcTrQuant->transformNxN(pcCU, pcResi->getLumaAddr(absTUPartIdx), pcResi->m_width, pcCoeffCurrY,
pcArlCoeffCurrY, trWidth, trHeight, uiAbsSumY, TEXT_LUMA, uiAbsPartIdx);
pcCU->setCbfSubParts(uiAbsSumY ? uiSetCbf : 0, TEXT_LUMA, uiAbsPartIdx, uiDepth);
@@ -4208,12 +4207,12 @@
m_pcTrQuant->selectLambda(TEXT_CHROMA);
- m_pcTrQuant->transformNxN(pcCU, pcResi->getCbAddr(absTUPartIdxC), pcResi->getCStride(), pcCoeffCurrU,
+ m_pcTrQuant->transformNxN(pcCU, pcResi->getCbAddr(absTUPartIdxC), pcResi->m_Cwidth, pcCoeffCurrU,
pcArlCoeffCurrU, trWidthC, trHeightC, uiAbsSumU, TEXT_CHROMA_U, uiAbsPartIdx);
curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
m_pcTrQuant->setQPforQuant(pcCU->getQP(0), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset);
- m_pcTrQuant->transformNxN(pcCU, pcResi->getCrAddr(absTUPartIdxC), pcResi->getCStride(), pcCoeffCurrV,
+ m_pcTrQuant->transformNxN(pcCU, pcResi->getCrAddr(absTUPartIdxC), pcResi->m_Cwidth, pcCoeffCurrV,
pcArlCoeffCurrV, trWidthC, trHeightC, uiAbsSumV, TEXT_CHROMA_V, uiAbsPartIdx);
pcCU->setCbfSubParts(uiAbsSumU ? uiSetCbf : 0, TEXT_CHROMA_U, uiAbsPartIdx, pcCU->getDepth(0) + uiTrModeC);
@@ -4252,7 +4251,7 @@
::memset(m_pTempPel, 0, sizeof(Pel) * uiNumSamplesLuma); // not necessary needed for inside of recursion (only at the beginning)
int Part = PartitionFromSizes(trWidth, trHeight);
- UInt uiDistY = primitives.sse_sp[Part](pcResi->getLumaAddr(absTUPartIdx), (intptr_t)pcResi->getStride(), (pixel *)m_pTempPel, trWidth);
+ UInt uiDistY = primitives.sse_sp[Part](pcResi->getLumaAddr(absTUPartIdx), (intptr_t)pcResi->m_width, (pixel*)m_pTempPel, trWidth);
if (puiZeroDist)
{
@@ -4266,10 +4265,10 @@
Int scalingListType = 3 + g_eTTable[(Int)TEXT_LUMA];
assert(scalingListType < 6);
- m_pcTrQuant->invtransformNxN(pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA, REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, trWidth, trHeight, scalingListType); //this is for inter mode only
-
- const UInt uiNonzeroDistY = primitives.sse_ss[Part](pcResi->getLumaAddr(absTUPartIdx), pcResi->getStride(), m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr(absTUPartIdx),
- m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride());
+ m_pcTrQuant->invtransformNxN(pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA, REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].m_width, pcCoeffCurrY, trWidth, trHeight, scalingListType); //this is for inter mode only
+
+ const UInt uiNonzeroDistY = primitives.sse_ss[Part](pcResi->getLumaAddr(absTUPartIdx), pcResi->m_width, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr(absTUPartIdx),
+ m_pcQTTempTComYuv[uiQTTempAccessLayer].m_width);
if (pcCU->isLosslessCoded(0))
{
uiDistY = uiNonzeroDistY;
@@ -4311,7 +4310,7 @@
if (!uiAbsSumY)
{
Short *pcPtr = m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr(absTUPartIdx);
- const UInt uiStride = m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride();
+ const UInt uiStride = m_pcQTTempTComYuv[uiQTTempAccessLayer].m_width;
for (UInt uiY = 0; uiY < trHeight; ++uiY)
{
::memset(pcPtr, 0, sizeof(Short) * trWidth);
@@ -4325,7 +4324,7 @@
int PartC = x265::PartitionFromSizes(trWidthC, trHeightC);
if (bCodeChroma)
{
- uiDistU = m_pcRdCost->scaleChromaDistCb(primitives.sse_sp[PartC](pcResi->getCbAddr(absTUPartIdxC), (intptr_t)pcResi->getCStride(), (pixel *)m_pTempPel, trWidthC));
+ uiDistU = m_pcRdCost->scaleChromaDistCb(primitives.sse_sp[PartC](pcResi->getCbAddr(absTUPartIdxC), (intptr_t)pcResi->m_Cwidth, (pixel*)m_pTempPel, trWidthC));
if (puiZeroDist)
{
@@ -4340,10 +4339,10 @@
Int scalingListType = 3 + g_eTTable[(Int)TEXT_CHROMA_U];
assert(scalingListType < 6);
- m_pcTrQuant->invtransformNxN(pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_CHROMA, REG_DCT, pcResiCurrU, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), pcCoeffCurrU, trWidthC, trHeightC, scalingListType);
-
- const UInt uiNonzeroDistU = m_pcRdCost->scaleChromaDistCb(primitives.sse_ss[PartC](pcResi->getCbAddr(absTUPartIdxC), pcResi->getCStride(),
- m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr(absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride()));
+ m_pcTrQuant->invtransformNxN(pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_CHROMA, REG_DCT, pcResiCurrU, m_pcQTTempTComYuv[uiQTTempAccessLayer].m_Cwidth, pcCoeffCurrU, trWidthC, trHeightC, scalingListType);
+
+ const UInt uiNonzeroDistU = m_pcRdCost->scaleChromaDistCb(primitives.sse_ss[PartC](pcResi->getCbAddr(absTUPartIdxC), pcResi->m_Cwidth,
+ m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr(absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].m_Cwidth));
if (pcCU->isLosslessCoded(0))
{
uiDistU = uiNonzeroDistU;
@@ -4384,7 +4383,7 @@
if (!uiAbsSumU)
{
Short *pcPtr = m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr(absTUPartIdxC);
- const UInt uiStride = m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride();
+ const UInt uiStride = m_pcQTTempTComYuv[uiQTTempAccessLayer].m_Cwidth;
for (UInt uiY = 0; uiY < trHeightC; ++uiY)
{
::memset(pcPtr, 0, sizeof(Short) * trWidthC);
@@ -4392,7 +4391,7 @@
}
}
- uiDistV = m_pcRdCost->scaleChromaDistCr(primitives.sse_sp[PartC](pcResi->getCrAddr(absTUPartIdxC), (intptr_t)pcResi->getCStride(), (pixel *)m_pTempPel, trWidthC));
+ uiDistV = m_pcRdCost->scaleChromaDistCr(primitives.sse_sp[PartC](pcResi->getCrAddr(absTUPartIdxC), (intptr_t)pcResi->m_Cwidth, (pixel*)m_pTempPel, trWidthC));
if (puiZeroDist)
{
*puiZeroDist += uiDistV;
@@ -4405,10 +4404,10 @@
Int scalingListType = 3 + g_eTTable[(Int)TEXT_CHROMA_V];
assert(scalingListType < 6);
- m_pcTrQuant->invtransformNxN(pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_CHROMA, REG_DCT, pcResiCurrV, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), pcCoeffCurrV, trWidthC, trHeightC, scalingListType);
-
- const UInt uiNonzeroDistV = m_pcRdCost->scaleChromaDistCr(primitives.sse_ss[PartC](pcResi->getCrAddr(absTUPartIdxC), pcResi->getCStride(),
- m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr(absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride()));
+ m_pcTrQuant->invtransformNxN(pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_CHROMA, REG_DCT, pcResiCurrV, m_pcQTTempTComYuv[uiQTTempAccessLayer].m_Cwidth, pcCoeffCurrV, trWidthC, trHeightC, scalingListType);
+
+ const UInt uiNonzeroDistV = m_pcRdCost->scaleChromaDistCr(primitives.sse_ss[PartC](pcResi->getCrAddr(absTUPartIdxC), pcResi->m_Cwidth,
+ m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr(absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].m_Cwidth));
if (pcCU->isLosslessCoded(0))
{
@@ -4450,7 +4449,7 @@
if (!uiAbsSumV)
{
Short *pcPtr = m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr(absTUPartIdxC);
- const UInt uiStride = m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride();
+ const UInt uiStride = m_pcQTTempTComYuv[uiQTTempAccessLayer].m_Cwidth;
for (UInt uiY = 0; uiY < trHeightC; ++uiY)
{
::memset(pcPtr, 0, sizeof(Short) * trWidthC);
@@ -4471,7 +4470,7 @@
UInt64 dSingleCostY = MAX_INT64;
Short *pcResiCurrY = m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr(absTUPartIdx);
- UInt resiYStride = m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride();
+ UInt resiYStride = m_pcQTTempTComYuv[uiQTTempAccessLayer].m_width;
TCoeff bestCoeffY[32 * 32];
memcpy(bestCoeffY, pcCoeffCurrY, sizeof(TCoeff) * uiNumSamplesLuma);
@@ -4497,7 +4496,7 @@
m_pcTrQuant->setQPforQuant(pcCU->getQP(0), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0);
m_pcTrQuant->selectLambda(TEXT_LUMA);
- m_pcTrQuant->transformNxN(pcCU, pcResi->getLumaAddr(absTUPartIdx), pcResi->getStride(), pcCoeffCurrY,
+ m_pcTrQuant->transformNxN(pcCU, pcResi->getLumaAddr(absTUPartIdx), pcResi->m_width, pcCoeffCurrY,
pcArlCoeffCurrY, trWidth, trHeight, uiAbsSumTransformSkipY, TEXT_LUMA, uiAbsPartIdx, true);
pcCU->setCbfSubParts(uiAbsSumTransformSkipY ? uiSetCbf : 0, TEXT_LUMA, uiAbsPartIdx, uiDepth);
@@ -4513,10 +4512,10 @@
Int scalingListType = 3 + g_eTTable[(Int)TEXT_LUMA];
assert(scalingListType < 6);
- m_pcTrQuant->invtransformNxN(pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA, REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcCoeffCurrY, trWidth, trHeight, scalingListType, true);
-
- uiNonzeroDistY = primitives.sse_ss[Part](pcResi->getLumaAddr(absTUPartIdx), pcResi->getStride(),
- m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr(absTUPartIdx), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride());
+ m_pcTrQuant->invtransformNxN(pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA, REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].m_width, pcCoeffCurrY, trWidth, trHeight, scalingListType, true);
+
+ uiNonzeroDistY = primitives.sse_ss[Part](pcResi->getLumaAddr(absTUPartIdx), pcResi->m_width,
+ m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr(absTUPartIdx), m_pcQTTempTComYuv[uiQTTempAccessLayer].m_width);
dSingleCostY = m_pcRdCost->calcRdCost(uiNonzeroDistY, uiTsSingleBitsY);
}
@@ -4549,7 +4548,7 @@
Short *pcResiCurrU = m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr(absTUPartIdxC);
Short *pcResiCurrV = m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr(absTUPartIdxC);
- UInt resiCStride = m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride();
+ UInt resiCStride = m_pcQTTempTComYuv[uiQTTempAccessLayer].m_Cwidth;
TCoeff bestCoeffU[32 * 32], bestCoeffV[32 * 32];
memcpy(bestCoeffU, pcCoeffCurrU, sizeof(TCoeff) * uiNumSamplesChro);
@@ -4581,11 +4580,11 @@
m_pcTrQuant->selectLambda(TEXT_CHROMA);
- m_pcTrQuant->transformNxN(pcCU, pcResi->getCbAddr(absTUPartIdxC), pcResi->getCStride(), pcCoeffCurrU,
+ m_pcTrQuant->transformNxN(pcCU, pcResi->getCbAddr(absTUPartIdxC), pcResi->m_Cwidth, pcCoeffCurrU,
pcArlCoeffCurrU, trWidthC, trHeightC, uiAbsSumTransformSkipU, TEXT_CHROMA_U, uiAbsPartIdx, true);
curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
m_pcTrQuant->setQPforQuant(pcCU->getQP(0), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset);
- m_pcTrQuant->transformNxN(pcCU, pcResi->getCrAddr(absTUPartIdxC), pcResi->getCStride(), pcCoeffCurrV,
+ m_pcTrQuant->transformNxN(pcCU, pcResi->getCrAddr(absTUPartIdxC), pcResi->m_Cwidth, pcCoeffCurrV,
pcArlCoeffCurrV, trWidthC, trHeightC, uiAbsSumTransformSkipV, TEXT_CHROMA_V, uiAbsPartIdx, true);
pcCU->setCbfSubParts(uiAbsSumTransformSkipU ? uiSetCbf : 0, TEXT_CHROMA_U, uiAbsPartIdx, pcCU->getDepth(0) + uiTrModeC);
@@ -4607,10 +4606,10 @@
Int scalingListType = 3 + g_eTTable[(Int)TEXT_CHROMA_U];
assert(scalingListType < 6);
- m_pcTrQuant->invtransformNxN(pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_CHROMA, REG_DCT, pcResiCurrU, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), pcCoeffCurrU, trWidthC, trHeightC, scalingListType, true);
-
- uiNonzeroDistU = m_pcRdCost->scaleChromaDistCb(primitives.sse_ss[PartC](pcResi->getCbAddr(absTUPartIdxC), pcResi->getCStride(),
- m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr(absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride()));
+ m_pcTrQuant->invtransformNxN(pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_CHROMA, REG_DCT, pcResiCurrU, m_pcQTTempTComYuv[uiQTTempAccessLayer].m_Cwidth, pcCoeffCurrU, trWidthC, trHeightC, scalingListType, true);
+
+ uiNonzeroDistU = m_pcRdCost->scaleChromaDistCb(primitives.sse_ss[PartC](pcResi->getCbAddr(absTUPartIdxC), pcResi->m_Cwidth,
+ m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr(absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].m_Cwidth));
dSingleCostU = m_pcRdCost->calcRdCost(uiNonzeroDistU, uiSingleBitsU);
}
@@ -4644,10 +4643,10 @@
Int scalingListType = 3 + g_eTTable[(Int)TEXT_CHROMA_V];
assert(scalingListType < 6);
- m_pcTrQuant->invtransformNxN(pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_CHROMA, REG_DCT, pcResiCurrV, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), pcCoeffCurrV, trWidthC, trHeightC, scalingListType, true);
-
- uiNonzeroDistV = m_pcRdCost->scaleChromaDistCr(primitives.sse_ss[PartC](pcResi->getCrAddr(absTUPartIdxC), pcResi->getCStride(),
- m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr(absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride()));
+ m_pcTrQuant->invtransformNxN(pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_CHROMA, REG_DCT, pcResiCurrV, m_pcQTTempTComYuv[uiQTTempAccessLayer].m_Cwidth, pcCoeffCurrV, trWidthC, trHeightC, scalingListType, true);
+
+ uiNonzeroDistV = m_pcRdCost->scaleChromaDistCr(primitives.sse_ss[PartC](pcResi->getCrAddr(absTUPartIdxC), pcResi->m_Cwidth,
+ m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr(absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].m_Cwidth));
dSingleCostV = m_pcRdCost->calcRdCost(uiNonzeroDistV, uiSingleBitsV);
}
@@ -5082,17 +5081,15 @@
{
m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true);
}
-
+
m_pcEntropyCoder->encodePredMode(pcCU, 0, true);
-
+
m_pcEntropyCoder->encodePartSize(pcCU, 0, pcCU->getDepth(0), true);
bits += m_pcEntropyCoder->getNumberOfWrittenBits();
return bits;
-
}
-
/**
* \brief Generate half-sample interpolated block
*
@@ -5107,7 +5104,7 @@
Int height = pattern->getROIYHeight();
Int srcStride = pattern->getPatternLStride();
- Int intStride = filteredBlockTmp[0].getWidth();
+ Int intStride = filteredBlockTmp[0].m_width;
Int dstStride = m_filteredBlock[0][0].getStride();
Pel *srcPtr; //Contains raw pixels
@@ -5159,7 +5156,7 @@
Int height = pattern->getROIYHeight();
Int srcStride = pattern->getPatternLStride();
- Int intStride = filteredBlockTmp[0].getWidth();
+ Int intStride = filteredBlockTmp[0].m_width;
Int dstStride = m_filteredBlock[0][0].getStride();
Pel *srcPtr; //Contains raw pixels
diff -r 6a97823d1060 -r 51cb78dccec1 source/common/TShortYUV.cpp
--- a/source/common/TShortYUV.cpp Tue Jul 02 11:42:33 2013 +0530
+++ b/source/common/TShortYUV.cpp Tue Jul 02 15:08:10 2013 +0530
@@ -32,9 +32,9 @@
TShortYUV::TShortYUV()
{
- YBuf = NULL;
- CbBuf = NULL;
- CrBuf = NULL;
+ m_YBuf = NULL;
+ m_CbBuf = NULL;
+ m_CrBuf = NULL;
}
TShortYUV::~TShortYUV()
@@ -42,32 +42,32 @@
void TShortYUV::create(unsigned int Width, unsigned int Height)
{
- YBuf = (short*)xMalloc(short, Width * Height);
- CbBuf = (short*)xMalloc(short, Width * Height >> 2);
- CrBuf = (short*)xMalloc(short, Width * Height >> 2);
+ m_YBuf = (short*)xMalloc(short, Width * Height);
+ m_CbBuf = (short*)xMalloc(short, Width * Height >> 2);
+ m_CrBuf = (short*)xMalloc(short, Width * Height >> 2);
// set width and height
- width = Width;
- height = Height;
- Cwidth = Width >> 1;
- Cheight = Height >> 1;
+ m_width = Width;
+ m_height = Height;
+ m_Cwidth = Width >> 1;
+ m_Cheight = Height >> 1;
}
void TShortYUV::destroy()
{
- xFree(YBuf);
- YBuf = NULL;
- xFree(CbBuf);
- CbBuf = NULL;
- xFree(CrBuf);
- CrBuf = NULL;
+ xFree(m_YBuf);
+ m_YBuf = NULL;
+ xFree(m_CbBuf);
+ m_CbBuf = NULL;
+ xFree(m_CrBuf);
+ m_CrBuf = NULL;
}
void TShortYUV::clear()
{
- ::memset(YBuf, 0, (width * height) * sizeof(short));
- ::memset(CbBuf, 0, (Cwidth * Cheight) * sizeof(short));
- ::memset(CrBuf, 0, (Cwidth * Cheight) * sizeof(short));
+ ::memset(m_YBuf, 0, (m_width * m_height) * sizeof(short));
+ ::memset(m_CbBuf, 0, (m_Cwidth * m_Cheight) * sizeof(short));
+ ::memset(m_CrBuf, 0, (m_Cwidth * m_Cheight) * sizeof(short));
}
void TShortYUV::subtract(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, unsigned int uiTrUnitIdx, unsigned int uiPartSize)
@@ -86,7 +86,7 @@
int iSrc0Stride = pcYuvSrc0->getStride();
int iSrc1Stride = pcYuvSrc1->getStride();
- int iDstStride = getStride();
+ int iDstStride = m_width;
for (y = uiPartSize - 1; y >= 0; y--)
{
@@ -114,7 +114,7 @@
int iSrc0Stride = pcYuvSrc0->getCStride();
int iSrc1Stride = pcYuvSrc1->getCStride();
- int iDstStride = getCStride();
+ int iDstStride = m_Cwidth;
for (y = uiPartSize - 1; y >= 0; y--)
{
@@ -151,9 +151,9 @@
short* pSrc1 = pcYuvSrc1->getLumaAddr(uiTrUnitIdx, uiPartSize);
short* pDst = getLumaAddr(uiTrUnitIdx, uiPartSize);
- unsigned int iSrc0Stride = pcYuvSrc0->getStride();
- unsigned int iSrc1Stride = pcYuvSrc1->getStride();
- unsigned int iDstStride = getStride();
+ unsigned int iSrc0Stride = pcYuvSrc0->m_width;
+ unsigned int iSrc1Stride = pcYuvSrc1->m_width;
+ unsigned int iDstStride = m_width;
for (y = uiPartSize - 1; y >= 0; y--)
{
@@ -179,9 +179,9 @@
short* pDstU = getCbAddr(uiTrUnitIdx, uiPartSize);
short* pDstV = getCrAddr(uiTrUnitIdx, uiPartSize);
- unsigned int iSrc0Stride = pcYuvSrc0->getCStride();
- unsigned int iSrc1Stride = pcYuvSrc1->getCStride();
- unsigned int iDstStride = getCStride();
+ unsigned int iSrc0Stride = pcYuvSrc0->m_Cwidth;
+ unsigned int iSrc1Stride = pcYuvSrc1->m_Cwidth;
+ unsigned int iDstStride = m_Cwidth;
for (y = uiPartSize - 1; y >= 0; y--)
{
@@ -228,8 +228,8 @@
return;
}
- unsigned int iSrcStride = getStride();
- unsigned int iDstStride = pcYuvDst->getStride();
+ unsigned int iSrcStride = m_width;
+ unsigned int iDstStride = pcYuvDst->m_width;
for (unsigned int y = iHeight; y != 0; y--)
{
::memcpy(pDst, pSrc, iWidth * sizeof(short));
@@ -243,7 +243,7 @@
short* pSrc = getLumaAddr(uiPartIdx);
Pel* pDst = pcYuvDst->getLumaAddr(uiPartIdx);
- unsigned int iSrcStride = getStride();
+ unsigned int iSrcStride = m_width;
unsigned int iDstStride = pcYuvDst->getStride();
for (unsigned int y = iHeight; y != 0; y--)
@@ -272,8 +272,8 @@
return;
}
- unsigned int iSrcStride = getCStride();
- unsigned int iDstStride = pcYuvDst->getCStride();
+ unsigned int iSrcStride = m_Cwidth;
+ unsigned int iDstStride = pcYuvDst->m_Cwidth;
for (unsigned int y = iHeight; y != 0; y--)
{
::memcpy(pDstU, pSrcU, iWidth * sizeof(short));
@@ -292,7 +292,7 @@
Pel* pDstU = pcYuvDst->getCbAddr(uiPartIdx);
Pel* pDstV = pcYuvDst->getCrAddr(uiPartIdx);
- unsigned int iSrcStride = getCStride();
+ unsigned int iSrcStride = m_Cwidth;
unsigned int iDstStride = pcYuvDst->getCStride();
for (unsigned int y = iHeight; y != 0; y--)
@@ -320,8 +320,8 @@
{
return;
}
- unsigned int iSrcStride = getCStride();
- unsigned int iDstStride = pcYuvDst->getCStride();
+ unsigned int iSrcStride = m_Cwidth;
+ unsigned int iDstStride = pcYuvDst->m_Cwidth;
for (unsigned int y = iHeight; y != 0; y--)
{
::memcpy(pDstU, pSrcU, iWidth * sizeof(short));
@@ -337,8 +337,8 @@
{
return;
}
- unsigned int iSrcStride = getCStride();
- unsigned int iDstStride = pcYuvDst->getCStride();
+ unsigned int iSrcStride = m_Cwidth;
+ unsigned int iDstStride = pcYuvDst->m_Cwidth;
for (unsigned int y = iHeight; y != 0; y--)
{
::memcpy(pDstV, pSrcV, iWidth * sizeof(short));
@@ -359,8 +359,8 @@
//th best would be to fix the caller
return;
}
- unsigned int iSrcStride = getCStride();
- unsigned int iDstStride = pcYuvDst->getCStride();
+ unsigned int iSrcStride = m_Cwidth;
+ unsigned int iDstStride = pcYuvDst->m_Cwidth;
for (unsigned int y = iHeight; y != 0; y--)
{
::memcpy(pDstU, pSrcU, iWidth * sizeof(short));
@@ -379,7 +379,7 @@
{
short* pSrcU = getCbAddr(uiPartIdx);
Pel* pDstU = pcYuvDst->getCbAddr(uiPartIdx);
- unsigned int iSrcStride = getCStride();
+ unsigned int iSrcStride = m_Cwidth;
unsigned int iDstStride = pcYuvDst->getCStride();
for (unsigned int y = iHeight; y != 0; y--)
{
@@ -396,7 +396,7 @@
{
short* pSrcV = getCrAddr(uiPartIdx);
Pel* pDstV = pcYuvDst->getCrAddr(uiPartIdx);
- unsigned int iSrcStride = getCStride();
+ unsigned int iSrcStride = m_Cwidth;
unsigned int iDstStride = pcYuvDst->getCStride();
for (unsigned int y = iHeight; y != 0; y--)
{
@@ -416,7 +416,7 @@
Pel* pDstU = pcYuvDst->getCbAddr(uiPartIdx);
Pel* pDstV = pcYuvDst->getCrAddr(uiPartIdx);
- unsigned int iSrcStride = getCStride();
+ unsigned int iSrcStride = m_Cwidth;
unsigned int iDstStride = pcYuvDst->getCStride();
for (unsigned int y = iHeight; y != 0; y--)
{
diff -r 6a97823d1060 -r 51cb78dccec1 source/common/TShortYUV.h
--- a/source/common/TShortYUV.h Tue Jul 02 11:42:33 2013 +0530
+++ b/source/common/TShortYUV.h Tue Jul 02 15:08:10 2013 +0530
@@ -35,15 +35,6 @@
{
private:
- short* YBuf;
- short* CbBuf;
- short* CrBuf;
-
- unsigned int width;
- unsigned int height;
- unsigned int Cwidth;
- unsigned int Cheight;
-
static int getAddrOffset(unsigned int uiPartUnitIdx, unsigned int width)
{
int blkX = g_auiRasterToPelX[g_auiZscanToRaster[uiPartUnitIdx]];
@@ -62,6 +53,15 @@
public:
+ short* m_YBuf;
+ short* m_CbBuf;
+ short* m_CrBuf;
+
+ unsigned int m_width;
+ unsigned int m_height;
+ unsigned int m_Cwidth;
+ unsigned int m_Cheight;
+
TShortYUV();
virtual ~TShortYUV();
@@ -69,25 +69,25 @@
void destroy();
void clear();
- short* getLumaAddr() { return YBuf; }
+ short* getLumaAddr() { return m_YBuf; }
- short* getCbAddr() { return CbBuf; }
+ short* getCbAddr() { return m_CbBuf; }
- short* getCrAddr() { return CrBuf; }
+ short* getCrAddr() { return m_CrBuf; }
// Access starting position of YUV partition unit buffer
- short* getLumaAddr(unsigned int iPartUnitIdx) { return YBuf + getAddrOffset(iPartUnitIdx, width); }
+ short* getLumaAddr(unsigned int iPartUnitIdx) { return m_YBuf + getAddrOffset(iPartUnitIdx, m_width); }
- short* getCbAddr(unsigned int iPartUnitIdx) { return CbBuf + (getAddrOffset(iPartUnitIdx, Cwidth) >> 1); }
+ short* getCbAddr(unsigned int iPartUnitIdx) { return m_CbBuf + (getAddrOffset(iPartUnitIdx, m_Cwidth) >> 1); }
- short* getCrAddr(unsigned int iPartUnitIdx) { return CrBuf + (getAddrOffset(iPartUnitIdx, Cwidth) >> 1); }
+ short* getCrAddr(unsigned int iPartUnitIdx) { return m_CrBuf + (getAddrOffset(iPartUnitIdx, m_Cwidth) >> 1); }
// Access starting position of YUV transform unit buffer
- short* getLumaAddr(unsigned int iTransUnitIdx, unsigned int iBlkSize) { return YBuf + getAddrOffset(iTransUnitIdx, iBlkSize, width); }
+ short* getLumaAddr(unsigned int iTransUnitIdx, unsigned int iBlkSize) { return m_YBuf + getAddrOffset(iTransUnitIdx, iBlkSize, m_width); }
- short* getCbAddr(unsigned int iTransUnitIdx, unsigned int iBlkSize) { return CbBuf + getAddrOffset(iTransUnitIdx, iBlkSize, Cwidth); }
+ short* getCbAddr(unsigned int iTransUnitIdx, unsigned int iBlkSize) { return m_CbBuf + getAddrOffset(iTransUnitIdx, iBlkSize, m_Cwidth); }
- short* getCrAddr(unsigned int iTransUnitIdx, unsigned int iBlkSize) { return CrBuf + getAddrOffset(iTransUnitIdx, iBlkSize, Cwidth); }
+ short* getCrAddr(unsigned int iTransUnitIdx, unsigned int iBlkSize) { return m_CrBuf + getAddrOffset(iTransUnitIdx, iBlkSize, m_Cwidth); }
void subtractLuma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, unsigned int uiTrUnitIdx, unsigned int uiPartSize);
void subtractChroma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, unsigned int uiTrUnitIdx, unsigned int uiPartSize);
@@ -106,18 +106,6 @@
void copyPartToPartLuma(TComYuv* pcYuvDst, unsigned int uiPartIdx, unsigned int uiWidth, unsigned int uiHeight);
void copyPartToPartChroma(TComYuv* pcYuvDst, unsigned int uiPartIdx, unsigned int uiWidth, unsigned int uiHeight);
void copyPartToPartChroma(TComYuv* pcYuvDst, unsigned int uiPartIdx, unsigned int iWidth, unsigned int iHeight, unsigned int chromaId);
-
- unsigned int getHeight() { return height; }
-
- unsigned int getWidth() { return width; }
-
- unsigned int getCHeight() { return Cheight; }
-
- unsigned int getCWidth() { return Cwidth; }
-
- unsigned int getStride() { return width; }
-
- unsigned int getCStride() { return Cwidth; }
};
#endif //end __TSHORTYUV__
More information about the x265-devel
mailing list