[x265] [PATCH] stats: add x265_frame_stats structure and copy frame level CU statistics

Divya Manivannan divya at multicorewareinc.com
Fri Jun 5 15:01:19 CEST 2015


# HG changeset patch
# User Divya Manivannan <divya at multicorewareinc.com>
# Date 1433509199 -19800
#      Fri Jun 05 18:29:59 2015 +0530
# Node ID 69ddf6001b990130e6b03d1126c1b7c4103af8db
# Parent  98e0e6e63c8a7884379e62c051054fc9e197fbf0
stats: add x265_frame_stats structure and copy frame level CU statistics

diff -r 98e0e6e63c8a -r 69ddf6001b99 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Fri Jun 05 18:25:13 2015 +0530
+++ b/source/encoder/encoder.cpp	Fri Jun 05 18:29:59 2015 +0530
@@ -615,6 +615,8 @@
                 pic_out->planes[2] = recpic->m_picOrg[2];
                 pic_out->stride[2] = (int)(recpic->m_strideC * sizeof(pixel));
 
+                fetchFrameStats(&(pic_out->frameData), sizeof(pic_out->frameData), curEncoder);
+
                 /* Dump analysis data from pic_out to file in save mode and free */
                 if (m_param->analysisMode == X265_ANALYSIS_SAVE)
                 {
@@ -1082,6 +1084,21 @@
      * future safety) */
 }
 
+void Encoder::fetchFrameStats(x265_frame_stats *frameStats, size_t frameStatsSize, FrameEncoder* curEncoder)
+{
+    if (frameStatsSize >= sizeof(frameStats))
+    {
+        frameStats->percentIntraNxN = curEncoder->m_frameStats.percentIntraNxN;
+        for (uint32_t depth = 0; depth <= g_maxCUDepth; depth++)
+        {
+            frameStats->percentInterCu[depth] = curEncoder->m_frameStats.percentInterCu[depth];
+            frameStats->percentIntraCu[depth] = curEncoder->m_frameStats.percentIntraCu[depth];
+            frameStats->percentSkipCu[depth]  = curEncoder->m_frameStats.percentSkipCu[depth];
+            frameStats->percentTotalCu[depth] = curEncoder->m_frameStats.percentTotalCu[depth];
+        }
+    }
+}
+
 void Encoder::writeLog(int argc, char **argv)
 {
     if (m_csvfpt)
diff -r 98e0e6e63c8a -r 69ddf6001b99 source/encoder/encoder.h
--- a/source/encoder/encoder.h	Fri Jun 05 18:25:13 2015 +0530
+++ b/source/encoder/encoder.h	Fri Jun 05 18:29:59 2015 +0530
@@ -149,6 +149,8 @@
 
     void fetchStats(x265_stats* stats, size_t statsSizeBytes);
 
+    void fetchFrameStats(x265_frame_stats* frameStats, size_t frameStatsSize, FrameEncoder* curEncoder);
+
     void writeLog(int argc, char **argv);
 
     void printSummary();
diff -r 98e0e6e63c8a -r 69ddf6001b99 source/x265.h
--- a/source/x265.h	Fri Jun 05 18:25:13 2015 +0530
+++ b/source/x265.h	Fri Jun 05 18:29:59 2015 +0530
@@ -100,6 +100,16 @@
     uint32_t         numPartitions;
 } x265_analysis_data;
 
+/* Frame level statistics*/
+typedef struct x265_frame_stats
+{
+    double      percentIntraCu[4];
+    double      percentInterCu[4];
+    double      percentSkipCu[4];
+    double      percentIntraNxN;
+    double      percentTotalCu[4];
+} x265_frame_stats;
+
 /* Used to pass pictures into the encoder, and to get picture data back out of
  * the encoder.  The input and output semantics are different */
 typedef struct x265_picture
@@ -161,6 +171,9 @@
      * this data structure */
     x265_analysis_data analysisData;
 
+    /* Frame level statistics*/
+    x265_frame_stats frameData;
+
 } x265_picture;
 
 typedef enum


More information about the x265-devel mailing list