Ticket #42: CTU_bit_distortion_calculation_fix.patch

File CTU_bit_distortion_calculation_fix.patch, 1.7 KB (added by FangliangSong, 7 years ago)
  • source/Lib/TLibCommon/TypeDef.h

     
    317317#define FIX_TICKET37                                      1  ///< Fix of ticket #37 (incorrect m_pppcPredYuvBest buffer copy)
    318318#define FIX_TICKET39                                      1  ///< Fix of ticket #39 (encoder bug of delta QP)
    319319#define FIX_TICKET40                                      1  ///< Fix of ticket #40 (ALF crash when image height is greater than image width)
     320#define FIX_TICKET42                                      1  ///< Fix of ticket #42 (CTU bits/distortion calculation mistake for I slice when QTBT is enabled)
    320321
    321322///////////////////////////////////////////////////////////
    322323// KTA tools section end
  • source/Lib/TLibEncoder/TEncCu.cpp

     
    880880      }
    881881#endif
    882882
     883#if FIX_TICKET42
     884          Double dLumaCTBTotalCost = pCtu->getTotalCost();
     885          Distortion dLumaCTBTotalDistortion = pCtu->getTotalDistortion();
     886          UInt uiLumaCTBTotalBits = pCtu->getTotalBits();
     887          UInt uiLumaCTBTotalBins = pCtu->getTotalBins();
     888#endif
    883889      xCompressCU( m_pppcBestCU[uiWidthIdx][uiHeightIdx], m_pppcTempCU[uiWidthIdx][uiHeightIdx], 0, uiCTUSize, uiCTUSize, 0 DEBUG_STRING_PASS_INTO(sDebug) );
     890#if FIX_TICKET42
     891          pCtu->getTotalCost() += dLumaCTBTotalCost;
     892          pCtu->getTotalDistortion() += dLumaCTBTotalDistortion;
     893          pCtu->getTotalBits() += uiLumaCTBTotalBits;
     894          pCtu->getTotalBins() += uiLumaCTBTotalBins;
     895#endif
    884896    }
    885897#endif
    886898