[x265] [PATCH] Scenecut detection when no bframes
deepthidevaki at multicorewareinc.com
deepthidevaki at multicorewareinc.com
Fri Sep 6 08:10:37 CEST 2013
# HG changeset patch
# User Deepthi Devaki <deepthidevaki at multicorewareinc.com>
# Date 1378447819 -19800
# Node ID 201665fd84d368895dcdac428b4d7c5a468ae3fb
# Parent f3a583f4d0b1ee113bd6e101647e5585ea4fe86c
Scenecut detection when no bframes
diff -r f3a583f4d0b1 -r 201665fd84d3 source/common/lowres.cpp
--- 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 @@
// (re) initialize lowres state
void Lowres::init(TComPicYuv *orig)
{
+ scenecut = 1;
bIntraCalculated = false;
memset(costEst, -1, sizeof(costEst));
sliceType = X265_TYPE_AUTO;
diff -r f3a583f4d0b1 -r 201665fd84d3 source/encoder/slicetype.cpp
--- 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 @@
outputQueue.pushBack(pic);
numDecided++;
lastKeyframe = 0;
+ frames[0] = &(pic->m_lowres);
return;
}
@@ -116,16 +117,18 @@
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 @@
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);
More information about the x265-devel
mailing list