Changeset 1412 in 3DVCSoftware for branches/HTM-16.2-dev/source/Lib/TLibCommon/TComPicSym.cpp
- Timestamp:
- 12 Apr 2018, 11:12:21 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-16.2-dev/source/Lib/TLibCommon/TComPicSym.cpp
r1405 r1412 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 6, ITU/ISO/IEC6 * Copyright (c) 2010-2017, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 64 64 ,m_puiTileIdxMap(NULL) 65 65 ,m_ctuRsToTsAddrMap(NULL) 66 #if REDUCED_ENCODER_MEMORY 67 ,m_dpbPerCtuData(NULL) 68 #endif 66 69 ,m_saoBlkParams(NULL) 67 70 #if ADAPTIVE_QP_SELECTION … … 77 80 78 81 82 #if REDUCED_ENCODER_MEMORY 83 Void TComPicSym::create ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth, const Bool bAllocateCtuArray ) 84 #else 79 85 Void TComPicSym::create ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth ) 80 { 86 #endif 87 { 88 destroy(); 89 81 90 m_sps = sps; 82 91 m_pps = pps; 83 92 93 #if !REDUCED_ENCODER_MEMORY 84 94 const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc(); 95 #endif 85 96 const Int iPicWidth = sps.getPicWidthInLumaSamples(); 86 97 const Int iPicHeight = sps.getPicHeightInLumaSamples(); … … 101 112 102 113 m_numCtusInFrame = m_frameWidthInCtus * m_frameHeightInCtus; 114 #if REDUCED_ENCODER_MEMORY 115 m_pictureCtuArray = NULL; 116 #else 103 117 m_pictureCtuArray = new TComDataCU*[m_numCtusInFrame]; 118 #endif 104 119 105 120 clearSliceBuffer(); … … 113 128 #endif 114 129 130 #if REDUCED_ENCODER_MEMORY 131 if (bAllocateCtuArray) 132 { 133 prepareForReconstruction(); 134 } 135 #else 115 136 for (UInt i=0; i<m_numCtusInFrame ; i++ ) 116 137 { … … 122 143 ); 123 144 } 145 #endif 124 146 125 147 m_ctuTsToRsAddrMap = new UInt[m_numCtusInFrame+1]; … … 141 163 } 142 164 165 #if REDUCED_ENCODER_MEMORY 166 Void TComPicSym::prepareForReconstruction() 167 { 168 const ChromaFormat chromaFormatIDC = m_sps.getChromaFormatIdc(); 169 const UInt uiMaxCuWidth = m_sps.getMaxCUWidth(); 170 const UInt uiMaxCuHeight = m_sps.getMaxCUHeight(); 171 if (m_pictureCtuArray == NULL) 172 { 173 m_pictureCtuArray = new TComDataCU*[m_numCtusInFrame]; 174 175 for (UInt i=0; i<m_numCtusInFrame ; i++ ) 176 { 177 m_pictureCtuArray[i] = new TComDataCU; 178 m_pictureCtuArray[i]->create( chromaFormatIDC, m_numPartitionsInCtu, uiMaxCuWidth, uiMaxCuHeight, false, uiMaxCuWidth >> m_uhTotalDepth 179 #if ADAPTIVE_QP_SELECTION 180 , m_pParentARLBuffer 181 #endif 182 ); 183 } 184 } 185 if (m_dpbPerCtuData == NULL) 186 { 187 m_dpbPerCtuData = new DPBPerCtuData[m_numCtusInFrame]; 188 for(UInt i=0; i<m_numCtusInFrame; i++) 189 { 190 for(Int j=0; j<NUM_REF_PIC_LIST_01; j++) 191 { 192 m_dpbPerCtuData[i].m_CUMvField[j].create( m_numPartitionsInCtu ); 193 } 194 m_dpbPerCtuData[i].m_pePredMode = new SChar[m_numPartitionsInCtu]; 195 memset(m_dpbPerCtuData[i].m_pePredMode, NUMBER_OF_PREDICTION_MODES, m_numPartitionsInCtu); 196 m_dpbPerCtuData[i].m_pePartSize = new SChar[m_numPartitionsInCtu]; 197 memset(m_dpbPerCtuData[i].m_pePartSize, NUMBER_OF_PART_SIZES, m_numPartitionsInCtu); 198 m_dpbPerCtuData[i].m_pSlice=NULL; 199 } 200 } 201 } 202 203 Void TComPicSym::releaseReconstructionIntermediateData() 204 { 205 if (m_pictureCtuArray) 206 { 207 for (Int i = 0; i < m_numCtusInFrame; i++) 208 { 209 if (m_pictureCtuArray[i]) 210 { 211 m_pictureCtuArray[i]->destroy(); 212 delete m_pictureCtuArray[i]; 213 m_pictureCtuArray[i] = NULL; 214 } 215 } 216 delete [] m_pictureCtuArray; 217 m_pictureCtuArray = NULL; 218 } 219 } 220 221 Void TComPicSym::releaseAllReconstructionData() 222 { 223 releaseReconstructionIntermediateData(); 224 225 if (m_dpbPerCtuData != NULL) 226 { 227 for(UInt i=0; i<m_numCtusInFrame; i++) 228 { 229 for(Int j=0; j<NUM_REF_PIC_LIST_01; j++) 230 { 231 m_dpbPerCtuData[i].m_CUMvField[j].destroy(); 232 } 233 delete [] m_dpbPerCtuData[i].m_pePredMode; 234 delete [] m_dpbPerCtuData[i].m_pePartSize; 235 } 236 delete [] m_dpbPerCtuData; 237 m_dpbPerCtuData=NULL; 238 } 239 } 240 #endif 241 143 242 Void TComPicSym::destroy() 144 243 { 145 244 clearSliceBuffer(); 146 245 246 #if REDUCED_ENCODER_MEMORY 247 releaseAllReconstructionData(); 248 #else 147 249 if (m_pictureCtuArray) 148 250 { … … 159 261 m_pictureCtuArray = NULL; 160 262 } 263 #endif 161 264 162 265 delete [] m_ctuTsToRsAddrMap; … … 497 600 { 498 601 } 602 603 #if MCTS_ENC_CHECK 604 605 Void getTilePosition(const TComDataCU* const pcCU, UInt &tileXPosInCtus, UInt &tileYPosInCtus, UInt &tileWidthtInCtus, UInt &tileHeightInCtus) 606 { 607 const UInt currentTileIdx = pcCU->getPic()->getPicSym()->getTileIdxMap(pcCU->getCtuRsAddr()); 608 const TComTile *pCurrentTile = pcCU->getPic()->getPicSym()->getTComTile(currentTileIdx); 609 const UInt frameWidthInCtus = pcCU->getPic()->getPicSym()->getFrameWidthInCtus(); 610 const UInt firstCtuRsAddrOfTile = pcCU->getPic()->getPicSym()->getTComTile(pcCU->getPic()->getPicSym()->getTileIdxMap(pcCU->getCtuRsAddr()))->getFirstCtuRsAddr(); 611 612 tileXPosInCtus = firstCtuRsAddrOfTile % frameWidthInCtus; 613 tileYPosInCtus = firstCtuRsAddrOfTile / frameWidthInCtus; 614 tileWidthtInCtus = pCurrentTile->getTileWidthInCtus(); 615 tileHeightInCtus = pCurrentTile->getTileHeightInCtus(); 616 } 617 618 #endif 619 499 620 //! \}
Note: See TracChangeset for help on using the changeset viewer.