[x265-commits] [x265] rest: tpyo
Steve Borho
steve at borho.org
Thu Jul 24 04:16:15 CEST 2014
details: http://hg.videolan.org/x265/rev/9a1c64cc7f28
branches:
changeset: 7524:9a1c64cc7f28
user: Steve Borho <steve at borho.org>
date: Wed Jul 23 01:22:37 2014 -0500
description:
rest: tpyo
Subject: [x265] analysis: whitespace nit
details: http://hg.videolan.org/x265/rev/379c44100fff
branches:
changeset: 7525:379c44100fff
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Wed Jul 23 12:00:22 2014 +0530
description:
analysis: whitespace nit
Subject: [x265] TComPrediction: remove unused parameter warning
details: http://hg.videolan.org/x265/rev/6919c9f2432a
branches:
changeset: 7526:6919c9f2432a
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Wed Jul 23 14:02:10 2014 +0530
description:
TComPrediction: remove unused parameter warning
Subject: [x265] TComPrediction: fix MC error caused by previous patch
details: http://hg.videolan.org/x265/rev/db6b7046d4f0
branches:
changeset: 7527:db6b7046d4f0
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Wed Jul 23 14:42:10 2014 +0530
description:
TComPrediction: fix MC error caused by previous patch
Subject: [x265] analysis: eoln fixup
details: http://hg.videolan.org/x265/rev/4f9ff4eeb7e3
branches:
changeset: 7528:4f9ff4eeb7e3
user: Steve Borho <steve at borho.org>
date: Wed Jul 23 17:53:42 2014 -0500
description:
analysis: eoln fixup
Subject: [x265] pred: remove default motionCompensation argument values
details: http://hg.videolan.org/x265/rev/342d72f0b613
branches:
changeset: 7529:342d72f0b613
user: Steve Borho <steve at borho.org>
date: Wed Jul 23 17:47:16 2014 -0500
description:
pred: remove default motionCompensation argument values
bugs waiting to happen; they've bit us multiple times in the past
Subject: [x265] rc: compute average of qpaRc, qpAq per frame even in 2 pass
details: http://hg.videolan.org/x265/rev/7dd13d919265
branches:
changeset: 7530:7dd13d919265
user: Aarthi Thirumalai
date: Thu Jul 24 00:37:15 2014 +0530
description:
rc: compute average of qpaRc, qpAq per frame even in 2 pass
Subject: [x265] rc: calculate mvBits, coefBits per Cu for 2 pass in skip mode as well
details: http://hg.videolan.org/x265/rev/6c0929567805
branches:
changeset: 7531:6c0929567805
user: Aarthi Thirumalai
date: Thu Jul 24 00:38:11 2014 +0530
description:
rc: calculate mvBits, coefBits per Cu for 2 pass in skip mode as well
diffstat:
doc/reST/cli.rst | 2 +-
source/Lib/TLibCommon/TComPrediction.cpp | 4 +-
source/Lib/TLibCommon/TComPrediction.h | 2 +-
source/Lib/TLibEncoder/TEncSearch.cpp | 15 +-
source/encoder/analysis.cpp | 17 +-
source/encoder/ratecontrol.cpp | 172 +++++++++++++++---------------
6 files changed, 109 insertions(+), 103 deletions(-)
diffs (truncated from 381 to 300 lines):
diff -r 8a8495c750ad -r 6c0929567805 doc/reST/cli.rst
--- a/doc/reST/cli.rst Wed Jul 23 01:14:30 2014 -0500
+++ b/doc/reST/cli.rst Thu Jul 24 00:38:11 2014 +0530
@@ -324,7 +324,7 @@ Profile, Level, Tier
higher than the actual level, the actual requirement level is
signaled.
- Beware, wpecifying a decoder level will force the encoder to enable
+ Beware, specifying a decoder level will force the encoder to enable
VBV for constant rate factor encodes, which may introduce
non-determinism.
diff -r 8a8495c750ad -r 6c0929567805 source/Lib/TLibCommon/TComPrediction.cpp
--- a/source/Lib/TLibCommon/TComPrediction.cpp Wed Jul 23 01:14:30 2014 -0500
+++ b/source/Lib/TLibCommon/TComPrediction.cpp Thu Jul 24 00:38:11 2014 +0530
@@ -219,10 +219,8 @@ bool TComPrediction::xCheckIdenticalMoti
return false;
}
-void TComPrediction::motionCompensation(TComDataCU* cu, TComYuv* predYuv, int list, int partIdx, bool bLuma, bool bChroma)
+void TComPrediction::motionCompensation(TComDataCU* cu, TComYuv* predYuv, int list, bool bLuma, bool bChroma)
{
- X265_CHECK(partIdx >= 0, "partidx is not positive\n");
-
if (cu->m_slice->isInterP())
list = REF_PIC_LIST_0;
if (list != REF_PIC_LIST_X)
diff -r 8a8495c750ad -r 6c0929567805 source/Lib/TLibCommon/TComPrediction.h
--- a/source/Lib/TLibCommon/TComPrediction.h Wed Jul 23 01:14:30 2014 -0500
+++ b/source/Lib/TLibCommon/TComPrediction.h Thu Jul 24 00:38:11 2014 +0530
@@ -108,7 +108,7 @@ public:
void initTempBuff(int csp);
// inter
- void motionCompensation(TComDataCU* cu, TComYuv* predYuv, int picList = REF_PIC_LIST_X, int partIdx = -1, bool bLuma = true, bool bChroma = true);
+ void motionCompensation(TComDataCU* cu, TComYuv* predYuv, int picList, bool bLuma, bool bChroma);
// Angular Intra
void predIntraLumaAng(uint32_t dirMode, pixel* pred, intptr_t stride, uint32_t log2TrSize);
diff -r 8a8495c750ad -r 6c0929567805 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp Wed Jul 23 01:14:30 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp Thu Jul 24 00:38:11 2014 +0530
@@ -1869,7 +1869,7 @@ uint32_t TEncSearch::xMergeEstimation(TC
cu->getCUMvField(REF_PIC_LIST_1)->m_mv[m.absPartIdx] = m.mvFieldNeighbours[mergeCand][1].mv;
cu->getCUMvField(REF_PIC_LIST_1)->m_refIdx[m.absPartIdx] = m.mvFieldNeighbours[mergeCand][1].refIdx;
- motionCompensation(cu, &m_predTempYuv, REF_PIC_LIST_X, puIdx, true, false);
+ motionCompensation(cu, &m_predTempYuv, REF_PIC_LIST_X, true, false);
uint32_t costCand = m_me.bufSATD(m_predTempYuv.getLumaAddr(m.absPartIdx), m_predTempYuv.getStride());
uint32_t bitsCand = getTUBits(mergeCand, m.maxNumMergeCand);
costCand = costCand + m_rdCost.getCost(bitsCand);
@@ -1952,7 +1952,7 @@ bool TEncSearch::predInterSearch(TComDat
cu->getCUMvField(REF_PIC_LIST_1)->setAllMvField(merge.mvField[1], partSize, partAddr, 0, partIdx);
totalmebits += merge.bits;
- motionCompensation(cu, predYuv, REF_PIC_LIST_X, partIdx, true, bChroma);
+ motionCompensation(cu, predYuv, REF_PIC_LIST_X, true, bChroma);
continue;
}
}
@@ -2165,7 +2165,7 @@ bool TEncSearch::predInterSearch(TComDat
totalmebits += list[1].bits;
}
- motionCompensation(cu, predYuv, REF_PIC_LIST_X, partIdx, true, bChroma);
+ motionCompensation(cu, predYuv, REF_PIC_LIST_X, true, bChroma);
}
x265_emms();
@@ -2296,7 +2296,7 @@ void TEncSearch::encodeResAndCalcRdInter
if (cu->isIntra(0))
return;
- uint32_t bits = 0, bestBits = 0;
+ uint32_t bits = 0, bestBits = 0, bestCoeffBits = 0;
uint32_t distortion = 0, bestDist = 0;
uint32_t log2CUSize = cu->getLog2CUSize(0);
@@ -2328,7 +2328,8 @@ void TEncSearch::encodeResAndCalcRdInter
m_entropyCoder->codeMergeIndex(cu, 0);
bits = m_entropyCoder->getNumberOfWrittenBits();
-
+ cu->m_mvBits = bits;
+ cu->m_coeffBits = 0;
cu->m_totalBits = bits;
cu->m_totalDistortion = distortion;
if (m_rdCost.psyRdEnabled())
@@ -2434,6 +2435,7 @@ void TEncSearch::encodeResAndCalcRdInter
bestBits = bits;
bestCost = cost;
+ bestCoeffBits = cu->m_coeffBits;
m_entropyCoder->store(m_rdEntropyCoders[depth][CI_TEMP_BEST]);
}
@@ -2461,6 +2463,8 @@ void TEncSearch::encodeResAndCalcRdInter
cu->m_totalRDCost = m_rdCost.calcRdCost(bestDist, bestBits);
cu->m_totalBits = bestBits;
cu->m_totalDistortion = bestDist;
+ cu->m_coeffBits = bestCoeffBits;
+ cu->m_mvBits = bestBits - bestCoeffBits;
if (cu->isSkipped(0))
cu->clearCbf(0, depth);
@@ -3707,6 +3711,7 @@ uint32_t TEncSearch::xSymbolBitsInter(TC
m_entropyCoder->codeSkipFlag(cu, 0);
m_entropyCoder->codeMergeIndex(cu, 0);
cu->m_mvBits = m_entropyCoder->getNumberOfWrittenBits();
+ cu->m_coeffBits = 0;
return m_entropyCoder->getNumberOfWrittenBits();
}
else
diff -r 8a8495c750ad -r 6c0929567805 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp Wed Jul 23 01:14:30 2014 -0500
+++ b/source/encoder/analysis.cpp Thu Jul 24 00:38:11 2014 +0530
@@ -685,7 +685,7 @@ void Analysis::compressInterCU_rd0_4(TCo
for (int partIdx = 0; partIdx < numPart; partIdx++)
{
outBestCU->getPartIndexAndSize(partIdx, m_partAddr, m_width, m_height);
- motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, partIdx, false, true);
+ motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, false, true);
}
encodeResAndCalcRdInterCU(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth],
@@ -758,7 +758,7 @@ void Analysis::compressInterCU_rd0_4(TCo
for (int partIdx = 0; partIdx < numPart; partIdx++)
{
outBestCU->getPartIndexAndSize(partIdx, m_partAddr, m_width, m_height);
- motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, partIdx, false, true);
+ motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, false, true);
}
encodeResAndCalcRdInterCU(outBestCU, m_origYuv[depth], m_bestPredYuv[depth], m_tmpResiYuv[depth],
@@ -783,7 +783,7 @@ void Analysis::compressInterCU_rd0_4(TCo
for (int partIdx = 0; partIdx < numPart; partIdx++)
{
outBestCU->getPartIndexAndSize(partIdx, m_partAddr, m_width, m_height);
- motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, partIdx, false, true);
+ motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, false, true);
}
m_tmpResiYuv[depth]->subtract(m_origYuv[depth], m_bestPredYuv[depth], outBestCU->getLog2CUSize(0));
@@ -800,7 +800,7 @@ void Analysis::compressInterCU_rd0_4(TCo
for (int partIdx = 0; partIdx < numPart; partIdx++)
{
outBestCU->getPartIndexAndSize(partIdx, m_partAddr, m_width, m_height);
- motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, partIdx, false, true);
+ motionCompensation(outBestCU, m_bestPredYuv[depth], REF_PIC_LIST_X, false, true);
}
}
}
@@ -1044,8 +1044,7 @@ void Analysis::compressInterCU_rd0_4(TCo
{
X265_CHECK(outBestCU->getPartitionSize(0) != SIZE_NONE, "no best prediction size\n");
X265_CHECK(outBestCU->getPredictionMode(0) != MODE_NONE, "no best prediction mode\n");
- X265_CHECK(outBestCU->m_totalRDCost != MAX_INT64, "no best prediction cost\n");
-
+ X265_CHECK(outBestCU->m_totalRDCost != MAX_INT64, "no best prediction cost\n");
}
x265_emms();
@@ -1397,7 +1396,7 @@ void Analysis::checkMerge2Nx2N_rd0_4(TCo
// do MC only for Luma part
/* Set CU parameters for motion compensation */
outTempCU->getPartIndexAndSize(0, m_partAddr, m_width, m_height);
- motionCompensation(outTempCU, m_tmpPredYuv[depth], REF_PIC_LIST_X, 0, true, false);
+ motionCompensation(outTempCU, m_tmpPredYuv[depth], REF_PIC_LIST_X, true, false);
uint32_t bitsCand = getTUBits(mergeCand, maxNumMergeCand);
outTempCU->m_totalBits = bitsCand;
outTempCU->m_totalDistortion = primitives.sa8d[sizeIdx](m_origYuv[depth]->getLumaAddr(), m_origYuv[depth]->getStride(),
@@ -1436,7 +1435,7 @@ void Analysis::checkMerge2Nx2N_rd0_4(TCo
for (int partIdx = 0; partIdx < numPart; partIdx++)
{
outBestCU->getPartIndexAndSize(partIdx, m_partAddr, m_width, m_height);
- motionCompensation(outBestCU, bestPredYuv, REF_PIC_LIST_X, partIdx, false, true);
+ motionCompensation(outBestCU, bestPredYuv, REF_PIC_LIST_X, false, true);
}
if (outTempCU->isLosslessCoded(0))
@@ -1510,7 +1509,7 @@ void Analysis::checkMerge2Nx2N_rd5_6(TCo
// do MC
outTempCU->getPartIndexAndSize(0, m_partAddr, m_width, m_height);
- motionCompensation(outTempCU, m_tmpPredYuv[depth], REF_PIC_LIST_X, 0);
+ motionCompensation(outTempCU, m_tmpPredYuv[depth], REF_PIC_LIST_X, true, true);
// estimate residual and encode everything
encodeResAndCalcRdInterCU(outTempCU,
m_origYuv[depth],
diff -r 8a8495c750ad -r 6c0929567805 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp Wed Jul 23 01:14:30 2014 -0500
+++ b/source/encoder/ratecontrol.cpp Thu Jul 24 00:38:11 2014 +0530
@@ -2063,100 +2063,104 @@ int RateControl::rateControlEnd(Frame* p
x265_qp2qScale(int(pic->m_avgQpRc + 0.5) + mbtree_offset);
}
}
- if (!m_isAbrReset)
+ }
+ if (!m_isAbrReset)
+ {
+ if (m_param->rc.aqMode || m_isVbv)
{
- if (m_param->rc.aqMode || m_isVbv)
+ if (pic->m_qpaRc)
{
- if (pic->m_qpaRc)
+ for (uint32_t i = 0; i < pic->getFrameHeightInCU(); i++)
{
- for (uint32_t i = 0; i < pic->getFrameHeightInCU(); i++)
- {
- pic->m_avgQpRc += pic->m_qpaRc[i];
- }
-
- pic->m_avgQpRc /= (pic->getFrameHeightInCU() * pic->getFrameWidthInCU());
- rce->qpaRc = pic->m_avgQpRc;
- // copy avg RC qp to m_avgQpAq. To print out the correct qp when aq/cutree is disabled.
- pic->m_avgQpAq = pic->m_avgQpRc;
+ pic->m_avgQpRc += pic->m_qpaRc[i];
}
- if (pic->m_qpaAq)
+ pic->m_avgQpRc /= (pic->getFrameHeightInCU() * pic->getFrameWidthInCU());
+ rce->qpaRc = pic->m_avgQpRc;
+ // copy avg RC qp to m_avgQpAq. To print out the correct qp when aq/cutree is disabled.
+ pic->m_avgQpAq = pic->m_avgQpRc;
+ }
+
+ if (pic->m_qpaAq)
+ {
+ for (uint32_t i = 0; i < pic->getFrameHeightInCU(); i++)
{
- for (uint32_t i = 0; i < pic->getFrameHeightInCU(); i++)
- {
- pic->m_avgQpAq += pic->m_qpaAq[i];
- }
+ pic->m_avgQpAq += pic->m_qpaAq[i];
+ }
- pic->m_avgQpAq /= (pic->getFrameHeightInCU() * pic->getFrameWidthInCU());
- }
+ pic->m_avgQpAq /= (pic->getFrameHeightInCU() * pic->getFrameWidthInCU());
}
- // Write frame stats into the stats file if 2 pass is enabled.
- if (m_param->rc.bStatWrite)
- {
- char cType = rce->sliceType == I_SLICE ? (rce->poc == 0 ? 'I' : 'i')
- : rce->sliceType == P_SLICE ? (pic->m_picSym->m_slice->m_bReferenced ? 'P' : 'p')
- : pic->m_picSym->m_slice->m_bReferenced ? 'B' : 'b';
- if (fprintf(m_statFileOut,
- "in:%d out:%d type:%c dur:%.3f q:%.2f q-aq:%.2f tex:%d mv:%d misc:%d icu:%.2f pcu:%.2f scu:%.2f ",
- rce->poc, rce->encodeOrder,
- cType, m_frameDuration,
- pic->m_avgQpRc, pic->m_avgQpAq,
- stats->coeffBits,
- stats->mvBits,
- stats->miscBits,
- stats->cuCount_i * m_ncu,
- stats->cuCount_p * m_ncu,
- stats->cuCount_skip * m_ncu) < 0)
- goto writeFailure;
- if (fprintf(m_statFileOut, ";\n") < 0)
- goto writeFailure;
- /* Don't re-write the data in multi-pass mode. */
- if (m_param->rc.cuTree && pic->m_picSym->m_slice->m_bReferenced && !m_param->rc.bStatRead)
- {
- uint8_t sliceType = (uint8_t)rce->sliceType;
- for (int i = 0; i < m_ncu; i++)
- m_cuTreeStats.qpBuffer[0][i] = (uint16_t)(pic->m_lowres.qpCuTreeOffset[i] * 256.0);
- if (fwrite(&sliceType, 1, 1, m_cutreeStatFileOut) < 1)
- goto writeFailure;
- if (fwrite(m_cuTreeStats.qpBuffer[0], sizeof(uint16_t), m_ncu, m_cutreeStatFileOut) < (size_t)m_ncu)
- goto writeFailure;
- }
- }
- /* amortize part of each I slice over the next several frames, up to
- * keyint-max, to avoid over-compensating for the large I slice cost */
- if (!m_param->rc.bStatWrite && !m_param->rc.bStatRead)
- {
- if (rce->sliceType == I_SLICE)
- {
- /* previous I still had a residual; roll it into the new loan */
- if (m_residualFrames)
- bits += m_residualCost * m_residualFrames;
- m_residualFrames = X265_MIN(s_amortizeFrames, m_param->keyframeMax);
- m_residualCost = (int)((bits * s_amortizeFraction) / m_residualFrames);
- bits -= m_residualCost * m_residualFrames;
- }
- else if (m_residualFrames)
- {
- bits += m_residualCost;
- m_residualFrames--;
- }
- }
- if (rce->sliceType != B_SLICE)
- {
- /* The factor 1.5 is to tune up the actual bits, otherwise the cplxrSum is scaled too low
- * to improve short term compensation for next frame. */
- m_cplxrSum += (bits * x265_qp2qScale(rce->qpaRc) / rce->qRceq) - (rce->rowCplxrSum);
- }
- else
More information about the x265-commits
mailing list