[x265] [PATCH] rc: write I/i slice in stats file based on whether openGop is enabled or not

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Mon Aug 25 08:31:07 CEST 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1408946307 -19800
#      Mon Aug 25 11:28:27 2014 +0530
# Node ID c71cf2abe789b7bb7696201c9cff99c438109a0a
# Parent  6e6756f94b27c3ef30f6159f1880112a7ff978e3
rc: write I/i slice in stats file based on whether openGop is enabled or not.

diff -r 6e6756f94b27 -r c71cf2abe789 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Fri Aug 22 15:53:34 2014 -0500
+++ b/source/encoder/ratecontrol.cpp	Mon Aug 25 11:28:27 2014 +0530
@@ -320,6 +320,7 @@
     m_startEndOrder.set(0);
     m_bTerminated = false;
     m_finalFrameCount = 0;
+    m_numEntries = 0;
     if (m_param->rc.rateControlMode == X265_RC_CRF)
     {
         m_param->rc.qp = (int)m_param->rc.rfConstant;
@@ -1033,7 +1034,7 @@
                 m_param->bframes = 1;
             return X265_TYPE_AUTO;
         }
-        int frameType = m_rce2Pass[frameNum].sliceType == I_SLICE ? (m_rce2Pass[frameNum].poc == 0 ? X265_TYPE_I : X265_TYPE_IDR)
+        int frameType = m_rce2Pass[frameNum].sliceType == I_SLICE ? (frameNum > 0 && m_param->bOpenGOP ? X265_TYPE_I : X265_TYPE_IDR)
                             : m_rce2Pass[frameNum].sliceType == P_SLICE ? X265_TYPE_P
                             : (m_rce2Pass[frameNum].sliceType == B_SLICE && m_rce2Pass[frameNum].keptAsRef? X265_TYPE_BREF : X265_TYPE_B);
         return frameType;
@@ -2080,7 +2081,7 @@
     // Write frame stats into the stats file if 2 pass is enabled.
     if (m_param->rc.bStatWrite)
     {
-        char cType = rce->sliceType == I_SLICE ? (rce->poc == 0 ? 'I' : 'i')
+        char cType = rce->sliceType == I_SLICE ? (rce->poc > 0 && m_param->bOpenGOP ? 'i' : 'I')
             : rce->sliceType == P_SLICE ? 'P'
             : IS_REFERENCED(slice) ? 'B' : 'b';
         if (fprintf(m_statFileOut,


More information about the x265-devel mailing list