<div dir="ltr">Please Ignore this patch, I have sent an another patch, the member variable name and commit message has been changed a bit<div><br></div><div>Thanks </div><div><br></div></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Thu, Apr 3, 2014 at 4:57 PM, <span dir="ltr"><<a href="mailto:gopu@multicorewareinc.com" target="_blank">gopu@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=""># HG changeset patch<br>
# User Gopu Govindaswamy<br>
</div># Date 1396524444 -19800<br>
# Thu Apr 03 16:57:24 2014 +0530<br>
# Node ID 099c17e87f7318c62b6f6323dfc0b84e8ff5f076<br>
<div class=""># Parent c0362b478e23777120ee2cf3c286ca1f2e740018<br>
frameencoder: store the reference state of the picture to FrameEncoder Member variable(m_keptAsRef)<br>
<br>
We find that reference state of the reference frame changed during the encode when we use frame-thread > 1<br>
this cause the CU level QP for the frame is non-deterministic, this is leading the non-deterministic<br>
encoded output for the frame, to avoid this store the reference state of the frame to FrameEncoder->m_keptAsRef and<br>
when the QP is calculate for CU, refer the reference state of the frame from FrameEncoder->m_keptAsRef<br>
this stat will never change during the encode<br>
<br>
Moved slice reference state initialization from dpb to FrameEncoder initSlice()<br>
<br>
</div>diff -r c0362b478e23 -r 099c17e87f73 source/encoder/dpb.cpp<br>
<div class="">--- a/source/encoder/dpb.cpp Wed Apr 02 22:52:19 2014 -0500<br>
</div>+++ b/source/encoder/dpb.cpp Thu Apr 03 16:57:24 2014 +0530<br>
<div class="">@@ -79,17 +79,6 @@<br>
m_lastIDR = pocCurr;<br>
}<br>
slice->setLastIDR(m_lastIDR);<br>
-<br>
- if (slice->getSliceType() != B_SLICE)<br>
- slice->setReferenced(true);<br>
- else<br>
- {<br>
- if (pic->m_lowres.sliceType == X265_TYPE_BREF)<br>
- slice->setReferenced(true);<br>
- else<br>
- slice->setReferenced(false);<br>
- }<br>
-<br>
slice->setTemporalLayerNonReferenceFlag(!slice->isReferenced());<br>
// Set the nal unit type<br>
slice->setNalUnitType(getNalUnitType(pocCurr, m_lastIDR, pic));<br>
</div>diff -r c0362b478e23 -r 099c17e87f73 source/encoder/frameencoder.cpp<br>
<div class="">--- a/source/encoder/frameencoder.cpp Wed Apr 02 22:52:19 2014 -0500<br>
</div>+++ b/source/encoder/frameencoder.cpp Thu Apr 03 16:57:24 2014 +0530<br>
<div class="">@@ -265,7 +265,18 @@<br>
int type = pic->m_lowres.sliceType;<br>
SliceType sliceType = IS_X265_TYPE_B(type) ? B_SLICE : ((type == X265_TYPE_P) ? P_SLICE : I_SLICE);<br>
slice->setSliceType(sliceType);<br>
- slice->setReferenced(true);<br>
+<br>
+ if (sliceType != B_SLICE)<br>
</div>+ m_isReferenced = true;<br>
<div class="">+ else<br>
+ {<br>
+ if (pic->m_lowres.sliceType == X265_TYPE_BREF)<br>
</div>+ m_isReferenced = true;<br>
+ else<br>
+ m_isReferenced = false;<br>
+ }<br>
+ slice->setReferenced(m_isReferenced);<br>
<div class="">+<br>
slice->setScalingList(m_top->getScalingList());<br>
slice->getScalingList()->setUseTransformSkip(m_pps.getUseTransformSkip());<br>
#if LOG_CU_STATISTICS<br>
@@ -1229,9 +1240,8 @@<br>
int block_x = (cuAddr * noOfBlocks) - block_y * m_pic->getPicSym()->getFrameWidthInCU();<br>
<br>
/* Use cuTree offsets in m_pic->m_lowres.qpOffset if cuTree enabled and<br>
- * frame is referenced (if P, ignore ref state). Else use AQ offsets */<br>
- double *qpoffs = ((m_pic->getSlice()->isReferenced() || m_pic->getSlice()->getSliceType() == P_SLICE) && m_cfg->param->rc.cuTree) ?<br>
- m_pic->m_lowres.qpOffset : m_pic->m_lowres.qpAqOffset;<br>
+ * frame is referenced Else use AQ offsets */<br>
</div>+ double *qpoffs = (m_isReferenced && m_cfg->param->rc.cuTree) ? m_pic->m_lowres.qpOffset : m_pic->m_lowres.qpAqOffset;<br>
<div class=""><br>
int cnt = 0, idx = 0;<br>
for (int h = 0; h < noOfBlocks && block_y < maxBlockRows; h++, block_y++)<br>
</div>diff -r c0362b478e23 -r 099c17e87f73 source/encoder/frameencoder.h<br>
<div class="">--- a/source/encoder/frameencoder.h Wed Apr 02 22:52:19 2014 -0500<br>
</div>+++ b/source/encoder/frameencoder.h Thu Apr 03 16:57:24 2014 +0530<br>
<div class="">@@ -190,6 +190,7 @@<br>
int m_filterRowDelay;<br>
Event m_completionEvent;<br>
int64_t m_totalTime;<br>
</div>+ bool m_isReferenced;<br>
};<br>
}<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks & Regards<br>Gopu G<br>Multicoreware Inc <br><br>
</div>