[x265] [PATCH] use slicetypes from lookahead

deepthidevaki at multicorewareinc.com deepthidevaki at multicorewareinc.com
Tue Sep 3 14:21:50 CEST 2013


# HG changeset patch
# User Deepthi Devaki <deepthidevaki at multicorewareinc.com>
# Date 1378210588 -19800
# Node ID 6155a8fc47fbc775f3196f59b57efb30e5135b32
# Parent  9a2eaa27b17476c798c831a15af019a7148c6735
use slicetypes from lookahead

diff -r 9a2eaa27b174 -r 6155a8fc47fb source/Lib/TLibEncoder/TEncTop.cpp
--- a/source/Lib/TLibEncoder/TEncTop.cpp	Tue Sep 03 14:36:20 2013 +0530
+++ b/source/Lib/TLibEncoder/TEncTop.cpp	Tue Sep 03 17:46:28 2013 +0530
@@ -252,11 +252,9 @@
         // 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;
+        // Initialise slice in Frame Encoder        
         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);
diff -r 9a2eaa27b174 -r 6155a8fc47fb source/encoder/dpb.cpp
--- a/source/encoder/dpb.cpp	Tue Sep 03 14:36:20 2013 +0530
+++ b/source/encoder/dpb.cpp	Tue Sep 03 17:46:28 2013 +0530
@@ -79,10 +79,6 @@
     }
     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());
 
diff -r 9a2eaa27b174 -r 6155a8fc47fb source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Tue Sep 03 14:36:20 2013 +0530
+++ b/source/encoder/frameencoder.cpp	Tue Sep 03 17:46:28 2013 +0530
@@ -211,7 +211,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();
@@ -222,8 +222,8 @@
     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 9a2eaa27b174 -r 6155a8fc47fb source/encoder/frameencoder.h
--- a/source/encoder/frameencoder.h	Tue Sep 03 14:36:20 2013 +0530
+++ b/source/encoder/frameencoder.h	Tue Sep 03 17:46:28 2013 +0530
@@ -166,7 +166,7 @@
 
     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 9a2eaa27b174 -r 6155a8fc47fb source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Tue Sep 03 14:36:20 2013 +0530
+++ b/source/encoder/slicetype.cpp	Tue Sep 03 17:46:28 2013 +0530
@@ -145,7 +145,8 @@
         }
 
         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++;


More information about the x265-devel mailing list