<div dir="ltr">After applying this patch and tested with two videos, found that there are some fake scenecuts and consecutive I-frames.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 6, 2015 at 5:06 PM, <span dir="ltr"><<a href="mailto:deepthi@multicorewareinc.com" target="_blank">deepthi@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"># HG changeset patch<br>
# User Deepthi Nandakumar <<a href="mailto:deepthi@multicorewareinc.com">deepthi@multicorewareinc.com</a>><br>
# Date 1444115344 -19800<br>
# Tue Oct 06 12:39:04 2015 +0530<br>
# Branch stable<br>
# Node ID aaf7fe7452b5c46e564d32ff52f2730a79ebaea1<br>
# Parent 98ac099a766fc3eb6333fd5676b87a5933e1e3d0<br>
slicetype: fix bugs in scenecut and slicetype decision<br>
<br>
The default value of bScenecut had changed to false (instead of true) and this<br>
was not accounted for correctly.<br>
<br>
diff -r 98ac099a766f -r aaf7fe7452b5 source/encoder/slicetype.cpp<br>
--- a/source/encoder/slicetype.cpp Tue Sep 29 14:14:24 2015 +0530<br>
+++ b/source/encoder/slicetype.cpp Tue Oct 06 12:39:04 2015 +0530<br>
@@ -1259,7 +1259,7 @@<br>
{<br>
bool isScenecut = scenecut(frames, 0, 1, true, origNumFrames);<br>
/* When scenecut threshold is set, use scenecut detection for I frame placements */<br>
- if (!m_param->scenecutThreshold && isScenecut)<br>
+ if (m_param->scenecutThreshold && isScenecut)<br>
{<br>
frames[1]->sliceType = X265_TYPE_I;<br>
return;<br>
@@ -1402,7 +1402,7 @@<br>
origmaxp1 += m_param->bframes;<br>
int maxp1 = X265_MIN(origmaxp1, numFrames);<br>
bool fluctuate = false;<br>
- bool noScenecuts = false;<br>
+ bool scenecutFound = false;<br>
int64_t avgSatdCost = 0;<br>
if (frames[0]->costEst[1][0] > -1)<br>
avgSatdCost = frames[0]->costEst[1][0];<br>
@@ -1412,23 +1412,11 @@<br>
* and not considered a scenecut. */<br>
for (int cp1 = p1; cp1 <= maxp1; cp1++)<br>
{<br>
- if (!scenecutInternal(frames, p0, cp1, false))<br>
+ if (scenecutInternal(frames, p0, cp1, false))<br>
{<br>
- /* Any frame in between p0 and cur_p1 cannot be a real scenecut. */<br>
- for (int i = cp1; i > p0; i--)<br>
- {<br>
- frames[i]->bScenecut = false;<br>
- noScenecuts = false;<br>
- }<br>
+ frames[cp1]->bScenecut = true;<br>
+ scenecutFound = true;<br>
}<br>
- else if (scenecutInternal(frames, cp1 - 1, cp1, false))<br>
- {<br>
- /* If current frame is a Scenecut from p0 frame as well as Scenecut from<br>
- * preceeding frame, mark it as a Scenecut */<br>
- frames[cp1]->bScenecut = true;<br>
- noScenecuts = true;<br>
- }<br>
-<br>
/* compute average satdcost of all the frames in the mini-gop to confirm<br>
* whether there is any great fluctuation among them to rule out false positives */<br>
X265_CHECK(frames[cp1]->costEst[cp1 - p0][0]!= -1, "costEst is not done \n");<br>
@@ -1440,32 +1428,30 @@<br>
* This could denote the beginning or ending of scene transitions.<br>
* During a scene transition(fade in/fade outs), if fluctuate remains false,<br>
* then the scene had completed its transition or stabilized */<br>
- if (noScenecuts)<br>
+ if (scenecutFound)<br>
{<br>
fluctuate = false;<br>
avgSatdCost /= cnt;<br>
- for (int i= p1 ; i <= maxp1; i++)<br>
+ for (int i = p1; i <= maxp1; i++)<br>
{<br>
if (fabs((double)(frames[i]->costEst[i - p0][0] - avgSatdCost)) > 0.1 * avgSatdCost)<br>
{<br>
fluctuate = true;<br>
- if (!m_isSceneTransition && frames[i]->bScenecut)<br>
+ if (frames[i]->bScenecut)<br>
{<br>
- m_isSceneTransition = true;<br>
- /* just mark the first scenechange in the scene transition as a scenecut. */<br>
+ /* just mark the first scenechange in the scene transition as a scenecut */<br>
for (int j = i + 1; j <= maxp1; j++)<br>
frames[j]->bScenecut = false;<br>
+ frames[i]->bScenecut = true;<br>
break;<br>
}<br>
}<br>
- frames[i]->bScenecut = false;<br>
}<br>
}<br>
- if (!fluctuate && !noScenecuts)<br>
- m_isSceneTransition = false; /* Signal end of scene transitioning */<br>
+ if (fluctuate && scenecutFound)<br>
+ m_isSceneTransition = !m_isSceneTransition;<br>
}<br>
<br>
- /* Ignore frames that are part of a flash, i.e. cannot be real scenecuts */<br>
if (!frames[p1]->bScenecut)<br>
return false;<br>
return scenecutInternal(frames, p0, p1, bRealScenecut);<br>
</div></div>_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br></div>