changeset 3895:004b67e2ea4c draft

Scenecut detection functional with no bframes
author Deepthi Devaki <deepthidevaki@multicorewareinc.com>
date Fri, 06 Sep 2013 11:40:19 +0530
parents a63dd470bb35
children d257053c42e5
files source/common/lowres.cpp source/encoder/slicetype.cpp
diffstat 2 files changed, 10 insertions(+-), 2 deletions(-) [+]
line wrap: on
line diff
--- a/source/common/lowres.cpp	Thu Sep 05 23:21:29 2013 -0500
+++ b/source/common/lowres.cpp	Fri Sep 06 11:40:19 2013 +0530
@@ -109,6 +109,7 @@ void Lowres::destroy()
 // (re) initialize lowres state
 void Lowres::init(TComPicYuv *orig)
 {
+    scenecut = 1;
     bIntraCalculated = false;
     memset(costEst, -1, sizeof(costEst));
     sliceType = X265_TYPE_AUTO;
--- a/source/encoder/slicetype.cpp	Thu Sep 05 23:21:29 2013 -0500
+++ b/source/encoder/slicetype.cpp	Fri Sep 06 11:40:19 2013 +0530
@@ -105,6 +105,7 @@ void Lookahead::slicetypeDecide()
         outputQueue.pushBack(pic);
         numDecided++;
         lastKeyframe = 0;
+        frames[0] = &(pic->m_lowres);
         return;
     }
 
@@ -116,16 +117,18 @@ void Lookahead::slicetypeDecide()
     for (dframes = 0; (frames[dframes + 1] != NULL) && (frames[dframes + 1]->sliceType != X265_TYPE_AUTO); dframes++)
     {}
 
-    TComPic *pic;
+    TComPic *pic = NULL;
     for (int i = 1; i <= dframes && i <= inputQueue.size(); i++)
     {
         pic = inputQueue.popFront();
         outputQueue.pushBack(pic);
-        if (pic->m_lowres.sliceType == X265_TYPE_I)
+        if ((pic->m_lowres.sliceType == X265_TYPE_I) && !(pic->getPOC() % cfg->param.keyframeMax))
         {
             lastKeyframe = pic->getPOC();
         }
     }
+    if (pic)
+        frames[0] = &(pic->m_lowres); // last nonb
 
 #else // if 0
     // Fake lookahead
@@ -444,6 +447,10 @@ void Lookahead::slicetypeAnalyse(bool bK
         frames[framecnt + 1] = &((*iterPic++)->m_lowres);
         frames[framecnt + 1]->sliceType = X265_TYPE_AUTO;
     }
+    for (int i = framecnt; (i < maxSearch); i++)
+    {
+        frames[i+1] = NULL;
+    }
 
     keyint_limit = cfg->param.keyframeMax - frames[1]->frameNum + lastKeyframe;
     origNumFrames = num_frames = X265_MIN(framecnt, keyint_limit);