Changeset 593 in SHVCSoftware for branches/SHM-5.0-dev/source/Lib/TLibEncoder/TEncTop.cpp
- Timestamp:
- 2 Feb 2014, 04:51:29 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-5.0-dev/source/Lib/TLibEncoder/TEncTop.cpp
r562 r593 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 3, ITU/ISO/IEC6 * Copyright (c) 2010-2014, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 129 129 if (m_bUseSAO) 130 130 { 131 #if HM_CLEANUP_SAO132 131 #if AUXILIARY_PICTURES 133 132 m_cEncSAO.create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); … … 140 139 m_cEncSAO.createEncData(); 141 140 #endif 142 #else143 m_cEncSAO.setSaoLcuBoundary(getSaoLcuBoundary());144 m_cEncSAO.setSaoLcuBasedOptimization(getSaoLcuBasedOptimization());145 m_cEncSAO.setMaxNumOffsetsPerPic(getMaxNumOffsetsPerPic());146 m_cEncSAO.create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight );147 m_cEncSAO.createEncBuffer();148 #endif149 141 } 150 142 #if ADAPTIVE_QP_SELECTION … … 161 153 g_uiMaxCUWidth, g_uiMaxCUHeight, m_RCKeepHierarchicalBit, m_RCUseLCUSeparateModel, m_GOPList ); 162 154 } 163 // if SBAC-based RD optimization is used 164 if( m_bUseSBACRD ) 165 { 166 m_pppcRDSbacCoder = new TEncSbac** [g_uiMaxCUDepth+1]; 155 156 m_pppcRDSbacCoder = new TEncSbac** [g_uiMaxCUDepth+1]; 167 157 #if FAST_BIT_EST 168 169 #else 170 171 #endif 172 173 174 175 158 m_pppcBinCoderCABAC = new TEncBinCABACCounter** [g_uiMaxCUDepth+1]; 159 #else 160 m_pppcBinCoderCABAC = new TEncBinCABAC** [g_uiMaxCUDepth+1]; 161 #endif 162 163 for ( Int iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ ) 164 { 165 m_pppcRDSbacCoder[iDepth] = new TEncSbac* [CI_NUM]; 176 166 #if FAST_BIT_EST 177 178 #else 179 180 #endif 181 182 183 184 167 m_pppcBinCoderCABAC[iDepth] = new TEncBinCABACCounter* [CI_NUM]; 168 #else 169 m_pppcBinCoderCABAC[iDepth] = new TEncBinCABAC* [CI_NUM]; 170 #endif 171 172 for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ ) 173 { 174 m_pppcRDSbacCoder[iDepth][iCIIdx] = new TEncSbac; 185 175 #if FAST_BIT_EST 186 m_pppcBinCoderCABAC [iDepth][iCIIdx] = new TEncBinCABACCounter; 187 #else 188 m_pppcBinCoderCABAC [iDepth][iCIIdx] = new TEncBinCABAC; 189 #endif 190 m_pppcRDSbacCoder [iDepth][iCIIdx]->init( m_pppcBinCoderCABAC [iDepth][iCIIdx] ); 191 } 176 m_pppcBinCoderCABAC [iDepth][iCIIdx] = new TEncBinCABACCounter; 177 #else 178 m_pppcBinCoderCABAC [iDepth][iCIIdx] = new TEncBinCABAC; 179 #endif 180 m_pppcRDSbacCoder [iDepth][iCIIdx]->init( m_pppcBinCoderCABAC [iDepth][iCIIdx] ); 192 181 } 193 182 } … … 226 215 m_pcSbacCoders[ui].init( &m_pcBinCoderCABACs[ui] ); 227 216 } 228 if( m_bUseSBACRD ) 229 { 230 m_ppppcRDSbacCoders = new TEncSbac*** [iNumSubstreams]; 231 m_ppppcBinCodersCABAC = new TEncBinCABAC***[iNumSubstreams]; 232 for ( UInt ui = 0 ; ui < iNumSubstreams ; ui++ ) 233 { 234 m_ppppcRDSbacCoders[ui] = new TEncSbac** [g_uiMaxCUDepth+1]; 235 m_ppppcBinCodersCABAC[ui]= new TEncBinCABAC** [g_uiMaxCUDepth+1]; 236 237 for ( Int iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ ) 238 { 239 m_ppppcRDSbacCoders[ui][iDepth] = new TEncSbac* [CI_NUM]; 240 m_ppppcBinCodersCABAC[ui][iDepth]= new TEncBinCABAC* [CI_NUM]; 241 242 for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ ) 243 { 244 m_ppppcRDSbacCoders [ui][iDepth][iCIIdx] = new TEncSbac; 245 m_ppppcBinCodersCABAC[ui][iDepth][iCIIdx] = new TEncBinCABAC; 246 m_ppppcRDSbacCoders [ui][iDepth][iCIIdx]->init( m_ppppcBinCodersCABAC[ui][iDepth][iCIIdx] ); 247 } 217 218 m_ppppcRDSbacCoders = new TEncSbac*** [iNumSubstreams]; 219 m_ppppcBinCodersCABAC = new TEncBinCABAC***[iNumSubstreams]; 220 for ( UInt ui = 0 ; ui < iNumSubstreams ; ui++ ) 221 { 222 m_ppppcRDSbacCoders[ui] = new TEncSbac** [g_uiMaxCUDepth+1]; 223 m_ppppcBinCodersCABAC[ui]= new TEncBinCABAC** [g_uiMaxCUDepth+1]; 224 225 for ( Int iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ ) 226 { 227 m_ppppcRDSbacCoders[ui][iDepth] = new TEncSbac* [CI_NUM]; 228 m_ppppcBinCodersCABAC[ui][iDepth]= new TEncBinCABAC* [CI_NUM]; 229 230 for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ ) 231 { 232 m_ppppcRDSbacCoders [ui][iDepth][iCIIdx] = new TEncSbac; 233 m_ppppcBinCodersCABAC[ui][iDepth][iCIIdx] = new TEncBinCABAC; 234 m_ppppcRDSbacCoders [ui][iDepth][iCIIdx]->init( m_ppppcBinCodersCABAC[ui][iDepth][iCIIdx] ); 248 235 } 249 236 } … … 259 246 if (m_cSPS.getUseSAO()) 260 247 { 261 #if HM_CLEANUP_SAO262 248 m_cEncSAO.destroyEncData(); 263 249 m_cEncSAO.destroy(); 264 #else265 m_cEncSAO.destroy();266 m_cEncSAO.destroyEncBuffer();267 #endif268 250 } 269 251 m_cLoopFilter. destroy(); 270 252 m_cRateCtrl. destroy(); 271 // SBAC RD 272 if( m_bUseSBACRD ) 273 { 274 Int iDepth; 253 254 Int iDepth; 255 for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ ) 256 { 257 for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ ) 258 { 259 delete m_pppcRDSbacCoder[iDepth][iCIIdx]; 260 delete m_pppcBinCoderCABAC[iDepth][iCIIdx]; 261 } 262 } 263 264 for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ ) 265 { 266 delete [] m_pppcRDSbacCoder[iDepth]; 267 delete [] m_pppcBinCoderCABAC[iDepth]; 268 } 269 270 delete [] m_pppcRDSbacCoder; 271 delete [] m_pppcBinCoderCABAC; 272 273 for ( UInt ui = 0; ui < m_iNumSubstreams; ui++ ) 274 { 275 275 for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ ) 276 276 { 277 277 for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ ) 278 278 { 279 delete m_ppp cRDSbacCoder[iDepth][iCIIdx];280 delete m_ppp cBinCoderCABAC[iDepth][iCIIdx];281 } 282 } 283 279 delete m_ppppcRDSbacCoders [ui][iDepth][iCIIdx]; 280 delete m_ppppcBinCodersCABAC[ui][iDepth][iCIIdx]; 281 } 282 } 283 284 284 for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ ) 285 285 { 286 delete [] m_pppcRDSbacCoder[iDepth]; 287 delete [] m_pppcBinCoderCABAC[iDepth]; 288 } 289 290 delete [] m_pppcRDSbacCoder; 291 delete [] m_pppcBinCoderCABAC; 292 293 for ( UInt ui = 0; ui < m_iNumSubstreams; ui++ ) 294 { 295 for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ ) 296 { 297 for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ ) 298 { 299 delete m_ppppcRDSbacCoders [ui][iDepth][iCIIdx]; 300 delete m_ppppcBinCodersCABAC[ui][iDepth][iCIIdx]; 301 } 302 } 303 304 for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ ) 305 { 306 delete [] m_ppppcRDSbacCoders [ui][iDepth]; 307 delete [] m_ppppcBinCodersCABAC[ui][iDepth]; 308 } 309 delete[] m_ppppcRDSbacCoders [ui]; 310 delete[] m_ppppcBinCodersCABAC[ui]; 311 } 312 delete[] m_ppppcRDSbacCoders; 313 delete[] m_ppppcBinCodersCABAC; 314 } 286 delete [] m_ppppcRDSbacCoders [ui][iDepth]; 287 delete [] m_ppppcBinCodersCABAC[ui][iDepth]; 288 } 289 delete[] m_ppppcRDSbacCoders [ui]; 290 delete[] m_ppppcBinCodersCABAC[ui]; 291 } 292 delete[] m_ppppcRDSbacCoders; 293 delete[] m_ppppcBinCodersCABAC; 315 294 delete[] m_pcSbacCoders; 316 295 delete[] m_pcBinCoderCABACs; … … 525 504 TComPic *pcTopField; 526 505 xGetNewPicBuffer( pcTopField ); 527 #if !HM_CLEANUP_SAO528 pcTopField->getPicSym()->allocSaoParam(&m_cEncSAO);529 #endif530 506 pcTopField->setReconMark (false); 531 507 … … 568 544 TComPic* pcBottomField; 569 545 xGetNewPicBuffer( pcBottomField ); 570 #if !HM_CLEANUP_SAO571 pcBottomField->getPicSym()->allocSaoParam(&m_cEncSAO);572 #endif573 546 pcBottomField->setReconMark (false); 574 547 … … 652 625 TComPic *pcTopField; 653 626 xGetNewPicBuffer( pcTopField ); 654 #if !HM_CLEANUP_SAO655 pcTopField->getPicSym()->allocSaoParam(&m_cEncSAO);656 #endif657 627 pcTopField->setReconMark (false); 658 628 … … 706 676 TComPic* pcBottomField; 707 677 xGetNewPicBuffer( pcBottomField ); 708 #if !HM_CLEANUP_SAO709 pcBottomField->getPicSym()->allocSaoParam(&m_cEncSAO);710 #endif711 678 pcBottomField->setReconMark (false); 712 679 … … 912 879 #endif 913 880 } 914 #if !HM_CLEANUP_SAO915 if (getUseSAO())916 {917 rpcPic->getPicSym()->allocSaoParam(&m_cEncSAO);918 }919 #endif920 881 m_cListPic.pushBack( rpcPic ); 921 882 } … … 1001 962 1002 963 m_cSPS.setTMVPFlagsPresent(false); 1003 m_cSPS.setUseLossless ( m_useLossless );1004 964 1005 965 m_cSPS.setMaxTrSize ( 1 << m_uiQuadtreeTULog2MaxSize ); … … 1038 998 m_cSPS.setMaxTLayers( m_maxTempLayer ); 1039 999 m_cSPS.setTemporalIdNestingFlag( ( m_maxTempLayer == 1 ) ? true : false ); 1040 for ( i = 0; i < m _cSPS.getMaxTLayers(); i++ )1000 for ( i = 0; i < min(m_cSPS.getMaxTLayers(),(UInt) MAX_TLAYER); i++ ) 1041 1001 { 1042 1002 m_cSPS.setMaxDecPicBuffering(m_maxDecPicBuffering[i], i); … … 1098 1058 Bool bUseDQP = (getMaxCuDQPDepth() > 0)? true : false; 1099 1059 1100 #if REPN_FORMAT_IN_VPS 1101 Int lowestQP; 1102 #if O0096_REP_FORMAT_INDEX 1103 if( m_layerId == 0 ) 1104 { 1105 lowestQP = - m_cSPS.getQpBDOffsetY(); 1106 } 1107 else 1108 { 1109 lowestQP = - (m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_cSPS.getUpdateRepFormatFlag() ? m_cSPS.getUpdateRepFormatIndex() : m_layerId ) )->getBitDepthVpsLuma() - 8) * 6; 1110 } 1111 #else 1112 if( m_layerId == 0 || m_cSPS.getUpdateRepFormatFlag() ) 1113 { 1114 lowestQP = - m_cSPS.getQpBDOffsetY(); 1115 } 1116 else 1117 { 1118 lowestQP = - (m_cVPS.getVpsRepFormat( m_cVPS.getVpsRepFormatIdx( m_layerId ) )->getBitDepthVpsLuma() - 8) * 6; 1119 } 1120 #endif 1121 #else 1122 Int lowestQP = - m_cSPS.getQpBDOffsetY(); 1123 #endif 1124 1125 if(getUseLossless()) 1126 { 1127 if ((getMaxCuDQPDepth() == 0) && (getMaxDeltaQP() == 0 ) && (getQP() == lowestQP) ) 1128 { 1129 bUseDQP = false; 1130 } 1131 else 1132 { 1133 bUseDQP = true; 1134 } 1135 } 1136 else 1137 { 1138 if(bUseDQP == false) 1139 { 1140 if((getMaxDeltaQP() != 0 )|| getUseAdaptiveQP()) 1141 { 1142 bUseDQP = true; 1143 } 1144 } 1060 if((getMaxDeltaQP() != 0 )|| getUseAdaptiveQP()) 1061 { 1062 bUseDQP = true; 1145 1063 } 1146 1064
Note: See TracChangeset for help on using the changeset viewer.