[x265] [PATCH] Added support for multiple references

Olivier Lapicque olapicque at nvidia.com
Thu Sep 26 00:27:37 CEST 2013


Shouldn't it be X265_MAX(m_numReorderPics[i] + 2, _param->maxNumReferences+1) ?
Unlike H.264, the picture is added to the DPB before being decoded (so the current picture always takes up one slot in the DPB)

Olivier

From: x265-devel [mailto:x265-devel-bounces at videolan.org] On Behalf Of Steve Borho
Sent: Wednesday, September 25, 2013 3:12 PM
To: Development for x265
Subject: Re: [x265] [PATCH] Added support for multiple references



On Wed, Sep 25, 2013 at 6:06 AM, Shazeb Khan <shazeb at multicorewareinc.com<mailto:shazeb at multicorewareinc.com>> wrote:
# HG changeset patch
# User Shazeb Nawaz Khan <shazeb at multicorewareinc.com<mailto:shazeb at multicorewareinc.com>>
# Date 1380099889 -19800
#      Wed Sep 25 14:34:49 2013 +0530
# Node ID 0cc1b50c7d500c182332f09fc66420002909d5ec
# Parent  4d0ced5c64fed290302b730ef8ac7d8613420a0d
Added support for multiple references

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

This patch was line wrap damaged, but I've queued a corrected version for default.

As a follow-up, we need to display maxrefs in the logs, especially if it is larger than 1.


diff -r 4d0ced5c64fe -r 0cc1b50c7d50 source/common/common.cpp
--- a/source/common/common.cpp Wed Sep 25 11:33:50 2013 +0530
+++ b/source/common/common.cpp Wed Sep 25 14:34:49 2013 +0530
@@ -160,7 +160,7 @@
     param->bEnableSignHiding = 1;
     param->bEnableTransformSkip = 1;
     param->bEnableTSkipFast = 1;
-
+    param->maxNumReferences = 1;
     /* Loop Filter */
     param->bEnableLoopFilter = 1;

diff -r 4d0ced5c64fe -r 0cc1b50c7d50 source/encoder/dpb.h
--- a/source/encoder/dpb.h Wed Sep 25 11:33:50 2013 +0530
+++ b/source/encoder/dpb.h Wed Sep 25 14:34:49 2013 +0530
@@ -52,10 +52,9 @@
         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;
     }
-
     ~DPB();

     void prepareEncode(TComPic*);
diff -r 4d0ced5c64fe -r 0cc1b50c7d50 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Wed Sep 25 11:33:50 2013 +0530
+++ 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 4d0ced5c64fe -r 0cc1b50c7d50 source/x265.h
--- a/source/x265.h Wed Sep 25 11:33:50 2013 +0530
+++ b/source/x265.h Wed Sep 25 14:34:49 2013 +0530
@@ -248,7 +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 4d0ced5c64fe -r 0cc1b50c7d50 source/x265opts.h
--- a/source/x265opts.h Wed Sep 25 11:33:50 2013 +0530
+++ 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 (1 .. 16) ")
 // 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")


_______________________________________________
x265-devel mailing list
x265-devel at videolan.org<mailto:x265-devel at videolan.org>
https://mailman.videolan.org/listinfo/x265-devel



--
Steve Borho

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130925/7103c19f/attachment-0001.html>


More information about the x265-devel mailing list