[x265-commits] [x265] param: apply missing default values to param, mostly zero...
Deepthi Nandakumar
deepthi at multicorewareinc.com
Wed Sep 10 11:59:55 CEST 2014
details: http://hg.videolan.org/x265/rev/3fc141aa74b5
branches:
changeset: 8035:3fc141aa74b5
user: Deepthi Nandakumar <deepthi at multicorewareinc.com>
date: Wed Sep 10 10:47:57 2014 +0530
description:
param: apply missing default values to param, mostly zero and reorder
Subject: [x265] rc: use m_frameDuration instead of rce->frameDuration to derive complexity for each frame in 2nd pass.
details: http://hg.videolan.org/x265/rev/139b41632c64
branches:
changeset: 8036:139b41632c64
user: Aarthi Thirumalai
date: Tue Sep 09 23:48:38 2014 +0530
description:
rc: use m_frameDuration instead of rce->frameDuration to derive complexity for each frame in 2nd pass.
don't store and use frameDuration from stats file per frame - losing precision.
Subject: [x265] search: re-enable chroma tskip
details: http://hg.videolan.org/x265/rev/bdd477050097
branches:
changeset: 8037:bdd477050097
user: Steve Borho <steve at borho.org>
date: Tue Sep 09 17:56:49 2014 +0200
description:
search: re-enable chroma tskip
this passed regression testing
Subject: [x265] encoder: nits
details: http://hg.videolan.org/x265/rev/81c9f704ae38
branches:
changeset: 8038:81c9f704ae38
user: Steve Borho <steve at borho.org>
date: Wed Sep 10 11:40:39 2014 +0200
description:
encoder: nits
diffstat:
source/common/param.cpp | 26 +++++++++++++++++---------
source/encoder/encoder.cpp | 26 ++++++++++++++++----------
source/encoder/ratecontrol.cpp | 24 ++++++++++--------------
source/encoder/search.cpp | 4 +---
source/x265.h | 3 ++-
5 files changed, 46 insertions(+), 37 deletions(-)
diffs (220 lines):
diff -r 408e2e6f0f70 -r 81c9f704ae38 source/common/param.cpp
--- a/source/common/param.cpp Tue Sep 09 22:23:26 2014 +0200
+++ b/source/common/param.cpp Wed Sep 10 11:40:39 2014 +0200
@@ -98,21 +98,33 @@ void x265_param_default(x265_param *para
{
memset(param, 0, sizeof(x265_param));
- /* Applying non-zero default values to all elements in the param structure */
+ /* Applying default values to all elements in the param structure */
param->cpuid = x265::cpu_detect();
+ param->bEnableWavefront = 1;
+ param->poolNumThreads = 0;
+ param->frameNumThreads = 0;
+
param->logLevel = X265_LOG_INFO;
- param->bEnableWavefront = 1;
- param->frameNumThreads = 0;
- param->poolNumThreads = 0;
param->csvfn = NULL;
param->rc.lambdaFileName = NULL;
param->bLogCuStats = 0;
- param->bEmitInfoSEI = 1;
+ param->decodedPictureHashSEI = 0;
+
+ /* Quality Measurement Metrics */
+ param->bEnablePsnr = 0;
+ param->bEnableSsim = 0;
/* Source specifications */
param->internalBitDepth = x265_max_bit_depth;
param->internalCsp = X265_CSP_I420;
+
param->levelIdc = 0;
+ param->bHighTier = 0;
+ param->interlaceMode = 0;
+ param->bRepeatHeaders = 0;
+ param->bEnableAccessUnitDelimiters = 0;
+ param->bEmitHRDSEI = 0;
+ param->bEmitInfoSEI = 1;
/* CU definitions */
param->maxCUSize = 64;
@@ -194,10 +206,6 @@ void x265_param_default(x265_param *para
param->rc.qblur = 0.5;
param->rc.bEnableSlowFirstPass = 0;
- /* Quality Measurement Metrics */
- param->bEnablePsnr = 0;
- param->bEnableSsim = 0;
-
/* Video Usability Information (VUI) */
param->vui.aspectRatioIdc = 0;
param->vui.sarWidth = 0;
diff -r 408e2e6f0f70 -r 81c9f704ae38 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Tue Sep 09 22:23:26 2014 +0200
+++ b/source/encoder/encoder.cpp Wed Sep 10 11:40:39 2014 +0200
@@ -240,23 +240,30 @@ void Encoder::updateVbvPlan(RateControl*
FrameEncoder *encoder = &m_frameEncoder[encIdx];
if (encoder->m_rce.isActive)
{
- rc->m_bufferFill -= encoder->m_rce.frameSizeEstimated;
+ int64_t bits = (int64_t) X265_MAX(encoder->m_rce.frameSizeEstimated, encoder->m_rce.frameSizePlanned);
+ rc->m_bufferFill -= bits;
rc->m_bufferFill = X265_MAX(rc->m_bufferFill, 0);
rc->m_bufferFill += encoder->m_rce.bufferRate;
rc->m_bufferFill = X265_MIN(rc->m_bufferFill, rc->m_bufferSize);
if (rc->m_2pass)
- rc->m_predictedBits += (int64_t)encoder->m_rce.frameSizeEstimated;
+ rc->m_predictedBits += bits;
}
encIdx = (encIdx + 1) % m_param->frameNumThreads;
}
}
/**
- \param pic_in input original YUV picture or NULL
- \param pic_out pointer to reconstructed picture struct
- \retval 1 - success, negative on error. m_nalList contains access unit
- */
-int Encoder::encode(const x265_picture* pic_in, x265_picture *pic_out)
+ * Feed one new input frame into the encoder, get one frame out. If pic_in is
+ * NULL, a flush condition is implied and pic_in must be NULL for all subsequent
+ * calls for this encoder instance.
+ *
+ * pic_in input original YUV picture or NULL
+ * pic_out pointer to reconstructed picture struct
+ *
+ * returns 0 if no frames are currently available for output
+ * 1 if frame was output, m_nalList contains access unit
+ * negative on malloc error or abort */
+int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)
{
if (m_aborted)
return -1;
@@ -406,10 +413,9 @@ int Encoder::encode(const x265_picture*
if (bChroma)
m_numChromaWPBiFrames++;
}
- if (m_aborted == true)
- {
+ if (m_aborted)
return -1;
- }
+
finishFrameStats(out, curEncoder, curEncoder->m_accessUnitBits);
// Allow this frame to be recycled if no frame encoders are using it for reference
if (!pic_out)
diff -r 408e2e6f0f70 -r 81c9f704ae38 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp Tue Sep 09 22:23:26 2014 +0200
+++ b/source/encoder/ratecontrol.cpp Wed Sep 10 11:40:39 2014 +0200
@@ -636,11 +636,10 @@ bool RateControl::init(const SPS *sps)
return false;
}
rce = &m_rce2Pass[frameNumber];
- e += sscanf(p, " in:%*d out:%*d type:%c dur:%lf q:%lf q-aq:%lf tex:%d mv:%d misc:%d icu:%lf pcu:%lf scu:%lf",
- &picType, &rce->frameDuration, &qpRc, &qpAq, &rce->coeffBits,
+ e += sscanf(p, " in:%*d out:%*d type:%c q:%lf q-aq:%lf tex:%d mv:%d misc:%d icu:%lf pcu:%lf scu:%lf",
+ &picType, &qpRc, &qpAq, &rce->coeffBits,
&rce->mvBits, &rce->miscBits, &rce->iCuCount, &rce->pCuCount,
&rce->skipCuCount);
- rce->clippedDuration = CLIP_DURATION(rce->frameDuration) / BASE_FRAME_DURATION;
rce->keptAsRef = true;
if (picType == 'b' || picType == 'p')
rce->keptAsRef = false;
@@ -652,7 +651,7 @@ bool RateControl::init(const SPS *sps)
rce->sliceType = B_SLICE;
else
e = -1;
- if (e < 11)
+ if (e < 10)
{
x265_log(m_param, X265_LOG_ERROR, "statistics are damaged at line %d, parser out=%d\n", i, e);
return false;
@@ -750,10 +749,7 @@ void RateControl::initHRD(SPS *sps)
bool RateControl::initPass2()
{
uint64_t allConstBits = 0;
- double duration = 0;
- for (int i = 0; i < m_numEntries; i++)
- duration += m_rce2Pass[i].frameDuration;
- uint64_t allAvailableBits = uint64_t(m_param->rc.bitrate * 1000. * duration);
+ uint64_t allAvailableBits = uint64_t(m_param->rc.bitrate * 1000. * m_numEntries * m_frameDuration);
double rateFactor, stepMult;
double qBlur = m_param->rc.qblur;
double cplxBlur = m_param->rc.complexityBlur;
@@ -761,6 +757,7 @@ bool RateControl::initPass2()
double expectedBits;
double *qScale, *blurredQscale;
double baseCplx = m_ncu * (m_param->bframes ? 120 : 80);
+ double clippedDuration = CLIP_DURATION(m_frameDuration) / BASE_FRAME_DURATION;
/* find total/average complexity & const_bits */
for (int i = 0; i < m_numEntries; i++)
@@ -792,7 +789,7 @@ bool RateControl::initPass2()
break;
gaussianWeight = weight * exp(-j * j / 200.0);
weightSum += gaussianWeight;
- cplxSum += gaussianWeight * (qScale2bits(rcj, 1) - rcj->miscBits) / rcj->clippedDuration;
+ cplxSum += gaussianWeight * (qScale2bits(rcj, 1) - rcj->miscBits) / clippedDuration;
}
/* weighted average of cplx of past frames */
weight = 1.0;
@@ -801,7 +798,7 @@ bool RateControl::initPass2()
RateControlEntry *rcj = &m_rce2Pass[i - j];
gaussianWeight = weight * exp(-j * j / 200.0);
weightSum += gaussianWeight;
- cplxSum += gaussianWeight * (qScale2bits(rcj, 1) - rcj->miscBits) / rcj->clippedDuration;
+ cplxSum += gaussianWeight * (qScale2bits(rcj, 1) - rcj->miscBits) / clippedDuration;
weight *= 1 - pow(rcj->iCuCount / m_ncu, 2);
if (weight < .0001)
break;
@@ -1236,7 +1233,7 @@ bool RateControl::findUnderflow(double *
int start = -1, end = -1;
for (int i = *t0; i < m_numEntries; i++)
{
- fill += (m_rce2Pass[i].frameDuration * m_vbvMaxRate -
+ fill += (m_frameDuration * m_vbvMaxRate -
qScale2bits(&m_rce2Pass[i], m_rce2Pass[i].newQScale)) * parity;
fill = Clip3(0.0, m_bufferSize, fill);
fills[i] = fill;
@@ -2103,10 +2100,9 @@ int RateControl::rateControlEnd(Frame* p
: rce->sliceType == P_SLICE ? 'P'
: IS_REFERENCED(slice) ? '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 ;\n",
+ "in:%d out:%d type:%c q:%.2f q-aq:%.2f tex:%d mv:%d misc:%d icu:%.2f pcu:%.2f scu:%.2f ;\n",
rce->poc, rce->encodeOrder,
- cType, m_frameDuration,
- pic->m_avgQpRc, pic->m_avgQpAq,
+ cType, pic->m_avgQpRc, pic->m_avgQpAq,
stats->coeffBits,
stats->mvBits,
stats->miscBits,
diff -r 408e2e6f0f70 -r 81c9f704ae38 source/encoder/search.cpp
--- a/source/encoder/search.cpp Tue Sep 09 22:23:26 2014 +0200
+++ b/source/encoder/search.cpp Wed Sep 10 11:40:39 2014 +0200
@@ -1202,9 +1202,7 @@ void Search::residualQTIntraChroma(TComD
pixel* reconIPred = cu->m_pic->getPicYuvRec()->getChromaAddr(chromaId, cu->getAddr(), zorder);
uint32_t reconIPredStride = cu->m_pic->getPicYuvRec()->getCStride();
- // TODO: is chroma transform skip irreparably broken?
- //bool useTransformSkipC = cu->getTransformSkip(absPartIdxC, ttype);
- const bool useTransformSkipC = false;
+ const bool useTransformSkipC = !!cu->getTransformSkip(absPartIdxC, ttype);
cu->setTransformSkipPartRange(0, ttype, absPartIdxC, tuIterator.absPartIdxStep);
uint32_t chromaPredMode = cu->getChromaIntraDir(absPartIdxC);
diff -r 408e2e6f0f70 -r 81c9f704ae38 source/x265.h
--- a/source/x265.h Tue Sep 09 22:23:26 2014 +0200
+++ b/source/x265.h Wed Sep 10 11:40:39 2014 +0200
@@ -424,7 +424,8 @@ typedef struct x265_param
/* Enables the emission of a user data SEI with the stream headers which
* describes the encoder version, build info, and parameters. This is
- * very helpful for debugging, but may interfere with regression tests. */
+ * very helpful for debugging, but may interfere with regression tests.
+ * Default enabled */
int bEmitInfoSEI;
/*== Coding Unit (CU) definitions ==*/
More information about the x265-commits
mailing list