[x265] [PATCH 1 of 2] using slicetypes from lookahead

shazeb at multicorewareinc.com shazeb at multicorewareinc.com
Wed Sep 4 13:25:46 CEST 2013


# HG changeset patch
# User Deepthi Devaki <deepthidevaki at multicorewareinc.com>
# Date 1378292721 -19800
#      Wed Sep 04 16:35:21 2013 +0530
# Node ID e83d23bf0756141e663ca14c3c298d34f2f70780
# Parent  e06a76856565bcb120c497d3695340dd17044ebf
using slicetypes from lookahead

diff -r e06a76856565 -r e83d23bf0756 source/Lib/TLibEncoder/TEncTop.cpp
--- a/source/Lib/TLibEncoder/TEncTop.cpp	Wed Sep 04 16:03:06 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncTop.cpp	Wed Sep 04 16:35:21 2013 +0530
@@ -246,13 +246,9 @@
         // pop a single frame from decided list, prepare, then provide to frame encoder
         // curEncoder is guaranteed to be idle at this point
         TComPic *fenc = m_lookahead->outputQueue.popFront();
-
         // Initialise slice in Frame Encoder
-        int pocCurr = fenc->getSlice()->getPOC();
-        bool forceIntra = m_dpb->m_cfg->param.keyframeMax == 1 || (pocCurr % m_dpb->m_cfg->param.keyframeMax == 0) || pocCurr == 0;
         int gopIdx = fenc->m_lowres.gopIdx;
-        curEncoder->initSlice(fenc, forceIntra, gopIdx);
-
+        curEncoder->initSlice(fenc,gopIdx);
         // determine references, set QP, etc
         m_dpb->prepareEncode(fenc, curEncoder);
         if (m_rateControl->rateControlMode == X265_RC_ABR)
diff -r e06a76856565 -r e83d23bf0756 source/encoder/dpb.cpp
--- a/source/encoder/dpb.cpp	Wed Sep 04 16:03:06 2013 +0530
+++ b/source/encoder/dpb.cpp	Wed Sep 04 16:35:21 2013 +0530
@@ -78,14 +78,8 @@
         m_lastIDR = pocCurr;
     }
     slice->setLastIDR(m_lastIDR);
-
-    if (slice->getSliceType() == B_SLICE && m_cfg->getGOPEntry(gopIdx).m_sliceType == 'P')
-    {
-        slice->setSliceType(P_SLICE);
-    }
     slice->setReferenced(slice->getSliceType() != B_SLICE);
     slice->setTemporalLayerNonReferenceFlag(!slice->isReferenced());
-
     // Set the nal unit type
     slice->setNalUnitType(getNalUnitType(pocCurr, m_lastIDR));
 
diff -r e06a76856565 -r e83d23bf0756 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Wed Sep 04 16:03:06 2013 +0530
+++ b/source/encoder/frameencoder.cpp	Wed Sep 04 16:35:21 2013 +0530
@@ -209,8 +209,7 @@
     }
     return 0;
 }
-
-void FrameEncoder::initSlice(TComPic* pic, bool bForceISlice, int gopID)
+void FrameEncoder::initSlice(TComPic* pic, int gopID)
 {
     m_pic = pic;
     TComSlice* slice = pic->getSlice();
@@ -220,9 +219,8 @@
     slice->setPic(pic);
     slice->initSlice();
     slice->setPicOutputFlag(true);
-
-    // slice type
-    SliceType sliceType = bForceISlice ? I_SLICE : B_SLICE;
+    int type = pic->m_lowres.sliceType;
+    SliceType sliceType = IS_X265_TYPE_B(type)? B_SLICE : ((type == X265_TYPE_P) ? P_SLICE: I_SLICE );
     slice->setSliceType(sliceType);
     slice->setReferenced(true);
     slice->setScalingList(m_top->getScalingList());
diff -r e06a76856565 -r e83d23bf0756 source/encoder/frameencoder.h
--- a/source/encoder/frameencoder.h	Wed Sep 04 16:03:06 2013 +0530
+++ b/source/encoder/frameencoder.h	Wed Sep 04 16:35:21 2013 +0530
@@ -163,11 +163,8 @@
         // Initialize global singletons (these should eventually be per-slice)
         m_sbacCoder.init((TEncBinIf*)&m_binCoderCABAC);
     }
-
     int getStreamHeaders(AccessUnit& accessUnitOut);
-
-    void initSlice(TComPic* pic, bool bForceISlice, int gopID);
-
+    void initSlice(TComPic* pic, int gopID);
     /* analyze / compress frame, can be run in parallel within reference constraints */
     void compressFrame(TComPic *pic);
 
diff -r e06a76856565 -r e83d23bf0756 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Wed Sep 04 16:03:06 2013 +0530
+++ b/source/encoder/slicetype.cpp	Wed Sep 04 16:35:21 2013 +0530
@@ -183,9 +183,9 @@
         {
             iterPic++;
         }
-
         TComPic *pic = *iterPic;
-        pic->m_lowres.sliceType = cfg->getGOPEntry(i).m_sliceType;
+        bool forceIntra = cfg->param.keyframeMax == 1 || ( pic->getPOC() % cfg->param.keyframeMax == 0) || pic->getPOC() == 0;
+        pic->m_lowres.sliceType = forceIntra? X265_TYPE_I : (cfg->getGOPEntry(i).m_sliceType=='P')? X265_TYPE_P : X265_TYPE_B;
         pic->m_lowres.gopIdx = i;
         outputQueue.pushBack(pic);
         numDecided++;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265-1.patch
Type: text/x-patch
Size: 4198 bytes
Desc: not available
URL: <https://mailman.videolan.org/private/x265-devel/attachments/20130904/9bb8642c/attachment.bin>


More information about the x265-devel mailing list