[x265-commits] [x265] y4m: nit cleanups in parseHeader()

Steve Borho steve at borho.org
Wed Feb 11 20:44:52 CET 2015


details:   http://hg.videolan.org/x265/rev/878742c31fd1
branches:  
changeset: 9343:878742c31fd1
user:      Steve Borho <steve at borho.org>
date:      Wed Feb 11 12:19:53 2015 -0600
description:
y4m: nit cleanups in parseHeader()
Subject: [x265] y4m: use ios::good() rather than !ios::eof() (refs #80)

details:   http://hg.videolan.org/x265/rev/bfc5a2e98f86
branches:  
changeset: 9344:bfc5a2e98f86
user:      Steve Borho <steve at borho.org>
date:      Wed Feb 11 12:27:57 2015 -0600
description:
y4m: use ios::good() rather than !ios::eof() (refs #80)

This is more robust to file read failures and will prevent infinite loops in
the event of a failure without EOF. good() imples !fail && !eof && !bad
Subject: [x265] api: reorder pic and params for greater clarity, improve and correct comments

details:   http://hg.videolan.org/x265/rev/eac76f29b82a
branches:  
changeset: 9345:eac76f29b82a
user:      Steve Borho <steve at borho.org>
date:      Wed Feb 11 13:40:30 2015 -0600
description:
api: reorder pic and params for greater clarity, improve and correct comments

this change also improves packing in a few places. options in online docs were
reordered to roughly match. The next commit will bump X265_BUILD
Subject: [x265] cli: add cli option max-tu-size and support for it

details:   http://hg.videolan.org/x265/rev/7a42ca02d198
branches:  
changeset: 9346:7a42ca02d198
user:      Santhoshini Sekar<santhoshini at multicorewareinc.com>
date:      Wed Feb 11 10:31:20 2015 +0530
description:
cli: add cli option max-tu-size and support for it

diffstat:

 doc/reST/cli.rst           |  185 +++++++++--------
 source/CMakeLists.txt      |    2 +-
 source/common/param.cpp    |   12 +-
 source/encoder/encoder.cpp |    4 +-
 source/input/y4m.cpp       |   58 +----
 source/x265.h              |  474 +++++++++++++++++++++++---------------------
 source/x265cli.h           |    2 +
 7 files changed, 368 insertions(+), 369 deletions(-)

diffs (truncated from 1224 to 300 lines):

diff -r b6d41bfd1fa3 -r 7a42ca02d198 doc/reST/cli.rst
--- a/doc/reST/cli.rst	Wed Feb 11 09:45:31 2015 -0600
+++ b/doc/reST/cli.rst	Wed Feb 11 10:31:20 2015 +0530
@@ -416,6 +416,13 @@ Profile, Level, Tier
 	specified level, main tier first, turning on high tier only if 
 	necessary and available at that level.
 
+.. option:: --ref <1..16>
+
+	Max number of L0 references to be allowed. This number has a linear
+	multiplier effect on the amount of work performed in motion search,
+	but will generally have a beneficial affect on compression and
+	distortion. Default 3
+
 .. note::
 	:option:`--profile`, :option:`--level-idc`, and
 	:option:`--high-tier` are only intended for use when you are
@@ -531,14 +538,6 @@ the prediction quad-tree.
 	Only effective at RD levels 3 and above, which perform RDO mode
 	decisions.
 
-.. option:: --tskip, --no-tskip
-
-	Enable evaluation of transform skip (bypass DCT but still use
-	quantization) coding for 4x4 TU coded blocks.
-
-	Only effective at RD levels 3 and above, which perform RDO mode
-	decisions. Default disabled
-
 .. option:: --tskip-fast, --no-tskip-fast
 
 	Only evaluate transform skip for NxN intra predictions (4x4 blocks).
@@ -598,9 +597,76 @@ as the residual quad-tree (RQT).
 	partitions, in which case a TU split is implied and thus the
 	residual quad-tree begins one layer below the CU quad-tree.
 
+.. option:: --nr-intra <integer>, --nr-inter <integer>
+
+	Noise reduction - an adaptive deadzone applied after DCT
+	(subtracting from DCT coefficients), before quantization.  It does
+	no pixel-level filtering, doesn't cross DCT block boundaries, has no
+	overlap, The higher the strength value parameter, the more
+	aggressively it will reduce noise.
+
+	Enabling noise reduction will make outputs diverge between different
+	numbers of frame threads. Outputs will be deterministic but the
+	outputs of -F2 will no longer match the outputs of -F3, etc.
+
+	**Values:** any value in range of 0 to 2000. Default 0 (disabled).
+
+.. option:: --tskip, --no-tskip
+
+	Enable evaluation of transform skip (bypass DCT but still use
+	quantization) coding for 4x4 TU coded blocks.
+
+	Only effective at RD levels 3 and above, which perform RDO mode
+	decisions. Default disabled
+
+.. option:: --rdpenalty <0..2>
+
+	When set to 1, transform units of size 32x32 are given a 4x bit cost
+	penalty compared to smaller transform units, in intra coded CUs in P
+	or B slices.
+
+	When set to 2, transform units of size 32x32 are not even attempted,
+	unless otherwise required by the maximum recursion depth.  For this
+	option to be effective with 32x32 intra CUs,
+	:option:`--tu-intra-depth` must be at least 2.  For it to be
+	effective with 64x64 intra CUs, :option:`--tu-intra-depth` must be
+	at least 3.
+
+	Note that in HEVC an intra transform unit (a block of the residual
+	quad-tree) is also a prediction unit, meaning that the intra
+	prediction signal is generated for each TU block, the residual
+	subtracted and then coded. The coding unit simply provides the
+	prediction modes that will be used when predicting all of the
+	transform units within the CU. This means that when you prevent
+	32x32 intra transform units, you are preventing 32x32 intra
+	predictions.
+
+	Default 0, disabled.
+
+	**Values:** 0:disabled 1:4x cost penalty 2:force splits
+
+.. option:: --max-tu-size <32|16|8|4>
+
+	Maximum TU size (width and height). The residual can be more
+	efficiently compressed by the DCT transform when the max TU size
+	is larger, but at the expense of more computation. Transform unit
+	quad-tree begins at the same depth of the coded tree unit, but if the
+	maximum TU size is smaller than the CU size then transform QT begins 
+	at the depth of the max-tu-size. Default: 32.
+
 Temporal / motion search options
 ================================
 
+.. option:: --max-merge <1..5>
+
+	Maximum number of neighbor (spatial and temporal) candidate blocks
+	that the encoder may consider for merging motion predictions. If a
+	merge candidate results in no residual, it is immediately selected
+	as a "skip".  Otherwise the merge candidates are tested as part of
+	motion estimation when searching for the least cost inter option.
+	The max candidate number is encoded in the SPS and determines the
+	bit cost of signaling merge CUs. Default 2
+
 .. option:: --me <integer|string>
 
 	Motion search method. Generally, the higher the number the harder
@@ -663,16 +729,6 @@ Temporal / motion search options
 
 	**Range of values:** an integer from 0 to 32768
 
-.. option:: --max-merge <1..5>
-
-	Maximum number of neighbor (spatial and temporal) candidate blocks
-	that the encoder may consider for merging motion predictions. If a
-	merge candidate results in no residual, it is immediately selected
-	as a "skip".  Otherwise the merge candidates are tested as part of
-	motion estimation when searching for the least cost inter option.
-	The max candidate number is encoded in the SPS and determines the
-	bit cost of signaling merge CUs. Default 2
-
 .. option:: --temporal-mvp, --no-temporal-mvp
 
 	Enable temporal motion vector predictors in P and B slices.
@@ -709,32 +765,6 @@ Spatial/intra options
 	propagation of reference errors that may have resulted from lossy
 	signals. Default disabled
 
-.. option:: --rdpenalty <0..2>
-
-	When set to 1, transform units of size 32x32 are given a 4x bit cost
-	penalty compared to smaller transform units, in intra coded CUs in P
-	or B slices.
-
-	When set to 2, transform units of size 32x32 are not even attempted,
-	unless otherwise required by the maximum recursion depth.  For this
-	option to be effective with 32x32 intra CUs,
-	:option:`--tu-intra-depth` must be at least 2.  For it to be
-	effective with 64x64 intra CUs, :option:`--tu-intra-depth` must be
-	at least 3.
-
-	Note that in HEVC an intra transform unit (a block of the residual
-	quad-tree) is also a prediction unit, meaning that the intra
-	prediction signal is generated for each TU block, the residual
-	subtracted and then coded. The coding unit simply provides the
-	prediction modes that will be used when predicting all of the
-	transform units within the CU. This means that when you prevent
-	32x32 intra transform units, you are preventing 32x32 intra
-	predictions.
-
-	Default 0, disabled.
-
-	**Values:** 0:disabled 1:4x cost penalty 2:force splits
-
 Psycho-visual options
 =====================
 
@@ -879,13 +909,6 @@ Slice decision options
 
 	Use B-frames as references, when possible. Default enabled
 
-.. option:: --ref <1..16>
-
-	Max number of L0 references to be allowed. This number has a linear
-	multiplier effect on the amount of work performed in motion search,
-	but will generally have a beneficial affect on compression and
-	distortion. Default 3
-
 Quality, rate control and rate distortion options
 =================================================
 
@@ -995,20 +1018,6 @@ Quality, rate control and rate distortio
 	less bits. This tends to improve detail in the backgrounds of video
 	with less detail in areas of high motion. Default enabled
 
-.. option:: --nr-intra <integer>, --nr-inter <integer>
-
-	Noise reduction - an adaptive deadzone applied after DCT
-	(subtracting from DCT coefficients), before quantization.  It does
-	no pixel-level filtering, doesn't cross DCT block boundaries, has no
-	overlap, The higher the strength value parameter, the more
-	aggressively it will reduce noise.
-
-	Enabling noise reduction will make outputs diverge between different
-	numbers of frame threads. Outputs will be deterministic but the
-	outputs of -F2 will no longer match the outputs of -F3, etc.
-
-	**Values:** any value in range of 0 to 2000. Default 0 (disabled).
-
 .. option:: --pass <integer>
 
 	Enable multi-pass rate control mode. Input is encoded multiple times,
@@ -1347,6 +1356,21 @@ Bitstream options
 	to keep the stream headers for you and you want keyframes to be
 	random access points. Default disabled
 
+.. option:: --aud, --no-aud
+
+	Emit an access unit delimiter NAL at the start of each slice access
+	unit. If :option:`--repeat-headers` is not enabled (indicating the
+	user will be writing headers manually at the start of the stream)
+	the very first AUD will be skipped since it cannot be placed at the
+	start of the access unit, where it belongs. Default disabled
+
+.. option:: --hrd, --no-hrd
+
+	Enable the signalling of HRD parameters to the decoder. The HRD
+	parameters are carried by the Buffering Period SEI messages and
+	Picture Timing SEI messages providing timing information to the
+	decoder. Default disabled
+
 .. option:: --info, --no-info
 
 	Emit an informational SEI with the stream headers which describes
@@ -1355,12 +1379,15 @@ Bitstream options
 	build info could make your bitstreams diverge and interfere with
 	regression testing. Default enabled
 
-.. option:: --hrd, --no-hrd
+.. option:: --hash <integer>
 
-	Enable the signalling of HRD parameters to the decoder. The HRD
-	parameters are carried by the Buffering Period SEI messages and
-	Picture Timing SEI messages providing timing information to the
-	decoder. Default disabled
+	Emit decoded picture hash SEI, so the decoder may validate the
+	reconstructed pictures and detect data loss. Also useful as a
+	debug feature to validate the encoder state. Default None
+
+	1. MD5
+	2. CRC
+	3. Checksum
 
 .. option:: --temporal-layers,--no-temporal-layers
 
@@ -1374,24 +1401,6 @@ Bitstream options
 	PbBbP. You probably also want :option:`--no-scenecut` and a keyframe
 	interval that is a multiple of 4.
 
-.. option:: --aud, --no-aud
-
-	Emit an access unit delimiter NAL at the start of each slice access
-	unit. If :option:`--repeat-headers` is not enabled (indicating the
-	user will be writing headers manually at the start of the stream)
-	the very first AUD will be skipped since it cannot be placed at the
-	start of the access unit, where it belongs. Default disabled
-
-.. option:: --hash <integer>
-
-	Emit decoded picture hash SEI, so the decoder may validate the
-	reconstructed pictures and detect data loss. Also useful as a
-	debug feature to validate the encoder state. Default None
-
-	1. MD5
-	2. CRC
-	3. Checksum
-
 Debugging options
 =================
 
diff -r b6d41bfd1fa3 -r 7a42ca02d198 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Wed Feb 11 09:45:31 2015 -0600
+++ b/source/CMakeLists.txt	Wed Feb 11 10:31:20 2015 +0530
@@ -21,7 +21,7 @@ include(CheckSymbolExists)
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 44)
+set(X265_BUILD 45)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r b6d41bfd1fa3 -r 7a42ca02d198 source/common/param.cpp
--- a/source/common/param.cpp	Wed Feb 11 09:45:31 2015 -0600
+++ b/source/common/param.cpp	Wed Feb 11 10:31:20 2015 +0530
@@ -129,6 +129,7 @@ void x265_param_default(x265_param *para
     param->maxCUSize = 64;
     param->tuQTMaxInterDepth = 1;
     param->tuQTMaxIntraDepth = 1;
+    param->maxTUSize = 32;
 
     /* Coding Structure */
     param->keyframeMin = 0;
@@ -572,6 +573,7 @@ int x265_param_parse(x265_param *p, cons
     OPT("ctu") p->maxCUSize = (uint32_t)atoi(value);
     OPT("tu-intra-depth") p->tuQTMaxIntraDepth = (uint32_t)atoi(value);
     OPT("tu-inter-depth") p->tuQTMaxInterDepth = (uint32_t)atoi(value);
+    OPT("max-tu-size") p->maxTUSize = (uint32_t)atoi(value);
     OPT("subme") p->subpelRefine = atoi(value);
     OPT("merange") p->searchRange = atoi(value);
     OPT("rect") p->bEnableRectInter = atobool(value);
@@ -1012,7 +1014,8 @@ int x265_check_params(x265_param *param)
           "QuadtreeTUMaxDepthIntra must be greater 0 and less than 5");
     CHECK(maxLog2CUSize < tuQTMinLog2Size + param->tuQTMaxIntraDepth - 1,
           "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1");
-
+    CHECK((param->maxTUSize != 32 && param->maxTUSize != 16 && param->maxTUSize != 8 && param->maxTUSize != 4) || param->maxTUSize > param->maxCUSize,
+          "max TU size must be 4, 8, 16, or 32 and should be less than max CU size");


More information about the x265-commits mailing list