[x265] [PATCH] Added support for multiple references

shazeb at multicorewareinc.com shazeb at multicorewareinc.com
Wed Sep 25 11:26:47 CEST 2013


# HG changeset patch
# User Shazeb Nawaz Khan <shazeb at multicorewareinc.com>
# Date 1380099889 -19800
#      Wed Sep 25 14:34:49 2013 +0530
# Node ID c24e375025c5c747a9c6902c7f0a383ce22449f3
# Parent  bdd26fd0325acf0f36409e994bdc262b11fa70f4
Added support for multiple references

Added a commandline parameter '--ref <max number of references>'. DPB size adjusted to use number of references.

diff -r bdd26fd0325a -r c24e375025c5 source/common/common.cpp
--- a/source/common/common.cpp	Tue Sep 24 15:21:06 2013 -0500
+++ b/source/common/common.cpp	Wed Sep 25 14:34:49 2013 +0530
@@ -160,6 +160,7 @@
     param->bEnableSignHiding = 1;
     param->bEnableTransformSkip = 1;
     param->bEnableTSkipFast = 1;
+    param->maxNumReferences = 1;
 
     /* Loop Filter */
     param->bEnableLoopFilter = 1;
diff -r bdd26fd0325a -r c24e375025c5 source/encoder/dpb.h
--- a/source/encoder/dpb.h	Tue Sep 24 15:21:06 2013 -0500
+++ b/source/encoder/dpb.h	Wed Sep 25 14:34:49 2013 +0530
@@ -52,7 +52,7 @@
         m_lastIDR = 0;
         m_pocCRA = 0;
         m_bRefreshPending = false;
-        m_maxRefL0 = 1;             //TODO: This values should later be fetched from input params
+        m_maxRefL0 = cfg->param.maxNumReferences;
         m_maxRefL1 = 1;
     }
 
diff -r bdd26fd0325a -r c24e375025c5 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Tue Sep 24 15:21:06 2013 -0500
+++ b/source/encoder/encoder.cpp	Wed Sep 25 14:34:49 2013 +0530
@@ -263,8 +263,8 @@
     vps.setMaxLayers(1);
     for (int i = 0; i < MAX_TLAYER; i++)
     {
-        m_numReorderPics[i] = _param->bframes;
-        m_maxDecPicBuffering[i] = _param->bframes + 2;
+        m_numReorderPics[i] = 1; 
+        m_maxDecPicBuffering[i] = X265_MIN(MAX_NUM_REF, X265_MAX(m_numReorderPics[i] + 1, _param->maxNumReferences));
         vps.setNumReorderPics(m_numReorderPics[i], i);
         vps.setMaxDecPicBuffering(m_maxDecPicBuffering[i], i);
     }
diff -r bdd26fd0325a -r c24e375025c5 source/x265.h
--- a/source/x265.h	Tue Sep 24 15:21:06 2013 -0500
+++ b/source/x265.h	Wed Sep 25 14:34:49 2013 +0530
@@ -248,6 +248,7 @@
     int       bEnableTransformSkip;            ///< enable intra transform skipping
     int       bEnableTSkipFast;                ///< enable fast intra transform skipping
     int       bEnableRDOQTS;                   ///< enable RD optimized quantization when transform skip is selected
+    int       maxNumReferences;                ///< maximum number of references a frame can have in L0
 
     // loop filter
     int       bEnableLoopFilter;               ///< enable Loop Filter
diff -r bdd26fd0325a -r c24e375025c5 source/x265opts.h
--- a/source/x265opts.h	Tue Sep 24 15:21:06 2013 -0500
+++ b/source/x265opts.h	Wed Sep 25 14:34:49 2013 +0530
@@ -66,6 +66,7 @@
 OPT("bframes",         param->bframes,                required_argument, 'b', "Maximum number of consecutive b-frames (now it only enables B GOP structure)")
 OPT("bframe-bias",     param->bFrameBias,             required_argument, 0, "Bias towards B frame decisions")
 OPT("b-adapt",         param->bFrameAdaptive,         required_argument, 0, "0 - none, 1 - fast, 2 - full (trellis) adaptive B frame scheduling")
+OPT("ref",             param->maxNumReferences,       required_argument, 0, "max number of references to be allowed")
 // Disabled because weighted uni-prediction was busted by not using
 // pre-generated planes in motion compensation
 //OPT("no-weightp",      param->bEnableWeightedPred,          no_argument, 0, "Disable weighted prediction in P slices")


More information about the x265-devel mailing list