[x265] remove unused trUnitIdx from subtract() and addClip()
Satoshi Nakagawa
nakagawa424 at oki.com
Thu Mar 13 03:22:48 CET 2014
# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1394677205 -32400
# Thu Mar 13 11:20:05 2014 +0900
# Node ID d03b5830fa379aae3b4bf8f5fab1720f36472c1b
# Parent 5328eec595543c1294cb34b133b4e36f14e2bb79
remove unused trUnitIdx from subtract() and addClip()
diff -r 5328eec59554 -r d03b5830fa37 source/Lib/TLibCommon/TComYuv.cpp
--- a/source/Lib/TLibCommon/TComYuv.cpp Wed Mar 12 16:01:25 2014 -0500
+++ b/source/Lib/TLibCommon/TComYuv.cpp Thu Mar 13 11:20:05 2014 +0900
@@ -145,15 +145,15 @@
void TComYuv::copyPartToYuv(TComYuv* dstPicYuv, uint32_t partIdx)
{
pixel* srcY = getLumaAddr(partIdx);
- pixel* dstY = dstPicYuv->getLumaAddr(0);
+ pixel* dstY = dstPicYuv->getLumaAddr();
int part = dstPicYuv->m_part;
primitives.luma_copy_pp[part](dstY, dstPicYuv->getStride(), srcY, getStride());
pixel* srcU = getCbAddr(partIdx);
pixel* srcV = getCrAddr(partIdx);
- pixel* dstU = dstPicYuv->getCbAddr(0);
- pixel* dstV = dstPicYuv->getCrAddr(0);
+ pixel* dstU = dstPicYuv->getCbAddr();
+ pixel* dstV = dstPicYuv->getCrAddr();
primitives.chroma[m_csp].copy_pp[part](dstU, dstPicYuv->getCStride(), srcU, getCStride());
primitives.chroma[m_csp].copy_pp[part](dstV, dstPicYuv->getCStride(), srcV, getCStride());
}
@@ -240,19 +240,19 @@
}
}
-void TComYuv::addClip(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
+void TComYuv::addClip(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t partSize)
{
int part = partitionFromSizes(partSize, partSize);
- addClipLuma(srcYuv0, srcYuv1, trUnitIdx, partSize, part);
- addClipChroma(srcYuv0, srcYuv1, trUnitIdx, partSize >> m_hChromaShift, part);
+ addClipLuma(srcYuv0, srcYuv1, part);
+ addClipChroma(srcYuv0, srcYuv1, part);
}
-void TComYuv::addClipLuma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize, uint32_t part)
+void TComYuv::addClipLuma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t part)
{
- pixel* src0 = srcYuv0->getLumaAddr(trUnitIdx, partSize);
- int16_t* src1 = srcYuv1->getLumaAddr(trUnitIdx, partSize);
- pixel* dst = getLumaAddr(trUnitIdx, partSize);
+ pixel* src0 = srcYuv0->getLumaAddr();
+ int16_t* src1 = srcYuv1->getLumaAddr();
+ pixel* dst = getLumaAddr();
uint32_t src0Stride = srcYuv0->getStride();
uint32_t src1Stride = srcYuv1->m_width;
@@ -261,14 +261,14 @@
primitives.luma_add_ps[part](dst, dststride, src0, src1, src0Stride, src1Stride);
}
-void TComYuv::addClipChroma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize, uint32_t part)
+void TComYuv::addClipChroma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t part)
{
- pixel* srcU0 = srcYuv0->getCbAddr(trUnitIdx, partSize);
- int16_t* srcU1 = srcYuv1->getCbAddr(trUnitIdx, partSize);
- pixel* srcV0 = srcYuv0->getCrAddr(trUnitIdx, partSize);
- int16_t* srcV1 = srcYuv1->getCrAddr(trUnitIdx, partSize);
- pixel* dstU = getCbAddr(trUnitIdx, partSize);
- pixel* dstV = getCrAddr(trUnitIdx, partSize);
+ pixel* srcU0 = srcYuv0->getCbAddr();
+ int16_t* srcU1 = srcYuv1->getCbAddr();
+ pixel* srcV0 = srcYuv0->getCrAddr();
+ int16_t* srcV1 = srcYuv1->getCrAddr();
+ pixel* dstU = getCbAddr();
+ pixel* dstV = getCrAddr();
uint32_t src0Stride = srcYuv0->getCStride();
uint32_t src1Stride = srcYuv1->m_cwidth;
@@ -278,69 +278,6 @@
primitives.chroma[m_csp].add_ps[part](dstV, dststride, srcV0, srcV1, src0Stride, src1Stride);
}
-void TComYuv::subtract(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
-{
- subtractLuma(srcYuv0, srcYuv1, trUnitIdx, partSize);
- subtractChroma(srcYuv0, srcYuv1, trUnitIdx, partSize >> 1);
-}
-
-void TComYuv::subtractLuma(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
-{
- int x, y;
-
- pixel* src0 = srcYuv0->getLumaAddr(trUnitIdx, partSize);
- pixel* src1 = srcYuv1->getLumaAddr(trUnitIdx, partSize);
- pixel* dst = getLumaAddr(trUnitIdx, partSize);
-
- int src0Stride = srcYuv0->getStride();
- int src1Stride = srcYuv1->getStride();
- int dststride = getStride();
-
- for (y = partSize - 1; y >= 0; y--)
- {
- for (x = partSize - 1; x >= 0; x--)
- {
- dst[x] = src0[x] - src1[x];
- }
-
- src0 += src0Stride;
- src1 += src1Stride;
- dst += dststride;
- }
-}
-
-void TComYuv::subtractChroma(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
-{
- int x, y;
-
- pixel* srcU0 = srcYuv0->getCbAddr(trUnitIdx, partSize);
- pixel* srcU1 = srcYuv1->getCbAddr(trUnitIdx, partSize);
- pixel* srcV0 = srcYuv0->getCrAddr(trUnitIdx, partSize);
- pixel* srcV1 = srcYuv1->getCrAddr(trUnitIdx, partSize);
- pixel* dstU = getCbAddr(trUnitIdx, partSize);
- pixel* dstV = getCrAddr(trUnitIdx, partSize);
-
- int src0Stride = srcYuv0->getCStride();
- int src1Stride = srcYuv1->getCStride();
- int dststride = getCStride();
-
- for (y = partSize - 1; y >= 0; y--)
- {
- for (x = partSize - 1; x >= 0; x--)
- {
- dstU[x] = srcU0[x] - srcU1[x];
- dstV[x] = srcV0[x] - srcV1[x];
- }
-
- srcU0 += src0Stride;
- srcU1 += src1Stride;
- srcV0 += src0Stride;
- srcV1 += src1Stride;
- dstU += dststride;
- dstV += dststride;
- }
-}
-
void TComYuv::addAvg(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t partUnitIdx, uint32_t width, uint32_t height, bool bLuma, bool bChroma)
{
int x, y;
diff -r 5328eec59554 -r d03b5830fa37 source/Lib/TLibCommon/TComYuv.h
--- a/source/Lib/TLibCommon/TComYuv.h Wed Mar 12 16:01:25 2014 -0500
+++ b/source/Lib/TLibCommon/TComYuv.h Thu Mar 13 11:20:05 2014 +0900
@@ -140,14 +140,9 @@
// ------------------------------------------------------------------------------------------------------------------
// Clip(srcYuv0 + srcYuv1) -> m_apiBuf
- void addClip(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
- void addClipLuma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize, uint32_t part);
- void addClipChroma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize, uint32_t part);
-
- // srcYuv0 - srcYuv1 -> m_apiBuf
- void subtract(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
- void subtractLuma(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
- void subtractChroma(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
+ void addClip(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t partSize);
+ void addClipLuma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t part);
+ void addClipChroma(TComYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t part);
// (srcYuv0 + srcYuv1)/2 for YUV partition
void addAvg(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t partUnitIdx, uint32_t width, uint32_t height, bool bLuma, bool bChroma);
diff -r 5328eec59554 -r d03b5830fa37 source/Lib/TLibEncoder/TEncCu.cpp
--- a/source/Lib/TLibEncoder/TEncCu.cpp Wed Mar 12 16:01:25 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncCu.cpp Thu Mar 13 11:20:05 2014 +0900
@@ -1584,7 +1584,7 @@
uint32_t width = cu->getCUSize(0);
uint32_t height = cu->getCUSize(0);
- Pel* srcY = fencYuv->getLumaAddr(0, width);
+ Pel* srcY = fencYuv->getLumaAddr();
Pel* dstY = cu->getPCMSampleY();
uint32_t srcStride = fencYuv->getStride();
diff -r 5328eec59554 -r d03b5830fa37 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp Wed Mar 12 16:01:25 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp Thu Mar 13 11:20:05 2014 +0900
@@ -2049,10 +2049,10 @@
uint32_t chromaOffset = lumaOffset >> 2;
// Luminance
- Pel* fenc = fencYuv->getLumaAddr(0, width);
- int16_t* resi = resiYuv->getLumaAddr(0, width);
- Pel* pred = predYuv->getLumaAddr(0, width);
- Pel* recon = reconYuv->getLumaAddr(0, width);
+ Pel* fenc = fencYuv->getLumaAddr();
+ int16_t* resi = resiYuv->getLumaAddr();
+ Pel* pred = predYuv->getLumaAddr();
+ Pel* recon = reconYuv->getLumaAddr();
Pel* pcm = cu->getPCMSampleY() + lumaOffset;
xEncPCM(cu, 0, fenc, pcm, pred, resi, recon, stride, width, height, TEXT_LUMA);
@@ -2730,7 +2730,7 @@
qp = bHighPass ? Clip3(-cu->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, (int)cu->getQP(0)) : cu->getQP(0);
- outResiYuv->subtract(fencYuv, predYuv, 0, width);
+ outResiYuv->subtract(fencYuv, predYuv, width);
cost = 0;
bits = 0;
@@ -2795,7 +2795,7 @@
if (cu->getQtRootCbf(0))
{
- outReconYuv->addClip(predYuv, outBestResiYuv, 0, width);
+ outReconYuv->addClip(predYuv, outBestResiYuv, width);
}
else
{
@@ -2838,7 +2838,7 @@
uint32_t width = cu->getCUSize(0);
if (cu->getQtRootCbf(0))
{
- reconYuv->addClip(predYuv, resiYuv, 0, width);
+ reconYuv->addClip(predYuv, resiYuv, width);
}
else
{
diff -r 5328eec59554 -r d03b5830fa37 source/common/shortyuv.cpp
--- a/source/common/shortyuv.cpp Wed Mar 12 16:01:25 2014 -0500
+++ b/source/common/shortyuv.cpp Thu Mar 13 11:20:05 2014 +0900
@@ -82,37 +82,36 @@
::memset(m_bufCr, 0, (m_cwidth * m_cheight) * sizeof(int16_t));
}
-void ShortYuv::subtract(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
+void ShortYuv::subtract(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t partSize)
{
int part = partitionFromSizes(partSize, partSize);
- pixel* srcY0 = srcYuv0->getLumaAddr(trUnitIdx, partSize);
- pixel* srcY1 = srcYuv1->getLumaAddr(trUnitIdx, partSize);
- primitives.luma_sub_ps[part](getLumaAddr(trUnitIdx, partSize), m_width, srcY0, srcY1, srcYuv0->getStride(), srcYuv1->getStride());
+ pixel* srcY0 = srcYuv0->getLumaAddr();
+ pixel* srcY1 = srcYuv1->getLumaAddr();
+ primitives.luma_sub_ps[part](getLumaAddr(), m_width, srcY0, srcY1, srcYuv0->getStride(), srcYuv1->getStride());
+
+ pixel* srcU0 = srcYuv0->getCbAddr();
+ pixel* srcU1 = srcYuv1->getCbAddr();
+ primitives.chroma[m_csp].sub_ps[part](getCbAddr(), m_cwidth, srcU0, srcU1, srcYuv0->getCStride(), srcYuv1->getCStride());
+
+ pixel* srcV0 = srcYuv0->getCrAddr();
+ pixel* srcV1 = srcYuv1->getCrAddr();
+ primitives.chroma[m_csp].sub_ps[part](getCrAddr(), m_cwidth, srcV0, srcV1, srcYuv0->getCStride(), srcYuv1->getCStride());
+}
+
+void ShortYuv::addClip(ShortYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t partSize)
+{
+ int16_t* srcY0 = srcYuv0->getLumaAddr();
+ int16_t* srcY1 = srcYuv1->getLumaAddr();
+ primitives.pixeladd_ss(partSize, partSize, getLumaAddr(), m_width, srcY0, srcY1, srcYuv0->m_width, srcYuv1->m_width);
uint32_t cpartSize = partSize >> m_hChromaShift;
- pixel* srcU0 = srcYuv0->getCbAddr(trUnitIdx, cpartSize);
- pixel* srcU1 = srcYuv1->getCbAddr(trUnitIdx, cpartSize);
- primitives.chroma[m_csp].sub_ps[part](getCbAddr(trUnitIdx, cpartSize), m_cwidth, srcU0, srcU1, srcYuv0->getCStride(), srcYuv1->getCStride());
-
- pixel* srcV0 = srcYuv0->getCrAddr(trUnitIdx, cpartSize);
- pixel* srcV1 = srcYuv1->getCrAddr(trUnitIdx, cpartSize);
- primitives.chroma[m_csp].sub_ps[part](getCrAddr(trUnitIdx, cpartSize), m_cwidth, srcV0, srcV1, srcYuv0->getCStride(), srcYuv1->getCStride());
-}
-
-void ShortYuv::addClip(ShortYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize)
-{
- int16_t* srcY0 = srcYuv0->getLumaAddr(trUnitIdx, partSize);
- int16_t* srcY1 = srcYuv1->getLumaAddr(trUnitIdx, partSize);
- primitives.pixeladd_ss(partSize, partSize, getLumaAddr(trUnitIdx, partSize), m_width, srcY0, srcY1, srcYuv0->m_width, srcYuv1->m_width);
-
- uint32_t cpartSize = partSize >> m_hChromaShift;
- int16_t* srcU0 = srcYuv0->getCbAddr(trUnitIdx, cpartSize);
- int16_t* srcU1 = srcYuv1->getCbAddr(trUnitIdx, cpartSize);
- int16_t* srcV0 = srcYuv0->getCrAddr(trUnitIdx, cpartSize);
- int16_t* srcV1 = srcYuv1->getCrAddr(trUnitIdx, cpartSize);
- primitives.pixeladd_ss(cpartSize, cpartSize, getCbAddr(trUnitIdx, cpartSize), m_cwidth, srcU0, srcU1, srcYuv0->m_cwidth, srcYuv1->m_cwidth);
- primitives.pixeladd_ss(cpartSize, cpartSize, getCrAddr(trUnitIdx, cpartSize), m_cwidth, srcV0, srcV1, srcYuv0->m_cwidth, srcYuv1->m_cwidth);
+ int16_t* srcU0 = srcYuv0->getCbAddr();
+ int16_t* srcU1 = srcYuv1->getCbAddr();
+ int16_t* srcV0 = srcYuv0->getCrAddr();
+ int16_t* srcV1 = srcYuv1->getCrAddr();
+ primitives.pixeladd_ss(cpartSize, cpartSize, getCbAddr(), m_cwidth, srcU0, srcU1, srcYuv0->m_cwidth, srcYuv1->m_cwidth);
+ primitives.pixeladd_ss(cpartSize, cpartSize, getCrAddr(), m_cwidth, srcV0, srcV1, srcYuv0->m_cwidth, srcYuv1->m_cwidth);
}
void ShortYuv::copyPartToPartLuma(ShortYuv* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height)
diff -r 5328eec59554 -r d03b5830fa37 source/common/shortyuv.h
--- a/source/common/shortyuv.h Wed Mar 12 16:01:25 2014 -0500
+++ b/source/common/shortyuv.h Thu Mar 13 11:20:05 2014 +0900
@@ -94,8 +94,8 @@
int16_t* getCrAddr(uint32_t partIdx, uint32_t size) { return m_bufCr + getAddrOffset(partIdx, size, m_cwidth); }
- void subtract(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
- void addClip(ShortYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t trUnitIdx, uint32_t partSize);
+ void subtract(TComYuv* srcYuv0, TComYuv* srcYuv1, uint32_t partSize);
+ void addClip(ShortYuv* srcYuv0, ShortYuv* srcYuv1, uint32_t partSize);
void copyPartToPartLuma(ShortYuv* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height);
void copyPartToPartChroma(ShortYuv* dstPicYuv, uint32_t partIdx, uint32_t lumaSize, bool bChromaSame);
diff -r 5328eec59554 -r d03b5830fa37 source/encoder/compress.cpp
--- a/source/encoder/compress.cpp Wed Mar 12 16:01:25 2014 -0500
+++ b/source/encoder/compress.cpp Thu Mar 13 11:20:05 2014 +0900
@@ -91,7 +91,7 @@
m_search->m_predBufHeight, m_search->m_refAbove, m_search->m_refLeft,
m_search->m_refAboveFlt, m_search->m_refLeftFlt);
- Pel* fenc = m_origYuv[depth]->getLumaAddr(0, width);
+ Pel* fenc = m_origYuv[depth]->getLumaAddr();
uint32_t stride = m_modePredYuv[5][depth]->getStride();
Pel *above = m_search->m_refAbove + width - 1;
@@ -576,7 +576,7 @@
m_search->motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, partIdx, false, true);
}
- m_tmpResiYuv[depth]->subtract(m_origYuv[depth], m_bestPredYuv[depth], 0, outBestCU->getCUSize(0));
+ m_tmpResiYuv[depth]->subtract(m_origYuv[depth], m_bestPredYuv[depth], outBestCU->getCUSize(0));
m_search->generateCoeffRecon(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth], m_bestRecoYuv[depth], false);
}
else
@@ -868,7 +868,7 @@
//Calculate Residue
Pel* src2 = m_bestPredYuv[0]->getLumaAddr(absPartIdx);
Pel* src1 = m_origYuv[0]->getLumaAddr(absPartIdx);
- int16_t* dst = m_tmpResiYuv[depth]->getLumaAddr(0);
+ int16_t* dst = m_tmpResiYuv[depth]->getLumaAddr();
uint32_t src2stride = m_bestPredYuv[0]->getStride();
uint32_t src1stride = m_origYuv[0]->getStride();
uint32_t dststride = m_tmpResiYuv[depth]->m_width;
@@ -877,7 +877,7 @@
src2 = m_bestPredYuv[0]->getCbAddr(absPartIdx);
src1 = m_origYuv[0]->getCbAddr(absPartIdx);
- dst = m_tmpResiYuv[depth]->getCbAddr(0);
+ dst = m_tmpResiYuv[depth]->getCbAddr();
src2stride = m_bestPredYuv[0]->getCStride();
src1stride = m_origYuv[0]->getCStride();
dststride = m_tmpResiYuv[depth]->m_cwidth;
@@ -885,7 +885,7 @@
src2 = m_bestPredYuv[0]->getCrAddr(absPartIdx);
src1 = m_origYuv[0]->getCrAddr(absPartIdx);
- dst = m_tmpResiYuv[depth]->getCrAddr(0);
+ dst = m_tmpResiYuv[depth]->getCrAddr();
dststride = m_tmpResiYuv[depth]->m_cwidth;
primitives.chroma[m_param->internalCsp].sub_ps[part](dst, dststride, src1, src2, src1stride, src2stride);
@@ -904,24 +904,25 @@
//Generate Recon
Pel* pred = m_bestPredYuv[0]->getLumaAddr(absPartIdx);
- int16_t* res = m_tmpResiYuv[depth]->getLumaAddr(0);
- Pel* reco = m_bestRecoYuv[depth]->getLumaAddr(0);
+ int16_t* res = m_tmpResiYuv[depth]->getLumaAddr();
+ Pel* reco = m_bestRecoYuv[depth]->getLumaAddr();
dststride = m_bestRecoYuv[depth]->getStride();
src1stride = m_bestPredYuv[0]->getStride();
src2stride = m_tmpResiYuv[depth]->m_width;
primitives.luma_add_ps[part](reco, dststride, pred, res, src1stride, src2stride);
pred = m_bestPredYuv[0]->getCbAddr(absPartIdx);
- res = m_tmpResiYuv[depth]->getCbAddr(0);
- reco = m_bestRecoYuv[depth]->getCbAddr(0);
+ res = m_tmpResiYuv[depth]->getCbAddr();
+ reco = m_bestRecoYuv[depth]->getCbAddr();
dststride = m_bestRecoYuv[depth]->getCStride();
src1stride = m_bestPredYuv[0]->getCStride();
src2stride = m_tmpResiYuv[depth]->m_cwidth;
primitives.chroma[m_param->internalCsp].add_ps[part](reco, dststride, pred, res, src1stride, src2stride);
pred = m_bestPredYuv[0]->getCrAddr(absPartIdx);
- res = m_tmpResiYuv[depth]->getCrAddr(0);
- reco = m_bestRecoYuv[depth]->getCrAddr(0);
+ res = m_tmpResiYuv[depth]->getCrAddr();
+ reco = m_bestRecoYuv[depth]->getCrAddr();
+ reco = m_bestRecoYuv[depth]->getCrAddr();
primitives.chroma[m_param->internalCsp].add_ps[part](reco, dststride, pred, res, src1stride, src2stride);
m_bestRecoYuv[depth]->copyToPicYuv(lcu->getPic()->getPicYuvRec(), lcu->getAddr(), absPartIdx, 0, 0);
return;
More information about the x265-devel
mailing list