Ticket #29: RDO_bit_estimate.patch
File RDO_bit_estimate.patch, 9.5 KB (added by tpoirier, 8 years ago) |
---|
-
Lib/TLibCommon/TypeDef.h
47 47 //! \ingroup TLibCommon 48 48 //! \{ 49 49 50 #define FIX_RDOQ_BIT_ESTIMATE 1 // correct RDOQ uninitialized values in case of vertical scan 51 50 52 /////////////////////////////////////////////////////////// 51 53 // KTA tools section start 52 54 /////////////////////////////////////////////////////////// -
Lib/TLibEncoder/TEncCavlc.cpp
1522 1522 assert(0); 1523 1523 } 1524 1524 1525 Void TEncCavlc::estBit( estBitsSbacStruct* /*pcEstBitsCabac*/, Int /*width*/, Int /*height*/, ChannelType /*chType*/ ) 1525 Void TEncCavlc::estBit( estBitsSbacStruct* /*pcEstBitsCabac*/, Int /*width*/, Int /*height*/, ChannelType /*chType*/ 1526 #if FIX_RDOQ_BIT_ESTIMATE 1527 , UInt /*uiScanIdx*/ 1528 #endif 1529 ) 1526 1530 { 1527 1531 // printf("error : no VLC mode support in this version\n"); 1528 1532 return; -
Lib/TLibEncoder/TEncCavlc.h
177 177 Void codeKLTFlags (TComTU &rTu, ComponentID component); 178 178 #endif 179 179 180 Void estBit ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType ); 180 Void estBit ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType 181 #if FIX_RDOQ_BIT_ESTIMATE 182 , UInt uiScanIdx 183 #endif 184 ); 181 185 182 186 Void xCodePredWeightTable ( TComSlice* pcSlice ); 183 187 -
Lib/TLibEncoder/TEncEntropy.cpp
1205 1205 } 1206 1206 } 1207 1207 1208 Void TEncEntropy::estimateBit (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, const ChannelType chType) 1208 Void TEncEntropy::estimateBit (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, const ChannelType chType 1209 #if FIX_RDOQ_BIT_ESTIMATE 1210 , UInt uiScanIdx 1211 #endif 1212 ) 1209 1213 { 1210 1214 #if JVET_C0024_QTBT 1211 1215 if (width==2 || height==2) … … 1213 1217 return; //don't use RDOQ for 2xn; 1214 1218 } 1215 1219 1216 m_pcEntropyCoderIf->estBit ( pcEstBitsSbac, width, height, chType ); 1220 m_pcEntropyCoderIf->estBit ( pcEstBitsSbac, width, height, chType 1221 #if FIX_RDOQ_BIT_ESTIMATE 1222 , uiScanIdx 1223 #endif 1224 ); 1217 1225 #else 1218 1226 const UInt heightAtEntropyCoding = (width != height) ? (height >> 1) : height; 1219 1227 -
Lib/TLibEncoder/TEncEntropy.h
150 150 virtual Void codeKLTFlags (TComTU &rTu, ComponentID component) = 0; 151 151 #endif 152 152 virtual Void codeSAOBlkParam (SAOBlkParam& saoBlkParam, const BitDepths &bitDepths, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false) =0; 153 virtual Void estBit (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType) = 0; 153 virtual Void estBit (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType 154 #if FIX_RDOQ_BIT_ESTIMATE 155 , UInt uiScanIdx 156 #endif 157 ) = 0; 154 158 155 159 virtual Void codeExplicitRdpcmMode ( TComTU &rTu, const ComponentID compID ) = 0; 156 160 … … 323 327 324 328 Void encodeCoeffNxN ( TComTU &rTu, TCoeff* pcCoef, const ComponentID compID ); 325 329 326 Void estimateBit ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType ); 330 Void estimateBit ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType 331 #if FIX_RDOQ_BIT_ESTIMATE 332 , UInt uiScanIdx 333 #endif 334 ); 327 335 328 336 Void encodeSAOBlkParam(SAOBlkParam& saoBlkParam, const BitDepths &bitDepths, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail){m_pcEntropyCoderIf->codeSAOBlkParam(saoBlkParam, bitDepths, sliceEnabled, leftMergeAvail, aboveMergeAvail, false);} 329 337 -
Lib/TLibEncoder/TEncSbac.cpp
2803 2803 * estimate bit cost for CBP, significant map and significant coefficients 2804 2804 **************************************************************************** 2805 2805 */ 2806 Void TEncSbac::estBit( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType ) 2806 Void TEncSbac::estBit( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType 2807 #if FIX_RDOQ_BIT_ESTIMATE 2808 , UInt uiScanIdx 2809 #endif 2810 ) 2807 2811 { 2808 2812 estCBFBit( pcEstBitsSbac ); 2809 2813 … … 2813 2817 estSignificantMapBit( pcEstBitsSbac, width, height, chType ); 2814 2818 2815 2819 // encode last significant position 2816 estLastSignificantPositionBit( pcEstBitsSbac, width, height, chType ); 2820 estLastSignificantPositionBit( pcEstBitsSbac, width, height, chType 2821 #if FIX_RDOQ_BIT_ESTIMATE 2822 , uiScanIdx 2823 #endif 2824 ); 2817 2825 2818 2826 // encode significant coefficients 2819 2827 estSignificantCoefficientsBit( pcEstBitsSbac, chType ); … … 2963 2971 **************************************************************************** 2964 2972 */ 2965 2973 2966 Void TEncSbac::estLastSignificantPositionBit( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType ) 2974 Void TEncSbac::estLastSignificantPositionBit( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType 2975 #if FIX_RDOQ_BIT_ESTIMATE 2976 , UInt uiScanIdx 2977 #endif 2978 ) 2967 2979 { 2968 2980 //--------------------------------------------------------------------------------------------------. 2981 #if FIX_RDOQ_BIT_ESTIMATE 2982 // swap 2983 if (uiScanIdx == SCAN_VER) 2984 { 2985 swap(width, height); 2986 } 2987 #endif 2969 2988 2970 2989 //set up the number of channels 2971 2990 -
Lib/TLibEncoder/TEncSbac.h
214 214 // for RD-optimizatioon 215 215 // ------------------------------------------------------------------------------------------------------------------- 216 216 217 Void estBit (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType); 217 Void estBit (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType 218 #if FIX_RDOQ_BIT_ESTIMATE 219 , UInt uiScanIdx 220 #endif 221 ); 218 222 Void estCBFBit ( estBitsSbacStruct* pcEstBitsSbac ); 219 223 Void estSignificantCoeffGroupMapBit( estBitsSbacStruct* pcEstBitsSbac, ChannelType chType ); 220 224 Void estSignificantMapBit ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType ); 221 Void estLastSignificantPositionBit ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType ); 225 Void estLastSignificantPositionBit ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType 226 #if FIX_RDOQ_BIT_ESTIMATE 227 , UInt uiScanIdx 228 #endif 229 ); 222 230 Void estSignificantCoefficientsBit ( estBitsSbacStruct* pcEstBitsSbac, ChannelType chType ); 223 231 224 232 Void codeExplicitRdpcmMode ( TComTU &rTu, const ComponentID compID ); -
Lib/TLibEncoder/TEncSearch.cpp
1881 1881 if( useTransformSkip ? m_pcEncCfg->getUseRDOQTS() : m_pcEncCfg->getUseRDOQ() ) 1882 1882 #endif 1883 1883 { 1884 m_pcEntropyCoder->estimateBit( m_pcTrQuant->m_pcEstBitsSbac, uiWidth, uiHeight, chType ); 1884 #if FIX_RDOQ_BIT_ESTIMATE 1885 COEFF_SCAN_TYPE scanType = COEFF_SCAN_TYPE(pcCU->getCoefScanIdx(uiAbsPartIdx, uiWidth, uiHeight, compID)); 1886 #endif 1887 m_pcEntropyCoder->estimateBit( m_pcTrQuant->m_pcEstBitsSbac, uiWidth, uiHeight, chType 1888 #if FIX_RDOQ_BIT_ESTIMATE 1889 , scanType 1890 #endif 1891 ); 1885 1892 } 1886 1893 1887 1894 //--- transform and quantization --- … … 2192 2199 if (useTransformSkip ? m_pcEncCfg->getUseRDOQTS() : m_pcEncCfg->getUseRDOQ()) 2193 2200 #endif 2194 2201 { 2195 m_pcEntropyCoder->estimateBit(m_pcTrQuant->m_pcEstBitsSbac, uiWidth, uiHeight, chType); 2202 #if FIX_RDOQ_BIT_ESTIMATE 2203 COEFF_SCAN_TYPE scanType = COEFF_SCAN_TYPE(pcCU->getCoefScanIdx(uiAbsPartIdx, uiWidth, uiHeight, compID)); 2204 #endif 2205 m_pcEntropyCoder->estimateBit(m_pcTrQuant->m_pcEstBitsSbac, uiWidth, uiHeight, chType 2206 #if FIX_RDOQ_BIT_ESTIMATE 2207 , scanType 2208 #endif 2209 ); 2196 2210 } 2197 2211 2198 2212 //--- transform and quantization --- … … 8720 8734 8721 8735 if ((compID != COMPONENT_Cr) && ((transformSkipModeId == 1) ? m_pcEncCfg->getUseRDOQTS() : m_pcEncCfg->getUseRDOQ())) 8722 8736 { 8723 m_pcEntropyCoder->estimateBit(m_pcTrQuant->m_pcEstBitsSbac, tuCompRect.width, tuCompRect.height, toChannelType(compID)); 8737 #if FIX_RDOQ_BIT_ESTIMATE 8738 COEFF_SCAN_TYPE scanType = COEFF_SCAN_TYPE(pcCU->getCoefScanIdx(uiAbsPartIdx, tuCompRect.width, tuCompRect.height, compID)); 8739 #endif 8740 m_pcEntropyCoder->estimateBit(m_pcTrQuant->m_pcEstBitsSbac, tuCompRect.width, tuCompRect.height, toChannelType(compID) 8741 #if FIX_RDOQ_BIT_ESTIMATE 8742 , scanType 8743 #endif 8744 ); 8724 8745 } 8725 8746 8726 8747 #if RDOQ_CHROMA_LAMBDA