[x265-commits] [x265] vbv: Introduce states to hold row data for row level VBV ...
Aarthi at videolan.org
Aarthi at videolan.org
Fri Feb 21 20:07:33 CET 2014
details: http://hg.videolan.org/x265/rev/00de531690c9
branches:
changeset: 6234:00de531690c9
user: Aarthi Thirumalai
date: Fri Feb 21 10:29:03 2014 +0530
description:
vbv: Introduce states to hold row data for row level VBV ratecontrol.
Subject: [x265] vbv: enable vbvLookahead for Keyframes; accumulate frame rowSatds from lowres rowSatds.
details: http://hg.videolan.org/x265/rev/34774abb8677
branches:
changeset: 6235:34774abb8677
user: Aarthi Thirumalai
date: Thu Feb 20 17:03:38 2014 +0530
description:
vbv: enable vbvLookahead for Keyframes; accumulate frame rowSatds from lowres rowSatds.
Subject: [x265] vbv: Add row predictors, rc states for vbv.
details: http://hg.videolan.org/x265/rev/b89687d958f8
branches:
changeset: 6236:b89687d958f8
user: Aarthi Thirumalai
date: Thu Feb 20 17:47:53 2014 +0530
description:
vbv: Add row predictors, rc states for vbv.
Subject: [x265] vbv: fix bugs in vbv flow with single pass ABR
details: http://hg.videolan.org/x265/rev/dd1bca7091d5
branches:
changeset: 6237:dd1bca7091d5
user: Aarthi Thirumalai
date: Thu Feb 20 18:09:53 2014 +0530
description:
vbv: fix bugs in vbv flow with single pass ABR
Subject: [x265] vbv: implement row wise vbvRateControl at each row diagonal
details: http://hg.videolan.org/x265/rev/fea3b6fa376b
branches:
changeset: 6238:fea3b6fa376b
user: Aarthi Thirumalai
date: Fri Feb 21 11:35:48 2014 +0530
description:
vbv: implement row wise vbvRateControl at each row diagonal
Subject: [x265] vbv: integrate row level vbv ratecontrol at each major row diagonal.
details: http://hg.videolan.org/x265/rev/2115a7771ce1
branches:
changeset: 6239:2115a7771ce1
user: Aarthi Thirumalai
date: Thu Feb 20 18:30:54 2014 +0530
description:
vbv: integrate row level vbv ratecontrol at each major row diagonal.
Subject: [x265] m_tempPel as static const
details: http://hg.videolan.org/x265/rev/b4d6162139f5
branches:
changeset: 6240:b4d6162139f5
user: Satoshi Nakagawa <nakagawa424 at oki.com>
date: Fri Feb 21 18:20:23 2014 +0900
description:
m_tempPel as static const
Subject: [x265] common: validate "bframe" and "maxCUSize" for positive values
details: http://hg.videolan.org/x265/rev/b8346a9f7020
branches:
changeset: 6241:b8346a9f7020
user: Sumalatha Polureddy
date: Fri Feb 21 12:30:00 2014 +0530
description:
common: validate "bframe" and "maxCUSize" for positive values
Subject: [x265] common: validate maximum ctusize
details: http://hg.videolan.org/x265/rev/ee58b2bb6f3c
branches:
changeset: 6242:ee58b2bb6f3c
user: Sumalatha Polureddy
date: Fri Feb 21 12:56:11 2014 +0530
description:
common: validate maximum ctusize
Subject: [x265] common: g_convertToBit cannot be indexed with UINT_MAX either
details: http://hg.videolan.org/x265/rev/047cdb785e84
branches:
changeset: 6243:047cdb785e84
user: Steve Borho <steve at borho.org>
date: Fri Feb 21 12:28:55 2014 -0600
description:
common: g_convertToBit cannot be indexed with UINT_MAX either
Subject: [x265] mechanically enforce coding style (uncrustify)
details: http://hg.videolan.org/x265/rev/e118b38a5ef8
branches:
changeset: 6244:e118b38a5ef8
user: Steve Borho <steve at borho.org>
date: Fri Feb 21 12:47:11 2014 -0600
description:
mechanically enforce coding style (uncrustify)
Subject: [x265] coding style - hand cleanup sections better than uncrustify wanted to
details: http://hg.videolan.org/x265/rev/66c56fc5dfb9
branches:
changeset: 6245:66c56fc5dfb9
user: Steve Borho <steve at borho.org>
date: Fri Feb 21 13:06:51 2014 -0600
description:
coding style - hand cleanup sections better than uncrustify wanted to
diffstat:
source/Lib/TLibCommon/ContextTables.h | 9 +-
source/Lib/TLibCommon/TComDataCU.cpp | 42 ++--
source/Lib/TLibCommon/TComDataCU.h | 2 +-
source/Lib/TLibCommon/TComPic.cpp | 60 ++++++-
source/Lib/TLibCommon/TComPic.h | 14 +-
source/Lib/TLibCommon/TComPicYuv.cpp | 3 +-
source/Lib/TLibCommon/TComYuv.cpp | 7 +
source/Lib/TLibEncoder/TEncCfg.h | 2 +-
source/Lib/TLibEncoder/TEncSearch.cpp | 15 +-
source/Lib/TLibEncoder/TEncSearch.h | 1 -
source/common/common.cpp | 57 +++--
source/common/lowres.h | 1 +
source/common/primitives.cpp | 1 +
source/common/x86/asm-primitives.cpp | 1 -
source/common/x86/ipfilter8.h | 1 -
source/encoder/compress.cpp | 1 +
source/encoder/encoder.cpp | 8 +-
source/encoder/encoder.h | 4 +-
source/encoder/frameencoder.cpp | 99 +++++++----
source/encoder/frameencoder.h | 2 +-
source/encoder/ratecontrol.cpp | 293 +++++++++++++++++++++++++++++----
source/encoder/ratecontrol.h | 17 +-
source/encoder/slicetype.cpp | 40 ++++-
source/encoder/weightPrediction.cpp | 4 +-
source/test/ipfilterharness.cpp | 6 +-
source/test/mbdstharness.cpp | 23 +-
source/test/mbdstharness.h | 1 +
source/test/pixelharness.cpp | 9 +-
source/x265.cpp | 8 +-
source/x265.h | 28 +-
30 files changed, 558 insertions(+), 201 deletions(-)
diffs (truncated from 1713 to 300 lines):
diff -r 5e2043f89aa1 -r 66c56fc5dfb9 source/Lib/TLibCommon/ContextTables.h
--- a/source/Lib/TLibCommon/ContextTables.h Fri Feb 21 03:05:48 2014 -0600
+++ b/source/Lib/TLibCommon/ContextTables.h Fri Feb 21 13:06:51 2014 -0600
@@ -155,10 +155,11 @@ uint8_t sbacInit(int qp, int initValue);
#define NEIGHBOURHOOD_00_CONTEXT_1_THRESHOLD_4x4 3
#define NEIGHBOURHOOD_00_CONTEXT_2_THRESHOLD_4x4 1
-static const uint32_t significanceMapContextSetStart [MAX_NUM_CHANNEL_TYPE][3] = { {0, 9, 21}, {0, 9, 12} };
-static const uint32_t significanceMapContextSetSize [MAX_NUM_CHANNEL_TYPE][3] = { {9, 12, 6}, {9, 3, 3} };
-static const uint32_t nonDiagonalScan8x8ContextOffset [MAX_NUM_CHANNEL_TYPE] = { 6, 0 };
-static const uint32_t notFirstGroupNeighbourhoodContextOffset[MAX_NUM_CHANNEL_TYPE] = { 3, 0 };
+static const uint32_t significanceMapContextSetStart[MAX_NUM_CHANNEL_TYPE][3] = { { 0, 9, 21 }, { 0, 9, 12 } };
+static const uint32_t significanceMapContextSetSize[MAX_NUM_CHANNEL_TYPE][3] = { { 9, 12, 6 }, { 9, 3, 3 } };
+static const uint32_t nonDiagonalScan8x8ContextOffset[MAX_NUM_CHANNEL_TYPE] = { 6, 0 };
+static const uint32_t notFirstGroupNeighbourhoodContextOffset[MAX_NUM_CHANNEL_TYPE] = { 3, 0 };
+
// initial probability for cu_transquant_bypass flag
static const uint8_t
INIT_CU_TRANSQUANT_BYPASS_FLAG[3][NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX] =
diff -r 5e2043f89aa1 -r 66c56fc5dfb9 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp Fri Feb 21 03:05:48 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.cpp Fri Feb 21 13:06:51 2014 -0600
@@ -99,6 +99,7 @@ TComDataCU::TComDataCU()
m_mvpIdx[0] = NULL;
m_mvpIdx[1] = NULL;
m_chromaFormat = 0;
+ m_baseQp = 0;
}
TComDataCU::~TComDataCU()
@@ -235,6 +236,7 @@ void TComDataCU::initCU(TComPic* pic, ui
m_totalBits = 0;
m_numPartitions = pic->getNumPartInCU();
int qp = pic->m_lowres.invQscaleFactor ? pic->getCU(getAddr())->getQP(0) : m_slice->getSliceQp();
+ m_baseQp = pic->getCU(getAddr())->m_baseQp;
for (int i = 0; i < 4; i++)
{
m_avgCost[i] = 0;
@@ -246,26 +248,26 @@ void TComDataCU::initCU(TComPic* pic, ui
assert(numElements > 0);
{
- memset(m_skipFlag , false, numElements * sizeof(*m_skipFlag));
- memset(m_predModes , MODE_NONE, numElements * sizeof(*m_predModes));
- memset(m_cuTransquantBypass, false, numElements * sizeof(*m_cuTransquantBypass));
- memset(m_depth , 0, numElements * sizeof(*m_depth));
- memset(m_trIdx , 0, numElements * sizeof(*m_trIdx));
- memset(m_transformSkip[0] , 0, numElements * sizeof(*m_transformSkip[0]));
- memset(m_transformSkip[1] , 0, numElements * sizeof(*m_transformSkip[1]));
- memset(m_transformSkip[2] , 0, numElements * sizeof(*m_transformSkip[2]));
- memset(m_width , g_maxCUWidth, numElements * sizeof(*m_width));
- memset(m_height , g_maxCUHeight, numElements * sizeof(*m_height));
- memset(m_qp , qp, numElements * sizeof(*m_qp));
- memset(m_bMergeFlags , false, numElements * sizeof(*m_bMergeFlags));
- memset(m_mergeIndex , 0, numElements * sizeof(*m_mergeIndex));
- memset(m_lumaIntraDir , DC_IDX, numElements * sizeof(*m_lumaIntraDir));
- memset(m_chromaIntraDir , 0, numElements * sizeof(*m_chromaIntraDir));
- memset(m_interDir , 0, numElements * sizeof(*m_interDir));
- memset(m_cbf[0] , 0, numElements * sizeof(*m_cbf[0]));
- memset(m_cbf[1] , 0, numElements * sizeof(*m_cbf[1]));
- memset(m_cbf[2] , 0, numElements * sizeof(*m_cbf[2]));
- memset(m_iPCMFlags , false, numElements * sizeof(*m_iPCMFlags));
+ memset(m_skipFlag, false, numElements * sizeof(*m_skipFlag));
+ memset(m_predModes, MODE_NONE, numElements * sizeof(*m_predModes));
+ memset(m_cuTransquantBypass, false, numElements * sizeof(*m_cuTransquantBypass));
+ memset(m_depth, 0, numElements * sizeof(*m_depth));
+ memset(m_trIdx, 0, numElements * sizeof(*m_trIdx));
+ memset(m_transformSkip[0], 0, numElements * sizeof(*m_transformSkip[0]));
+ memset(m_transformSkip[1], 0, numElements * sizeof(*m_transformSkip[1]));
+ memset(m_transformSkip[2], 0, numElements * sizeof(*m_transformSkip[2]));
+ memset(m_width, g_maxCUWidth, numElements * sizeof(*m_width));
+ memset(m_height, g_maxCUHeight, numElements * sizeof(*m_height));
+ memset(m_qp, qp, numElements * sizeof(*m_qp));
+ memset(m_bMergeFlags, false, numElements * sizeof(*m_bMergeFlags));
+ memset(m_mergeIndex, 0, numElements * sizeof(*m_mergeIndex));
+ memset(m_lumaIntraDir, DC_IDX, numElements * sizeof(*m_lumaIntraDir));
+ memset(m_chromaIntraDir, 0, numElements * sizeof(*m_chromaIntraDir));
+ memset(m_interDir, 0, numElements * sizeof(*m_interDir));
+ memset(m_cbf[0], 0, numElements * sizeof(*m_cbf[0]));
+ memset(m_cbf[1], 0, numElements * sizeof(*m_cbf[1]));
+ memset(m_cbf[2], 0, numElements * sizeof(*m_cbf[2]));
+ memset(m_iPCMFlags, false, numElements * sizeof(*m_iPCMFlags));
}
uint32_t y_tmp = g_maxCUWidth * g_maxCUHeight;
diff -r 5e2043f89aa1 -r 66c56fc5dfb9 source/Lib/TLibCommon/TComDataCU.h
--- a/source/Lib/TLibCommon/TComDataCU.h Fri Feb 21 03:05:48 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.h Fri Feb 21 13:06:51 2014 -0600
@@ -182,7 +182,7 @@ public:
uint64_t m_avgCost[4]; // stores the avg cost of CU's in frame for each depth
uint32_t m_count[4];
uint64_t m_sa8dCost;
-
+ double m_baseQp; //Qp of Cu set from RateControl/Vbv.
// -------------------------------------------------------------------------------------------------------------------
// create / destroy / initialize / copy
// -------------------------------------------------------------------------------------------------------------------
diff -r 5e2043f89aa1 -r 66c56fc5dfb9 source/Lib/TLibCommon/TComPic.cpp
--- a/source/Lib/TLibCommon/TComPic.cpp Fri Feb 21 03:05:48 2014 -0600
+++ b/source/Lib/TLibCommon/TComPic.cpp Fri Feb 21 13:06:51 2014 -0600
@@ -56,6 +56,13 @@ TComPic::TComPic()
, m_bUsedByCurr(false)
, m_bIsLongTerm(false)
, m_bCheckLTMSB(false)
+ , m_rowDiagQp(NULL)
+ , m_rowDiagQScale(NULL)
+ , m_rowDiagSatd(NULL)
+ , m_rowEncodedBits(NULL)
+ , m_numEncodedCusPerRow(NULL)
+ , m_rowSatdForVbv(NULL)
+ , m_cuCostsForVbv(NULL)
{
m_reconRowCount = 0;
m_countRefEncoders = 0;
@@ -69,6 +76,9 @@ TComPic::TComPic()
m_ssimCnt = 0;
m_frameTime = 0.0;
m_elapsedCompressTime = 0.0;
+ m_qpaAq = 0;
+ m_qpaRc = 0;
+ m_avgQpRc = 0;
m_bChromaPlanesExtended = false;
}
@@ -94,7 +104,46 @@ bool TComPic::create(TEncCfg* cfg)
ok &= m_origPicYuv->create(cfg->param.sourceWidth, cfg->param.sourceHeight, cfg->param.internalCsp, g_maxCUWidth, g_maxCUHeight, g_maxCUDepth);
ok &= m_reconPicYuv->create(cfg->param.sourceWidth, cfg->param.sourceHeight, cfg->param.internalCsp, g_maxCUWidth, g_maxCUHeight, g_maxCUDepth);
ok &= m_lowres.create(m_origPicYuv, cfg->param.bframes, &cfg->param.rc.aqMode);
+
+ if (ok && cfg->param.rc.vbvBufferSize > 0 && cfg->param.rc.vbvMaxBitrate > 0)
+ {
+ int numRows = m_picSym->getFrameHeightInCU();
+ int numCols = m_picSym->getFrameWidthInCU();
+ CHECKED_MALLOC(m_rowDiagQp, double, numRows);
+ CHECKED_MALLOC(m_rowDiagQScale, double, numRows);
+ CHECKED_MALLOC(m_rowDiagSatd, uint32_t, numRows);
+ CHECKED_MALLOC(m_rowEncodedBits, uint32_t, numRows);
+ CHECKED_MALLOC(m_numEncodedCusPerRow, uint32_t, numRows);
+ CHECKED_MALLOC(m_rowSatdForVbv, uint32_t, numRows);
+ CHECKED_MALLOC(m_cuCostsForVbv, uint32_t, numRows * numCols);
+ CHECKED_MALLOC(m_qpaRc, double, numRows);
+ CHECKED_MALLOC(m_qpaAq, int, numRows);
+ reInit(cfg);
+ }
+
return ok;
+
+fail:
+ ok = false;
+ return ok;
+}
+
+void TComPic::reInit(TEncCfg* cfg)
+{
+ if (cfg->param.rc.vbvBufferSize > 0 && cfg->param.rc.vbvMaxBitrate > 0)
+ {
+ int numRows = m_picSym->getFrameHeightInCU();
+ int numCols = m_picSym->getFrameWidthInCU();
+ memset(m_rowDiagQp, 0, numRows * sizeof(double));
+ memset(m_rowDiagQScale, 0, numRows * sizeof(double));
+ memset(m_rowDiagSatd, 0, numRows * sizeof(uint32_t));
+ memset(m_rowEncodedBits, 0, numRows * sizeof(uint32_t));
+ memset(m_numEncodedCusPerRow, 0, numRows * sizeof(uint32_t));
+ memset(m_rowSatdForVbv, 0, numRows * sizeof(uint32_t));
+ memset(m_cuCostsForVbv, 0, numRows * numCols * sizeof(uint32_t));
+ memset(m_qpaRc, 0, numRows * sizeof(double));
+ memset(m_qpaAq, 0, numRows * sizeof(uint32_t));
+ }
}
void TComPic::destroy(int bframes)
@@ -119,8 +168,17 @@ void TComPic::destroy(int bframes)
delete m_reconPicYuv;
m_reconPicYuv = NULL;
}
+ m_lowres.destroy(bframes);
- m_lowres.destroy(bframes);
+ X265_FREE(m_rowDiagQp);
+ X265_FREE(m_rowDiagQScale);
+ X265_FREE(m_rowDiagSatd);
+ X265_FREE(m_rowEncodedBits);
+ X265_FREE(m_numEncodedCusPerRow);
+ X265_FREE(m_rowSatdForVbv);
+ X265_FREE(m_cuCostsForVbv);
+ X265_FREE(m_qpaAq);
+ X265_FREE(m_qpaRc);
}
//! \}
diff -r 5e2043f89aa1 -r 66c56fc5dfb9 source/Lib/TLibCommon/TComPic.h
--- a/source/Lib/TLibCommon/TComPic.h Fri Feb 21 03:05:48 2014 -0600
+++ b/source/Lib/TLibCommon/TComPic.h Fri Feb 21 13:06:51 2014 -0600
@@ -102,15 +102,23 @@ public:
MD5Context m_state[3];
uint32_t m_crc[3];
uint32_t m_checksum[3];
-
bool m_bChromaPlanesExtended; // orig chroma planes motion extended for weightp analysis
-
+ double* m_rowDiagQp;
+ double* m_rowDiagQScale;
+ uint32_t* m_rowDiagSatd;
+ uint32_t* m_rowEncodedBits;
+ uint32_t* m_numEncodedCusPerRow;
+ uint32_t* m_rowSatdForVbv;
+ uint32_t* m_cuCostsForVbv;
+ int* m_qpaAq;
+ double* m_qpaRc;
+ double m_avgQpRc;
TComPic();
virtual ~TComPic();
bool create(TEncCfg* cfg);
-
virtual void destroy(int bframes);
+ void reInit(TEncCfg* cfg);
bool getUsedByCurr() { return m_bUsedByCurr; }
diff -r 5e2043f89aa1 -r 66c56fc5dfb9 source/Lib/TLibCommon/TComPicYuv.cpp
--- a/source/Lib/TLibCommon/TComPicYuv.cpp Fri Feb 21 03:05:48 2014 -0600
+++ b/source/Lib/TLibCommon/TComPicYuv.cpp Fri Feb 21 13:06:51 2014 -0600
@@ -176,7 +176,8 @@ void TComPicYuv::copyFromPicture(const x
/* add one more row and col of pad for downscale interpolation, fixes
* warnings from valgrind about using uninitialized pixels */
- padx++; pady++;
+ padx++;
+ pady++;
if (pic.bitDepth < X265_DEPTH)
{
diff -r 5e2043f89aa1 -r 66c56fc5dfb9 source/Lib/TLibCommon/TComYuv.cpp
--- a/source/Lib/TLibCommon/TComYuv.cpp Fri Feb 21 03:05:48 2014 -0600
+++ b/source/Lib/TLibCommon/TComYuv.cpp Fri Feb 21 13:06:51 2014 -0600
@@ -107,6 +107,7 @@ void TComYuv::copyToPicYuv(TComPicYuv* d
int part = partitionFromSizes(width, m_height >> depth);
Pel* srcY = getLumaAddr(partIdx, width);
Pel* dstY = destPicYuv->getLumaAddr(cuAddr, absZOrderIdx);
+
primitives.luma_copy_pp[part](dstY, destPicYuv->getStride(), srcY, getStride());
width = m_cwidth >> depth;
@@ -121,6 +122,7 @@ void TComYuv::copyToPicYuv(TComPicYuv* d
void TComYuv::copyFromPicYuv(TComPicYuv* srcPicYuv, uint32_t cuAddr, uint32_t absZOrderIdx)
{
Pel* srcY = srcPicYuv->getLumaAddr(cuAddr, absZOrderIdx);
+
primitives.luma_copy_pp[m_part](m_bufY, getStride(), srcY, srcPicYuv->getStride());
Pel* srcU = srcPicYuv->getCbAddr(cuAddr, absZOrderIdx);
@@ -132,6 +134,7 @@ void TComYuv::copyFromPicYuv(TComPicYuv*
void TComYuv::copyToPartYuv(TComYuv* dstPicYuv, uint32_t partIdx)
{
Pel* dstY = dstPicYuv->getLumaAddr(partIdx);
+
primitives.luma_copy_pp[m_part](dstY, dstPicYuv->getStride(), m_bufY, getStride());
Pel* dstU = dstPicYuv->getCbAddr(partIdx);
@@ -148,6 +151,7 @@ void TComYuv::copyPartToYuv(TComYuv* dst
Pel* srcY = getLumaAddr(partIdx);
Pel* dstY = dstPicYuv->getLumaAddr(0);
+
primitives.luma_copy_pp[part](dstY, dstPicYuv->getStride(), srcY, getStride());
Pel* srcU = getCbAddr(partIdx);
@@ -161,6 +165,7 @@ void TComYuv::copyPartToYuv(TComYuv* dst
void TComYuv::copyPartToPartYuv(TComYuv* dstPicYuv, uint32_t partIdx, uint32_t width, uint32_t height, bool bLuma, bool bChroma)
{
int part = partitionFromSizes(width, height);
+
assert(width != 4 || height != 4);
if (bLuma)
@@ -194,6 +199,7 @@ void TComYuv::copyPartToPartShort(TShort
int16_t* dst = dstPicYuv->getLumaAddr(partIdx);
uint32_t dststride = dstPicYuv->m_width;
+
primitives.luma_copy_ps[part](dst, dststride, getLumaAddr(partIdx), getStride());
if (bChroma)
@@ -218,6 +224,7 @@ void TComYuv::copyPartToPartShort(TShort
void TComYuv::copyPartToPartChroma(TShortYUV* dstPicYuv, uint32_t partIdx, uint32_t lumaSize, uint32_t chromaId)
{
int part = partitionFromSizes(lumaSize, lumaSize);
+
assert(lumaSize != 4);
if (chromaId == 0)
diff -r 5e2043f89aa1 -r 66c56fc5dfb9 source/Lib/TLibEncoder/TEncCfg.h
--- a/source/Lib/TLibEncoder/TEncCfg.h Fri Feb 21 03:05:48 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncCfg.h Fri Feb 21 13:06:51 2014 -0600
@@ -323,7 +323,7 @@ public:
int getVuiTimeScale() const { return m_vuiTimeScale; }
bool getVuiHrdParametersPresentFlag() const { return m_vuiHrdParametersPresentFlag; }
-
More information about the x265-commits
mailing list