<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 23, 2013 at 4:20 AM, <span dir="ltr"><<a href="mailto:shazeb@multicorewareinc.com" target="_blank">shazeb@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Shazeb Nawaz Khan <<a href="mailto:shazeb@multicorewareinc.com">shazeb@multicorewareinc.com</a>><br>
# Date 1382520034 -19800<br>
# Wed Oct 23 14:50:34 2013 +0530<br>
# Node ID 98e84472bb7ae8aa60bdcffb5972b4d20017ab79<br>
# Parent 6d96d64c4e9a2c526b57274760a7147241328cb3<br>
Displaying the number of weighted P frames used in console log<br>
<br>
diff -r 6d96d64c4e9a -r 98e84472bb7a source/Lib/TLibCommon/TComSlice.cpp<br>
--- a/source/Lib/TLibCommon/TComSlice.cpp Tue Oct 22 23:36:36 2013 +0530<br>
+++ b/source/Lib/TLibCommon/TComSlice.cpp Wed Oct 23 14:50:34 2013 +0530<br>
@@ -125,6 +125,7 @@<br>
m_enableTMVPFlag = true;<br>
m_ssim = 0;<br>
m_ssimCnt = 0;<br>
+ m_numWPRefs = 0;<br>
}<br>
<br>
bool TComSlice::getRapPicFlag()<br>
diff -r 6d96d64c4e9a -r 98e84472bb7a source/Lib/TLibCommon/TComSlice.h<br>
--- a/source/Lib/TLibCommon/TComSlice.h Tue Oct 22 23:36:36 2013 +0530<br>
+++ b/source/Lib/TLibCommon/TComSlice.h Wed Oct 23 14:50:34 2013 +0530<br>
@@ -1375,8 +1375,9 @@<br>
<br>
public:<br>
<br>
- MotionReference * m_mref[2][MAX_NUM_REF + 1];<br>
- wpScalingParam m_weightPredTable[2][MAX_NUM_REF][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]<br>
+ MotionReference *m_mref[2][MAX_NUM_REF + 1];<br>
+ wpScalingParam m_weightPredTable[2][MAX_NUM_REF][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]<br>
+ int m_numWPRefs; // number of references for which unidirectional weighted prediction is used<br>
<br>
/* SSIM values per frame */<br>
double m_ssim;<br>
diff -r 6d96d64c4e9a -r 98e84472bb7a source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp Tue Oct 22 23:36:36 2013 +0530<br>
+++ b/source/encoder/encoder.cpp Wed Oct 23 14:50:34 2013 +0530<br>
@@ -94,6 +94,7 @@<br>
m_lookahead = new Lookahead(this, m_threadPool);<br>
m_dpb = new DPB(this);<br>
m_rateControl = new RateControl(this);<br>
+ m_numWPFrames = 0;<br>
}<br>
<br>
void Encoder::destroy()<br>
@@ -249,6 +250,8 @@<br>
pic_out->stride[2] = recpic->getCStride();<br>
}<br>
<br>
+ if (out->getSlice()->m_numWPRefs > 0)<br>
+ m_numWPFrames++;<br>
uint64_t bits = calculateHashAndPSNR(out, nalunits);<br>
// Allow this frame to be recycled if no frame encoders are using it for reference<br>
ATOMIC_DEC(&out->m_countRefEncoders);<br>
@@ -293,6 +296,12 @@<br>
m_analyzeB.printOut('b', fps);<br>
m_analyzeAll.printOut('a', fps);<br>
}<br>
+<br>
+ if (param.bEnableWeightedPred)<br>
+ {<br>
+ fprintf(stderr, "x265 [info]: %d weighted P frames used\n", m_numWPFrames);<br></blockquote><div><br></div><div>this should use x265_log(). Perhaps it should be something like: "%d of %d (%d%%) P frames weighted"</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ }<br>
+<br>
<br>
#if _SUMMARY_OUT_<br>
m_analyzeAll.printSummaryOut(fps);<br>
@@ -326,6 +335,7 @@<br>
stats->globalSsim = 0;<br>
stats->globalPsnr = 0;<br>
}<br>
+ stats->totalWPFrames = m_numWPFrames;<br>
}<br>
<br>
#define VERBOSE_RATE 0<br>
diff -r 6d96d64c4e9a -r 98e84472bb7a source/encoder/encoder.h<br>
--- a/source/encoder/encoder.h Tue Oct 22 23:36:36 2013 +0530<br>
+++ b/source/encoder/encoder.h Wed Oct 23 14:50:34 2013 +0530<br>
@@ -69,6 +69,9 @@<br>
// quality control<br>
TComScalingList m_scalingList; ///< quantization matrix information<br>
<br>
+ // weighted prediction<br>
+ int m_numWPFrames; // number of Unidirectional weighted frames used<br>
+<br>
public:<br>
<br>
x265_nal_t *m_nals;<br>
diff -r 6d96d64c4e9a -r 98e84472bb7a source/encoder/frameencoder.cpp<br>
--- a/source/encoder/frameencoder.cpp Tue Oct 22 23:36:36 2013 +0530<br>
+++ b/source/encoder/frameencoder.cpp Wed Oct 23 14:50:34 2013 +0530<br>
@@ -426,7 +426,10 @@<br>
{<br>
TComPicYuv *recon = slice->getRefPic(list, ref)->getPicYuvRec();<br>
if ((slice->isInterP() && slice->getPPS()->getUseWP()))<br>
+ {<br>
w = slice->m_weightPredTable[list][ref];<br>
+ slice->m_numWPRefs++;<br></blockquote><div><br></div><div>this is counting number of weighted references, which isn't quite the same thing. The increment needs to be outside this loop</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ }<br>
slice->m_mref[list][ref] = recon->generateMotionReference(w);<br>
}<br>
}<br>
diff -r 6d96d64c4e9a -r 98e84472bb7a source/x265.h<br>
--- a/source/x265.h Tue Oct 22 23:36:36 2013 +0530<br>
+++ b/source/x265.h Wed Oct 23 14:50:34 2013 +0530<br>
@@ -241,6 +241,7 @@<br>
double globalSsim;<br>
double accBits;<br>
uint32_t totalNumPics;<br>
+ uint32_t totalWPFrames; /* Total number of Uni-directional weighted frames used */<br>
}<br>
x265_stats_t;<br>
<br>
_______________________________________________<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" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>