[x265] [PATCH] rc: fix non-IDR slicetype in multi-pass

Divya Manivannan divya at multicorewareinc.com
Wed Sep 14 12:50:15 CEST 2016


# HG changeset patch
# User Divya Manivannan <divya at multicorewareinc.com>
# Date 1473850160 -19800
#      Wed Sep 14 16:19:20 2016 +0530
# Node ID d42f8c94e5f2770ecbaeb7f68b7cd9eca5e8ec0d
# Parent  cc77b9922b199d3a3503147643de237a1c6e827d
rc: fix non-IDR slicetype in multi-pass

diff -r cc77b9922b19 -r d42f8c94e5f2 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Wed Sep 14 13:51:36 2016 +0530
+++ b/source/encoder/ratecontrol.cpp	Wed Sep 14 16:19:20 2016 +0530
@@ -547,8 +547,11 @@
                        &rce->mvBits, &rce->miscBits, &rce->iCuCount, &rce->pCuCount,
                        &rce->skipCuCount);
                 rce->keptAsRef = true;
+                rce->isIdr = false;
                 if (picType == 'b' || picType == 'p')
                     rce->keptAsRef = false;
+                if (picType == 'I')
+                    rce->isIdr = true;
                 if (picType == 'I' || picType == 'i')
                     rce->sliceType = I_SLICE;
                 else if (picType == 'P' || picType == 'p')
@@ -1065,7 +1068,7 @@
             return X265_TYPE_AUTO;
         }
         int index = m_encOrder[frameNum];
-        int frameType = m_rce2Pass[index].sliceType == I_SLICE ? (frameNum > 0 && m_param->bOpenGOP ? X265_TYPE_I : X265_TYPE_IDR)
+        int frameType = m_rce2Pass[index].sliceType == I_SLICE ? (m_rce2Pass[index].isIdr ? X265_TYPE_IDR : X265_TYPE_I)
                         : m_rce2Pass[index].sliceType == P_SLICE ? X265_TYPE_P
                         : (m_rce2Pass[index].sliceType == B_SLICE && m_rce2Pass[index].keptAsRef ? X265_TYPE_BREF : X265_TYPE_B);
         return frameType;
@@ -2612,7 +2615,7 @@
         ncu = m_ncu * 4;
     else
         ncu = m_ncu;
-    char cType = rce->sliceType == I_SLICE ? (rce->poc > 0 && m_param->bOpenGOP ? 'i' : 'I')
+    char cType = rce->sliceType == I_SLICE ? (curFrame->m_lowres.sliceType == X265_TYPE_IDR ? 'I' : 'i')
         : rce->sliceType == P_SLICE ? 'P'
         : IS_REFERENCED(curFrame) ? 'B' : 'b';
     if (fprintf(m_statFileOut,
diff -r cc77b9922b19 -r d42f8c94e5f2 source/encoder/ratecontrol.h
--- a/source/encoder/ratecontrol.h	Wed Sep 14 13:51:36 2016 +0530
+++ b/source/encoder/ratecontrol.h	Wed Sep 14 16:19:20 2016 +0530
@@ -108,6 +108,7 @@
     int      coeffBits;
     bool     keptAsRef;
     bool     scenecut;
+    bool     isIdr;
 
     SEIPictureTiming *picTimingSEI;
     HRDTiming        *hrdTiming;


More information about the x265-devel mailing list