[x265] [PATCH] api: introduce --no-mixed-refs type feature interface

Steve Borho steve at borho.org
Wed Feb 18 20:17:56 CET 2015


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1424286900 21600
#      Wed Feb 18 13:15:00 2015 -0600
# Node ID aec9e9e511f42c0c45edaca25b990ee11a7ebb02
# Parent  bd86e9a434e350beb6e5d7aeb1d05dcf91e2c6f9
api: introduce --no-mixed-refs type feature interface

x264 has a --no-mixed-refs feature which allows the encoder to only check all
references once per macroblock, and then only use the 'best' reference for all
remaining block sizes, reducing the number of motion searches performed per
macroblock and reducing the cost of keeping additional references.

In HEVC we have a much deeper potential recursion depth (64x64 down to 8x8) and
thus we need more complexity to handle this optimization. I propose a two-layer
approach.

With X265_REF_LIMIT_DEPTH we will limit the references used for the
current depth based on only the best references used to code the 4 sub-blocks at
the next greater depth.  For example, a 16x16 CU will only use the references
used to code its four 8x8 CUs.

With X265_REF_LIMIT_CU, the rectangular and asymmetrical partitions will only
use references selected by the 2Nx2N motion search.

The two flags may be combined such that the 2Nx2N motion search at each depth
will only use references from the split CUs and then the other motion searches
at that depth will only use the reference(s) selected by 2Nx2N

This will be implemented at the cli as: --limit-refs 0|1|2|3

diff -r bd86e9a434e3 -r aec9e9e511f4 source/x265.h
--- a/source/x265.h	Wed Feb 18 13:00:01 2015 -0600
+++ b/source/x265.h	Wed Feb 18 13:15:00 2015 -0600
@@ -229,6 +229,9 @@
 #define X265_B_ADAPT_FAST       1
 #define X265_B_ADAPT_TRELLIS    2
 
+#define X265_REF_LIMIT_DEPTH    1
+#define X265_REF_LIMIT_CU       2
+
 #define X265_BFRAME_MAX         16
 #define X265_MAX_FRAME_THREADS  16
 
@@ -671,6 +674,15 @@
      * the performance but the less compression efficiency. Default is 3 */
     uint32_t  maxNumMergeCand;
 
+    /* Limit the motion references used for each search based on the results of
+     * previous motion searches already performed for the same CU: If 0 all
+     * references are always searched. If X265_REF_LIMIT_CU all motion searches
+     * will restrict themselves to the references selected by the 2Nx2N search
+     * at the same depth. If X265_REF_LIMIT_DEPTH the 2Nx2N motion search will
+     * only use references that were selected by the best motion searches of the
+     * 4 split CUs at the next lower CU depth.  The two flags may be combined */
+    uint32_t  limitReferences;
+
     /* ME search method (DIA, HEX, UMH, STAR, FULL). The search patterns
      * (methods) are sorted in increasing complexity, with diamond being the
      * simplest and fastest and full being the slowest.  DIA, HEX, and UMH were


More information about the x265-devel mailing list