[x265-commits] [x265] compress: review/clean up merge
Deepthi Nandakumar
deepthi at multicorewareinc.com
Fri Dec 13 17:10:33 CET 2013
details: http://hg.videolan.org/x265/rev/1012911d1895
branches:
changeset: 5713:1012911d1895
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Fri Dec 13 14:35:32 2013 +0530
description:
compress: review/clean up merge
Subject: [x265] compress: review/clean up top_skip
details: http://hg.videolan.org/x265/rev/20f9187af731
branches:
changeset: 5714:20f9187af731
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Fri Dec 13 14:42:50 2013 +0530
description:
compress: review/clean up top_skip
Subject: [x265] rd level: change the indexing for sa8d threshold array
details: http://hg.videolan.org/x265/rev/bf541ca76b3a
branches:
changeset: 5715:bf541ca76b3a
user: Sumalatha Polureddy
date: Thu Dec 12 12:00:25 2013 +0530
description:
rd level: change the indexing for sa8d threshold array
The index in threshold array won't be same as depth when the max cu size is less than 64.
Subject: [x265] rd level: remove the redundant splitflag bit calculation with EARLY EXIT ON
details: http://hg.videolan.org/x265/rev/fdfecd9f4c9e
branches:
changeset: 5716:fdfecd9f4c9e
user: Sumalatha Polureddy
date: Thu Dec 12 12:02:15 2013 +0530
description:
rd level: remove the redundant splitflag bit calculation with EARLY EXIT ON
Subject: [x265] rd level: fix the incorrect cost calculation for sa8d
details: http://hg.videolan.org/x265/rev/ba3cc2f01138
branches:
changeset: 5717:ba3cc2f01138
user: Sumalatha Polureddy
date: Thu Dec 12 12:07:41 2013 +0530
description:
rd level: fix the incorrect cost calculation for sa8d
In rd level 1, the distortion is sa8d, so cost calculation should be calrdsadcost() instead of calcrdcost()
Subject: [x265] Merge: changes outputs
details: http://hg.videolan.org/x265/rev/d0cf79d76057
branches:
changeset: 5718:d0cf79d76057
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Fri Dec 13 15:35:18 2013 +0530
description:
Merge: changes outputs
Subject: [x265] Fix for deltaWeight assert failure in Decoder
details: http://hg.videolan.org/x265/rev/ba2f8f5d3b07
branches:
changeset: 5719:ba2f8f5d3b07
user: Shazeb Nawaz Khan <shazeb at multicorewareinc.com>
date: Thu Dec 12 17:38:25 2013 +0530
description:
Fix for deltaWeight assert failure in Decoder
Subject: [x265] rc: Initialize virtual qps till 69
details: http://hg.videolan.org/x265/rev/07d83bc1cfad
branches:
changeset: 5720:07d83bc1cfad
user: Aarthi Thirumalai
date: Fri Dec 13 00:36:35 2013 +0530
description:
rc: Initialize virtual qps till 69
Subject: [x265] rc: implement ratecontrol upto MAX_MAX_QP.
details: http://hg.videolan.org/x265/rev/926f7034b2f0
branches:
changeset: 5721:926f7034b2f0
user: Aarthi Thirumalai
date: Fri Dec 13 01:03:47 2013 +0530
description:
rc: implement ratecontrol upto MAX_MAX_QP.
For RateControl .virtual qps are used from 0 till 69. Howevr,Before encoding the frame,
the qps are clipped back to 51
Subject: [x265] y4m: perform file offset math in uint64_t
details: http://hg.videolan.org/x265/rev/292a91f3427e
branches:
changeset: 5722:292a91f3427e
user: Steve Borho <steve at borho.org>
date: Thu Dec 12 13:56:18 2013 -0600
description:
y4m: perform file offset math in uint64_t
Subject: [x265] yuv: prevent 32bit compiler warnings
details: http://hg.videolan.org/x265/rev/14e9dbedab9d
branches: stable
changeset: 5723:14e9dbedab9d
user: Steve Borho <steve at borho.org>
date: Fri Dec 13 10:09:51 2013 -0600
description:
yuv: prevent 32bit compiler warnings
Subject: [x265] Merge with stable
details: http://hg.videolan.org/x265/rev/5cbea1cd3d3a
branches:
changeset: 5724:5cbea1cd3d3a
user: Steve Borho <steve at borho.org>
date: Fri Dec 13 10:10:08 2013 -0600
description:
Merge with stable
diffstat:
source/Lib/TLibCommon/CommonDef.h | 1 +
source/Lib/TLibCommon/TComRom.cpp | 17 +++++---
source/Lib/TLibCommon/TComRom.h | 6 +-
source/Lib/TLibCommon/TComSlice.cpp | 1 +
source/Lib/TLibCommon/TComSlice.h | 1 +
source/Lib/TLibEncoder/WeightPredAnalysis.cpp | 2 +-
source/encoder/compress.cpp | 52 +++++++++-----------------
source/encoder/frameencoder.cpp | 27 +++++++++----
source/encoder/ratecontrol.cpp | 13 +++---
source/output/y4m.cpp | 2 +-
source/output/yuv.cpp | 2 +-
11 files changed, 64 insertions(+), 60 deletions(-)
diffs (truncated from 401 to 300 lines):
diff -r 033a65692b6a -r 5cbea1cd3d3a source/Lib/TLibCommon/CommonDef.h
--- a/source/Lib/TLibCommon/CommonDef.h Thu Dec 12 13:53:33 2013 -0600
+++ b/source/Lib/TLibCommon/CommonDef.h Fri Dec 13 10:10:08 2013 -0600
@@ -133,6 +133,7 @@
#define MIN_QP 0
#define MAX_QP 51
+#define MAX_MAX_QP 69
#define NOT_VALID -1
diff -r 033a65692b6a -r 5cbea1cd3d3a source/Lib/TLibCommon/TComRom.cpp
--- a/source/Lib/TLibCommon/TComRom.cpp Thu Dec 12 13:53:33 2013 -0600
+++ b/source/Lib/TLibCommon/TComRom.cpp Fri Dec 13 10:10:08 2013 -0600
@@ -278,12 +278,13 @@ const int16_t g_t32[32][32] =
{ 4, -13, 22, -31, 38, -46, 54, -61, 67, -73, 78, -82, 85, -88, 90, -90, 90, -90, 88, -85, 82, -78, 73, -67, 61, -54, 46, -38, 31, -22, 13, -4 }
};
-const UChar g_chromaScale[58] =
+const UChar g_chromaScale [70] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32,
33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ 62, 63
};
// ====================================================================================================================
@@ -512,7 +513,7 @@ int g_eTTable[4] = { 0, 3, 1, 2 };
const int g_winUnitX[] = { 1, 2, 2, 1 };
const int g_winUnitY[] = { 1, 2, 1, 1 };
-const double x265_lambda2_tab_I[MAX_QP + 1] =
+const double x265_lambda2_tab_I[MAX_MAX_QP + 1] =
{
0.012265625, 0.022265625, 0.028052813, 0.035344375, 0.04453125, 0.056105938, 0.070689063, 0.0890625,
0.112211563, 0.141377813, 0.178125, 0.224423438, 0.282755938, 0.35625, 0.448846875,
@@ -520,10 +521,12 @@ const double x265_lambda2_tab_I[MAX_QP +
3.590775, 4.524093125, 5.7, 7.7800125, 10.55621688, 14.25, 19.1508, 25.63652688, 34.2,
45.48315, 60.32124, 79.8, 105.3293997, 138.7388519, 182.4, 229.8095994, 289.5419519, 364.8,
459.6191991, 579.0839038, 729.6, 919.2383981, 1158.167808, 1459.2, 1838.476796, 2316.335615,
- 2918.4, 3676.953592, 4632.67123
+ 2918.4, 3676.953592, 4632.67123, 5836.799769, 7353.906601, 9265.341359, 11673.59815, 14707.81146,
+ 18530.68052, 23347.19353, 29415.61942, 37061.35663, 46694.38151, 58831.23184, 74122.70446,
+ 93388.75192, 117662.4497, 148245.3913, 186777.4817, 235324.8715, 296490.7474
};
-const double x265_lambda2_non_I[MAX_QP + 1] =
+const double x265_lambda2_non_I[MAX_MAX_QP + 1] =
{
0.05231, 0.060686, 0.07646, 0.096333333, 0.151715667, 0.15292, 0.192666667, 0.242745, 0.382299,
0.385333333, 0.485489333, 0.611678333, 0.963333333, 0.970979, 1.223356667, 1.541333333, 2.427447667,
@@ -531,7 +534,9 @@ const double x265_lambda2_non_I[MAX_QP +
16.57137733, 22.183542, 29.5936, 39.357022, 52.19656867, 69.05173333, 91.14257667, 150.0651347,
157.8325333, 207.1422197, 271.4221573, 443.904, 447.4271947, 563.722941, 710.2464, 1118.567987,
1127.445883, 1420.4928, 1789.70878, 2818.614706, 2840.9856, 3579.41756, 4509.78353, 7102.464,
- 7158.83512, 9019.56706, 11363.9424
+ 7158.83512, 9019.56706, 11363.9424, 14317.66967, 18039.13269, 22727.8821, 28635.33594, 36078.2611,
+ 45455.7588, 57270.66508, 72156.51362, 90911.5068, 114541.3166, 144313.0101, 181822.992, 229082.6059,
+ 288625.9859, 363645.9408, 458165.1574, 577251.9032, 727291.7952
};
const UChar g_lpsTable[64][4] =
diff -r 033a65692b6a -r 5cbea1cd3d3a source/Lib/TLibCommon/TComRom.h
--- a/source/Lib/TLibCommon/TComRom.h Thu Dec 12 13:53:33 2013 -0600
+++ b/source/Lib/TLibCommon/TComRom.h Fri Dec 13 10:10:08 2013 -0600
@@ -128,7 +128,7 @@ extern const int16_t g_chromaFilter[8][N
// Luma QP to Chroma QP mapping
// ====================================================================================================================
-extern const UChar g_chromaScale[58];
+extern const UChar g_chromaScale[70];
// ====================================================================================================================
// Scanning order & context mapping table
@@ -294,8 +294,8 @@ extern int g_eTTable[4];
// Map Luma samples to chroma samples
extern const int g_winUnitX[MAX_CHROMA_FORMAT_IDC + 1];
extern const int g_winUnitY[MAX_CHROMA_FORMAT_IDC + 1];
-extern const double x265_lambda2_tab_I[MAX_QP + 1];
-extern const double x265_lambda2_non_I[MAX_QP + 1];
+extern const double x265_lambda2_tab_I[MAX_MAX_QP + 1];
+extern const double x265_lambda2_non_I[MAX_MAX_QP + 1];
// CABAC tables
extern const UChar g_lpsTable[64][4];
extern const UChar g_renormTable[32];
diff -r 033a65692b6a -r 5cbea1cd3d3a source/Lib/TLibCommon/TComSlice.cpp
--- a/source/Lib/TLibCommon/TComSlice.cpp Thu Dec 12 13:53:33 2013 -0600
+++ b/source/Lib/TLibCommon/TComSlice.cpp Fri Dec 13 10:10:08 2013 -0600
@@ -64,6 +64,7 @@ TComSlice::TComSlice()
, m_sliceQpDeltaCb(0)
, m_sliceQpDeltaCr(0)
, m_bReferenced(false)
+ ,m_avgQpRc(0)
, m_sps(NULL)
, m_pps(NULL)
, m_pic(NULL)
diff -r 033a65692b6a -r 5cbea1cd3d3a source/Lib/TLibCommon/TComSlice.h
--- a/source/Lib/TLibCommon/TComSlice.h Thu Dec 12 13:53:33 2013 -0600
+++ b/source/Lib/TLibCommon/TComSlice.h Fri Dec 13 10:10:08 2013 -0600
@@ -1356,6 +1356,7 @@ public:
wpScalingParam m_weightPredTable[2][MAX_NUM_REF][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
int m_numWPRefs; // number of references for which unidirectional weighted prediction is used
+ int m_avgQpRc;
TComSlice();
virtual ~TComSlice();
diff -r 033a65692b6a -r 5cbea1cd3d3a source/Lib/TLibEncoder/WeightPredAnalysis.cpp
--- a/source/Lib/TLibEncoder/WeightPredAnalysis.cpp Thu Dec 12 13:53:33 2013 -0600
+++ b/source/Lib/TLibEncoder/WeightPredAnalysis.cpp Fri Dec 13 10:10:08 2013 -0600
@@ -254,7 +254,7 @@ bool WeightPredAnalysis::xUpdatingWPPara
// Weighting factor limitation
int defaultWeight = (1 << log2Denom);
int deltaWeight = (defaultWeight - weight);
- if (deltaWeight > 127 || deltaWeight < -128)
+ if (deltaWeight > 127 || deltaWeight <= -128)
return false;
m_wp[list][refIdxTemp][comp].bPresentFlag = true;
diff -r 033a65692b6a -r 5cbea1cd3d3a source/encoder/compress.cpp
--- a/source/encoder/compress.cpp Thu Dec 12 13:53:33 2013 -0600
+++ b/source/encoder/compress.cpp Fri Dec 13 10:10:08 2013 -0600
@@ -300,19 +300,12 @@ void TEncCu::xComputeCostMerge2Nx2N(TCom
{
m_search->motionCompensation(outBestCU, bestPredYuv, REF_PIC_LIST_X, partIdx, false, true);
}
-
- TComDataCU* tmp;
- TComYuv *yuv;
-
+
//No-residue mode
- m_search->encodeResAndCalcRdInterCU(outTempCU, m_origYuv[depth], bestPredYuv, m_tmpResiYuv[depth], m_bestResiYuv[depth], m_tmpRecoYuv[depth], true);
+ m_search->encodeResAndCalcRdInterCU(outBestCU, m_origYuv[depth], bestPredYuv, m_tmpResiYuv[depth], m_bestResiYuv[depth], m_tmpRecoYuv[depth], true);
xCheckDQP(outTempCU);
- tmp = outTempCU;
- outTempCU = outBestCU;
- outBestCU = tmp;
-
- yuv = yuvReconBest;
+ TComYuv* yuv = yuvReconBest;
yuvReconBest = m_tmpRecoYuv[depth];
m_tmpRecoYuv[depth] = yuv;
@@ -322,7 +315,7 @@ void TEncCu::xComputeCostMerge2Nx2N(TCom
if (outTempCU->m_totalCost < outBestCU->m_totalCost) //Choose best from no-residue mode and residue mode
{
- tmp = outTempCU;
+ TComDataCU* tmp = outTempCU;
outTempCU = outBestCU;
outBestCU = tmp;
@@ -372,11 +365,7 @@ void TEncCu::xCompressInterCU(TComDataCU
UChar delta = 0, minDepth0 = 4, minDepth1 = 4;
if (depth == 0)
{
- double sum0 = 0;
- double sum1 = 0;
- double avgDepth0 = 0;
- double avgDepth1 = 0;
- double avgDepth = 0;
+ double sum0 = 0, sum1 = 0, avgDepth0 = 0, avgDepth1 = 0, avgDepth = 0;
for (uint32_t i = 0; i < outTempCU->getTotalNumPart(); i = i + 4)
{
if (colocated0 && colocated0->getDepth(i) < minDepth0)
@@ -393,11 +382,7 @@ void TEncCu::xCompressInterCU(TComDataCU
avgDepth1 = sum1 / outTempCU->getTotalNumPart();
avgDepth = (avgDepth0 + avgDepth1) / 2;
- if (minDepth1 < minDepth0)
- minDepth = minDepth1;
- else
- minDepth = minDepth0;
-
+ minDepth = X265_MIN(minDepth0, minDepth1);
if (((currentQP - previousQP) < 0) || (((currentQP - previousQP) >= 0) && ((avgDepth - minDepth) > 0.5)))
delta = 0;
else
@@ -405,8 +390,6 @@ void TEncCu::xCompressInterCU(TComDataCU
if (minDepth > 0)
minDepth = minDepth - delta;
}
-#endif // if TOPSKIP
-#if TOPSKIP
if (!(depth < minDepth)) //topskip
#endif
{
@@ -519,7 +502,8 @@ void TEncCu::xCompressInterCU(TComDataCU
else
{
uint32_t threshold[4] = { 20000, 6000, 1600, 500 };
- bdoIntra = (outBestCU->m_totalDistortion > threshold[depth]);
+ int index = 4 - g_convertToBit[outBestCU->getWidth(0)];
+ bdoIntra = (outBestCU->m_totalDistortion > threshold[index]);
}
if (bdoIntra)
{
@@ -616,7 +600,8 @@ void TEncCu::xCompressInterCU(TComDataCU
else if (m_cfg->param.rdLevel <= 1)
{
uint32_t threshold[4] = { 20000, 6000, 1600, 500 };
- if (m_mergeCU[depth]->m_totalDistortion < threshold[depth])
+ int index = 4 - g_convertToBit[outBestCU->getWidth(0)];
+ if (m_mergeCU[depth]->m_totalDistortion < threshold[index])
{
m_mergeCU[depth]->setSkipFlagSubParts(true, 0, depth);
m_search->generateCoeffRecon(m_mergeCU[depth], m_origYuv[depth], bestMergePred, m_tmpResiYuv[depth], m_bestRecoYuv[depth], true);
@@ -700,10 +685,6 @@ void TEncCu::xCompressInterCU(TComDataCU
if (outBestCU->m_totalCost < lambda * avgCost && avgCost != 0 && depth != 0)
{
- m_entropyCoder->resetBits();
- m_entropyCoder->encodeSplitFlag(outBestCU, 0, depth, true);
- outBestCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
- outBestCU->m_totalCost = m_rdCost->calcRdCost(outBestCU->m_totalDistortion, outBestCU->m_totalBits);
/* Copy Best data to Picture for next partition prediction. */
outBestCU->copyToPic((UChar)depth);
@@ -757,10 +738,15 @@ void TEncCu::xCompressInterCU(TComDataCU
if (!bBoundary)
{
- m_entropyCoder->resetBits();
- m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth, true);
-
- outTempCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
+ if(m_cfg->param.rdLevel > 1)
+ {
+ m_entropyCoder->resetBits();
+ m_entropyCoder->encodeSplitFlag(outTempCU, 0, depth, true);
+ outTempCU->m_totalBits += m_entropyCoder->getNumberOfWrittenBits(); // split bits
+ outTempCU->m_totalCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
+ }
+ else
+ outTempCU->m_totalCost = m_rdCost->calcRdSADCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
}
outTempCU->m_totalCost = m_rdCost->calcRdCost(outTempCU->m_totalDistortion, outTempCU->m_totalBits);
diff -r 033a65692b6a -r 5cbea1cd3d3a source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp Thu Dec 12 13:53:33 2013 -0600
+++ b/source/encoder/frameencoder.cpp Fri Dec 13 10:10:08 2013 -0600
@@ -329,11 +329,11 @@ void FrameEncoder::setLambda(int qp, int
// in RdCost there is only one lambda because the luma and chroma bits are not separated,
// instead we weight the distortion of chroma.
int chromaQPOffset = slice->getPPS()->getChromaCbQpOffset() + slice->getSliceQpDeltaCb();
- int qpc = Clip3(0, 57, qp + chromaQPOffset);
+ int qpc = Clip3(0, 70, qp + chromaQPOffset);
double cbWeight = pow(2.0, (qp - g_chromaScale[qpc])); // takes into account of the chroma qp mapping and chroma qp Offset
chromaQPOffset = slice->getPPS()->getChromaCrQpOffset() + slice->getSliceQpDeltaCr();
- qpc = Clip3(0, 57, qp + chromaQPOffset);
+ qpc = Clip3(0, 70, qp + chromaQPOffset);
double crWeight = pow(2.0, (qp - g_chromaScale[qpc])); // takes into account of the chroma qp mapping and chroma qp Offset
double chromaLambda = lambda / crWeight;
@@ -370,10 +370,10 @@ void FrameEncoder::compressFrame()
// instead we weight the distortion of chroma.
int qpc;
int chromaQPOffset = slice->getPPS()->getChromaCbQpOffset() + slice->getSliceQpDeltaCb();
- qpc = Clip3(0, 57, qp + chromaQPOffset);
+ qpc = Clip3(0, 70, qp + chromaQPOffset);
double cbWeight = pow(2.0, (qp - g_chromaScale[qpc])); // takes into account of the chroma qp mapping and chroma qp Offset
chromaQPOffset = slice->getPPS()->getChromaCrQpOffset() + slice->getSliceQpDeltaCr();
- qpc = Clip3(0, 57, qp + chromaQPOffset);
+ qpc = Clip3(0, 70, qp + chromaQPOffset);
double crWeight = pow(2.0, (qp - g_chromaScale[qpc])); // takes into account of the chroma qp mapping and chroma qp Offset
double chromaLambda = lambda / crWeight;
@@ -389,7 +389,7 @@ void FrameEncoder::compressFrame()
m_frameFilter.m_sao.lumaLambda = lambda;
m_frameFilter.m_sao.chromaLambda = chromaLambda;
-
+
switch (slice->getSliceType())
{
case I_SLICE:
@@ -402,7 +402,13 @@ void FrameEncoder::compressFrame()
m_frameFilter.m_sao.depth = 2 + !slice->isReferenced();
break;
}
-
+ /* Clip qps back to 0-51 range before encoding */
+ if(qp > MAX_QP)
+ {
+ qp = MAX_QP;
+ slice->setSliceQp(qp);
+ slice->setSliceQpBase(qp);
+ }
slice->setSliceQpDelta(0);
slice->setSliceQpDeltaCb(0);
slice->setSliceQpDeltaCr(0);
@@ -1045,8 +1051,11 @@ void FrameEncoder::processRowEncoder(int
if (m_cfg->param.rc.aqMode)
{
More information about the x265-commits
mailing list