Changeset 56 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComSlice.cpp
- Timestamp:
- 11 May 2012, 21:20:17 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComSlice.cpp
r42 r56 1 /* The copyright in this software is being made available under the BSD1 /* The copyright in this software is being made available under the BSD 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 1,ISO/IEC6 * Copyright (c) 2010-2012, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 15 15 * this list of conditions and the following disclaimer in the documentation 16 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the I SO/IEC nor the names of its contributors may17 * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may 18 18 * be used to endorse or promote products derived from this software without 19 19 * specific prior written permission. … … 32 32 */ 33 33 34 35 36 34 /** \file TComSlice.cpp 37 35 \brief slice header and SPS class … … 42 40 #include "TComPic.h" 43 41 42 //! \ingroup TLibCommon 43 //! \{ 44 44 45 TComSlice::TComSlice() 45 { 46 m_uiPPSId = 0; 47 m_iPOC = 0; 48 m_eSliceType = I_SLICE; 49 m_iSliceQp = 0; 50 m_iSymbolMode = 1; 51 m_aiNumRefIdx[0] = 0; 52 m_aiNumRefIdx[1] = 0; 53 m_bLoopFilterDisable = false; 46 : m_iPPSId ( -1 ) 47 , m_iPOC ( 0 ) 48 , m_iLastIDR ( 0 ) 49 , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR ) 50 , m_eNalUnitTypeBaseViewMvc ( NAL_UNIT_INVALID ) 51 , m_eSliceType ( I_SLICE ) 52 , m_iSliceQp ( 0 ) 53 #if ADAPTIVE_QP_SELECTION 54 , m_iSliceQpBase ( 0 ) 55 #endif 56 , m_bLoopFilterDisable ( false ) 57 , m_inheritDblParamFromAPS ( true ) 58 , m_loopFilterBetaOffsetDiv2 ( 0 ) 59 , m_loopFilterTcOffsetDiv2 ( 0 ) 60 , m_bRefPicListModificationFlagLC ( false ) 61 , m_bRefPicListCombinationFlag ( false ) 62 , m_bCheckLDC ( false ) 63 , m_iSliceQpDelta ( 0 ) 64 , m_pcTexturePic ( NULL ) 65 , m_iDepth ( 0 ) 66 , m_bRefenced ( false ) 67 , m_pcSPS ( NULL ) 68 , m_pcPPS ( NULL ) 69 , m_pcPic ( NULL ) 70 , m_uiColDir ( 0 ) 71 #if COLLOCATED_REF_IDX 72 , m_colRefIdx ( 0 ) 73 #endif 74 #if ALF_CHROMA_LAMBDA || SAO_CHROMA_LAMBDA 75 , m_dLambdaLuma( 0.0 ) 76 , m_dLambdaChroma( 0.0 ) 77 #else 78 , m_dLambda ( 0.0 ) 79 #endif 80 , m_bNoBackPredFlag ( false ) 81 , m_bRefIdxCombineCoding ( false ) 82 , m_uiTLayer ( 0 ) 83 , m_bTLayerSwitchingFlag ( false ) 84 , m_uiSliceMode ( 0 ) 85 , m_uiSliceArgument ( 0 ) 86 , m_uiSliceCurStartCUAddr ( 0 ) 87 , m_uiSliceCurEndCUAddr ( 0 ) 88 , m_uiSliceIdx ( 0 ) 89 , m_uiEntropySliceMode ( 0 ) 90 , m_uiEntropySliceArgument ( 0 ) 91 , m_uiEntropySliceCurStartCUAddr ( 0 ) 92 , m_uiEntropySliceCurEndCUAddr ( 0 ) 93 , m_bNextSlice ( false ) 94 , m_bNextEntropySlice ( false ) 95 , m_uiSliceBits ( 0 ) 96 , m_uiEntropySliceCounter ( 0 ) 97 , m_bFinalized ( false ) 98 , m_uiTileByteLocation ( NULL ) 99 , m_uiTileCount ( 0 ) 100 , m_iTileMarkerFlag ( 0 ) 101 , m_uiTileOffstForMultES ( 0 ) 102 , m_puiSubstreamSizes ( NULL ) 103 #if CABAC_INIT_FLAG 104 , m_cabacInitFlag ( false ) 105 #else 106 , m_cabacInitIdc ( -1 ) 107 #endif 108 #if TILES_WPP_ENTRY_POINT_SIGNALLING 109 , m_numEntryPointOffsets ( 0 ) 110 #endif 111 #if SONY_COLPIC_AVAILABILITY 112 , m_iViewOrderIdx ( 0 ) 113 #endif 114 { 115 m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0; 54 116 55 m_iSliceQpDelta = 0;117 initEqualRef(); 56 118 57 m_iDepth = 0; 58 59 m_pcPic = NULL; 60 m_bRefenced = false; 61 #ifdef ROUNDING_CONTROL_BIPRED 62 m_bRounding = false; 63 #endif 64 m_uiColDir = 0; 65 66 m_iViewIdx = 0 ; 67 68 #if BITSTREAM_EXTRACTION 69 m_uiLayerId = 0; 70 #endif 71 72 #if SONY_COLPIC_AVAILABILITY 73 m_iViewOrderIdx = 0; 74 #endif 75 76 initEqualRef(); 77 m_bNoBackPredFlag = false; 78 #if MS_LCEC_LOOKUP_TABLE_EXCEPTION 79 m_bRefIdxCombineCoding = false; 80 #endif 81 #if DCM_COMB_LIST 82 m_bRefPicListCombinationFlag = false; 83 m_bRefPicListModificationFlagLC = false; 84 #endif 85 m_uiSliceCurStartCUAddr = 0; 86 m_uiEntropySliceCurStartCUAddr = 0; 87 88 ::memset( m_aaiCodedScale, 0x00, sizeof( m_aaiCodedScale ) ); 89 ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) ); 90 m_pcTexturePic = NULL; 91 #ifdef WEIGHT_PRED 119 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++) 120 { 121 m_iRefIdxOfLC[REF_PIC_LIST_0][iNumCount]=-1; 122 m_iRefIdxOfLC[REF_PIC_LIST_1][iNumCount]=-1; 123 m_eListIdFromIdxOfLC[iNumCount]=0; 124 m_iRefIdxFromIdxOfLC[iNumCount]=0; 125 m_iRefIdxOfL0FromRefIdxOfL1[iNumCount] = -1; 126 m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1; 127 } 128 for(Int iNumCount = 0; iNumCount < MAX_NUM_REF+1; iNumCount++) 129 { 130 m_apcRefPicList [0][iNumCount] = NULL; 131 m_apcRefPicList [1][iNumCount] = NULL; 132 m_aiRefPOCList [0][iNumCount] = 0; 133 m_aiRefPOCList [1][iNumCount] = 0; 134 m_aiRefViewIdList[0][iNumCount] = 0; 135 m_aiRefViewIdList[1][iNumCount] = 0; 136 } 137 m_bCombineWithReferenceFlag = 0; 92 138 resetWpScaling(m_weightPredTable); 139 resetWpScalingLC(m_weightPredTableLC); 93 140 initWpAcDcParam(); 94 #endif95 141 } 96 142 97 143 TComSlice::~TComSlice() 98 144 { 145 if (m_uiTileByteLocation) 146 { 147 delete [] m_uiTileByteLocation; 148 m_uiTileByteLocation = NULL; 149 } 150 delete[] m_puiSubstreamSizes; 151 m_puiSubstreamSizes = NULL; 99 152 } 100 153 … … 106 159 107 160 m_uiColDir = 0; 108 109 ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); 110 ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); 161 162 #if COLLOCATED_REF_IDX 163 m_colRefIdx = 0; 164 #endif 111 165 m_pcTexturePic = NULL; 112 166 113 167 initEqualRef(); 114 168 m_bNoBackPredFlag = false; 115 #if MS_LCEC_LOOKUP_TABLE_EXCEPTION116 169 m_bRefIdxCombineCoding = false; 117 #endif118 #if DCM_COMB_LIST119 170 m_bRefPicListCombinationFlag = false; 120 171 m_bRefPicListModificationFlagLC = false; 121 #endif 172 m_bCheckLDC = false; 173 174 m_aiNumRefIdx[REF_PIC_LIST_C] = 0; 175 176 m_uiMaxNumMergeCand = MRG_MAX_NUM_CANDS_SIGNALED; 177 178 m_bFinalized=false; 179 180 m_uiTileCount = 0; 181 #if CABAC_INIT_FLAG 182 m_cabacInitFlag = false; 183 #endif 184 #if TILES_WPP_ENTRY_POINT_SIGNALLING 185 m_numEntryPointOffsets = 0; 186 #endif 187 } 188 189 Void TComSlice::initTiles() 190 { 191 Int iWidth = m_pcSPS->getPicWidthInLumaSamples(); 192 Int iHeight = m_pcSPS->getPicHeightInLumaSamples(); 193 UInt uiWidthInCU = ( iWidth %g_uiMaxCUWidth ) ? iWidth /g_uiMaxCUWidth + 1 : iWidth /g_uiMaxCUWidth; 194 UInt uiHeightInCU = ( iHeight%g_uiMaxCUHeight ) ? iHeight/g_uiMaxCUHeight + 1 : iHeight/g_uiMaxCUHeight; 195 UInt uiNumCUsInFrame = uiWidthInCU * uiHeightInCU; 196 197 if (m_uiTileByteLocation==NULL) m_uiTileByteLocation = new UInt[uiNumCUsInFrame]; 198 } 199 200 201 /** 202 - allocate table to contain substream sizes to be written to the slice header. 203 . 204 \param uiNumSubstreams Number of substreams -- the allocation will be this value - 1. 205 */ 206 Void TComSlice::allocSubstreamSizes(UInt uiNumSubstreams) 207 { 208 delete[] m_puiSubstreamSizes; 209 m_puiSubstreamSizes = new UInt[uiNumSubstreams > 0 ? uiNumSubstreams-1 : 0]; 122 210 } 123 211 … … 159 247 } 160 248 161 Void TComSlice::setRefPOCList () 162 { 163 for (Int iDir = 0; iDir < 2; iDir++) 164 { 165 for (Int iNumRefIdx = 0; iNumRefIdx < m_aiNumRefIdx[iDir]; iNumRefIdx++) 166 { 167 m_aiRefPOCList[iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getPOC(); 168 } 169 } 170 171 } 172 173 #if DCM_COMB_LIST 249 TComPic* TComSlice::xGetRefPic( TComList<TComPic*>& rcListPic, UInt uiPOC ) 250 { 251 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 252 TComPic* pcPic = *(iterPic); 253 while ( iterPic != rcListPic.end() ) 254 { 255 if(pcPic->getPOC() == uiPOC) 256 { 257 break; 258 } 259 iterPic++; 260 pcPic = *(iterPic); 261 } 262 return pcPic; 263 } 264 265 266 TComPic* TComSlice::xGetLongTermRefPic( TComList<TComPic*>& rcListPic, UInt uiPOC ) 267 { 268 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 269 TComPic* pcPic = *(iterPic); 270 TComPic* pcStPic = pcPic; 271 while ( iterPic != rcListPic.end() ) 272 { 273 pcPic = *(iterPic); 274 if(pcPic && (pcPic->getPOC()%(1<<getSPS()->getBitsForPOC())) == (uiPOC%(1<<getSPS()->getBitsForPOC()))) 275 { 276 if(pcPic->getIsLongTerm()) 277 return pcPic; 278 else 279 pcStPic = pcPic; 280 break; 281 } 282 283 iterPic++; 284 } 285 return pcStPic; 286 } 287 288 TComPic* TComSlice::xGetInterViewRefPic( std::vector<TComPic*>& rcListIvPic, UInt uiViewId ) 289 { 290 TComPic* pcPic = NULL; 291 for( Int k = 0; k < rcListIvPic.size(); k++ ) 292 { 293 if( rcListIvPic[k]->getViewId() == uiViewId ) 294 { 295 pcPic = rcListIvPic[k]; 296 break; 297 } 298 } 299 300 assert( pcPic != NULL ); 301 return pcPic; 302 } 303 304 Int TComSlice::getNumPocTotalCurr() 305 { 306 if( m_eSliceType == I_SLICE ) 307 { 308 return 0; 309 } 310 311 Int numPocTotalCurr = 0; 312 for( UInt i = 0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++ ) 313 { 314 if(m_pcRPS->getUsed(i)) 315 { 316 numPocTotalCurr++; 317 } 318 } 319 320 return numPocTotalCurr; 321 } 322 323 Int TComSlice::getNumPocTotalCurrMvc() 324 { 325 if( m_eSliceType == I_SLICE ) 326 { 327 return 0; 328 } 329 return getNumPocTotalCurr() + m_pcSPS->getNumberOfUsableInterViewRefs(); 330 } 331 332 Void TComSlice::setRefPOCnViewListsMvc() 333 { 334 for(Int iDir = 0; iDir < 2; iDir++) 335 { 336 for(Int iNumRefIdx = 0; iNumRefIdx < m_aiNumRefIdx[iDir]; iNumRefIdx++) 337 { 338 m_aiRefPOCList [iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getPOC(); 339 m_aiRefViewIdList[iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getViewId(); 340 } 341 } 342 } 343 174 344 Void TComSlice::generateCombinedList() 175 345 { … … 189 359 for (Int iNumRefIdx = 0; iNumRefIdx < MAX_NUM_REF; iNumRefIdx++) 190 360 { 191 if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_0]){ 361 if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_0]) 362 { 192 363 Bool bTempRefIdxInL2 = true; 193 364 for ( Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++ ) 194 365 { 195 if (( m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC()) &&196 ( m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getViewIdx() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getViewIdx() ))366 if( (m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() ) && 367 (m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getViewId() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getViewId()) ) 197 368 { 198 369 m_iRefIdxOfL1FromRefIdxOfL0[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC]; 199 370 m_iRefIdxOfL0FromRefIdxOfL1[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx; 200 371 bTempRefIdxInL2 = false; 201 assert(m_eListIdFromIdxOfLC[iRefIdxLC]==REF_PIC_LIST_1);202 372 break; 203 373 } … … 212 382 } 213 383 214 if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_1]){ 384 if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_1]) 385 { 215 386 Bool bTempRefIdxInL2 = true; 216 387 for ( Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++ ) 217 388 { 218 if (( m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC()) &&219 ( m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getViewIdx() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getViewIdx() ))389 if( (m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() ) && 390 (m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getViewId() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getViewId()) ) 220 391 { 221 392 m_iRefIdxOfL0FromRefIdxOfL1[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC]; 222 393 m_iRefIdxOfL1FromRefIdxOfL0[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx; 223 394 bTempRefIdxInL2 = false; 224 assert(m_eListIdFromIdxOfLC[iRefIdxLC]==REF_PIC_LIST_0);225 395 break; 226 396 } … … 236 406 } 237 407 } 238 #endif 239 240 Void TComSlice::setRefPicListFromGOPSTring( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& rapcSpatRefPics ) 241 { 242 243 if (m_eSliceType == I_SLICE) 244 { 245 ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); 246 ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); 408 409 Void TComSlice::setRefPicListMvc( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& rapcInterViewRefPics ) 410 { 411 if( m_eSliceType == I_SLICE ) 412 { 413 ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList) ); 414 ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx ) ); 247 415 248 416 return; 249 417 } 250 418 251 sortPicList(rcListPic); 252 assert( m_eSliceType != P_SLICE || m_pcPic->getNumRefs( REF_PIC_LIST_1 ) == 0 ); 253 for(Int iRefList = 0; iRefList<2; iRefList++ ) 254 { 255 RefPicList eRefList = (RefPicList) iRefList; 256 m_aiNumRefIdx[eRefList] = m_pcPic->getNumRefs( eRefList ); 257 for( Int i =0; i<m_pcPic->getNumRefs(eRefList); i++ ) 258 { 259 const int iRefPoc = m_pcPic->getRefPOC( eRefList, i ); 260 const int iRefViewIdx = m_pcPic->getRefViewIdx( eRefList, i ); 261 m_aiRefPOCList[eRefList][i] = iRefPoc; 262 m_aiRefViewList[eRefList][i] = iRefViewIdx; 263 264 TComPic* pcRefPic = NULL; 265 if( iRefViewIdx == m_iViewIdx ) 266 { 267 // temporal prediction from current view 268 for( TComList<TComPic*>::iterator it = rcListPic.begin(); it!=rcListPic.end(); it++) 269 { 270 if((*it)->getPOC() == iRefPoc) 271 { 272 pcRefPic = *it; 273 break; 274 } 275 } 276 assert( pcRefPic ); 277 if( pcRefPic == NULL && iRefPoc > m_iPOC ) 278 { 279 const int iAltRefPoc = m_iPOC-(iRefPoc-m_iPOC) ; 280 m_aiRefPOCList[eRefList][i] = iAltRefPoc ; 281 for( TComList<TComPic*>::iterator it = rcListPic.begin(); it!=rcListPic.end(); it++) 282 { 283 if((*it)->getPOC() == iAltRefPoc) 284 { 285 pcRefPic = *it ; 286 break; 287 } 288 } 289 } 290 } 291 else 292 { 293 // inter-view prediction 294 assert( iRefPoc == m_iPOC ); 295 assert( 0 <= iRefViewIdx && iRefViewIdx < rapcSpatRefPics.size() ); 296 pcRefPic = rapcSpatRefPics[iRefViewIdx]; 297 } 298 if( pcRefPic ) 299 { 300 m_apcRefPicList[eRefList][i] = pcRefPic; 301 pcRefPic->getPicYuvRec()->extendPicBorder(); 302 } 303 else 304 { 305 printf("\n inconsistence in gop string!") ; // gop string inconsistent 306 assert(0) ; 307 } 308 } 309 } 310 } 311 Void TComSlice::setRefPicListExplicitlyDecoderSided( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& rapcSpatRefPics ) 312 { 313 sortPicList(rcListPic); 314 TComPic* pcRefPic = NULL; 315 316 for(Int iRefList = 0; iRefList<2; iRefList++) 317 { 318 RefPicList eRefList = (RefPicList) iRefList; 319 for( Int i=0; i<m_aiNumRefIdx[eRefList]; i++ ) 320 { 321 const int iRefPoc = m_aiRefPOCList[ eRefList][i ]; 322 const int iRefViewIdx = m_aiRefViewList[ eRefList][i ]; 323 if( iRefViewIdx == m_iViewIdx ) 324 { 325 for( TComList<TComPic*>::iterator it = rcListPic.begin(); it!=rcListPic.end(); it++) 326 { 327 if((*it)->getPOC() == iRefPoc) 328 { 329 pcRefPic = *it; 330 break; 331 } 332 } 333 } 334 else 335 { 336 // inter-view prediction 337 assert( iRefPoc == m_iPOC ); 338 assert( 0 <= iRefViewIdx && iRefViewIdx < rapcSpatRefPics.size() ); 339 pcRefPic = rapcSpatRefPics[iRefViewIdx]; 340 } 341 if( pcRefPic ) 342 { 343 m_apcRefPicList[eRefList][i] = pcRefPic; 344 pcRefPic->getPicYuvRec()->extendPicBorder(); 345 } 346 else 347 { 348 printf("\n inconsistence in gop string!") ; // gop string inconsistent 349 assert(0) ; 350 } 419 TComPic* pcRefPic; 420 TComPic* RefPicSetStCurr0[16]; 421 TComPic* RefPicSetStCurr1[16]; 422 TComPic* RefPicSetLtCurr [16]; 423 TComPic* RefPicSetIvCurr [16]; 424 425 UInt NumPocStCurr0 = 0; 426 UInt NumPocStCurr1 = 0; 427 UInt NumPocLtCurr = 0; 428 UInt NumPocIvCurr = 0; 429 430 Int i; 431 // short term negative 432 for( i = 0; i < m_pcRPS->getNumberOfNegativePictures(); i++ ) 433 { 434 if( m_pcRPS->getUsed(i) ) 435 { 436 pcRefPic = xGetRefPic( rcListPic, getPOC() + m_pcRPS->getDeltaPOC(i) ); 437 pcRefPic->setIsLongTerm( 0 ); 438 pcRefPic->getPicYuvRec()->extendPicBorder(); 439 RefPicSetStCurr0[NumPocStCurr0] = pcRefPic; 440 NumPocStCurr0++; 441 } 442 } 443 // short term positive 444 for( ; i < m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures(); i++ ) 445 { 446 if( m_pcRPS->getUsed(i) ) 447 { 448 pcRefPic = xGetRefPic( rcListPic, getPOC() + m_pcRPS->getDeltaPOC(i) ); 449 pcRefPic->setIsLongTerm( 0 ); 450 pcRefPic->getPicYuvRec()->extendPicBorder(); 451 RefPicSetStCurr1[NumPocStCurr1] = pcRefPic; 452 NumPocStCurr1++; 453 } 454 } 455 // long term 456 for( i = m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures() - 1; i > m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures() - 1 ; i-- ) 457 { 458 if( m_pcRPS->getUsed(i) ) 459 { 460 pcRefPic = xGetLongTermRefPic( rcListPic, m_pcRPS->getPOC(i) ); 461 pcRefPic->setIsLongTerm( 1 ); 462 pcRefPic->getPicYuvRec()->extendPicBorder(); 463 RefPicSetLtCurr[NumPocLtCurr] = pcRefPic; 464 NumPocLtCurr++; 465 } 466 } 467 // inter-view 468 for( i = 0; i < m_pcSPS->getNumberOfUsableInterViewRefs(); i++ ) 469 { 470 pcRefPic = xGetInterViewRefPic( rapcInterViewRefPics, getViewId() + m_pcSPS->getUsableInterViewRef(i) ); 471 pcRefPic->setIsLongTerm( 0 ); 472 pcRefPic->getPicYuvRec()->extendPicBorder(); 473 RefPicSetIvCurr[NumPocIvCurr] = pcRefPic; 474 NumPocIvCurr++; 475 } 476 477 // ref_pic_list_init 478 UInt cIdx = 0; 479 UInt num_ref_idx_l0_active_minus1 = m_aiNumRefIdx[0] - 1; 480 UInt num_ref_idx_l1_active_minus1 = m_aiNumRefIdx[1] - 1; 481 482 assert( (NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + NumPocIvCurr) == getNumPocTotalCurrMvc() ); 483 Int numRpsCurrTempList0 = max( (num_ref_idx_l0_active_minus1 + 1), (NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + NumPocIvCurr) ); 484 Int numRpsCurrTempList1 = max( (num_ref_idx_l1_active_minus1 + 1), (NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + NumPocIvCurr) ); 485 486 assert( numRpsCurrTempList0 <= 16 ); 487 TComPic* refPicListTemp0[16]; 488 assert( numRpsCurrTempList1 <= 16 ); 489 TComPic* refPicListTemp1[16]; 490 491 cIdx = 0; 492 while( cIdx < numRpsCurrTempList0 ) 493 { 494 for( i = 0; i < NumPocStCurr0 && cIdx < numRpsCurrTempList0; cIdx++, i++ ) { refPicListTemp0[cIdx] = RefPicSetStCurr0[i]; } 495 for( i = 0; i < NumPocStCurr1 && cIdx < numRpsCurrTempList0; cIdx++, i++ ) { refPicListTemp0[cIdx] = RefPicSetStCurr1[i]; } 496 for( i = 0; i < NumPocLtCurr && cIdx < numRpsCurrTempList0; cIdx++, i++ ) { refPicListTemp0[cIdx] = RefPicSetLtCurr [i]; } 497 for( i = 0; i < NumPocIvCurr && cIdx < numRpsCurrTempList0; cIdx++, i++ ) { refPicListTemp0[cIdx] = RefPicSetIvCurr [i]; } 498 } 499 500 cIdx = 0; 501 while( cIdx < numRpsCurrTempList1 && m_eSliceType == B_SLICE ) 502 { 503 for( i = 0; i < NumPocStCurr1 && cIdx < numRpsCurrTempList1; cIdx++, i++ ) { refPicListTemp1[cIdx] = RefPicSetStCurr1[i]; } 504 for( i = 0; i < NumPocStCurr0 && cIdx < numRpsCurrTempList1; cIdx++, i++ ) { refPicListTemp1[cIdx] = RefPicSetStCurr0[i]; } 505 for( i = 0; i < NumPocLtCurr && cIdx < numRpsCurrTempList1; cIdx++, i++ ) { refPicListTemp1[cIdx] = RefPicSetLtCurr [i]; } 506 for( i = 0; i < NumPocIvCurr && cIdx < numRpsCurrTempList1; cIdx++, i++ ) { refPicListTemp1[cIdx] = RefPicSetIvCurr [i]; } 507 } 508 509 for( cIdx = 0; cIdx <= num_ref_idx_l0_active_minus1; cIdx ++ ) 510 { 511 m_apcRefPicList[0][cIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? refPicListTemp0[ m_RefPicListModification.getRefPicSetIdxL0(cIdx) ] : refPicListTemp0[cIdx]; 512 } 513 if( m_eSliceType == P_SLICE ) 514 { 515 m_aiNumRefIdx[1] = 0; 516 ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1]) ); 517 } 518 else 519 { 520 for( cIdx = 0; cIdx <= num_ref_idx_l1_active_minus1; cIdx ++ ) 521 { 522 m_apcRefPicList[1][cIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? refPicListTemp1[ m_RefPicListModification.getRefPicSetIdxL1(cIdx) ] : refPicListTemp1[cIdx]; 351 523 } 352 524 } … … 382 554 } 383 555 384 385 #if DCM_DECODING_REFRESH 386 /** Function for marking the reference pictures when an IDR and CDR is encountered. 387 * \param uiPOCCDR POC of the CDR picture 556 #if COLLOCATED_REF_IDX 557 Void TComSlice::checkColRefIdx(UInt curSliceIdx, TComPic* pic) 558 { 559 Int i; 560 TComSlice* curSlice = pic->getSlice(curSliceIdx); 561 Int currColRefPOC = curSlice->getRefPOC( RefPicList(curSlice->getColDir()), curSlice->getColRefIdx()); 562 TComSlice* preSlice; 563 Int preColRefPOC; 564 for(i=curSliceIdx-1; i>=0; i--) 565 { 566 preSlice = pic->getSlice(i); 567 if(preSlice->getSliceType() != I_SLICE) 568 { 569 preColRefPOC = preSlice->getRefPOC( RefPicList(preSlice->getColDir()), preSlice->getColRefIdx()); 570 if(currColRefPOC != preColRefPOC) 571 { 572 printf("Collocated_ref_idx shall always be the same for all slices of a coded picture!\n"); 573 exit(EXIT_FAILURE); 574 } 575 else 576 { 577 break; 578 } 579 } 580 } 581 } 582 #endif 583 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, TComList<TComPic*>& rcListPic) 584 { 585 for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++) 586 { 587 if(pocCRA < MAX_UINT && getPOC() > pocCRA) 588 { 589 assert(getPOC()+pReferencePictureSet->getDeltaPOC(i) >= pocCRA); 590 } 591 } 592 for(Int i = pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i < pReferencePictureSet->getNumberOfPictures(); i++) 593 { 594 if(pocCRA < MAX_UINT && getPOC() > pocCRA) 595 { 596 assert(pReferencePictureSet->getPOC(i) >= pocCRA); 597 } 598 } 599 #if H0566_TLA 600 if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found 601 #else 602 if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CDR ) // CDR picture found 603 #endif 604 { 605 pocCRA = getPOC(); 606 } 607 } 608 609 /** Function for marking the reference pictures when an IDR and CRA is encountered. 610 * \param pocCRA POC of the CRA picture 388 611 * \param bRefreshPending flag indicating if a deferred decoding refresh is pending 389 612 * \param rcListPic reference to the reference picture list … … 391 614 * If the nal_unit_type is IDR all pictures in the reference picture list 392 615 * is marked as "unused for reference" 393 * Otherwise do for the C DR case (non CDRcase has no effect since both if conditions below will not be true)616 * Otherwise do for the CRA case (non CRA case has no effect since both if conditions below will not be true) 394 617 * If the bRefreshPending flag is true (a deferred decoding refresh is pending) and the current 395 * temporal reference is greater than the temporal reference of the latest C DR picture (uiPOCCDR),396 * mark all reference pictures except the latest C DRpicture as "unused for reference" and set618 * temporal reference is greater than the temporal reference of the latest CRA picture (pocCRA), 619 * mark all reference pictures except the latest CRA picture as "unused for reference" and set 397 620 * the bRefreshPending flag to false. 398 * If the nal_unit_type is C DR, set the bRefreshPending flag to true and iPOCCDRto the temporal621 * If the nal_unit_type is CRA, set the bRefreshPending flag to true and pocCRA to the temporal 399 622 * reference of the current picture. 400 623 * Note that the current picture is already placed in the reference list and its marking is not changed. 401 624 * If the current picture has a nal_ref_idc that is not 0, it will remain marked as "used for reference". 402 625 */ 403 Void TComSlice::decodingRefreshMarking( UInt& uiPOCCDR, Bool& bRefreshPending, TComList<TComPic*>& rcListPic)626 Void TComSlice::decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic) 404 627 { 405 628 TComPic* rpcPic; 406 629 UInt uiPOCCurr = getPOC(); 407 630 408 if (getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR) // IDR631 if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_IDR ) // IDR 409 632 { 410 633 // mark all pictures as not used for reference … … 418 641 } 419 642 } 420 else // C DRor No DR421 { 422 if (bRefreshPending==true && uiPOCCurr > uiPOCCDR) // CDRreference marking pending643 else // CRA or No DR 644 { 645 if (bRefreshPending==true && uiPOCCurr > pocCRA) // CRA reference marking pending 423 646 { 424 647 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); … … 426 649 { 427 650 rpcPic = *(iterPic); 428 if (rpcPic->getPOC() != uiPOCCurr && rpcPic->getPOC() != uiPOCCDR) rpcPic->getSlice(0)->setReferenced(false);651 if (rpcPic->getPOC() != uiPOCCurr && rpcPic->getPOC() != pocCRA) rpcPic->getSlice(0)->setReferenced(false); 429 652 iterPic++; 430 653 } 431 654 bRefreshPending = false; 432 655 } 433 if (getNalUnitType() == NAL_UNIT_CODED_SLICE_CDR) // CDR picture found 656 #if H0566_TLA 657 if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found 658 #else 659 if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CDR ) // CDR picture found 660 #endif 434 661 { 435 662 bRefreshPending = true; 436 uiPOCCDR = uiPOCCurr; 437 } 438 } 439 } 440 #endif 663 pocCRA = uiPOCCurr; 664 } 665 } 666 } 441 667 442 668 Void TComSlice::copySliceInfo(TComSlice *pSrc) … … 447 673 448 674 m_iPOC = pSrc->m_iPOC; 449 m_ iViewIdx = pSrc->m_iViewIdx;675 m_viewId = pSrc->m_viewId; 450 676 #if SONY_COLPIC_AVAILABILITY 451 677 m_iViewOrderIdx = pSrc->m_iViewOrderIdx; 452 678 #endif 453 #if DCM_DECODING_REFRESH454 679 m_eNalUnitType = pSrc->m_eNalUnitType; 455 #endif 680 m_eNalUnitTypeBaseViewMvc = pSrc->m_eNalUnitTypeBaseViewMvc; 456 681 m_eSliceType = pSrc->m_eSliceType; 457 682 m_iSliceQp = pSrc->m_iSliceQp; 458 m_iSymbolMode = pSrc->m_iSymbolMode; 683 #if ADAPTIVE_QP_SELECTION 684 m_iSliceQpBase = pSrc->m_iSliceQpBase; 685 #endif 459 686 m_bLoopFilterDisable = pSrc->m_bLoopFilterDisable; 687 m_inheritDblParamFromAPS = pSrc->m_inheritDblParamFromAPS; 688 m_loopFilterBetaOffsetDiv2 = pSrc->m_loopFilterBetaOffsetDiv2; 689 m_loopFilterTcOffsetDiv2 = pSrc->m_loopFilterTcOffsetDiv2; 460 690 461 #if DCM_COMB_LIST462 691 for (i = 0; i < 3; i++) 463 692 { … … 481 710 m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC; 482 711 m_bRefPicListCombinationFlag = pSrc->m_bRefPicListCombinationFlag; 483 #else 484 for (i = 0; i < 2; i++) 485 { 486 m_aiNumRefIdx[i] = pSrc->m_aiNumRefIdx[i]; 487 } 488 #endif 489 712 m_bCheckLDC = pSrc->m_bCheckLDC; 490 713 m_iSliceQpDelta = pSrc->m_iSliceQpDelta; 491 714 for (i = 0; i < 2; i++) … … 493 716 for (j = 0; j < MAX_NUM_REF; j++) 494 717 { 495 m_apcRefPicList [i][j] = pSrc->m_apcRefPicList[i][j];496 m_aiRefPOCList [i][j] = pSrc->m_aiRefPOCList[i][j];497 m_aiRefView List[i][j] = pSrc->m_aiRefViewList[i][j];718 m_apcRefPicList [i][j] = pSrc->m_apcRefPicList [i][j]; 719 m_aiRefPOCList [i][j] = pSrc->m_aiRefPOCList [i][j]; 720 m_aiRefViewIdList[i][j] = pSrc->m_aiRefViewIdList[i][j]; 498 721 } 499 722 } … … 502 725 // referenced slice 503 726 m_bRefenced = pSrc->m_bRefenced; 504 #ifdef ROUNDING_CONTROL_BIPRED505 m_bRounding = pSrc->m_bRounding;506 #endif507 727 508 728 // access channel 509 729 m_pcSPS = pSrc->m_pcSPS; 510 730 m_pcPPS = pSrc->m_pcPPS; 511 m_uiPPSId = pSrc->m_uiPPSId; 731 m_pcRPS = pSrc->m_pcRPS; 732 m_iLastIDR = pSrc->m_iLastIDR; 733 512 734 m_pcPic = pSrc->m_pcPic; 735 m_pcAPS = pSrc->m_pcAPS; 736 m_iAPSId = pSrc->m_iAPSId; 513 737 514 738 m_uiColDir = pSrc->m_uiColDir; 739 #if COLLOCATED_REF_IDX 740 m_colRefIdx = pSrc->m_colRefIdx; 741 #endif 742 #if ALF_CHROMA_LAMBDA || SAO_CHROMA_LAMBDA 743 m_dLambdaLuma = pSrc->m_dLambdaLuma; 744 m_dLambdaChroma = pSrc->m_dLambdaChroma; 745 #else 515 746 m_dLambda = pSrc->m_dLambda; 747 #endif 516 748 for (i = 0; i < 2; i++) 517 749 { … … 526 758 527 759 m_bNoBackPredFlag = pSrc->m_bNoBackPredFlag; 528 #if MS_LCEC_LOOKUP_TABLE_EXCEPTION529 760 m_bRefIdxCombineCoding = pSrc->m_bRefIdxCombineCoding; 530 #endif 761 762 m_uiTLayer = pSrc->m_uiTLayer; 763 m_bTLayerSwitchingFlag = pSrc->m_bTLayerSwitchingFlag; 764 531 765 m_uiSliceMode = pSrc->m_uiSliceMode; 532 766 m_uiSliceArgument = pSrc->m_uiSliceArgument; … … 540 774 m_bNextSlice = pSrc->m_bNextSlice; 541 775 m_bNextEntropySlice = pSrc->m_bNextEntropySlice; 542 #ifdef WEIGHT_PRED 776 m_iTileMarkerFlag = pSrc->m_iTileMarkerFlag; 543 777 for ( int e=0 ; e<2 ; e++ ) 544 for ( int n=0 ; n<MAX_NUM_REF ; n++ ) 545 memcpy(m_weightPredTable[e][n], pSrc->m_weightPredTable[e][n], sizeof(wpScalingParam)*3 ); 546 #endif 547 } 548 549 #ifdef WEIGHT_PRED 778 for ( int n=0 ; n<MAX_NUM_REF ; n++ ) 779 memcpy(m_weightPredTable[e][n], pSrc->m_weightPredTable[e][n], sizeof(wpScalingParam)*3 ); 780 781 m_saoEnabledFlag = pSrc->m_saoEnabledFlag; 782 #if SAO_UNIT_INTERLEAVING 783 m_saoInterleavingFlag = pSrc->m_saoInterleavingFlag; 784 m_saoEnabledFlagCb = pSrc->m_saoEnabledFlagCb; 785 m_saoEnabledFlagCr = pSrc->m_saoEnabledFlagCr; 786 #endif 787 #if CABAC_INIT_FLAG 788 m_cabacInitFlag = pSrc->m_cabacInitFlag; 789 #endif 790 #if TILES_WPP_ENTRY_POINT_SIGNALLING 791 m_numEntryPointOffsets = pSrc->m_numEntryPointOffsets; 792 #endif 793 794 #if H0111_MVD_L1_ZERO 795 m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero; 796 #endif 797 } 798 799 int TComSlice::m_prevPOC = 0; 800 /** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag. 801 * \param uiTLayer Temporal layer ID of the current slice 802 * The decoder calls this function to set temporal_layer_switching_point_flag for each temporal layer based on 803 * the SPS's temporal_id_nesting_flag and the parsed PPS. Then, current slice's temporal layer ID and 804 * temporal_layer_switching_point_flag is set accordingly. 805 */ 806 Void TComSlice::setTLayerInfo( UInt uiTLayer ) 807 { 808 #if !H0566_TLA 809 // If temporal_id_nesting_flag == 1, then num_temporal_layer_switching_point_flags shall be inferred to be 0 and temporal_layer_switching_point_flag shall be inferred to be 1 for all temporal layers 810 if ( m_pcSPS->getTemporalIdNestingFlag() ) 811 { 812 m_pcPPS->setNumTLayerSwitchingFlags( 0 ); 813 for ( UInt i = 0; i < MAX_TLAYER; i++ ) 814 { 815 m_pcPPS->setTLayerSwitchingFlag( i, true ); 816 } 817 } 818 else 819 { 820 for ( UInt i = m_pcPPS->getNumTLayerSwitchingFlags(); i < MAX_TLAYER; i++ ) 821 { 822 m_pcPPS->setTLayerSwitchingFlag( i, false ); 823 } 824 } 825 #endif 826 827 m_uiTLayer = uiTLayer; 828 #if !H0566_TLA 829 m_bTLayerSwitchingFlag = m_pcPPS->getTLayerSwitchingFlag( uiTLayer ); 830 #endif 831 } 832 833 #if H0566_TLA && H0566_TLA_SET_FOR_SWITCHING_POINTS 834 /** Function for checking if this is a switching-point 835 */ 836 Bool TComSlice::isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet) 837 { 838 TComPic* rpcPic; 839 // loop through all pictures in the reference picture buffer 840 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 841 while ( iterPic != rcListPic.end()) 842 { 843 rpcPic = *(iterPic++); 844 if(rpcPic->getSlice(0)->isReferenced() && rpcPic->getPOC() != getPOC()) 845 { 846 if(rpcPic->getTLayer() >= getTLayer()) 847 { 848 return false; 849 } 850 } 851 } 852 return true; 853 } 854 #endif 855 856 /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. 857 */ 858 Void TComSlice::applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet) 859 { 860 TComPic* rpcPic; 861 Int i, isReference; 862 863 Int j = 0; 864 // loop through all pictures in the reference picture buffer 865 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 866 while ( iterPic != rcListPic.end()) 867 { 868 j++; 869 rpcPic = *(iterPic++); 870 871 isReference = 0; 872 // loop through all pictures in the Reference Picture Set to see if the picture should be kept as reference picture 873 for(i=0;i<pReferencePictureSet->getNumberOfPositivePictures()+pReferencePictureSet->getNumberOfNegativePictures();i++) 874 { 875 if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i)) 876 { 877 isReference = 1; 878 rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); 879 rpcPic->setIsLongTerm(0); 880 } 881 } 882 // long term pictures 883 for(;i<pReferencePictureSet->getNumberOfPictures();i++) 884 { 885 if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i)%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) 886 { 887 isReference = 1; 888 rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); 889 } 890 } 891 // mark the picture as "unused for reference" if it is not in 892 // the Reference Picture Set 893 if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && isReference == 0) 894 { 895 rpcPic->getSlice( 0 )->setReferenced( false ); 896 rpcPic->setIsLongTerm(0); 897 } 898 } 899 } 900 901 /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. 902 */ 903 #if START_DECODING_AT_CRA 904 Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag, Int pocRandomAccess) 905 #else 906 Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag) 907 #endif 908 { 909 TComPic* rpcPic; 910 Int i, isAvailable, j; 911 Int atLeastOneLost = 0; 912 Int atLeastOneRemoved = 0; 913 Int iPocLost = 0; 914 915 // loop through all long-term pictures in the Reference Picture Set 916 // to see if the picture should be kept as reference picture 917 for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++) 918 { 919 j = 0; 920 isAvailable = 0; 921 // loop through all pictures in the reference picture buffer 922 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 923 while ( iterPic != rcListPic.end()) 924 { 925 j++; 926 rpcPic = *(iterPic++); 927 if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i)%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced()) 928 { 929 isAvailable = 1; 930 } 931 } 932 // if there was no such long-term check the short terms 933 if(!isAvailable) 934 { 935 iterPic = rcListPic.begin(); 936 while ( iterPic != rcListPic.end()) 937 { 938 j++; 939 rpcPic = *(iterPic++); 940 941 if((rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == (this->getPOC() + pReferencePictureSet->getDeltaPOC(i))%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced()) 942 { 943 isAvailable = 1; 944 rpcPic->setIsLongTerm(1); 945 break; 946 } 947 } 948 } 949 // report that a picture is lost if it is in the Reference Picture Set 950 // but not available as reference picture 951 if(isAvailable == 0) 952 { 953 #if START_DECODING_AT_CRA 954 if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) 955 { 956 #endif 957 if(!pReferencePictureSet->getUsed(i) ) 958 { 959 if(outputFlag) 960 printf("\nLong-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); 961 atLeastOneRemoved = 1; 962 } 963 else 964 { 965 if(outputFlag) 966 printf("\nLong-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); 967 atLeastOneLost = 1; 968 iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); 969 } 970 #if START_DECODING_AT_CRA 971 } 972 #endif 973 } 974 } 975 // loop through all short-term pictures in the Reference Picture Set 976 // to see if the picture should be kept as reference picture 977 for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++) 978 { 979 j = 0; 980 isAvailable = 0; 981 // loop through all pictures in the reference picture buffer 982 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 983 while ( iterPic != rcListPic.end()) 984 { 985 j++; 986 rpcPic = *(iterPic++); 987 988 if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) 989 { 990 isAvailable = 1; 991 } 992 } 993 // report that a picture is lost if it is in the Reference Picture Set 994 // but not available as reference picture 995 if(isAvailable == 0) 996 { 997 #if START_DECODING_AT_CRA 998 if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) 999 { 1000 #endif 1001 if(!pReferencePictureSet->getUsed(i) ) 1002 { 1003 if(outputFlag) 1004 printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); 1005 atLeastOneRemoved = 1; 1006 } 1007 else 1008 { 1009 if(outputFlag) 1010 printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); 1011 atLeastOneLost = 1; 1012 iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); 1013 } 1014 #if START_DECODING_AT_CRA 1015 } 1016 #endif 1017 } 1018 } 1019 if(atLeastOneLost) 1020 { 1021 return iPocLost+1; 1022 } 1023 if(atLeastOneRemoved) 1024 { 1025 return -2; 1026 } 1027 else 1028 return 0; 1029 } 1030 1031 /** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set 1032 */ 1033 Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet) 1034 { 1035 TComPic* rpcPic; 1036 Int i, j; 1037 Int k = 0; 1038 Int nrOfNegativePictures = 0; 1039 Int nrOfPositivePictures = 0; 1040 TComReferencePictureSet* pcRPS = this->getLocalRPS(); 1041 1042 // loop through all pictures in the Reference Picture Set 1043 for(i=0;i<pReferencePictureSet->getNumberOfPictures();i++) 1044 { 1045 j = 0; 1046 // loop through all pictures in the reference picture buffer 1047 TComList<TComPic*>::iterator iterPic = rcListPic.begin(); 1048 while ( iterPic != rcListPic.end()) 1049 { 1050 j++; 1051 rpcPic = *(iterPic++); 1052 1053 if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) 1054 { 1055 // This picture exists as a reference picture 1056 // and should be added to the explicit Reference Picture Set 1057 pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i)); 1058 pcRPS->setUsed(k, pReferencePictureSet->getUsed(i)); 1059 if(pcRPS->getDeltaPOC(k) < 0) 1060 nrOfNegativePictures++; 1061 else 1062 nrOfPositivePictures++; 1063 k++; 1064 } 1065 } 1066 } 1067 pcRPS->setNumberOfNegativePictures(nrOfNegativePictures); 1068 pcRPS->setNumberOfPositivePictures(nrOfPositivePictures); 1069 pcRPS->setNumberOfPictures(nrOfNegativePictures+nrOfPositivePictures); 1070 // This is a simplistic inter rps example. A smarter encoder will look for a better reference RPS to do the 1071 // inter RPS prediction with. Here we just use the reference used by pReferencePictureSet. 1072 // If pReferencePictureSet is not inter_RPS_predicted, then inter_RPS_prediction is for the current RPS also disabled. 1073 if (!pReferencePictureSet->getInterRPSPrediction()) 1074 { 1075 pcRPS->setInterRPSPrediction(false); 1076 pcRPS->setNumRefIdc(0); 1077 } 1078 else 1079 { 1080 Int rIdx = this->getRPSidx() - pReferencePictureSet->getDeltaRIdxMinus1() - 1; 1081 Int deltaRPS = pReferencePictureSet->getDeltaRPS(); 1082 #if RPS_IN_SPS 1083 TComReferencePictureSet* pcRefRPS = this->getSPS()->getRPSList()->getReferencePictureSet(rIdx); 1084 #else 1085 TComReferencePictureSet* pcRefRPS = this->getPPS()->getRPSList()->getReferencePictureSet(rIdx); 1086 #endif 1087 Int iRefPics = pcRefRPS->getNumberOfPictures(); 1088 Int iNewIdc=0; 1089 for(i=0; i<= iRefPics; i++) 1090 { 1091 Int deltaPOC = ((i != iRefPics)? pcRefRPS->getDeltaPOC(i) : 0); // check if the reference abs POC is >= 0 1092 Int iRefIdc = 0; 1093 for (j=0; j < pcRPS->getNumberOfPictures(); j++) // loop through the pictures in the new RPS 1094 { 1095 if ( (deltaPOC + deltaRPS) == pcRPS->getDeltaPOC(j)) 1096 { 1097 if (pcRPS->getUsed(j)) 1098 { 1099 iRefIdc = 1; 1100 } 1101 else 1102 { 1103 iRefIdc = 2; 1104 } 1105 } 1106 } 1107 pcRPS->setRefIdc(i, iRefIdc); 1108 iNewIdc++; 1109 } 1110 pcRPS->setInterRPSPrediction(true); 1111 pcRPS->setNumRefIdc(iNewIdc); 1112 pcRPS->setDeltaRPS(deltaRPS); 1113 #if RPS_IN_SPS 1114 pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx()); 1115 #else 1116 pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getPPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx()); 1117 #endif 1118 } 1119 1120 this->setRPS(pcRPS); 1121 this->setRPSidx(-1); 1122 } 1123 1124 Void TComSlice::decodingMarkingForNoTMVP( TComList<TComPic*>& rcListPic, Int currentPOC ) 1125 { 1126 TComList<TComPic*>::iterator it; 1127 for ( it = rcListPic.begin(); it != rcListPic.end(); it++ ) 1128 { 1129 if ( (*it)->getSlice(0)->getPOC() != currentPOC ) 1130 { 1131 (*it)->setUsedForTMVP( false ); 1132 } 1133 } 1134 } 1135 1136 /** get AC and DC values for weighted pred 1137 * \param *wp 1138 * \returns Void 1139 */ 1140 Void TComSlice::getWpAcDcParam(wpACDCParam *&wp) 1141 { 1142 wp = m_weightACDCParam; 1143 } 1144 1145 /** init AC and DC values for weighted pred 1146 * \returns Void 1147 */ 1148 Void TComSlice::initWpAcDcParam() 1149 { 1150 for(Int iComp = 0; iComp < 3; iComp++ ) 1151 { 1152 m_weightACDCParam[iComp].iAC = 0; 1153 m_weightACDCParam[iComp].iDC = 0; 1154 } 1155 } 1156 1157 /** get WP tables for weighted pred 1158 * \param RefPicList 1159 * \param iRefIdx 1160 * \param *&wpScalingParam 1161 * \returns Void 1162 */ 550 1163 Void TComSlice::getWpScaling( RefPicList e, Int iRefIdx, wpScalingParam *&wp ) 551 1164 { … … 553 1166 } 554 1167 555 Void TComSlice::displayWpScaling() 556 { 557 Bool bFound = false; 558 for ( int e=0 ; e<2 ; e++ ) { 1168 /** reset Default WP tables settings : no weight. 1169 * \param wpScalingParam 1170 * \returns Void 1171 */ 1172 Void TComSlice::resetWpScaling(wpScalingParam wp[2][MAX_NUM_REF][3]) 1173 { 1174 for ( int e=0 ; e<2 ; e++ ) 1175 { 559 1176 for ( int i=0 ; i<MAX_NUM_REF ; i++ ) 560 for ( int yuv=0 ; yuv<3 ; yuv++ ) 561 if ( m_weightPredTable[e][i][yuv].bPresentFlag ) { 562 if ( !bFound ) { 563 printf("\tluma_log2_weight_denom = %d\n", m_weightPredTable[0][0][0].uiLog2WeightDenom); 564 printf("\tchroma_log2_weight_denom = %d\n", m_weightPredTable[0][0][1].uiLog2WeightDenom); 565 bFound = true; 566 } 567 Double weight = (Double)m_weightPredTable[e][i][yuv].iWeight / (Double)(1<<m_weightPredTable[0][0][0].uiLog2WeightDenom); 568 if ( yuv == 0 ) { 569 printf("\tluma_weight_l%d_flag = 1\n", e); 570 printf("\t luma_weight_l%d[%d] = %d => w = %g\n", e, i, m_weightPredTable[e][i][yuv].iWeight, weight); 571 printf("\t luma_offset_l%d[%d] = %d\n", e, i, m_weightPredTable[e][i][yuv].iOffset); 572 } 573 else { 574 if ( yuv == 1 ) printf("\tchroma_weight_l%d_flag = 1\n", e); 575 printf("\t chroma_weight_l%d[%d][%d] = %d => w = %g\n", e, i, yuv-1, m_weightPredTable[e][i][yuv].iWeight, weight); 576 printf("\t chroma_offset_l%d[%d][%d] = %d\n", e, i, yuv-1, m_weightPredTable[e][i][yuv].iOffset); 577 } 578 } 579 } 580 } 581 582 // Default WP values settings : no weight. 583 Void TComSlice::resetWpScaling(wpScalingParam wp[2][MAX_NUM_REF][3]) 584 { 585 for ( int e=0 ; e<2 ; e++ ) { 586 for ( int i=0 ; i<MAX_NUM_REF ; i++ ) 587 for ( int yuv=0 ; yuv<3 ; yuv++ ) { 1177 { 1178 for ( int yuv=0 ; yuv<3 ; yuv++ ) 1179 { 588 1180 wpScalingParam *pwp = &(wp[e][i][yuv]); 589 1181 pwp->bPresentFlag = false; … … 593 1185 pwp->iOffset = 0; 594 1186 } 595 } 596 } 597 1187 } 1188 } 1189 } 1190 1191 /** init WP table 1192 * \returns Void 1193 */ 598 1194 Void TComSlice::initWpScaling() 599 1195 { … … 601 1197 } 602 1198 1199 /** set WP tables 1200 * \param wpScalingParam 1201 * \returns Void 1202 */ 603 1203 Void TComSlice::initWpScaling(wpScalingParam wp[2][MAX_NUM_REF][3]) 604 1204 { 605 for ( int e=0 ; e<2 ; e++ ) { 1205 for ( int e=0 ; e<2 ; e++ ) 1206 { 606 1207 for ( int i=0 ; i<MAX_NUM_REF ; i++ ) 607 for ( int yuv=0 ; yuv<3 ; yuv++ ) { 1208 { 1209 for ( int yuv=0 ; yuv<3 ; yuv++ ) 1210 { 608 1211 wpScalingParam *pwp = &(wp[e][i][yuv]); 609 1212 if ( !pwp->bPresentFlag ) { … … 618 1221 pwp->round = (pwp->uiLog2WeightDenom>=1) ? (1 << (pwp->uiLog2WeightDenom-1)) : (0); 619 1222 } 620 } 621 } 622 #endif 623 624 #ifdef WEIGHT_PRED 625 Void TComSlice::getWpAcDcParam(wpACDCParam *&wp) 626 { 627 wp = m_weightACDCParam; 628 } 629 630 Void TComSlice::initWpAcDcParam() 631 { 632 for(Int iComp = 0; iComp < 3; iComp++ ) 633 { 634 m_weightACDCParam[iComp].iAC = 0; 635 m_weightACDCParam[iComp].iDC = 0; 636 } 637 } 638 #endif 1223 } 1224 } 1225 } 1226 1227 /** get WP tables for weighted pred of LC 1228 * \param iRefIdxLC 1229 * \param *&wpScalingParam 1230 * \returns Void 1231 */ 1232 Void TComSlice::getWpScalingLC( Int iRefIdx, wpScalingParam *&wp ) 1233 { 1234 wp = m_weightPredTableLC[iRefIdx]; 1235 } 1236 /** reset Default WP tables settings for LC : no weight. 1237 * \param wpScalingParam 1238 * \returns Void 1239 */ 1240 Void TComSlice::resetWpScalingLC(wpScalingParam wp[2*MAX_NUM_REF][3]) 1241 { 1242 for ( int i=0 ; i<2*MAX_NUM_REF ; i++ ) 1243 { 1244 for ( int yuv=0 ; yuv<3 ; yuv++ ) 1245 { 1246 wpScalingParam *pwp = &(wp[i][yuv]); 1247 pwp->bPresentFlag = false; 1248 pwp->uiLog2WeightDenom = 0; 1249 pwp->uiLog2WeightDenom = 0; 1250 pwp->iWeight = 1; 1251 pwp->iOffset = 0; 1252 } 1253 } 1254 } 1255 /** set current WP tables settings for LC 1256 * \returns Void 1257 */ 1258 Void TComSlice::setWpParamforLC() 1259 { 1260 for ( Int iRefIdx=0 ; iRefIdx<getNumRefIdx(REF_PIC_LIST_C) ; iRefIdx++ ) 1261 { 1262 RefPicList eRefPicList = (RefPicList)getListIdFromIdxOfLC(iRefIdx); 1263 Int iCombRefIdx = getRefIdxFromIdxOfLC(iRefIdx); 1264 1265 wpScalingParam *wp_src, *wp_dst; 1266 getWpScalingLC(iRefIdx, wp_src); 1267 getWpScaling(eRefPicList, iCombRefIdx, wp_dst); 1268 copyWPtable(wp_src, wp_dst); 1269 1270 if(eRefPicList == REF_PIC_LIST_0) 1271 { 1272 Int iRefIdxL1 = getRefIdxOfL1FromRefIdxOfL0(iCombRefIdx); 1273 if(iRefIdxL1 >= 0) 1274 { 1275 getWpScaling(REF_PIC_LIST_1, iRefIdxL1, wp_dst); 1276 copyWPtable(wp_src, wp_dst); 1277 } 1278 } 1279 if(eRefPicList == REF_PIC_LIST_1) 1280 { 1281 Int iRefIdxL0 = getRefIdxOfL0FromRefIdxOfL1(iCombRefIdx); 1282 if(iRefIdxL0 >= 0) 1283 { 1284 getWpScaling(REF_PIC_LIST_0, iRefIdxL0, wp_dst); 1285 copyWPtable(wp_src, wp_dst); 1286 } 1287 } 1288 } 1289 initWpScaling(); 1290 } 1291 /** copy source WP tables to destination table for LC 1292 * \param wpScalingParam *&wp_src : source 1293 * \param wpScalingParam *&wp_dst : destination 1294 * \returns Void 1295 */ 1296 Void TComSlice::copyWPtable(wpScalingParam *&wp_src, wpScalingParam *&wp_dst) 1297 { 1298 for ( Int iComp = 0; iComp < 3; iComp++ ) 1299 { 1300 wp_dst[iComp].uiLog2WeightDenom = (iComp==0) ? wp_src[0].uiLog2WeightDenom : wp_src[1].uiLog2WeightDenom; 1301 wp_dst[iComp].bPresentFlag = wp_src[iComp].bPresentFlag; 1302 wp_dst[iComp].iWeight = wp_src[iComp].iWeight; 1303 wp_dst[iComp].iOffset = wp_src[iComp].iOffset; 1304 } 1305 } 1306 639 1307 640 1308 // ------------------------------------------------------------------------------------------------ … … 643 1311 644 1312 TComSPS::TComSPS() 645 { 646 // Structure 647 m_uiSPSId = 0; 648 m_uiWidth = 352; 649 m_uiHeight = 288; 650 m_uiMaxCUWidth = 32; 651 m_uiMaxCUHeight = 32; 652 m_uiMaxCUDepth = 3; 653 m_uiMinTrDepth = 0; 654 m_uiMaxTrDepth = 1; 655 m_uiMaxTrSize = 32; 656 657 // Tool list 658 m_bUseALF = false; 659 m_bUseDQP = false; 660 661 m_bUseMRG = false; // SOPH: 1313 : m_SPSId ( 0) 1314 , m_ProfileIdc ( 0) 1315 , m_LevelIdc ( 0) 1316 , m_chromaFormatIdc (CHROMA_420) 1317 , m_uiMaxTLayers ( 1) 1318 // Structure 1319 , m_picWidthInLumaSamples (352) 1320 , m_picHeightInLumaSamples (288) 1321 #if PIC_CROPPING 1322 , m_picCroppingFlag (false) 1323 , m_picCropLeftOffset ( 0) 1324 , m_picCropRightOffset ( 0) 1325 , m_picCropTopOffset ( 0) 1326 , m_picCropBottomOffset ( 0) 1327 #endif 1328 , m_uiMaxCUWidth ( 32) 1329 , m_uiMaxCUHeight ( 32) 1330 , m_uiMaxCUDepth ( 3) 1331 , m_uiMinTrDepth ( 0) 1332 , m_uiMaxTrDepth ( 1) 1333 #if RPS_IN_SPS 1334 , m_bLongTermRefsPresent (false) 1335 #endif 1336 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 1337 , m_numReorderFrames ( 0) 1338 #endif 1339 , m_iNumberOfUsableInterViewRefs( 0 ) 1340 , m_uiQuadtreeTULog2MaxSize ( 0) 1341 , m_uiQuadtreeTULog2MinSize ( 0) 1342 , m_uiQuadtreeTUMaxDepthInter ( 0) 1343 , m_uiQuadtreeTUMaxDepthIntra ( 0) 1344 // Tool list 1345 , m_usePCM (false) 1346 , m_pcmLog2MaxSize ( 5) 1347 , m_uiPCMLog2MinSize ( 7) 1348 , m_bDisInter4x4 ( 1) 1349 , m_bUseALF (false) 1350 #if LCU_SYNTAX_ALF 1351 , m_bALFCoefInSlice (false) 1352 #endif 1353 #if !PIC_CROPPING 1354 , m_bUsePAD (false) 1355 #endif 1356 , m_bUseLMChroma (false) 1357 , m_bUseLComb (false) 1358 , m_bLCMod (false) 1359 #if H0412_REF_PIC_LIST_RESTRICTION 1360 , m_restrictedRefPicListsFlag ( 1) 1361 , m_listsModificationPresentFlag( 0) 1362 #endif 1363 , m_uiBitDepth ( 8) 1364 , m_uiBitIncrement ( 0) 1365 #if H0736_AVC_STYLE_QP_RANGE 1366 , m_qpBDOffsetY ( 0) 1367 , m_qpBDOffsetC ( 0) 1368 #endif 1369 #if LOSSLESS_CODING 1370 , m_useLossless (false) 1371 #endif 1372 , m_uiPCMBitDepthLuma ( 8) 1373 , m_uiPCMBitDepthChroma ( 8) 1374 , m_bPCMFilterDisableFlag (false) 1375 , m_uiBitsForPOC ( 8) 1376 , m_uiMaxTrSize ( 32) 1377 , m_bLFCrossSliceBoundaryFlag (false) 1378 , m_bUseSAO (false) 662 1379 #if HHI_MPI 663 m_bUseMVI = false; 664 #endif 665 666 #if BITSTREAM_EXTRACTION 667 m_uiLayerId = 0; 668 #endif 1380 , m_bUseMVI (false) 1381 #endif 1382 , m_bLFCrossTileBoundaryFlag (false) 1383 , m_iUniformSpacingIdr ( 0 ) 1384 , m_iTileBoundaryIndependenceIdr ( 0 ) 1385 , m_iNumColumnsMinus1 ( 0 ) 1386 , m_puiColumnWidth ( NULL ) 1387 , m_iNumRowsMinus1 ( 0 ) 1388 , m_puiRowHeight ( NULL ) 1389 , m_bTemporalIdNestingFlag (false) 1390 , m_scalingListEnabledFlag (false) 1391 #if !H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 1392 , m_uiMaxDecFrameBuffering ( 0) 1393 , m_uiMaxLatencyIncrease ( 0) 1394 #endif 1395 #if TILES_WPP_ENTRY_POINT_SIGNALLING 1396 , m_tilesOrEntropyCodingSyncIdc( 0 ) 1397 , m_numSubstreams ( 0 ) 1398 #endif 1399 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1400 , m_bUseDMM (false) 1401 #endif 1402 { 1403 // AMVP parameter 1404 ::memset( m_aeAMVPMode, 0, sizeof( m_aeAMVPMode ) ); 1405 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER 1406 for ( Int i = 0; i < MAX_TLAYER; i++ ) 1407 { 1408 m_uiMaxLatencyIncrease[i] = 0; 1409 m_uiMaxDecPicBuffering[i] = 0; 1410 m_numReorderPics[i] = 0; 1411 } 1412 #endif 1413 669 1414 m_uiViewId = 0; 670 1415 m_iViewOrderIdx = 0; … … 684 1429 m_uiMultiviewMvPredMode = 0; 685 1430 #endif 686 #if HHI_INTER_VIEW_RESIDUAL_PRED 687 m_uiMultiviewResPredMode = 0; 688 #endif 689 690 // AMVP parameter 691 ::memset( m_aeAMVPMode, 0, sizeof( m_aeAMVPMode ) ); 692 693 #if ( HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX ) 694 m_bUseDMM = false; 695 #endif 696 #if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER 697 m_bUseDMM34 = false; 698 #endif 1431 1432 ::memset( m_aiUsableInterViewRefs, 0, sizeof( m_aiUsableInterViewRefs ) ); 699 1433 } 700 1434 701 1435 TComSPS::~TComSPS() 702 1436 { 1437 if( m_iNumColumnsMinus1 > 0 && m_iUniformSpacingIdr == 0 ) 1438 { 1439 delete [] m_puiColumnWidth; 1440 m_puiColumnWidth = NULL; 1441 } 1442 if( m_iNumRowsMinus1 > 0 && m_iUniformSpacingIdr == 0 ) 1443 { 1444 delete [] m_puiRowHeight; 1445 m_puiRowHeight = NULL; 1446 } 703 1447 } 704 1448 705 1449 TComPPS::TComPPS() 706 { 707 #if BITSTREAM_EXTRACTION 708 m_uiLayerId = 0; 709 #endif 710 #if CONSTRAINED_INTRA_PRED 711 m_bConstrainedIntraPred = false; 712 #endif 713 m_uiSPSId = 0; 714 m_uiPPSId = 0; 1450 : m_PPSId (0) 1451 , m_SPSId (0) 1452 , m_picInitQPMinus26 (0) 1453 , m_useDQP (false) 1454 , m_bConstrainedIntraPred (false) 1455 , m_pcSPS (NULL) 1456 , m_uiMaxCuDQPDepth (0) 1457 , m_uiMinCuDQPSize (0) 1458 , m_iChromaQpOffset (0) 1459 , m_iChromaQpOffset2nd (0) 1460 #if !RPS_IN_SPS 1461 , m_bLongTermRefsPresent (false) 1462 #endif 1463 #if !H0566_TLA 1464 , m_uiNumTlayerSwitchingFlags (0) 1465 #endif 1466 , m_iSliceGranularity (0) 1467 , m_iTileBehaviorControlPresentFlag (0) 1468 , m_bLFCrossTileBoundaryFlag (true) 1469 , m_iColumnRowInfoPresent (0) 1470 , m_iUniformSpacingIdr (0) 1471 #if !REMOVE_TILE_DEPENDENCE 1472 , m_iTileBoundaryIndependenceIdr (0) 1473 #endif 1474 , m_iNumColumnsMinus1 (0) 1475 , m_puiColumnWidth (NULL) 1476 , m_iNumRowsMinus1 (0) 1477 , m_puiRowHeight (NULL) 1478 #if !WPP_SIMPLIFICATION 1479 , m_iEntropyCodingSynchro (0) 1480 , m_bCabacIstateReset (false) 1481 #endif 1482 , m_iNumSubstreams (1) 1483 #if MULTIBITS_DATA_HIDING 1484 , m_signHideFlag(0) 1485 , m_signHidingThreshold(0) 1486 #endif 1487 #if CABAC_INIT_FLAG 1488 , m_cabacInitPresentFlag (false) 1489 , m_encCABACTableIdx (0) 1490 #endif 1491 { 1492 #if !H0566_TLA 1493 for ( UInt i = 0; i < MAX_TLAYER; i++ ) 1494 { 1495 m_abTLayerSwitchingFlag[i] = false; 1496 } 1497 #endif 715 1498 } 716 1499 717 1500 TComPPS::~TComPPS() 718 1501 { 1502 if( m_iNumColumnsMinus1 > 0 && m_iUniformSpacingIdr == 0 ) 1503 { 1504 if (m_puiColumnWidth) delete [] m_puiColumnWidth; 1505 m_puiColumnWidth = NULL; 1506 } 1507 if( m_iNumRowsMinus1 > 0 && m_iUniformSpacingIdr == 0 ) 1508 { 1509 if (m_puiRowHeight) delete [] m_puiRowHeight; 1510 m_puiRowHeight = NULL; 1511 } 719 1512 } 720 1513 … … 759 1552 ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) ); 760 1553 } 761 762 1554 763 1555 #if DEPTH_MAP_GENERATION … … 770 1562 AOT( uiPdmGenMode && ( aaiPdmScaleNomDelta == 0 || aaiPdmOffset == 0 ) ); 771 1563 AOT( uiPdmMvPredMode && uiPdmGenMode == 0 ); 772 1564 773 1565 m_uiPredDepthMapGeneration = uiPdmGenMode; 774 1566 #if HHI_INTER_VIEW_MOTION_PRED 775 1567 m_uiMultiviewMvPredMode = uiPdmMvPredMode; 776 1568 #endif 1569 777 1570 m_uiPdmPrecision = ( m_uiPredDepthMapGeneration ? uiPdmPrec : 0 ); 778 1571 ::memset( m_aiPdmScaleNomDelta, 0x00, sizeof( m_aiPdmScaleNomDelta ) ); … … 788 1581 } 789 1582 #endif 1583 1584 TComReferencePictureSet::TComReferencePictureSet() 1585 : m_numberOfPictures (0) 1586 , m_numberOfNegativePictures (0) 1587 , m_numberOfPositivePictures (0) 1588 , m_numberOfLongtermPictures (0) 1589 , m_interRPSPrediction (0) 1590 , m_deltaRIdxMinus1 (0) 1591 , m_deltaRPS (0) 1592 , m_numRefIdc (0) 1593 { 1594 ::memset( m_deltaPOC, 0, sizeof(m_deltaPOC) ); 1595 ::memset( m_POC, 0, sizeof(m_POC) ); 1596 ::memset( m_used, 0, sizeof(m_used) ); 1597 ::memset( m_refIdc, 0, sizeof(m_refIdc) ); 1598 } 1599 1600 TComReferencePictureSet::~TComReferencePictureSet() 1601 { 1602 } 1603 1604 Void TComReferencePictureSet::setUsed(Int bufferNum, Bool used) 1605 { 1606 m_used[bufferNum] = used; 1607 } 1608 1609 Void TComReferencePictureSet::setDeltaPOC(Int bufferNum, Int deltaPOC) 1610 { 1611 m_deltaPOC[bufferNum] = deltaPOC; 1612 } 1613 1614 Void TComReferencePictureSet::setNumberOfPictures(Int numberOfPictures) 1615 { 1616 m_numberOfPictures = numberOfPictures; 1617 } 1618 1619 Int TComReferencePictureSet::getUsed(Int bufferNum) 1620 { 1621 return m_used[bufferNum]; 1622 } 1623 1624 Int TComReferencePictureSet::getDeltaPOC(Int bufferNum) 1625 { 1626 return m_deltaPOC[bufferNum]; 1627 } 1628 1629 Int TComReferencePictureSet::getNumberOfPictures() 1630 { 1631 return m_numberOfPictures; 1632 } 1633 1634 Int TComReferencePictureSet::getPOC(Int bufferNum) 1635 { 1636 return m_POC[bufferNum]; 1637 } 1638 Void TComReferencePictureSet::setPOC(Int bufferNum, Int POC) 1639 { 1640 m_POC[bufferNum] = POC; 1641 } 1642 1643 /** set the reference idc value at uiBufferNum entry to the value of iRefIdc 1644 * \param uiBufferNum 1645 * \param iRefIdc 1646 * \returns Void 1647 */ 1648 Void TComReferencePictureSet::setRefIdc(Int bufferNum, Int refIdc) 1649 { 1650 m_refIdc[bufferNum] = refIdc; 1651 } 1652 1653 /** get the reference idc value at uiBufferNum 1654 * \param uiBufferNum 1655 * \returns Int 1656 */ 1657 Int TComReferencePictureSet::getRefIdc(Int bufferNum) 1658 { 1659 return m_refIdc[bufferNum]; 1660 } 1661 1662 /** Sorts the deltaPOC and Used by current values in the RPS based on the deltaPOC values. 1663 * deltaPOC values are sorted with -ve values before the +ve values. -ve values are in decreasing order. 1664 * +ve values are in increasing order. 1665 * \returns Void 1666 */ 1667 Void TComReferencePictureSet::sortDeltaPOC() 1668 { 1669 // sort in increasing order (smallest first) 1670 for(Int j=1; j < getNumberOfPictures(); j++) 1671 { 1672 Int deltaPOC = getDeltaPOC(j); 1673 Bool used = getUsed(j); 1674 for (Int k=j-1; k >= 0; k--) 1675 { 1676 Int temp = getDeltaPOC(k); 1677 if (deltaPOC < temp) 1678 { 1679 setDeltaPOC(k+1, temp); 1680 setUsed(k+1, getUsed(k)); 1681 setDeltaPOC(k, deltaPOC); 1682 setUsed(k, used); 1683 } 1684 } 1685 } 1686 // flip the negative values to largest first 1687 Int numNegPics = getNumberOfNegativePictures(); 1688 for(Int j=0, k=numNegPics-1; j < numNegPics>>1; j++, k--) 1689 { 1690 Int deltaPOC = getDeltaPOC(j); 1691 Bool used = getUsed(j); 1692 setDeltaPOC(j, getDeltaPOC(k)); 1693 setUsed(j, getUsed(k)); 1694 setDeltaPOC(k, deltaPOC); 1695 setUsed(k, used); 1696 } 1697 } 1698 1699 /** Prints the deltaPOC and RefIdc (if available) values in the RPS. 1700 * A "*" is added to the deltaPOC value if it is Used bu current. 1701 * \returns Void 1702 */ 1703 Void TComReferencePictureSet::printDeltaPOC() 1704 { 1705 printf("DeltaPOC = { "); 1706 for(Int j=0; j < getNumberOfPictures(); j++) 1707 { 1708 printf("%d%s ", getDeltaPOC(j), (getUsed(j)==1)?"*":""); 1709 } 1710 if (getInterRPSPrediction()) 1711 { 1712 printf("}, RefIdc = { "); 1713 for(Int j=0; j < getNumRefIdc(); j++) 1714 { 1715 printf("%d ", getRefIdc(j)); 1716 } 1717 } 1718 printf("}\n"); 1719 } 1720 1721 TComRPSList::TComRPSList() 1722 { 1723 } 1724 1725 TComRPSList::~TComRPSList() 1726 { 1727 } 1728 1729 Void TComRPSList::create( Int numberOfReferencePictureSets) 1730 { 1731 m_numberOfReferencePictureSets = numberOfReferencePictureSets; 1732 m_referencePictureSets = new TComReferencePictureSet[numberOfReferencePictureSets]; 1733 } 1734 1735 Void TComRPSList::destroy() 1736 { 1737 delete [] m_referencePictureSets; 1738 m_numberOfReferencePictureSets = 0; 1739 m_referencePictureSets = NULL; 1740 } 1741 1742 1743 1744 TComReferencePictureSet* TComRPSList::getReferencePictureSet(Int referencePictureSetNum) 1745 { 1746 return &m_referencePictureSets[referencePictureSetNum]; 1747 } 1748 1749 Int TComRPSList::getNumberOfReferencePictureSets() 1750 { 1751 return m_numberOfReferencePictureSets; 1752 } 1753 1754 Void TComRPSList::setNumberOfReferencePictureSets(Int numberOfReferencePictureSets) 1755 { 1756 m_numberOfReferencePictureSets = numberOfReferencePictureSets; 1757 } 1758 1759 TComRefPicListModification::TComRefPicListModification() 1760 : m_bRefPicListModificationFlagL0 (false) 1761 , m_bRefPicListModificationFlagL1 (false) 1762 #if !H0137_0138_LIST_MODIFICATION 1763 , m_uiNumberOfRefPicListModificationsL0 (0) 1764 , m_uiNumberOfRefPicListModificationsL1 (0) 1765 #endif 1766 { 1767 #if !H0137_0138_LIST_MODIFICATION 1768 ::memset( m_ListIdcL0, 0, sizeof(m_ListIdcL0) ); 1769 #endif 1770 ::memset( m_RefPicSetIdxL0, 0, sizeof(m_RefPicSetIdxL0) ); 1771 #if !H0137_0138_LIST_MODIFICATION 1772 ::memset( m_ListIdcL1, 0, sizeof(m_ListIdcL1) ); 1773 #endif 1774 ::memset( m_RefPicSetIdxL1, 0, sizeof(m_RefPicSetIdxL1) ); 1775 } 1776 1777 TComRefPicListModification::~TComRefPicListModification() 1778 { 1779 } 1780 1781 TComAPS::TComAPS() 1782 { 1783 m_apsID = 0; 1784 m_bAlfEnabled = false; 1785 m_bSaoEnabled = false; 1786 m_pSaoParam = NULL; 1787 #if LCU_SYNTAX_ALF 1788 m_alfParamSet = NULL; 1789 #else 1790 m_pAlfParam = NULL; 1791 #endif 1792 m_scalingList = NULL; 1793 m_scalingListEnabled = false; 1794 } 1795 1796 TComAPS::~TComAPS() 1797 { 1798 1799 } 1800 1801 TComAPS& TComAPS::operator= (const TComAPS& src) 1802 { 1803 m_apsID = src.m_apsID; 1804 m_loopFilterOffsetInAPS = src.m_loopFilterOffsetInAPS; 1805 m_loopFilterDisable = src.m_loopFilterDisable; 1806 m_loopFilterBetaOffsetDiv2 = src.m_loopFilterBetaOffsetDiv2; 1807 m_loopFilterTcOffsetDiv2 = src.m_loopFilterTcOffsetDiv2; 1808 m_bAlfEnabled = src.m_bAlfEnabled; 1809 m_bSaoEnabled = src.m_bSaoEnabled; 1810 m_pSaoParam = src.m_pSaoParam; 1811 #if LCU_SYNTAX_ALF 1812 m_alfParamSet = src.m_alfParamSet; 1813 #else 1814 m_pAlfParam = src.m_pAlfParam; 1815 #endif 1816 m_scalingList = src.m_scalingList; 1817 m_scalingListEnabled = src.m_scalingListEnabled; 1818 #if SAO_UNIT_INTERLEAVING 1819 m_saoInterleavingFlag = src.m_saoInterleavingFlag; 1820 #endif 1821 1822 return *this; 1823 } 1824 1825 Void TComAPS::createSaoParam() 1826 { 1827 m_pSaoParam = new SAOParam; 1828 } 1829 1830 Void TComAPS::destroySaoParam() 1831 { 1832 if(m_pSaoParam != NULL) 1833 { 1834 delete m_pSaoParam; 1835 m_pSaoParam = NULL; 1836 } 1837 } 1838 1839 Void TComAPS::createAlfParam() 1840 { 1841 #if LCU_SYNTAX_ALF 1842 m_alfParamSet = new AlfParamSet; 1843 #else 1844 m_pAlfParam = new ALFParam; 1845 #endif 1846 } 1847 Void TComAPS::destroyAlfParam() 1848 { 1849 #if LCU_SYNTAX_ALF 1850 if(m_alfParamSet != NULL) 1851 { 1852 delete m_alfParamSet; 1853 m_alfParamSet = NULL; 1854 } 1855 #else 1856 if(m_pAlfParam != NULL) 1857 { 1858 delete m_pAlfParam; 1859 m_pAlfParam = NULL; 1860 } 1861 #endif 1862 } 1863 1864 Void TComAPS::createScalingList() 1865 { 1866 m_scalingList = new TComScalingList; 1867 } 1868 Void TComAPS::destroyScalingList() 1869 { 1870 delete m_scalingList; 1871 } 1872 1873 TComScalingList::TComScalingList() 1874 { 1875 init(); 1876 } 1877 TComScalingList::~TComScalingList() 1878 { 1879 destroy(); 1880 } 1881 1882 /** set default quantization matrix to array 1883 */ 1884 Void TComSlice::setDefaultScalingList() 1885 { 1886 for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 1887 { 1888 for(UInt listId=0;listId<g_scalingListNum[sizeId];listId++) 1889 { 1890 getScalingList()->processDefaultMarix(sizeId, listId); 1891 } 1892 } 1893 } 1894 /** check if use default quantization matrix 1895 * \returns true if use default quantization matrix in all size 1896 */ 1897 #if SCALING_LIST 1898 Bool TComSlice::checkDefaultScalingList() 1899 { 1900 UInt defaultCounter=0; 1901 1902 for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 1903 { 1904 for(UInt listId=0;listId<g_scalingListNum[sizeId];listId++) 1905 { 1906 if(getScalingList()->getUseDefaultScalingMatrixFlag(sizeId,listId)) 1907 { 1908 defaultCounter++; 1909 } 1910 } 1911 } 1912 return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? true : false; // -4 for 32x32 1913 } 1914 #else 1915 Bool TComSlice::checkDefaultScalingList() 1916 { 1917 UInt i; 1918 Int *dst=0; 1919 Int *src=0; 1920 UInt defaultCounter=0; 1921 1922 //4x4 1923 for(i=0;i<SCALING_LIST_NUM;i++) 1924 { 1925 src = (i<3) ? g_quantIntraDefault4x4 : g_quantInterDefault4x4; 1926 dst = getScalingList()->getScalingListAddress(SCALING_LIST_4x4,i); 1927 if(::memcmp(dst,src,sizeof(UInt)*16) == 0) defaultCounter++; 1928 } 1929 1930 //8x8 1931 for(i=0;i<SCALING_LIST_NUM;i++) 1932 { 1933 src = (i<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; 1934 dst = getScalingList()->getScalingListAddress(SCALING_LIST_8x8,i); 1935 if(::memcmp(dst,src,sizeof(UInt)*64) == 0) defaultCounter++; 1936 } 1937 //16x16 1938 for(i=0;i<SCALING_LIST_NUM;i++) 1939 { 1940 src = (i<3) ? g_quantIntraDefault16x16 : g_quantInterDefault16x16; 1941 dst = getScalingList()->getScalingListAddress(SCALING_LIST_16x16,i); 1942 if(::memcmp(dst,src,sizeof(UInt)*256) == 0) defaultCounter++; 1943 } 1944 //32x32 1945 for(i=0;i<SCALING_LIST_NUM_32x32;i++) 1946 { 1947 src = (i<1) ? g_quantIntraDefault32x32 : g_quantInterDefault32x32; 1948 dst = getScalingList()->getScalingListAddress(SCALING_LIST_32x32,i*3); 1949 if(::memcmp(dst,src,sizeof(UInt)*1024) == 0) defaultCounter++; 1950 } 1951 return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? true : false; // -4 for 32x32 1952 } 1953 #endif 1954 /** get scaling matrix from RefMatrixID 1955 * \param sizeId size index 1956 * \param Index of input matrix 1957 * \param Index of reference matrix 1958 */ 1959 Void TComScalingList::processRefMatrix( UInt sizeId, UInt listId , UInt refListId ) 1960 { 1961 #if SCALING_LIST 1962 ::memcpy(getScalingListAddress(sizeId, listId),getScalingListAddress(sizeId, refListId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); 1963 #else 1964 ::memcpy(getScalingListAddress(sizeId, listId),getScalingListAddress(sizeId, refListId),sizeof(Int)*g_scalingListSize[sizeId]); 1965 #endif 1966 } 1967 /** parse syntax infomation 1968 * \param pchFile syntax infomation 1969 * \returns false if successful 1970 */ 1971 Bool TComScalingList::xParseScalingList(char* pchFile) 1972 { 1973 FILE *fp; 1974 Char line[1024]; 1975 UInt sizeIdc,listIdc; 1976 UInt i,size = 0; 1977 Int *src=0,data; 1978 Char *ret; 1979 UInt retval; 1980 1981 if((fp = fopen(pchFile,"r")) == (FILE*)NULL) 1982 { 1983 printf("can't open file %s :: set Default Matrix\n",pchFile); 1984 return true; 1985 } 1986 1987 for(sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) 1988 { 1989 #if SCALING_LIST 1990 size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeIdc]); 1991 #else 1992 size = g_scalingListSize[sizeIdc]; 1993 #endif 1994 for(listIdc = 0; listIdc < g_scalingListNum[sizeIdc]; listIdc++) 1995 { 1996 src = getScalingListAddress(sizeIdc, listIdc); 1997 1998 fseek(fp,0,0); 1999 do 2000 { 2001 ret = fgets(line, 1024, fp); 2002 if ((ret==NULL)||(strstr(line, MatrixType[sizeIdc][listIdc])==NULL && feof(fp))) 2003 { 2004 printf("Error: can't read Matrix :: set Default Matrix\n"); 2005 return true; 2006 } 2007 } 2008 while (strstr(line, MatrixType[sizeIdc][listIdc]) == NULL); 2009 for (i=0; i<size; i++) 2010 { 2011 retval = fscanf(fp, "%d,", &data); 2012 if (retval!=1) 2013 { 2014 printf("Error: can't read Matrix :: set Default Matrix\n"); 2015 return true; 2016 } 2017 src[i] = data; 2018 } 2019 #if SCALING_LIST 2020 //set DC value for default matrix check 2021 setScalingListDC(sizeIdc,listIdc,src[0]); 2022 2023 if(sizeIdc > SCALING_LIST_8x8) 2024 { 2025 fseek(fp,0,0); 2026 do 2027 { 2028 ret = fgets(line, 1024, fp); 2029 if ((ret==NULL)||(strstr(line, MatrixType_DC[sizeIdc][listIdc])==NULL && feof(fp))) 2030 { 2031 printf("Error: can't read DC :: set Default Matrix\n"); 2032 return true; 2033 } 2034 } 2035 while (strstr(line, MatrixType_DC[sizeIdc][listIdc]) == NULL); 2036 retval = fscanf(fp, "%d,", &data); 2037 if (retval!=1) 2038 { 2039 printf("Error: can't read Matrix :: set Default Matrix\n"); 2040 return true; 2041 } 2042 //overwrite DC value when size of matrix is larger than 16x16 2043 setScalingListDC(sizeIdc,listIdc,data); 2044 } 2045 #endif 2046 } 2047 } 2048 fclose(fp); 2049 return false; 2050 } 2051 2052 /** initialization process of quantization matrix array 2053 */ 2054 Void TComScalingList::init() 2055 { 2056 for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 2057 { 2058 for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) 2059 { 2060 #if SCALING_LIST 2061 m_scalingListCoef[sizeId][listId] = new Int [min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])]; 2062 #else 2063 m_scalingListCoef[sizeId][listId] = new Int [g_scalingListSize[sizeId]]; 2064 #endif 2065 } 2066 } 2067 m_scalingListCoef[SCALING_LIST_32x32][3] = m_scalingListCoef[SCALING_LIST_32x32][1]; // copy address for 32x32 2068 } 2069 /** destroy quantization matrix array 2070 */ 2071 Void TComScalingList::destroy() 2072 { 2073 for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 2074 { 2075 for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) 2076 { 2077 if(m_scalingListCoef[sizeId][listId]) delete [] m_scalingListCoef[sizeId][listId]; 2078 } 2079 } 2080 } 2081 /** get default address of quantization matrix 2082 * \param sizeId size index 2083 * \param listId list index 2084 * \returns pointer of quantization matrix 2085 */ 2086 Int* TComScalingList::getScalingListDefaultAddress(UInt sizeId, UInt listId) 2087 { 2088 Int *src = 0; 2089 switch(sizeId) 2090 { 2091 case SCALING_LIST_4x4: 2092 src = (listId<3) ? g_quantIntraDefault4x4 : g_quantInterDefault4x4; 2093 break; 2094 case SCALING_LIST_8x8: 2095 src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; 2096 break; 2097 #if SCALING_LIST 2098 case SCALING_LIST_16x16: 2099 src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; 2100 break; 2101 case SCALING_LIST_32x32: 2102 src = (listId<1) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; 2103 break; 2104 #else 2105 case SCALING_LIST_16x16: 2106 src = (listId<3) ? g_quantIntraDefault16x16 : g_quantInterDefault16x16; 2107 break; 2108 case SCALING_LIST_32x32: 2109 src = (listId<1) ? g_quantIntraDefault32x32 : g_quantInterDefault32x32; 2110 break; 2111 #endif 2112 default: 2113 assert(0); 2114 src = NULL; 2115 break; 2116 } 2117 return src; 2118 } 2119 /** process of default matrix 2120 * \param sizeId size index 2121 * \param Index of input matrix 2122 */ 2123 Void TComScalingList::processDefaultMarix(UInt sizeId, UInt listId) 2124 { 2125 #if SCALING_LIST 2126 ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); 2127 setUseDefaultScalingMatrixFlag(sizeId,listId,true); 2128 setScalingListDC(sizeId,listId,SCALING_LIST_DC); 2129 #else 2130 ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*(Int)g_scalingListSize[sizeId]); 2131 #endif 2132 } 2133 #if SCALING_LIST 2134 /** check DC value of matrix for default matrix signaling 2135 */ 2136 Void TComScalingList::checkDcOfMatrix() 2137 { 2138 for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) 2139 { 2140 for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) 2141 { 2142 setUseDefaultScalingMatrixFlag(sizeId,listId,false); 2143 //check default matrix? 2144 if(getScalingListDC(sizeId,listId) == 0) 2145 { 2146 processDefaultMarix(sizeId, listId); 2147 } 2148 } 2149 } 2150 } 2151 #endif 2152 2153 ParameterSetManager::ParameterSetManager() 2154 : m_spsMap(MAX_NUM_SPS) 2155 , m_ppsMap(MAX_NUM_PPS) 2156 , m_apsMap(MAX_NUM_APS) 2157 { 2158 } 2159 2160 2161 ParameterSetManager::~ParameterSetManager() 2162 { 2163 } 2164 2165 //! \}
Note: See TracChangeset for help on using the changeset viewer.