[x265] [PATCH] Displaying the number of weighted P frames used in console log

shazeb at multicorewareinc.com shazeb at multicorewareinc.com
Wed Oct 23 11:20:55 CEST 2013


# HG changeset patch
# User Shazeb Nawaz Khan <shazeb at multicorewareinc.com>
# Date 1382520034 -19800
#      Wed Oct 23 14:50:34 2013 +0530
# Node ID 98e84472bb7ae8aa60bdcffb5972b4d20017ab79
# Parent  6d96d64c4e9a2c526b57274760a7147241328cb3
Displaying the number of weighted P frames used in console log

diff -r 6d96d64c4e9a -r 98e84472bb7a source/Lib/TLibCommon/TComSlice.cpp
--- a/source/Lib/TLibCommon/TComSlice.cpp	Tue Oct 22 23:36:36 2013 +0530
+++ b/source/Lib/TLibCommon/TComSlice.cpp	Wed Oct 23 14:50:34 2013 +0530
@@ -125,6 +125,7 @@
     m_enableTMVPFlag = true;
     m_ssim = 0;
     m_ssimCnt = 0;
+    m_numWPRefs = 0;
 }
 
 bool TComSlice::getRapPicFlag()
diff -r 6d96d64c4e9a -r 98e84472bb7a source/Lib/TLibCommon/TComSlice.h
--- a/source/Lib/TLibCommon/TComSlice.h	Tue Oct 22 23:36:36 2013 +0530
+++ b/source/Lib/TLibCommon/TComSlice.h	Wed Oct 23 14:50:34 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 6d96d64c4e9a -r 98e84472bb7a source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Tue Oct 22 23:36:36 2013 +0530
+++ b/source/encoder/encoder.cpp	Wed Oct 23 14:50:34 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);
@@ -293,6 +296,12 @@
         m_analyzeB.printOut('b', fps);
         m_analyzeAll.printOut('a', fps);
     }
+    
+    if (param.bEnableWeightedPred)
+    {
+        fprintf(stderr, "x265 [info]: %d weighted P frames used\n", m_numWPFrames);
+    }
+
 
 #if _SUMMARY_OUT_
     m_analyzeAll.printSummaryOut(fps);
@@ -326,6 +335,7 @@
         stats->globalSsim = 0;
         stats->globalPsnr = 0;
     }
+    stats->totalWPFrames = m_numWPFrames;
 }
 
 #define VERBOSE_RATE 0
diff -r 6d96d64c4e9a -r 98e84472bb7a source/encoder/encoder.h
--- a/source/encoder/encoder.h	Tue Oct 22 23:36:36 2013 +0530
+++ b/source/encoder/encoder.h	Wed Oct 23 14:50:34 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 6d96d64c4e9a -r 98e84472bb7a source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Tue Oct 22 23:36:36 2013 +0530
+++ b/source/encoder/frameencoder.cpp	Wed Oct 23 14:50:34 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 6d96d64c4e9a -r 98e84472bb7a source/x265.h
--- a/source/x265.h	Tue Oct 22 23:36:36 2013 +0530
+++ b/source/x265.h	Wed Oct 23 14:50:34 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