[x265] [PATCH 1 of 2] Adding support for RPS generation (not integrated yet)

shazeb at multicorewareinc.com shazeb at multicorewareinc.com
Tue Aug 27 11:11:18 CEST 2013


# HG changeset patch
# User Shazeb Nawaz Khan
# Date 1377594122 -19800
#      Tue Aug 27 14:32:02 2013 +0530
# Node ID 5245113fa0d66de8933b18ca03fffde4f3fbdef0
# Parent  273b1face64ce9e0c391713165776c773ec54774
Adding support for RPS generation (not integrated yet)

diff -r 273b1face64c -r 5245113fa0d6 source/Lib/TLibCommon/TComSlice.h
--- a/source/Lib/TLibCommon/TComSlice.h	Mon Aug 26 15:00:18 2013 -0500
+++ b/source/Lib/TLibCommon/TComSlice.h	Tue Aug 27 14:32:02 2013 +0530
@@ -66,18 +66,13 @@
 {
 private:
 
-    Int  m_numberOfPictures;
-    Int  m_numberOfNegativePictures;
-    Int  m_numberOfPositivePictures;
-    Int  m_numberOfLongtermPictures;
-    Int  m_deltaPOC[MAX_NUM_REF_PICS];
-    Int  m_POC[MAX_NUM_REF_PICS];
-    Bool m_used[MAX_NUM_REF_PICS];
-    Bool m_interRPSPrediction;
+    // Parameters for inter RPS prediction
     Int  m_deltaRIdxMinus1;
     Int  m_deltaRPS;
     Int  m_numRefIdc;
     Int  m_refIdc[MAX_NUM_REF_PICS + 1];
+
+    // Parameters for long term references
     Bool m_bCheckLTMSB[MAX_NUM_REF_PICS];
     Int  m_pocLSBLT[MAX_NUM_REF_PICS];
     Int  m_deltaPOCMSBCycleLT[MAX_NUM_REF_PICS];
@@ -85,6 +80,17 @@
 
 public:
 
+    Int  m_numberOfPictures;
+    Int  m_numberOfNegativePictures;
+    Int  m_numberOfPositivePictures;
+    Int  m_deltaPOC[MAX_NUM_REF_PICS];
+    Bool m_used[MAX_NUM_REF_PICS];
+    Int  m_POC[MAX_NUM_REF_PICS];
+
+    Bool m_interRPSPrediction;
+    Int  m_numberOfLongtermPictures;          // Zero when disabled
+
+
     TComReferencePictureSet();
     virtual ~TComReferencePictureSet();
     Int   getPocLSBLT(Int i)                       { return m_pocLSBLT[i]; }
diff -r 273b1face64c -r 5245113fa0d6 source/encoder/dpb.cpp
--- a/source/encoder/dpb.cpp	Mon Aug 26 15:00:18 2013 -0500
+++ b/source/encoder/dpb.cpp	Tue Aug 27 14:32:02 2013 +0530
@@ -243,6 +243,36 @@
     slice->setNextSlice(false);
 }
 
+void DPB::computeRPS(int curPoc, bool isRAP, TComReferencePictureSet * rps, unsigned int maxDecPicBuffer)
+{
+    curPoc;
+    TComPic * refPic;
+    unsigned int poci=0, numNeg=0, numPos=0;
+
+    TComList<TComPic*>::iterator iterPic = m_picList.begin();
+    while ((iterPic != m_picList.end())&&(poci<maxDecPicBuffer))
+    {
+        refPic = *(iterPic);
+        if ((refPic->getPOC() != curPoc)&&(refPic->getSlice()->isReferenced()))
+        {
+            rps->m_POC[poci] = refPic->getPOC();
+            rps->m_deltaPOC[poci] = rps->m_POC[poci] - curPoc;
+            (rps->m_deltaPOC[poci] < 0) ? numNeg++: numPos++;
+            rps->m_used[poci] = true && (!isRAP);
+            poci++;
+        }
+        iterPic++;
+    }
+
+    rps->m_numberOfPictures = poci;
+    rps->m_numberOfPositivePictures = numPos;
+    rps->m_numberOfNegativePictures = numNeg;
+    rps->m_numberOfLongtermPictures = 0;
+    rps->m_interRPSPrediction = false;          // To be changed later when needed
+
+    rps->sortDeltaPOC();                        // TO DO: check whether entire process of sorting is needed here
+}
+
 // This is a function that determines what Reference Picture Set to use for a
 // specific slice (with POC = POCCurr)
 void DPB::selectReferencePictureSet(TComSlice* slice, FrameEncoder *frameEncoder, int curPOC, int gopID)
diff -r 273b1face64c -r 5245113fa0d6 source/encoder/dpb.h
--- a/source/encoder/dpb.h	Mon Aug 26 15:00:18 2013 -0500
+++ b/source/encoder/dpb.h	Tue Aug 27 14:32:02 2013 +0530
@@ -43,6 +43,8 @@
     bool               m_bRefreshPending;
     TEncCfg*           m_cfg;
     TComList<TComPic*> m_picList;
+    int                m_maxRefL0;
+    int                m_maxRefL1;
 
     DPB(TEncCfg *cfg)
         : m_cfg(cfg)
@@ -50,6 +52,8 @@
         m_lastIDR = 0;
         m_pocCRA = 0;
         m_bRefreshPending = false;
+        m_maxRefL0 = 1;             //TODO: This values should later be fetched from input params
+        m_maxRefL1 = 1;
     }
 
     ~DPB();
@@ -62,6 +66,8 @@
 
     void selectReferencePictureSet(TComSlice* slice, x265::FrameEncoder*, int curPoc, int gopID);
 
+    void computeRPS(int curPoc, bool isRAP, TComReferencePictureSet * rps, unsigned int maxDecPicBuffer);
+
     int getReferencePictureSetIdxForSOP(int pocCur, int GOPid);
 
     void arrangeLongtermPicturesInRPS(TComSlice *, x265::FrameEncoder *frameEncoder);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265-1.patch
Type: text/x-patch
Size: 4282 bytes
Desc: not available
URL: <https://mailman.videolan.org/private/x265-devel/attachments/20130827/76a85367/attachment-0001.bin>


More information about the x265-devel mailing list