[x265] nits
Satoshi Nakagawa
nakagawa424 at oki.com
Thu Nov 13 08:31:47 CET 2014
# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1415863775 -32400
# Thu Nov 13 16:29:35 2014 +0900
# Node ID 49141f28397dd294bb6e590dad2bb8d2b01bf97b
# Parent 18aefbde72ab2dfaa0d4edeea7fd0ab4f9a09f9c
nits
diff -r 18aefbde72ab -r 49141f28397d source/common/cudata.cpp
--- a/source/common/cudata.cpp Wed Nov 12 17:17:56 2014 -0600
+++ b/source/common/cudata.cpp Thu Nov 13 16:29:35 2014 +0900
@@ -1953,8 +1953,8 @@
bool CUData::getColMVP(MV& outMV, int& outRefIdx, int picList, int cuAddr, int partUnitIdx) const
{
- Frame *colPic = m_slice->m_refPicList[m_slice->isInterB() ? 1 - m_slice->m_colFromL0Flag : 0][m_slice->m_colRefIdx];
- CUData *colCU = colPic->m_encData->getPicCTU(cuAddr);
+ const Frame* colPic = m_slice->m_refPicList[m_slice->isInterB() && !m_slice->m_colFromL0Flag][m_slice->m_colRefIdx];
+ const CUData* colCU = colPic->m_encData->getPicCTU(cuAddr);
if (colCU->m_predMode[partUnitIdx] == MODE_NONE)
return false;
diff -r 18aefbde72ab -r 49141f28397d source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp Wed Nov 12 17:17:56 2014 -0600
+++ b/source/encoder/analysis.cpp Thu Nov 13 16:29:35 2014 +0900
@@ -138,7 +138,7 @@
if (m_param->analysisMode == X265_ANALYSIS_SAVE && m_frame->m_intraData)
{
- CUData *bestCU = &m_modeDepth[0].bestMode->cu;
+ const CUData* bestCU = &m_modeDepth[0].bestMode->cu;
memcpy(&m_frame->m_intraData->depth[ctu.m_cuAddr * numPartition], bestCU->m_cuDepth, sizeof(uint8_t) * numPartition);
memcpy(&m_frame->m_intraData->modes[ctu.m_cuAddr * numPartition], bestCU->m_lumaIntraDir, sizeof(uint8_t) * numPartition);
memcpy(&m_frame->m_intraData->partSizes[ctu.m_cuAddr * numPartition], bestCU->m_partSize, sizeof(uint8_t) * numPartition);
@@ -268,23 +268,23 @@
for (uint32_t subPartIdx = 0; subPartIdx < 4; subPartIdx++)
{
- const CUGeom& childCuData = *(&cuGeom + cuGeom.childOffset + subPartIdx);
- if (childCuData.flags & CUGeom::PRESENT)
+ const CUGeom& childGeom = *(&cuGeom + cuGeom.childOffset + subPartIdx);
+ if (childGeom.flags & CUGeom::PRESENT)
{
- m_modeDepth[0].fencYuv.copyPartToYuv(nd.fencYuv, childCuData.encodeIdx);
+ m_modeDepth[0].fencYuv.copyPartToYuv(nd.fencYuv, childGeom.encodeIdx);
m_rqt[nextDepth].cur.load(*nextContext);
- compressIntraCU(parentCTU, childCuData, shared, zOrder);
+ compressIntraCU(parentCTU, childGeom, shared, zOrder);
// Save best CU and pred data for this sub CU
- splitCU->copyPartFrom(nd.bestMode->cu, childCuData, subPartIdx);
+ splitCU->copyPartFrom(nd.bestMode->cu, childGeom, subPartIdx);
splitPred->addSubCosts(*nd.bestMode);
- nd.bestMode->reconYuv.copyToPartYuv(splitPred->reconYuv, childCuData.numPartitions * subPartIdx);
+ nd.bestMode->reconYuv.copyToPartYuv(splitPred->reconYuv, childGeom.numPartitions * subPartIdx);
nextContext = &nd.bestMode->contexts;
}
else
{
/* record the depth of this non-present sub-CU */
- splitCU->setEmptyPart(childCuData, subPartIdx);
+ splitCU->setEmptyPart(childGeom, subPartIdx);
zOrder += g_depthInc[g_maxCUDepth - 1][nextDepth];
}
}
@@ -735,22 +735,22 @@
for (uint32_t subPartIdx = 0; subPartIdx < 4; subPartIdx++)
{
- const CUGeom& childCuData = *(&cuGeom + cuGeom.childOffset + subPartIdx);
- if (childCuData.flags & CUGeom::PRESENT)
+ const CUGeom& childGeom = *(&cuGeom + cuGeom.childOffset + subPartIdx);
+ if (childGeom.flags & CUGeom::PRESENT)
{
- m_modeDepth[0].fencYuv.copyPartToYuv(nd.fencYuv, childCuData.encodeIdx);
+ m_modeDepth[0].fencYuv.copyPartToYuv(nd.fencYuv, childGeom.encodeIdx);
m_rqt[nextDepth].cur.load(*nextContext);
- compressInterCU_dist(parentCTU, childCuData);
+ compressInterCU_dist(parentCTU, childGeom);
// Save best CU and pred data for this sub CU
- splitCU->copyPartFrom(nd.bestMode->cu, childCuData, subPartIdx);
+ splitCU->copyPartFrom(nd.bestMode->cu, childGeom, subPartIdx);
splitPred->addSubCosts(*nd.bestMode);
- nd.bestMode->reconYuv.copyToPartYuv(splitPred->reconYuv, childCuData.numPartitions * subPartIdx);
+ nd.bestMode->reconYuv.copyToPartYuv(splitPred->reconYuv, childGeom.numPartitions * subPartIdx);
nextContext = &nd.bestMode->contexts;
}
else
- splitCU->setEmptyPart(childCuData, subPartIdx);
+ splitCU->setEmptyPart(childGeom, subPartIdx);
}
nextContext->store(splitPred->contexts);
@@ -1006,26 +1006,26 @@
for (uint32_t subPartIdx = 0; subPartIdx < 4; subPartIdx++)
{
- const CUGeom& childCuData = *(&cuGeom + cuGeom.childOffset + subPartIdx);
- if (childCuData.flags & CUGeom::PRESENT)
+ const CUGeom& childGeom = *(&cuGeom + cuGeom.childOffset + subPartIdx);
+ if (childGeom.flags & CUGeom::PRESENT)
{
- m_modeDepth[0].fencYuv.copyPartToYuv(nd.fencYuv, childCuData.encodeIdx);
+ m_modeDepth[0].fencYuv.copyPartToYuv(nd.fencYuv, childGeom.encodeIdx);
m_rqt[nextDepth].cur.load(*nextContext);
- compressInterCU_rd0_4(parentCTU, childCuData);
+ compressInterCU_rd0_4(parentCTU, childGeom);
// Save best CU and pred data for this sub CU
- splitCU->copyPartFrom(nd.bestMode->cu, childCuData, subPartIdx);
+ splitCU->copyPartFrom(nd.bestMode->cu, childGeom, subPartIdx);
splitPred->addSubCosts(*nd.bestMode);
if (m_param->rdLevel)
- nd.bestMode->reconYuv.copyToPartYuv(splitPred->reconYuv, childCuData.numPartitions * subPartIdx);
+ nd.bestMode->reconYuv.copyToPartYuv(splitPred->reconYuv, childGeom.numPartitions * subPartIdx);
else
- nd.bestMode->predYuv.copyToPartYuv(splitPred->predYuv, childCuData.numPartitions * subPartIdx);
+ nd.bestMode->predYuv.copyToPartYuv(splitPred->predYuv, childGeom.numPartitions * subPartIdx);
if (m_param->rdLevel > 1)
nextContext = &nd.bestMode->contexts;
}
else
- splitCU->setEmptyPart(childCuData, subPartIdx);
+ splitCU->setEmptyPart(childGeom, subPartIdx);
}
nextContext->store(splitPred->contexts);
@@ -1197,21 +1197,21 @@
for (uint32_t subPartIdx = 0; subPartIdx < 4; subPartIdx++)
{
- const CUGeom& childCuData = *(&cuGeom + cuGeom.childOffset + subPartIdx);
- if (childCuData.flags & CUGeom::PRESENT)
+ const CUGeom& childGeom = *(&cuGeom + cuGeom.childOffset + subPartIdx);
+ if (childGeom.flags & CUGeom::PRESENT)
{
- m_modeDepth[0].fencYuv.copyPartToYuv(nd.fencYuv, childCuData.encodeIdx);
+ m_modeDepth[0].fencYuv.copyPartToYuv(nd.fencYuv, childGeom.encodeIdx);
m_rqt[nextDepth].cur.load(*nextContext);
- compressInterCU_rd5_6(parentCTU, childCuData);
+ compressInterCU_rd5_6(parentCTU, childGeom);
// Save best CU and pred data for this sub CU
- splitCU->copyPartFrom(nd.bestMode->cu, childCuData, subPartIdx);
+ splitCU->copyPartFrom(nd.bestMode->cu, childGeom, subPartIdx);
splitPred->addSubCosts(*nd.bestMode);
- nd.bestMode->reconYuv.copyToPartYuv(splitPred->reconYuv, childCuData.numPartitions * subPartIdx);
+ nd.bestMode->reconYuv.copyToPartYuv(splitPred->reconYuv, childGeom.numPartitions * subPartIdx);
nextContext = &nd.bestMode->contexts;
}
else
- splitCU->setEmptyPart(childCuData, subPartIdx);
+ splitCU->setEmptyPart(childGeom, subPartIdx);
}
nextContext->store(splitPred->contexts);
if (mightNotSplit)
@@ -1657,9 +1657,9 @@
{
for (uint32_t subPartIdx = 0; subPartIdx < 4; subPartIdx++)
{
- const CUGeom& childCuData = *(&cuGeom + cuGeom.childOffset + subPartIdx);
- if (childCuData.flags & CUGeom::PRESENT)
- encodeResidue(ctu, childCuData);
+ const CUGeom& childGeom = *(&cuGeom + cuGeom.childOffset + subPartIdx);
+ if (childGeom.flags & CUGeom::PRESENT)
+ encodeResidue(ctu, childGeom);
}
return;
}
diff -r 18aefbde72ab -r 49141f28397d source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp Wed Nov 12 17:17:56 2014 -0600
+++ b/source/encoder/entropy.cpp Thu Nov 13 16:29:35 2014 +0900
@@ -517,9 +517,9 @@
}
/* encode a CU block recursively */
-void Entropy::encodeCU(const CUData& cu, const CUGeom& cuGeom, uint32_t absPartIdx, uint32_t depth, bool& bEncodeDQP)
+void Entropy::encodeCU(const CUData& ctu, const CUGeom& cuGeom, uint32_t absPartIdx, uint32_t depth, bool& bEncodeDQP)
{
- const Slice* slice = cu.m_slice;
+ const Slice* slice = ctu.m_slice;
if (depth <= slice->m_pps->maxCuDQPDepth && slice->m_pps->bUseDQP)
bEncodeDQP = true;
@@ -532,74 +532,74 @@
uint32_t qNumParts = (NUM_CU_PARTITIONS >> (depth << 1)) >> 2;
for (uint32_t subPartIdx = 0; subPartIdx < 4; subPartIdx++, absPartIdx += qNumParts)
{
- const CUGeom& childCuData = *(&cuGeom + cuGeom.childOffset + subPartIdx);
- if (childCuData.flags & CUGeom::PRESENT)
- encodeCU(cu, childCuData, absPartIdx, depth + 1, bEncodeDQP);
+ const CUGeom& childGeom = *(&cuGeom + cuGeom.childOffset + subPartIdx);
+ if (childGeom.flags & CUGeom::PRESENT)
+ encodeCU(ctu, childGeom, absPartIdx, depth + 1, bEncodeDQP);
}
return;
}
// We need to split, so don't try these modes.
if (cuSplitFlag)
- codeSplitFlag(cu, absPartIdx, depth);
+ codeSplitFlag(ctu, absPartIdx, depth);
- if (depth < cu.m_cuDepth[absPartIdx] && depth < g_maxCUDepth)
+ if (depth < ctu.m_cuDepth[absPartIdx] && depth < g_maxCUDepth)
{
uint32_t qNumParts = (NUM_CU_PARTITIONS >> (depth << 1)) >> 2;
for (uint32_t subPartIdx = 0; subPartIdx < 4; subPartIdx++, absPartIdx += qNumParts)
{
- const CUGeom& childCuData = *(&cuGeom + cuGeom.childOffset + subPartIdx);
- encodeCU(cu, childCuData, absPartIdx, depth + 1, bEncodeDQP);
+ const CUGeom& childGeom = *(&cuGeom + cuGeom.childOffset + subPartIdx);
+ encodeCU(ctu, childGeom, absPartIdx, depth + 1, bEncodeDQP);
}
return;
}
if (slice->m_pps->bTransquantBypassEnabled)
- codeCUTransquantBypassFlag(cu.m_tqBypass[absPartIdx]);
+ codeCUTransquantBypassFlag(ctu.m_tqBypass[absPartIdx]);
if (!slice->isIntra())
{
- codeSkipFlag(cu, absPartIdx);
- if (cu.isSkipped(absPartIdx))
+ codeSkipFlag(ctu, absPartIdx);
+ if (ctu.isSkipped(absPartIdx))
{
- codeMergeIndex(cu, absPartIdx);
- finishCU(cu, absPartIdx, depth);
+ codeMergeIndex(ctu, absPartIdx);
+ finishCU(ctu, absPartIdx, depth);
return;
}
- codePredMode(cu.m_predMode[absPartIdx]);
+ codePredMode(ctu.m_predMode[absPartIdx]);
}
- codePartSize(cu, absPartIdx, depth);
+ codePartSize(ctu, absPartIdx, depth);
// prediction Info ( Intra : direction mode, Inter : Mv, reference idx )
- codePredInfo(cu, absPartIdx);
+ codePredInfo(ctu, absPartIdx);
uint32_t tuDepthRange[2];
- if (cu.isIntra(absPartIdx))
- cu.getIntraTUQtDepthRange(tuDepthRange, absPartIdx);
+ if (ctu.isIntra(absPartIdx))
+ ctu.getIntraTUQtDepthRange(tuDepthRange, absPartIdx);
else
- cu.getInterTUQtDepthRange(tuDepthRange, absPartIdx);
+ ctu.getInterTUQtDepthRange(tuDepthRange, absPartIdx);
// Encode Coefficients, allow codeCoeff() to modify bEncodeDQP
- codeCoeff(cu, absPartIdx, depth, bEncodeDQP, tuDepthRange);
+ codeCoeff(ctu, absPartIdx, depth, bEncodeDQP, tuDepthRange);
// --- write terminating bit ---
- finishCU(cu, absPartIdx, depth);
+ finishCU(ctu, absPartIdx, depth);
}
/* finish encoding a cu and handle end-of-slice conditions */
-void Entropy::finishCU(const CUData& cu, uint32_t absPartIdx, uint32_t depth)
+void Entropy::finishCU(const CUData& ctu, uint32_t absPartIdx, uint32_t depth)
{
- const Slice* slice = cu.m_slice;
+ const Slice* slice = ctu.m_slice;
uint32_t realEndAddress = slice->m_endCUAddr;
- uint32_t cuAddr = cu.getSCUAddr() + absPartIdx;
- X265_CHECK(realEndAddress == cu.m_slice->realEndAddress(slice->m_endCUAddr), "real end address expected\n");
+ uint32_t cuAddr = ctu.getSCUAddr() + absPartIdx;
+ X265_CHECK(realEndAddress == slice->realEndAddress(slice->m_endCUAddr), "real end address expected\n");
uint32_t granularityMask = g_maxCUSize - 1;
- uint32_t cuSize = 1 << cu.m_log2CUSize[absPartIdx];
- uint32_t rpelx = cu.m_cuPelX + g_zscanToPelX[absPartIdx] + cuSize;
- uint32_t bpely = cu.m_cuPelY + g_zscanToPelY[absPartIdx] + cuSize;
+ uint32_t cuSize = 1 << ctu.m_log2CUSize[absPartIdx];
+ uint32_t rpelx = ctu.m_cuPelX + g_zscanToPelX[absPartIdx] + cuSize;
+ uint32_t bpely = ctu.m_cuPelY + g_zscanToPelY[absPartIdx] + cuSize;
bool granularityBoundary = (((rpelx & granularityMask) == 0 || (rpelx == slice->m_sps->picWidthInLumaSamples )) &&
((bpely & granularityMask) == 0 || (bpely == slice->m_sps->picHeightInLumaSamples)));
diff -r 18aefbde72ab -r 49141f28397d source/encoder/entropy.h
--- a/source/encoder/entropy.h Wed Nov 12 17:17:56 2014 -0600
+++ b/source/encoder/entropy.h Thu Nov 13 16:29:35 2014 +0900
@@ -213,8 +213,8 @@
return (uint32_t)(fracBits >> 15);
}
- void encodeCU(const CUData& cu, const CUGeom &cuGeom, uint32_t absPartIdx, uint32_t depth, bool& bEncodeDQP);
- void finishCU(const CUData& cu, uint32_t absPartIdx, uint32_t depth);
+ void encodeCU(const CUData& ctu, const CUGeom &cuGeom, uint32_t absPartIdx, uint32_t depth, bool& bEncodeDQP);
+ void finishCU(const CUData& ctu, uint32_t absPartIdx, uint32_t depth);
void writeOut();
diff -r 18aefbde72ab -r 49141f28397d source/encoder/sao.cpp
--- a/source/encoder/sao.cpp Wed Nov 12 17:17:56 2014 -0600
+++ b/source/encoder/sao.cpp Thu Nov 13 16:29:35 2014 +0900
@@ -543,7 +543,7 @@
void SAO::calcSaoStatsCu(int addr, int plane)
{
int x, y;
- CUData* cu = m_frame->m_encData->getPicCTU(addr);
+ const CUData* cu = m_frame->m_encData->getPicCTU(addr);
const pixel* fenc0 = m_frame->m_fencPic->getPlaneAddr(plane, addr);
const pixel* rec0 = m_frame->m_reconPic->getPlaneAddr(plane, addr);
const pixel* fenc;
@@ -789,7 +789,7 @@
int addr = idxX + m_numCuInWidth * idxY;
int x, y;
- CUData* cu = frame->m_encData->getPicCTU(addr);
+ const CUData* cu = frame->m_encData->getPicCTU(addr);
const pixel* fenc;
const pixel* rec;
intptr_t stride = m_frame->m_reconPic->m_stride;
More information about the x265-devel
mailing list