[x265-commits] [x265] nits
Steve Borho
steve at borho.org
Thu Mar 27 20:26:10 CET 2014
details: http://hg.videolan.org/x265/rev/8e0c2d24fc45
branches:
changeset: 6610:8e0c2d24fc45
user: Steve Borho <steve at borho.org>
date: Wed Mar 26 22:39:01 2014 -0500
description:
nits
Subject: [x265] rest: improve docs for --me and --early-skip
details: http://hg.videolan.org/x265/rev/6e25dfa0cc9e
branches:
changeset: 6611:6e25dfa0cc9e
user: Steve Borho <steve at borho.org>
date: Thu Mar 27 14:10:48 2014 -0500
description:
rest: improve docs for --me and --early-skip
Subject: [x265] api: change x265_encoder_headers() to return byte count on success
details: http://hg.videolan.org/x265/rev/8ce32bd20ec7
branches:
changeset: 6612:8ce32bd20ec7
user: Steve Borho <steve at borho.org>
date: Wed Mar 26 19:46:05 2014 -0500
description:
api: change x265_encoder_headers() to return byte count on success
Subject: [x265] rest: cleanup --input description
details: http://hg.videolan.org/x265/rev/3c366c8973e0
branches:
changeset: 6613:3c366c8973e0
user: Steve Borho <steve at borho.org>
date: Thu Mar 27 14:25:05 2014 -0500
description:
rest: cleanup --input description
diffstat:
doc/reST/cli.rst | 26 ++++++++++++++++++++------
source/CMakeLists.txt | 2 +-
source/Lib/TLibCommon/TComTrQuant.cpp | 2 +-
source/Lib/TLibEncoder/TEncSearch.cpp | 8 ++++----
source/encoder/api.cpp | 7 ++++---
source/encoder/encoder.cpp | 9 ++++-----
source/encoder/encoder.h | 2 +-
source/x265.cpp | 12 +++++++++---
source/x265.h | 2 +-
9 files changed, 45 insertions(+), 25 deletions(-)
diffs (245 lines):
diff -r ca35d9b58b55 -r 3c366c8973e0 doc/reST/cli.rst
--- a/doc/reST/cli.rst Wed Mar 26 22:29:25 2014 -0500
+++ b/doc/reST/cli.rst Thu Mar 27 14:25:05 2014 -0500
@@ -144,9 +144,9 @@ Input Options
.. option:: --y4m
Parse input stream as YUV4MPEG2 regardless of file extension,
- primarily intended for use with stdin. This option is implied if
- the input filename has a ".y4m" extension
- (ie: :option:`--input` - :option:`--y4m`)
+ primarily intended for use with stdin (ie: :option:`--input` -
+ :option:`--y4m`). This option is implied if the input filename has
+ a ".y4m" extension
**CLI ONLY**
@@ -251,7 +251,14 @@ Temporal / motion search options
.. option:: --me <integer|string>
Motion search method. Generally, the higher the number the harder
- the ME method will try to find an optimal match.
+ the ME method will try to find an optimal match. Diamond search is
+ the simplest. Hexagon search is a little better. Uneven
+ Multi-Hexegon is an adaption of the search method used by x264 for
+ slower presets. Star is a three step search adapted from the HM
+ encoder: a star-pattern search followed by an optional radix scan
+ followed by an optional star-search refinement. Full is an
+ exhaustive search; an order of magnitude slower than all other
+ searches but not much better than umh or star.
0. dia
1. hex **(default)**
@@ -288,6 +295,12 @@ Temporal / motion search options
Motion search range. Default 57
+ The default is derived from the default CTU size (64) minus the luma
+ interpolation half-length (4) minus maximum subpel distance (2)
+ minus one extra pixel just in case the hex search method is used. If
+ the search range were any larger than this, another CTU row of
+ latency would be required for reference frames.
+
**Range of values:** an integer from 0 to 32768
.. option:: --rect, --no-rect
@@ -315,14 +328,15 @@ Temporal / motion search options
.. option:: --early-skip, --no-early-skip
- Enable early SKIP detection. Default disabled
+ Measure full CU size (2Nx2N) merge candidates first; if no residual
+ is found the analysis is short circuited. Default disabled
.. option:: --fast-cbf, --no-fast-cbf
Short circuit analysis if a prediction is found that does not set
the coded block flag (aka: no residual was encoded). It prevents
the encoder from perhaps finding other predictions that also have no
- residual but require less signaling bits. Default disabled
+ residual but require less signaling bits. Default disabled
.. option:: --ref <1..16>
diff -r ca35d9b58b55 -r 3c366c8973e0 source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Mar 26 22:29:25 2014 -0500
+++ b/source/CMakeLists.txt Thu Mar 27 14:25:05 2014 -0500
@@ -18,7 +18,7 @@ include(CheckSymbolExists)
include(CheckCXXCompilerFlag)
# X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 12)
+set(X265_BUILD 13)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r ca35d9b58b55 -r 3c366c8973e0 source/Lib/TLibCommon/TComTrQuant.cpp
--- a/source/Lib/TLibCommon/TComTrQuant.cpp Wed Mar 26 22:29:25 2014 -0500
+++ b/source/Lib/TLibCommon/TComTrQuant.cpp Thu Mar 27 14:25:05 2014 -0500
@@ -308,7 +308,7 @@ void TComTrQuant::init(uint32_t maxTrSiz
uint32_t TComTrQuant::transformNxN(TComDataCU* cu,
int16_t* residual,
uint32_t stride,
- coeff_t* coeff,
+ coeff_t* coeff,
uint32_t trSize,
TextType ttype,
uint32_t absPartIdx,
diff -r ca35d9b58b55 -r 3c366c8973e0 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp Wed Mar 26 22:29:25 2014 -0500
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp Thu Mar 27 14:25:05 2014 -0500
@@ -958,8 +958,8 @@ void TEncSearch::xSetIntraResultQT(TComD
//===== copy transform coefficients =====
uint32_t numCoeffY = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize()) >> (fullDepth << 1);
uint32_t numCoeffIncY = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize()) >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1);
- coeff_t* coeffSrcY = m_qtTempCoeffY[qtlayer] + (numCoeffIncY * absPartIdx);
- coeff_t* coeffDestY = cu->getCoeffY() + (numCoeffIncY * absPartIdx);
+ coeff_t* coeffSrcY = m_qtTempCoeffY[qtlayer] + (numCoeffIncY * absPartIdx);
+ coeff_t* coeffDestY = cu->getCoeffY() + (numCoeffIncY * absPartIdx);
::memcpy(coeffDestY, coeffSrcY, sizeof(coeff_t) * numCoeffY);
//===== copy reconstruction =====
@@ -1338,7 +1338,7 @@ void TEncSearch::residualQTIntrachroma(T
uint32_t absPartIdx,
TComYuv* fencYuv,
TComYuv* predYuv,
- ShortYuv* resiYuv,
+ ShortYuv* resiYuv,
TComYuv* reconYuv)
{
uint32_t fullDepth = cu->getDepth(0) + trDepth;
@@ -1376,7 +1376,7 @@ void TEncSearch::residualQTIntrachroma(T
int16_t* residual = (chromaId > 0 ? resiYuv->getCrAddr(absPartIdx) : resiYuv->getCbAddr(absPartIdx));
pixel* recon = (chromaId > 0 ? reconYuv->getCrAddr(absPartIdx) : reconYuv->getCbAddr(absPartIdx));
uint32_t numCoeffPerInc = (cu->getSlice()->getSPS()->getMaxCUSize() * cu->getSlice()->getSPS()->getMaxCUSize() >> (cu->getSlice()->getSPS()->getMaxCUDepth() << 1)) >> 2;
- coeff_t* coeff = (chromaId > 0 ? cu->getCoeffCr() : cu->getCoeffCb()) + numCoeffPerInc * absPartIdx;
+ coeff_t* coeff = (chromaId > 0 ? cu->getCoeffCr() : cu->getCoeffCb()) + numCoeffPerInc * absPartIdx;
uint32_t zorder = cu->getZorderIdxInCU() + absPartIdx;
pixel* reconIPred = (chromaId > 0 ? cu->getPic()->getPicYuvRec()->getCrAddr(cu->getAddr(), zorder) : cu->getPic()->getPicYuvRec()->getCbAddr(cu->getAddr(), zorder));
diff -r ca35d9b58b55 -r 3c366c8973e0 source/encoder/api.cpp
--- a/source/encoder/api.cpp Wed Mar 26 22:29:25 2014 -0500
+++ b/source/encoder/api.cpp Thu Mar 27 14:25:05 2014 -0500
@@ -69,7 +69,7 @@ extern "C"
int x265_encoder_headers(x265_encoder *enc, x265_nal **pp_nal, uint32_t *pi_nal)
{
if (!pp_nal || !enc)
- return 0;
+ return -1;
Encoder *encoder = static_cast<Encoder*>(enc);
@@ -77,7 +77,7 @@ int x265_encoder_headers(x265_encoder *e
NALUnitEBSP *nalunits[MAX_NAL_UNITS] = { 0, 0, 0, 0, 0 };
if (encoder->getStreamHeaders(nalunits) > 0)
{
- int nalcount = encoder->extractNalData(nalunits);
+ int nalcount = encoder->extractNalData(nalunits, ret);
*pp_nal = &encoder->m_nals[0];
if (pi_nal) *pi_nal = nalcount;
}
@@ -111,7 +111,8 @@ int x265_encoder_encode(x265_encoder *en
if (pp_nal && numEncoded > 0)
{
- int nalcount = encoder->extractNalData(nalunits);
+ int memsize;
+ int nalcount = encoder->extractNalData(nalunits, memsize);
*pp_nal = &encoder->m_nals[0];
if (pi_nal) *pi_nal = nalcount;
}
diff -r ca35d9b58b55 -r 3c366c8973e0 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Wed Mar 26 22:29:25 2014 -0500
+++ b/source/encoder/encoder.cpp Thu Mar 27 14:25:05 2014 -0500
@@ -1523,14 +1523,13 @@ void Encoder::configure(x265_param *p)
m_CUTransquantBypassFlagValue = false;
}
-int Encoder::extractNalData(NALUnitEBSP **nalunits)
+int Encoder::extractNalData(NALUnitEBSP **nalunits, int& memsize)
{
- uint32_t memsize = 0;
- uint32_t offset = 0;
+ int offset = 0;
int nalcount = 0;
-
int num = 0;
+ memsize = 0;
for (; num < MAX_NAL_UNITS && nalunits[num] != NULL; num++)
{
const NALUnitEBSP& temp = *nalunits[num];
@@ -1548,7 +1547,7 @@ int Encoder::extractNalData(NALUnitEBSP
for (; nalcount < num; nalcount++)
{
const NALUnitEBSP& nalu = *nalunits[nalcount];
- uint32_t size; /* size of annexB unit in bytes */
+ int size; /* size of annexB unit in bytes */
static const char start_code_prefix[] = { 0, 0, 0, 1 };
if (nalcount == 0 || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_PPS)
diff -r ca35d9b58b55 -r 3c366c8973e0 source/encoder/encoder.h
--- a/source/encoder/encoder.h Wed Mar 26 22:29:25 2014 -0500
+++ b/source/encoder/encoder.h Thu Mar 27 14:25:05 2014 -0500
@@ -224,7 +224,7 @@ public:
void determineLevelAndProfile(x265_param *param);
- int extractNalData(NALUnitEBSP **nalunits);
+ int extractNalData(NALUnitEBSP **nalunits, int& memsize);
void updateVbvPlan(RateControl* rc);
diff -r ca35d9b58b55 -r 3c366c8973e0 source/x265.cpp
--- a/source/x265.cpp Wed Mar 26 22:29:25 2014 -0500
+++ b/source/x265.cpp Thu Mar 27 14:25:05 2014 -0500
@@ -669,21 +669,26 @@ int main(int argc, char **argv)
x265_picture pic_orig, pic_out;
x265_picture *pic_in = &pic_orig;
x265_picture *pic_recon = cliopt.recon ? &pic_out : NULL;
+ uint32_t inFrameCount = 0;
+ uint32_t outFrameCount = 0;
x265_nal *p_nal;
x265_stats stats;
uint32_t nal;
if (!param->bRepeatHeaders)
{
- if (!x265_encoder_headers(encoder, &p_nal, &nal))
+ if (x265_encoder_headers(encoder, &p_nal, &nal) < 0)
+ {
+ x265_log(param, X265_LOG_ERROR, "Failure generating stream headers\n");
+ goto fail;
+ }
+ else
cliopt.writeNALs(p_nal, nal);
}
x265_picture_init(param, pic_in);
// main encoder loop
- uint32_t inFrameCount = 0;
- uint32_t outFrameCount = 0;
while (pic_in && !b_ctrl_c)
{
pic_orig.poc = inFrameCount;
@@ -737,6 +742,7 @@ int main(int argc, char **argv)
if (cliopt.bProgress)
fprintf(stderr, "%*s\r", 80, " ");
+fail:
x265_encoder_get_stats(encoder, &stats, sizeof(stats));
if (param->csvfn && !b_ctrl_c)
x265_encoder_log(encoder, argc, argv);
diff -r ca35d9b58b55 -r 3c366c8973e0 source/x265.h
--- a/source/x265.h Wed Mar 26 22:29:25 2014 -0500
+++ b/source/x265.h Thu Mar 27 14:25:05 2014 -0500
@@ -925,7 +925,7 @@ x265_encoder* x265_encoder_open(x265_par
/* x265_encoder_headers:
* return the SPS and PPS that will be used for the whole stream.
* *pi_nal is the number of NAL units outputted in pp_nal.
- * returns negative on error.
+ * returns negative on error, total byte size of payload data on success
* the payloads of all output NALs are guaranteed to be sequential in memory. */
int x265_encoder_headers(x265_encoder *, x265_nal **pp_nal, uint32_t *pi_nal);
More information about the x265-commits
mailing list