Commits

Steve Borho committed 44433a2 Merge

Merge with stable

Comments (0)

Files changed (3)

source/common/quant.cpp

 {
     if (transQuantBypass)
     {
-        primitives.cvt32to16_shr(residual, coeff, stride, 0, 1 << log2TrSize);
+        primitives.cvt32to16_shl[log2TrSize - 2](residual, coeff, stride, 0);
         return;
     }
 
 #if X265_DEPTH <= 10
         primitives.cvt32to16_shr(residual, m_resiDctCoeff, stride, shift, trSize);
 #else
-        if (shift >= 0)
+        if (shift > 0)
             primitives.cvt32to16_shr(residual, m_resiDctCoeff, stride, shift, trSize);
         else
             primitives.cvt32to16_shl[log2TrSize - 2](residual, m_resiDctCoeff, stride, -shift);

source/encoder/ratecontrol.cpp

     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;
                 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;
     // 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,
     while (pic_in && !b_ctrl_c)
     {
         pic_orig.poc = inFrameCount;
-        if (cliopt.qpfile)
+        if (cliopt.qpfile && !param->rc.bStatRead)
         {
             if (!cliopt.parseQPFile(pic_orig))
             {