[x265] [PATCH] Displaying the number of weighted P frames used in console log
shazeb at multicorewareinc.com
shazeb at multicorewareinc.com
Thu Oct 24 08:59:34 CEST 2013
# HG changeset patch
# User Shazeb Nawaz Khan <shazeb at multicorewareinc.com>
# Date 1382597911 -19800
# Thu Oct 24 12:28:31 2013 +0530
# Node ID 207ddd54cdbcd516076d31a98ae6b5c6f4942e46
# Parent 0cb0692d6c69dbf6c5b49c51f6f528e29674baa9
Displaying the number of weighted P frames used in console log
diff -r 0cb0692d6c69 -r 207ddd54cdbc source/Lib/TLibCommon/TComSlice.cpp
--- a/source/Lib/TLibCommon/TComSlice.cpp Wed Oct 23 20:09:33 2013 +0800
+++ b/source/Lib/TLibCommon/TComSlice.cpp Thu Oct 24 12:28:31 2013 +0530
@@ -125,6 +125,7 @@
m_enableTMVPFlag = true;
m_ssim = 0;
m_ssimCnt = 0;
+ m_numWPRefs = 0;
}
bool TComSlice::getRapPicFlag()
diff -r 0cb0692d6c69 -r 207ddd54cdbc source/Lib/TLibCommon/TComSlice.h
--- a/source/Lib/TLibCommon/TComSlice.h Wed Oct 23 20:09:33 2013 +0800
+++ b/source/Lib/TLibCommon/TComSlice.h Thu Oct 24 12:28:31 2013 +0530
@@ -1375,8 +1375,9 @@
public:
- MotionReference * m_mref[2][MAX_NUM_REF + 1];
- wpScalingParam m_weightPredTable[2][MAX_NUM_REF][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
+ MotionReference *m_mref[2][MAX_NUM_REF + 1];
+ wpScalingParam m_weightPredTable[2][MAX_NUM_REF][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
+ int m_numWPRefs; // number of references for which unidirectional weighted prediction is used
/* SSIM values per frame */
double m_ssim;
diff -r 0cb0692d6c69 -r 207ddd54cdbc source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Wed Oct 23 20:09:33 2013 +0800
+++ b/source/encoder/encoder.cpp Thu Oct 24 12:28:31 2013 +0530
@@ -94,6 +94,7 @@
m_lookahead = new Lookahead(this, m_threadPool);
m_dpb = new DPB(this);
m_rateControl = new RateControl(this);
+ m_numWPFrames = 0;
}
void Encoder::destroy()
@@ -249,6 +250,8 @@
pic_out->stride[2] = recpic->getCStride();
}
+ if (out->getSlice()->m_numWPRefs > 0)
+ m_numWPFrames++;
uint64_t bits = calculateHashAndPSNR(out, nalunits);
// Allow this frame to be recycled if no frame encoders are using it for reference
ATOMIC_DEC(&out->m_countRefEncoders);
@@ -294,6 +297,12 @@
m_analyzeAll.printOut('a', fps);
}
+ if (param.bEnableWeightedPred)
+ {
+ int numPFrames = m_analyzeP.getNumPic();
+ x265_log(¶m, X265_LOG_INFO, "%d of %d (%.2f%%) P frames weighted\n", m_numWPFrames, numPFrames, (float) 100.0 * m_numWPFrames / numPFrames);
+ }
+
#if _SUMMARY_OUT_
m_analyzeAll.printSummaryOut(fps);
#endif
@@ -326,6 +335,7 @@
stats->globalSsim = 0;
stats->globalPsnr = 0;
}
+ stats->totalWPFrames = m_numWPFrames;
}
#define VERBOSE_RATE 0
diff -r 0cb0692d6c69 -r 207ddd54cdbc source/encoder/encoder.h
--- a/source/encoder/encoder.h Wed Oct 23 20:09:33 2013 +0800
+++ b/source/encoder/encoder.h Thu Oct 24 12:28:31 2013 +0530
@@ -69,6 +69,9 @@
// quality control
TComScalingList m_scalingList; ///< quantization matrix information
+ // weighted prediction
+ int m_numWPFrames; // number of Unidirectional weighted frames used
+
public:
x265_nal_t *m_nals;
diff -r 0cb0692d6c69 -r 207ddd54cdbc source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp Wed Oct 23 20:09:33 2013 +0800
+++ b/source/encoder/frameencoder.cpp Thu Oct 24 12:28:31 2013 +0530
@@ -426,7 +426,10 @@
{
TComPicYuv *recon = slice->getRefPic(list, ref)->getPicYuvRec();
if ((slice->isInterP() && slice->getPPS()->getUseWP()))
+ {
w = slice->m_weightPredTable[list][ref];
+ slice->m_numWPRefs++;
+ }
slice->m_mref[list][ref] = recon->generateMotionReference(w);
}
}
diff -r 0cb0692d6c69 -r 207ddd54cdbc source/x265.h
--- a/source/x265.h Wed Oct 23 20:09:33 2013 +0800
+++ b/source/x265.h Thu Oct 24 12:28:31 2013 +0530
@@ -241,6 +241,7 @@
double globalSsim;
double accBits;
uint32_t totalNumPics;
+ uint32_t totalWPFrames; /* Total number of Uni-directional weighted frames used */
}
x265_stats_t;
More information about the x265-devel
mailing list