[61] | 1 | /* The copyright in this software is being made available under the BSD |
---|
[5] | 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[56] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[56] | 6 | * Copyright (c) 2010-2012, ITU/ISO/IEC |
---|
[5] | 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
[56] | 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
[5] | 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
| 33 | |
---|
[2] | 34 | /** \file TComSlice.cpp |
---|
| 35 | \brief slice header and SPS class |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include "CommonDef.h" |
---|
| 39 | #include "TComSlice.h" |
---|
| 40 | #include "TComPic.h" |
---|
| 41 | |
---|
[56] | 42 | //! \ingroup TLibCommon |
---|
| 43 | //! \{ |
---|
| 44 | |
---|
[2] | 45 | TComSlice::TComSlice() |
---|
[210] | 46 | #if QC_MVHEVC_B0046 |
---|
| 47 | : m_iPPSId ( 0 ) |
---|
| 48 | #else |
---|
[56] | 49 | : m_iPPSId ( -1 ) |
---|
[210] | 50 | #endif |
---|
[56] | 51 | , m_iPOC ( 0 ) |
---|
| 52 | , m_iLastIDR ( 0 ) |
---|
| 53 | , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR ) |
---|
| 54 | , m_eNalUnitTypeBaseViewMvc ( NAL_UNIT_INVALID ) |
---|
| 55 | , m_eSliceType ( I_SLICE ) |
---|
| 56 | , m_iSliceQp ( 0 ) |
---|
| 57 | #if ADAPTIVE_QP_SELECTION |
---|
| 58 | , m_iSliceQpBase ( 0 ) |
---|
[2] | 59 | #endif |
---|
[56] | 60 | , m_bLoopFilterDisable ( false ) |
---|
| 61 | , m_inheritDblParamFromAPS ( true ) |
---|
| 62 | , m_loopFilterBetaOffsetDiv2 ( 0 ) |
---|
| 63 | , m_loopFilterTcOffsetDiv2 ( 0 ) |
---|
| 64 | , m_bRefPicListModificationFlagLC ( false ) |
---|
| 65 | , m_bRefPicListCombinationFlag ( false ) |
---|
| 66 | , m_bCheckLDC ( false ) |
---|
| 67 | , m_iSliceQpDelta ( 0 ) |
---|
| 68 | , m_pcTexturePic ( NULL ) |
---|
| 69 | , m_iDepth ( 0 ) |
---|
| 70 | , m_bRefenced ( false ) |
---|
| 71 | , m_pcSPS ( NULL ) |
---|
| 72 | , m_pcPPS ( NULL ) |
---|
| 73 | , m_pcPic ( NULL ) |
---|
| 74 | , m_uiColDir ( 0 ) |
---|
| 75 | #if COLLOCATED_REF_IDX |
---|
| 76 | , m_colRefIdx ( 0 ) |
---|
[42] | 77 | #endif |
---|
[56] | 78 | #if ALF_CHROMA_LAMBDA || SAO_CHROMA_LAMBDA |
---|
| 79 | , m_dLambdaLuma( 0.0 ) |
---|
| 80 | , m_dLambdaChroma( 0.0 ) |
---|
| 81 | #else |
---|
| 82 | , m_dLambda ( 0.0 ) |
---|
| 83 | #endif |
---|
| 84 | , m_bNoBackPredFlag ( false ) |
---|
| 85 | , m_bRefIdxCombineCoding ( false ) |
---|
| 86 | , m_uiTLayer ( 0 ) |
---|
| 87 | , m_bTLayerSwitchingFlag ( false ) |
---|
| 88 | , m_uiSliceMode ( 0 ) |
---|
| 89 | , m_uiSliceArgument ( 0 ) |
---|
| 90 | , m_uiSliceCurStartCUAddr ( 0 ) |
---|
| 91 | , m_uiSliceCurEndCUAddr ( 0 ) |
---|
| 92 | , m_uiSliceIdx ( 0 ) |
---|
| 93 | , m_uiEntropySliceMode ( 0 ) |
---|
| 94 | , m_uiEntropySliceArgument ( 0 ) |
---|
| 95 | , m_uiEntropySliceCurStartCUAddr ( 0 ) |
---|
| 96 | , m_uiEntropySliceCurEndCUAddr ( 0 ) |
---|
| 97 | , m_bNextSlice ( false ) |
---|
| 98 | , m_bNextEntropySlice ( false ) |
---|
| 99 | , m_uiSliceBits ( 0 ) |
---|
| 100 | , m_uiEntropySliceCounter ( 0 ) |
---|
| 101 | , m_bFinalized ( false ) |
---|
| 102 | , m_uiTileByteLocation ( NULL ) |
---|
| 103 | , m_uiTileCount ( 0 ) |
---|
| 104 | , m_iTileMarkerFlag ( 0 ) |
---|
| 105 | , m_uiTileOffstForMultES ( 0 ) |
---|
| 106 | , m_puiSubstreamSizes ( NULL ) |
---|
| 107 | #if CABAC_INIT_FLAG |
---|
| 108 | , m_cabacInitFlag ( false ) |
---|
| 109 | #else |
---|
| 110 | , m_cabacInitIdc ( -1 ) |
---|
| 111 | #endif |
---|
| 112 | , m_numEntryPointOffsets ( 0 ) |
---|
[189] | 113 | #if LGE_ILLUCOMP_B0045 |
---|
| 114 | , m_bApplyIC ( false ) |
---|
[443] | 115 | #if SHARP_ILLUCOMP_PARSE_D0060 |
---|
| 116 | , m_icSkipParseFlag ( false ) |
---|
[189] | 117 | #endif |
---|
[443] | 118 | #endif |
---|
[296] | 119 | #if INTER_VIEW_VECTOR_SCALING_C0115 |
---|
| 120 | , m_bIVScalingFlag (false) |
---|
| 121 | , m_iViewOrderIdx ( 0 ) // will be changed to view_id |
---|
| 122 | #endif |
---|
[56] | 123 | { |
---|
[443] | 124 | #if MERL_VSP_NBDV_RefVId_Fix_D0166 |
---|
| 125 | for(Int iNumCount = 0; iNumCount < MAX_VIEW_NUM; iNumCount++) |
---|
| 126 | m_pcListDepthPic[iNumCount] =NULL; |
---|
| 127 | #endif |
---|
[56] | 128 | m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0; |
---|
[296] | 129 | |
---|
[2] | 130 | initEqualRef(); |
---|
[56] | 131 | |
---|
| 132 | for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++) |
---|
| 133 | { |
---|
| 134 | m_iRefIdxOfLC[REF_PIC_LIST_0][iNumCount]=-1; |
---|
| 135 | m_iRefIdxOfLC[REF_PIC_LIST_1][iNumCount]=-1; |
---|
| 136 | m_eListIdFromIdxOfLC[iNumCount]=0; |
---|
| 137 | m_iRefIdxFromIdxOfLC[iNumCount]=0; |
---|
| 138 | m_iRefIdxOfL0FromRefIdxOfL1[iNumCount] = -1; |
---|
| 139 | m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1; |
---|
| 140 | } |
---|
| 141 | for(Int iNumCount = 0; iNumCount < MAX_NUM_REF+1; iNumCount++) |
---|
| 142 | { |
---|
| 143 | m_apcRefPicList [0][iNumCount] = NULL; |
---|
| 144 | m_apcRefPicList [1][iNumCount] = NULL; |
---|
| 145 | m_aiRefPOCList [0][iNumCount] = 0; |
---|
| 146 | m_aiRefPOCList [1][iNumCount] = 0; |
---|
| 147 | m_aiRefViewIdList[0][iNumCount] = 0; |
---|
| 148 | m_aiRefViewIdList[1][iNumCount] = 0; |
---|
| 149 | } |
---|
| 150 | m_bCombineWithReferenceFlag = 0; |
---|
[2] | 151 | resetWpScaling(m_weightPredTable); |
---|
[56] | 152 | resetWpScalingLC(m_weightPredTableLC); |
---|
[2] | 153 | initWpAcDcParam(); |
---|
[210] | 154 | #if QC_IV_AS_LT_B0046 |
---|
| 155 | for(Int iNumCount = 0; iNumCount < MAX_NUM_REF+1; iNumCount++) |
---|
| 156 | { |
---|
| 157 | m_bWasLongTerm[0][iNumCount] = false; |
---|
| 158 | m_bWasLongTerm[1][iNumCount] = false; |
---|
| 159 | } |
---|
| 160 | #endif |
---|
[2] | 161 | } |
---|
| 162 | |
---|
| 163 | TComSlice::~TComSlice() |
---|
| 164 | { |
---|
[56] | 165 | if (m_uiTileByteLocation) |
---|
| 166 | { |
---|
| 167 | delete [] m_uiTileByteLocation; |
---|
| 168 | m_uiTileByteLocation = NULL; |
---|
| 169 | } |
---|
| 170 | delete[] m_puiSubstreamSizes; |
---|
| 171 | m_puiSubstreamSizes = NULL; |
---|
[2] | 172 | } |
---|
| 173 | |
---|
| 174 | |
---|
| 175 | Void TComSlice::initSlice() |
---|
| 176 | { |
---|
| 177 | m_aiNumRefIdx[0] = 0; |
---|
| 178 | m_aiNumRefIdx[1] = 0; |
---|
[5] | 179 | |
---|
[2] | 180 | m_uiColDir = 0; |
---|
[56] | 181 | |
---|
| 182 | #if COLLOCATED_REF_IDX |
---|
| 183 | m_colRefIdx = 0; |
---|
| 184 | #endif |
---|
| 185 | m_pcTexturePic = NULL; |
---|
[2] | 186 | |
---|
| 187 | initEqualRef(); |
---|
| 188 | m_bNoBackPredFlag = false; |
---|
| 189 | m_bRefIdxCombineCoding = false; |
---|
| 190 | m_bRefPicListCombinationFlag = false; |
---|
| 191 | m_bRefPicListModificationFlagLC = false; |
---|
[56] | 192 | m_bCheckLDC = false; |
---|
| 193 | |
---|
| 194 | m_aiNumRefIdx[REF_PIC_LIST_C] = 0; |
---|
| 195 | |
---|
| 196 | m_uiMaxNumMergeCand = MRG_MAX_NUM_CANDS_SIGNALED; |
---|
| 197 | |
---|
| 198 | m_bFinalized=false; |
---|
| 199 | |
---|
| 200 | m_uiTileCount = 0; |
---|
| 201 | #if CABAC_INIT_FLAG |
---|
| 202 | m_cabacInitFlag = false; |
---|
[2] | 203 | #endif |
---|
[56] | 204 | m_numEntryPointOffsets = 0; |
---|
[296] | 205 | #if QC_TMVP_MRG_REFIDX_C0047 |
---|
| 206 | m_aiNewRefIdx[0] = -1; |
---|
| 207 | m_aiNewRefIdx[1] = -1; |
---|
[56] | 208 | #endif |
---|
[2] | 209 | } |
---|
| 210 | |
---|
[56] | 211 | Void TComSlice::initTiles() |
---|
| 212 | { |
---|
| 213 | Int iWidth = m_pcSPS->getPicWidthInLumaSamples(); |
---|
| 214 | Int iHeight = m_pcSPS->getPicHeightInLumaSamples(); |
---|
| 215 | UInt uiWidthInCU = ( iWidth %g_uiMaxCUWidth ) ? iWidth /g_uiMaxCUWidth + 1 : iWidth /g_uiMaxCUWidth; |
---|
| 216 | UInt uiHeightInCU = ( iHeight%g_uiMaxCUHeight ) ? iHeight/g_uiMaxCUHeight + 1 : iHeight/g_uiMaxCUHeight; |
---|
| 217 | UInt uiNumCUsInFrame = uiWidthInCU * uiHeightInCU; |
---|
| 218 | |
---|
| 219 | if (m_uiTileByteLocation==NULL) m_uiTileByteLocation = new UInt[uiNumCUsInFrame]; |
---|
| 220 | } |
---|
| 221 | |
---|
| 222 | |
---|
| 223 | /** |
---|
| 224 | - allocate table to contain substream sizes to be written to the slice header. |
---|
| 225 | . |
---|
| 226 | \param uiNumSubstreams Number of substreams -- the allocation will be this value - 1. |
---|
| 227 | */ |
---|
| 228 | Void TComSlice::allocSubstreamSizes(UInt uiNumSubstreams) |
---|
| 229 | { |
---|
| 230 | delete[] m_puiSubstreamSizes; |
---|
| 231 | m_puiSubstreamSizes = new UInt[uiNumSubstreams > 0 ? uiNumSubstreams-1 : 0]; |
---|
| 232 | } |
---|
| 233 | |
---|
[2] | 234 | Void TComSlice::sortPicList (TComList<TComPic*>& rcListPic) |
---|
| 235 | { |
---|
| 236 | TComPic* pcPicExtract; |
---|
| 237 | TComPic* pcPicInsert; |
---|
[5] | 238 | |
---|
[2] | 239 | TComList<TComPic*>::iterator iterPicExtract; |
---|
| 240 | TComList<TComPic*>::iterator iterPicExtract_1; |
---|
| 241 | TComList<TComPic*>::iterator iterPicInsert; |
---|
[5] | 242 | |
---|
[2] | 243 | for (Int i = 1; i < (Int)(rcListPic.size()); i++) |
---|
| 244 | { |
---|
| 245 | iterPicExtract = rcListPic.begin(); |
---|
| 246 | for (Int j = 0; j < i; j++) iterPicExtract++; |
---|
| 247 | pcPicExtract = *(iterPicExtract); |
---|
| 248 | pcPicExtract->setCurrSliceIdx(0); |
---|
[5] | 249 | |
---|
[2] | 250 | iterPicInsert = rcListPic.begin(); |
---|
| 251 | while (iterPicInsert != iterPicExtract) |
---|
| 252 | { |
---|
| 253 | pcPicInsert = *(iterPicInsert); |
---|
| 254 | pcPicInsert->setCurrSliceIdx(0); |
---|
| 255 | if (pcPicInsert->getPOC() >= pcPicExtract->getPOC()) |
---|
| 256 | { |
---|
| 257 | break; |
---|
| 258 | } |
---|
[5] | 259 | |
---|
[2] | 260 | iterPicInsert++; |
---|
| 261 | } |
---|
[5] | 262 | |
---|
[2] | 263 | iterPicExtract_1 = iterPicExtract; iterPicExtract_1++; |
---|
[5] | 264 | |
---|
[2] | 265 | // swap iterPicExtract and iterPicInsert, iterPicExtract = curr. / iterPicInsert = insertion position |
---|
| 266 | rcListPic.insert (iterPicInsert, iterPicExtract, iterPicExtract_1); |
---|
| 267 | rcListPic.erase (iterPicExtract); |
---|
| 268 | } |
---|
| 269 | } |
---|
| 270 | |
---|
[56] | 271 | TComPic* TComSlice::xGetRefPic( TComList<TComPic*>& rcListPic, UInt uiPOC ) |
---|
[2] | 272 | { |
---|
[56] | 273 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 274 | TComPic* pcPic = *(iterPic); |
---|
| 275 | while ( iterPic != rcListPic.end() ) |
---|
[2] | 276 | { |
---|
[56] | 277 | if(pcPic->getPOC() == uiPOC) |
---|
[2] | 278 | { |
---|
[56] | 279 | break; |
---|
[2] | 280 | } |
---|
[56] | 281 | iterPic++; |
---|
| 282 | pcPic = *(iterPic); |
---|
[2] | 283 | } |
---|
[56] | 284 | return pcPic; |
---|
| 285 | } |
---|
[2] | 286 | |
---|
[56] | 287 | |
---|
| 288 | TComPic* TComSlice::xGetLongTermRefPic( TComList<TComPic*>& rcListPic, UInt uiPOC ) |
---|
| 289 | { |
---|
| 290 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 291 | TComPic* pcPic = *(iterPic); |
---|
| 292 | TComPic* pcStPic = pcPic; |
---|
| 293 | while ( iterPic != rcListPic.end() ) |
---|
| 294 | { |
---|
| 295 | pcPic = *(iterPic); |
---|
| 296 | if(pcPic && (pcPic->getPOC()%(1<<getSPS()->getBitsForPOC())) == (uiPOC%(1<<getSPS()->getBitsForPOC()))) |
---|
| 297 | { |
---|
| 298 | if(pcPic->getIsLongTerm()) |
---|
| 299 | return pcPic; |
---|
| 300 | else |
---|
| 301 | pcStPic = pcPic; |
---|
| 302 | break; |
---|
| 303 | } |
---|
| 304 | |
---|
| 305 | iterPic++; |
---|
| 306 | } |
---|
| 307 | return pcStPic; |
---|
[2] | 308 | } |
---|
| 309 | |
---|
[56] | 310 | TComPic* TComSlice::xGetInterViewRefPic( std::vector<TComPic*>& rcListIvPic, UInt uiViewId ) |
---|
| 311 | { |
---|
| 312 | TComPic* pcPic = NULL; |
---|
| 313 | for( Int k = 0; k < rcListIvPic.size(); k++ ) |
---|
| 314 | { |
---|
| 315 | if( rcListIvPic[k]->getViewId() == uiViewId ) |
---|
| 316 | { |
---|
| 317 | pcPic = rcListIvPic[k]; |
---|
| 318 | break; |
---|
| 319 | } |
---|
| 320 | } |
---|
| 321 | |
---|
| 322 | assert( pcPic != NULL ); |
---|
| 323 | return pcPic; |
---|
| 324 | } |
---|
| 325 | |
---|
| 326 | Int TComSlice::getNumPocTotalCurr() |
---|
| 327 | { |
---|
| 328 | if( m_eSliceType == I_SLICE ) |
---|
| 329 | { |
---|
| 330 | return 0; |
---|
| 331 | } |
---|
| 332 | |
---|
| 333 | Int numPocTotalCurr = 0; |
---|
| 334 | for( UInt i = 0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++ ) |
---|
| 335 | { |
---|
| 336 | if(m_pcRPS->getUsed(i)) |
---|
| 337 | { |
---|
| 338 | numPocTotalCurr++; |
---|
| 339 | } |
---|
| 340 | } |
---|
| 341 | |
---|
| 342 | return numPocTotalCurr; |
---|
| 343 | } |
---|
| 344 | |
---|
| 345 | Int TComSlice::getNumPocTotalCurrMvc() |
---|
| 346 | { |
---|
| 347 | if( m_eSliceType == I_SLICE ) |
---|
| 348 | { |
---|
| 349 | return 0; |
---|
| 350 | } |
---|
| 351 | return getNumPocTotalCurr() + m_pcSPS->getNumberOfUsableInterViewRefs(); |
---|
| 352 | } |
---|
| 353 | |
---|
| 354 | Void TComSlice::setRefPOCnViewListsMvc() |
---|
| 355 | { |
---|
| 356 | for(Int iDir = 0; iDir < 2; iDir++) |
---|
| 357 | { |
---|
| 358 | for(Int iNumRefIdx = 0; iNumRefIdx < m_aiNumRefIdx[iDir]; iNumRefIdx++) |
---|
| 359 | { |
---|
| 360 | m_aiRefPOCList [iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getPOC(); |
---|
| 361 | m_aiRefViewIdList[iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getViewId(); |
---|
| 362 | } |
---|
| 363 | } |
---|
| 364 | } |
---|
| 365 | |
---|
[2] | 366 | Void TComSlice::generateCombinedList() |
---|
| 367 | { |
---|
| 368 | if(m_aiNumRefIdx[REF_PIC_LIST_C] > 0) |
---|
| 369 | { |
---|
| 370 | m_aiNumRefIdx[REF_PIC_LIST_C]=0; |
---|
| 371 | for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++) |
---|
| 372 | { |
---|
| 373 | m_iRefIdxOfLC[REF_PIC_LIST_0][iNumCount]=-1; |
---|
| 374 | m_iRefIdxOfLC[REF_PIC_LIST_1][iNumCount]=-1; |
---|
| 375 | m_eListIdFromIdxOfLC[iNumCount]=0; |
---|
| 376 | m_iRefIdxFromIdxOfLC[iNumCount]=0; |
---|
| 377 | m_iRefIdxOfL0FromRefIdxOfL1[iNumCount] = -1; |
---|
| 378 | m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1; |
---|
| 379 | } |
---|
| 380 | |
---|
| 381 | for (Int iNumRefIdx = 0; iNumRefIdx < MAX_NUM_REF; iNumRefIdx++) |
---|
| 382 | { |
---|
[56] | 383 | if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_0]) |
---|
| 384 | { |
---|
[2] | 385 | Bool bTempRefIdxInL2 = true; |
---|
| 386 | for ( Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++ ) |
---|
| 387 | { |
---|
[56] | 388 | if( (m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() ) && |
---|
| 389 | (m_apcRefPicList[REF_PIC_LIST_0][iNumRefIdx]->getViewId() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getViewId()) ) |
---|
[2] | 390 | { |
---|
| 391 | m_iRefIdxOfL1FromRefIdxOfL0[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC]; |
---|
| 392 | m_iRefIdxOfL0FromRefIdxOfL1[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx; |
---|
| 393 | bTempRefIdxInL2 = false; |
---|
| 394 | break; |
---|
| 395 | } |
---|
| 396 | } |
---|
| 397 | |
---|
| 398 | if(bTempRefIdxInL2 == true) |
---|
[5] | 399 | { |
---|
[2] | 400 | m_eListIdFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = REF_PIC_LIST_0; |
---|
| 401 | m_iRefIdxFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = iNumRefIdx; |
---|
| 402 | m_iRefIdxOfLC[REF_PIC_LIST_0][iNumRefIdx] = m_aiNumRefIdx[REF_PIC_LIST_C]++; |
---|
| 403 | } |
---|
| 404 | } |
---|
| 405 | |
---|
[56] | 406 | if(iNumRefIdx < m_aiNumRefIdx[REF_PIC_LIST_1]) |
---|
| 407 | { |
---|
[2] | 408 | Bool bTempRefIdxInL2 = true; |
---|
| 409 | for ( Int iRefIdxLC = 0; iRefIdxLC < m_aiNumRefIdx[REF_PIC_LIST_C]; iRefIdxLC++ ) |
---|
| 410 | { |
---|
[56] | 411 | if( (m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getPOC() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getPOC() ) && |
---|
| 412 | (m_apcRefPicList[REF_PIC_LIST_1][iNumRefIdx]->getViewId() == m_apcRefPicList[m_eListIdFromIdxOfLC[iRefIdxLC]][m_iRefIdxFromIdxOfLC[iRefIdxLC]]->getViewId()) ) |
---|
[2] | 413 | { |
---|
| 414 | m_iRefIdxOfL0FromRefIdxOfL1[iNumRefIdx] = m_iRefIdxFromIdxOfLC[iRefIdxLC]; |
---|
| 415 | m_iRefIdxOfL1FromRefIdxOfL0[m_iRefIdxFromIdxOfLC[iRefIdxLC]] = iNumRefIdx; |
---|
| 416 | bTempRefIdxInL2 = false; |
---|
| 417 | break; |
---|
| 418 | } |
---|
| 419 | } |
---|
| 420 | if(bTempRefIdxInL2 == true) |
---|
| 421 | { |
---|
| 422 | m_eListIdFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = REF_PIC_LIST_1; |
---|
| 423 | m_iRefIdxFromIdxOfLC[m_aiNumRefIdx[REF_PIC_LIST_C]] = iNumRefIdx; |
---|
| 424 | m_iRefIdxOfLC[REF_PIC_LIST_1][iNumRefIdx] = m_aiNumRefIdx[REF_PIC_LIST_C]++; |
---|
| 425 | } |
---|
| 426 | } |
---|
| 427 | } |
---|
| 428 | } |
---|
[296] | 429 | #if QC_TMVP_MRG_REFIDX_C0047 |
---|
| 430 | Int iCurrPOC = this->getPOC(); |
---|
| 431 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )//just to get one updated ref idx for merge in each L0/L1 direction, if it is not avaialbe, it is still -1 |
---|
| 432 | { |
---|
| 433 | if ( this->getNumRefIdx( RefPicList( uiRefListIdx ) ) == 0) |
---|
| 434 | continue; |
---|
| 435 | |
---|
| 436 | Bool bZeroIdxInterViewFlag = ( this->getRefPic(RefPicList(uiRefListIdx), 0)->getPOC() == iCurrPOC ) ? true : false; |
---|
| 437 | for(Int i = 1; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ ) |
---|
| 438 | { |
---|
| 439 | if ( (bZeroIdxInterViewFlag && this->getRefPic(RefPicList(uiRefListIdx), i)->getPOC() != iCurrPOC ) || |
---|
| 440 | (!bZeroIdxInterViewFlag && this->getRefPic(RefPicList(uiRefListIdx), i)->getPOC() == iCurrPOC ) ) |
---|
| 441 | { |
---|
| 442 | this->setNewRefIdx(RefPicList(uiRefListIdx),i); |
---|
| 443 | break; |
---|
| 444 | } |
---|
| 445 | } |
---|
| 446 | } |
---|
| 447 | |
---|
| 448 | #endif |
---|
[2] | 449 | } |
---|
| 450 | |
---|
[56] | 451 | Void TComSlice::setRefPicListMvc( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& rapcInterViewRefPics ) |
---|
[2] | 452 | { |
---|
[56] | 453 | if( m_eSliceType == I_SLICE ) |
---|
[2] | 454 | { |
---|
[56] | 455 | ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList) ); |
---|
| 456 | ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx ) ); |
---|
[2] | 457 | |
---|
| 458 | return; |
---|
| 459 | } |
---|
| 460 | |
---|
[56] | 461 | TComPic* pcRefPic; |
---|
| 462 | TComPic* RefPicSetStCurr0[16]; |
---|
| 463 | TComPic* RefPicSetStCurr1[16]; |
---|
| 464 | TComPic* RefPicSetLtCurr [16]; |
---|
| 465 | TComPic* RefPicSetIvCurr [16]; |
---|
| 466 | |
---|
| 467 | UInt NumPocStCurr0 = 0; |
---|
| 468 | UInt NumPocStCurr1 = 0; |
---|
| 469 | UInt NumPocLtCurr = 0; |
---|
| 470 | UInt NumPocIvCurr = 0; |
---|
| 471 | |
---|
| 472 | Int i; |
---|
| 473 | // short term negative |
---|
| 474 | for( i = 0; i < m_pcRPS->getNumberOfNegativePictures(); i++ ) |
---|
[2] | 475 | { |
---|
[56] | 476 | if( m_pcRPS->getUsed(i) ) |
---|
[2] | 477 | { |
---|
[56] | 478 | pcRefPic = xGetRefPic( rcListPic, getPOC() + m_pcRPS->getDeltaPOC(i) ); |
---|
| 479 | pcRefPic->setIsLongTerm( 0 ); |
---|
| 480 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 481 | RefPicSetStCurr0[NumPocStCurr0] = pcRefPic; |
---|
| 482 | NumPocStCurr0++; |
---|
[2] | 483 | } |
---|
| 484 | } |
---|
[56] | 485 | // short term positive |
---|
| 486 | for( ; i < m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures(); i++ ) |
---|
| 487 | { |
---|
| 488 | if( m_pcRPS->getUsed(i) ) |
---|
| 489 | { |
---|
| 490 | pcRefPic = xGetRefPic( rcListPic, getPOC() + m_pcRPS->getDeltaPOC(i) ); |
---|
| 491 | pcRefPic->setIsLongTerm( 0 ); |
---|
| 492 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 493 | RefPicSetStCurr1[NumPocStCurr1] = pcRefPic; |
---|
| 494 | NumPocStCurr1++; |
---|
| 495 | } |
---|
| 496 | } |
---|
| 497 | // long term |
---|
| 498 | for( i = m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures() - 1; i > m_pcRPS->getNumberOfNegativePictures() + m_pcRPS->getNumberOfPositivePictures() - 1 ; i-- ) |
---|
| 499 | { |
---|
| 500 | if( m_pcRPS->getUsed(i) ) |
---|
| 501 | { |
---|
| 502 | pcRefPic = xGetLongTermRefPic( rcListPic, m_pcRPS->getPOC(i) ); |
---|
| 503 | pcRefPic->setIsLongTerm( 1 ); |
---|
| 504 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 505 | RefPicSetLtCurr[NumPocLtCurr] = pcRefPic; |
---|
| 506 | NumPocLtCurr++; |
---|
| 507 | } |
---|
| 508 | } |
---|
| 509 | // inter-view |
---|
| 510 | for( i = 0; i < m_pcSPS->getNumberOfUsableInterViewRefs(); i++ ) |
---|
| 511 | { |
---|
| 512 | pcRefPic = xGetInterViewRefPic( rapcInterViewRefPics, getViewId() + m_pcSPS->getUsableInterViewRef(i) ); |
---|
[210] | 513 | #if QC_IV_AS_LT_B0046 |
---|
| 514 | pcRefPic->setIsLongTerm( 1 ); |
---|
| 515 | #else |
---|
[56] | 516 | pcRefPic->setIsLongTerm( 0 ); |
---|
[210] | 517 | #endif |
---|
[56] | 518 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 519 | RefPicSetIvCurr[NumPocIvCurr] = pcRefPic; |
---|
| 520 | NumPocIvCurr++; |
---|
| 521 | } |
---|
[2] | 522 | |
---|
[56] | 523 | // ref_pic_list_init |
---|
| 524 | UInt cIdx = 0; |
---|
| 525 | UInt num_ref_idx_l0_active_minus1 = m_aiNumRefIdx[0] - 1; |
---|
| 526 | UInt num_ref_idx_l1_active_minus1 = m_aiNumRefIdx[1] - 1; |
---|
| 527 | |
---|
| 528 | assert( (NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + NumPocIvCurr) == getNumPocTotalCurrMvc() ); |
---|
| 529 | Int numRpsCurrTempList0 = max( (num_ref_idx_l0_active_minus1 + 1), (NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + NumPocIvCurr) ); |
---|
| 530 | Int numRpsCurrTempList1 = max( (num_ref_idx_l1_active_minus1 + 1), (NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + NumPocIvCurr) ); |
---|
| 531 | |
---|
| 532 | assert( numRpsCurrTempList0 <= 16 ); |
---|
| 533 | TComPic* refPicListTemp0[16]; |
---|
| 534 | assert( numRpsCurrTempList1 <= 16 ); |
---|
| 535 | TComPic* refPicListTemp1[16]; |
---|
| 536 | |
---|
| 537 | cIdx = 0; |
---|
| 538 | while( cIdx < numRpsCurrTempList0 ) |
---|
[2] | 539 | { |
---|
[56] | 540 | for( i = 0; i < NumPocStCurr0 && cIdx < numRpsCurrTempList0; cIdx++, i++ ) { refPicListTemp0[cIdx] = RefPicSetStCurr0[i]; } |
---|
| 541 | for( i = 0; i < NumPocStCurr1 && cIdx < numRpsCurrTempList0; cIdx++, i++ ) { refPicListTemp0[cIdx] = RefPicSetStCurr1[i]; } |
---|
| 542 | for( i = 0; i < NumPocLtCurr && cIdx < numRpsCurrTempList0; cIdx++, i++ ) { refPicListTemp0[cIdx] = RefPicSetLtCurr [i]; } |
---|
| 543 | for( i = 0; i < NumPocIvCurr && cIdx < numRpsCurrTempList0; cIdx++, i++ ) { refPicListTemp0[cIdx] = RefPicSetIvCurr [i]; } |
---|
| 544 | } |
---|
| 545 | |
---|
| 546 | cIdx = 0; |
---|
| 547 | while( cIdx < numRpsCurrTempList1 && m_eSliceType == B_SLICE ) |
---|
| 548 | { |
---|
| 549 | for( i = 0; i < NumPocStCurr1 && cIdx < numRpsCurrTempList1; cIdx++, i++ ) { refPicListTemp1[cIdx] = RefPicSetStCurr1[i]; } |
---|
| 550 | for( i = 0; i < NumPocStCurr0 && cIdx < numRpsCurrTempList1; cIdx++, i++ ) { refPicListTemp1[cIdx] = RefPicSetStCurr0[i]; } |
---|
| 551 | for( i = 0; i < NumPocLtCurr && cIdx < numRpsCurrTempList1; cIdx++, i++ ) { refPicListTemp1[cIdx] = RefPicSetLtCurr [i]; } |
---|
| 552 | for( i = 0; i < NumPocIvCurr && cIdx < numRpsCurrTempList1; cIdx++, i++ ) { refPicListTemp1[cIdx] = RefPicSetIvCurr [i]; } |
---|
| 553 | } |
---|
| 554 | |
---|
| 555 | for( cIdx = 0; cIdx <= num_ref_idx_l0_active_minus1; cIdx ++ ) |
---|
| 556 | { |
---|
| 557 | m_apcRefPicList[0][cIdx] = m_RefPicListModification.getRefPicListModificationFlagL0() ? refPicListTemp0[ m_RefPicListModification.getRefPicSetIdxL0(cIdx) ] : refPicListTemp0[cIdx]; |
---|
[210] | 558 | #if QC_IV_AS_LT_B0046 |
---|
| 559 | setWasLongTerm(m_apcRefPicList[0][cIdx]->getIsLongTerm(), REF_PIC_LIST_0, cIdx); |
---|
| 560 | #endif |
---|
[56] | 561 | } |
---|
| 562 | if( m_eSliceType == P_SLICE ) |
---|
| 563 | { |
---|
| 564 | m_aiNumRefIdx[1] = 0; |
---|
| 565 | ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1]) ); |
---|
| 566 | } |
---|
| 567 | else |
---|
| 568 | { |
---|
| 569 | for( cIdx = 0; cIdx <= num_ref_idx_l1_active_minus1; cIdx ++ ) |
---|
[2] | 570 | { |
---|
[56] | 571 | m_apcRefPicList[1][cIdx] = m_RefPicListModification.getRefPicListModificationFlagL1() ? refPicListTemp1[ m_RefPicListModification.getRefPicSetIdxL1(cIdx) ] : refPicListTemp1[cIdx]; |
---|
[210] | 572 | #if QC_IV_AS_LT_B0046 |
---|
| 573 | setWasLongTerm(m_apcRefPicList[1][cIdx]->getIsLongTerm(), REF_PIC_LIST_1, cIdx); |
---|
| 574 | #endif |
---|
[2] | 575 | } |
---|
| 576 | } |
---|
| 577 | } |
---|
| 578 | |
---|
| 579 | Void TComSlice::initEqualRef() |
---|
| 580 | { |
---|
| 581 | for (Int iDir = 0; iDir < 2; iDir++) |
---|
| 582 | { |
---|
| 583 | for (Int iRefIdx1 = 0; iRefIdx1 < MAX_NUM_REF; iRefIdx1++) |
---|
| 584 | { |
---|
| 585 | for (Int iRefIdx2 = iRefIdx1; iRefIdx2 < MAX_NUM_REF; iRefIdx2++) |
---|
| 586 | { |
---|
| 587 | m_abEqualRef[iDir][iRefIdx1][iRefIdx2] = m_abEqualRef[iDir][iRefIdx2][iRefIdx1] = (iRefIdx1 == iRefIdx2? true : false); |
---|
| 588 | } |
---|
| 589 | } |
---|
| 590 | } |
---|
| 591 | } |
---|
| 592 | |
---|
| 593 | Void TComSlice::initMultiviewSlice( Int** aaiScale, Int** aaiOffset ) |
---|
| 594 | { |
---|
| 595 | if( m_pcSPS->hasCamParInSliceHeader() ) |
---|
| 596 | { |
---|
| 597 | UInt uiViewId = m_pcSPS->getViewId(); |
---|
| 598 | for( UInt uiBaseViewId = 0; uiBaseViewId < uiViewId; uiBaseViewId++ ) |
---|
| 599 | { |
---|
| 600 | m_aaiCodedScale [ 0 ][ uiBaseViewId ] = aaiScale [ uiBaseViewId ][ uiViewId ]; |
---|
| 601 | m_aaiCodedScale [ 1 ][ uiBaseViewId ] = aaiScale [ uiViewId ][ uiBaseViewId ]; |
---|
| 602 | m_aaiCodedOffset[ 0 ][ uiBaseViewId ] = aaiOffset[ uiBaseViewId ][ uiViewId ]; |
---|
| 603 | m_aaiCodedOffset[ 1 ][ uiBaseViewId ] = aaiOffset[ uiViewId ][ uiBaseViewId ]; |
---|
| 604 | } |
---|
| 605 | } |
---|
| 606 | } |
---|
| 607 | |
---|
[56] | 608 | #if COLLOCATED_REF_IDX |
---|
| 609 | Void TComSlice::checkColRefIdx(UInt curSliceIdx, TComPic* pic) |
---|
| 610 | { |
---|
| 611 | Int i; |
---|
| 612 | TComSlice* curSlice = pic->getSlice(curSliceIdx); |
---|
| 613 | Int currColRefPOC = curSlice->getRefPOC( RefPicList(curSlice->getColDir()), curSlice->getColRefIdx()); |
---|
| 614 | TComSlice* preSlice; |
---|
| 615 | Int preColRefPOC; |
---|
| 616 | for(i=curSliceIdx-1; i>=0; i--) |
---|
| 617 | { |
---|
| 618 | preSlice = pic->getSlice(i); |
---|
| 619 | if(preSlice->getSliceType() != I_SLICE) |
---|
| 620 | { |
---|
| 621 | preColRefPOC = preSlice->getRefPOC( RefPicList(preSlice->getColDir()), preSlice->getColRefIdx()); |
---|
| 622 | if(currColRefPOC != preColRefPOC) |
---|
| 623 | { |
---|
| 624 | printf("Collocated_ref_idx shall always be the same for all slices of a coded picture!\n"); |
---|
| 625 | exit(EXIT_FAILURE); |
---|
| 626 | } |
---|
| 627 | else |
---|
| 628 | { |
---|
| 629 | break; |
---|
| 630 | } |
---|
| 631 | } |
---|
| 632 | } |
---|
| 633 | } |
---|
| 634 | #endif |
---|
| 635 | Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, TComList<TComPic*>& rcListPic) |
---|
| 636 | { |
---|
| 637 | for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++) |
---|
| 638 | { |
---|
| 639 | if(pocCRA < MAX_UINT && getPOC() > pocCRA) |
---|
| 640 | { |
---|
| 641 | assert(getPOC()+pReferencePictureSet->getDeltaPOC(i) >= pocCRA); |
---|
| 642 | } |
---|
| 643 | } |
---|
| 644 | for(Int i = pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i < pReferencePictureSet->getNumberOfPictures(); i++) |
---|
| 645 | { |
---|
| 646 | if(pocCRA < MAX_UINT && getPOC() > pocCRA) |
---|
| 647 | { |
---|
| 648 | assert(pReferencePictureSet->getPOC(i) >= pocCRA); |
---|
| 649 | } |
---|
| 650 | } |
---|
| 651 | if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found |
---|
| 652 | { |
---|
| 653 | pocCRA = getPOC(); |
---|
| 654 | } |
---|
| 655 | } |
---|
[2] | 656 | |
---|
[56] | 657 | /** Function for marking the reference pictures when an IDR and CRA is encountered. |
---|
| 658 | * \param pocCRA POC of the CRA picture |
---|
[2] | 659 | * \param bRefreshPending flag indicating if a deferred decoding refresh is pending |
---|
| 660 | * \param rcListPic reference to the reference picture list |
---|
| 661 | * This function marks the reference pictures as "unused for reference" in the following conditions. |
---|
[5] | 662 | * If the nal_unit_type is IDR all pictures in the reference picture list |
---|
| 663 | * is marked as "unused for reference" |
---|
[56] | 664 | * Otherwise do for the CRA case (non CRA case has no effect since both if conditions below will not be true) |
---|
[5] | 665 | * If the bRefreshPending flag is true (a deferred decoding refresh is pending) and the current |
---|
[56] | 666 | * temporal reference is greater than the temporal reference of the latest CRA picture (pocCRA), |
---|
| 667 | * mark all reference pictures except the latest CRA picture as "unused for reference" and set |
---|
[2] | 668 | * the bRefreshPending flag to false. |
---|
[56] | 669 | * If the nal_unit_type is CRA, set the bRefreshPending flag to true and pocCRA to the temporal |
---|
[2] | 670 | * reference of the current picture. |
---|
| 671 | * Note that the current picture is already placed in the reference list and its marking is not changed. |
---|
| 672 | * If the current picture has a nal_ref_idc that is not 0, it will remain marked as "used for reference". |
---|
| 673 | */ |
---|
[56] | 674 | Void TComSlice::decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic) |
---|
[2] | 675 | { |
---|
| 676 | TComPic* rpcPic; |
---|
[5] | 677 | UInt uiPOCCurr = getPOC(); |
---|
[2] | 678 | |
---|
[56] | 679 | if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_IDR ) // IDR |
---|
[2] | 680 | { |
---|
| 681 | // mark all pictures as not used for reference |
---|
| 682 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 683 | while (iterPic != rcListPic.end()) |
---|
| 684 | { |
---|
| 685 | rpcPic = *(iterPic); |
---|
| 686 | rpcPic->setCurrSliceIdx(0); |
---|
| 687 | if (rpcPic->getPOC() != uiPOCCurr) rpcPic->getSlice(0)->setReferenced(false); |
---|
| 688 | iterPic++; |
---|
| 689 | } |
---|
| 690 | } |
---|
[56] | 691 | else // CRA or No DR |
---|
[2] | 692 | { |
---|
[56] | 693 | if (bRefreshPending==true && uiPOCCurr > pocCRA) // CRA reference marking pending |
---|
[2] | 694 | { |
---|
| 695 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 696 | while (iterPic != rcListPic.end()) |
---|
| 697 | { |
---|
| 698 | rpcPic = *(iterPic); |
---|
[56] | 699 | if (rpcPic->getPOC() != uiPOCCurr && rpcPic->getPOC() != pocCRA) rpcPic->getSlice(0)->setReferenced(false); |
---|
[2] | 700 | iterPic++; |
---|
| 701 | } |
---|
[5] | 702 | bRefreshPending = false; |
---|
[2] | 703 | } |
---|
[56] | 704 | if( getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found |
---|
[2] | 705 | { |
---|
[5] | 706 | bRefreshPending = true; |
---|
[56] | 707 | pocCRA = uiPOCCurr; |
---|
[2] | 708 | } |
---|
| 709 | } |
---|
| 710 | } |
---|
| 711 | |
---|
| 712 | Void TComSlice::copySliceInfo(TComSlice *pSrc) |
---|
| 713 | { |
---|
| 714 | assert( pSrc != NULL ); |
---|
| 715 | |
---|
| 716 | Int i, j, k; |
---|
| 717 | |
---|
| 718 | m_iPOC = pSrc->m_iPOC; |
---|
[56] | 719 | m_viewId = pSrc->m_viewId; |
---|
[296] | 720 | #if INTER_VIEW_VECTOR_SCALING_C0115 |
---|
| 721 | m_iViewOrderIdx = pSrc->m_iViewOrderIdx;// will be changed to view_id |
---|
| 722 | m_bIVScalingFlag = pSrc->m_bIVScalingFlag; |
---|
[21] | 723 | #endif |
---|
[2] | 724 | m_eNalUnitType = pSrc->m_eNalUnitType; |
---|
[56] | 725 | m_eNalUnitTypeBaseViewMvc = pSrc->m_eNalUnitTypeBaseViewMvc; |
---|
[2] | 726 | m_eSliceType = pSrc->m_eSliceType; |
---|
| 727 | m_iSliceQp = pSrc->m_iSliceQp; |
---|
[56] | 728 | #if ADAPTIVE_QP_SELECTION |
---|
| 729 | m_iSliceQpBase = pSrc->m_iSliceQpBase; |
---|
| 730 | #endif |
---|
[2] | 731 | m_bLoopFilterDisable = pSrc->m_bLoopFilterDisable; |
---|
[56] | 732 | m_inheritDblParamFromAPS = pSrc->m_inheritDblParamFromAPS; |
---|
| 733 | m_loopFilterBetaOffsetDiv2 = pSrc->m_loopFilterBetaOffsetDiv2; |
---|
| 734 | m_loopFilterTcOffsetDiv2 = pSrc->m_loopFilterTcOffsetDiv2; |
---|
[5] | 735 | |
---|
[2] | 736 | for (i = 0; i < 3; i++) |
---|
| 737 | { |
---|
| 738 | m_aiNumRefIdx[i] = pSrc->m_aiNumRefIdx[i]; |
---|
| 739 | } |
---|
| 740 | |
---|
| 741 | for (i = 0; i < 2; i++) |
---|
| 742 | { |
---|
| 743 | for (j = 0; j < MAX_NUM_REF_LC; j++) |
---|
| 744 | { |
---|
| 745 | m_iRefIdxOfLC[i][j] = pSrc->m_iRefIdxOfLC[i][j]; |
---|
| 746 | } |
---|
| 747 | } |
---|
| 748 | for (i = 0; i < MAX_NUM_REF_LC; i++) |
---|
| 749 | { |
---|
| 750 | m_eListIdFromIdxOfLC[i] = pSrc->m_eListIdFromIdxOfLC[i]; |
---|
| 751 | m_iRefIdxFromIdxOfLC[i] = pSrc->m_iRefIdxFromIdxOfLC[i]; |
---|
| 752 | m_iRefIdxOfL1FromRefIdxOfL0[i] = pSrc->m_iRefIdxOfL1FromRefIdxOfL0[i]; |
---|
| 753 | m_iRefIdxOfL0FromRefIdxOfL1[i] = pSrc->m_iRefIdxOfL0FromRefIdxOfL1[i]; |
---|
| 754 | } |
---|
| 755 | m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC; |
---|
| 756 | m_bRefPicListCombinationFlag = pSrc->m_bRefPicListCombinationFlag; |
---|
[56] | 757 | m_bCheckLDC = pSrc->m_bCheckLDC; |
---|
[2] | 758 | m_iSliceQpDelta = pSrc->m_iSliceQpDelta; |
---|
| 759 | for (i = 0; i < 2; i++) |
---|
| 760 | { |
---|
| 761 | for (j = 0; j < MAX_NUM_REF; j++) |
---|
| 762 | { |
---|
[56] | 763 | m_apcRefPicList [i][j] = pSrc->m_apcRefPicList [i][j]; |
---|
| 764 | m_aiRefPOCList [i][j] = pSrc->m_aiRefPOCList [i][j]; |
---|
| 765 | m_aiRefViewIdList[i][j] = pSrc->m_aiRefViewIdList[i][j]; |
---|
[2] | 766 | } |
---|
[5] | 767 | } |
---|
[2] | 768 | m_iDepth = pSrc->m_iDepth; |
---|
| 769 | |
---|
| 770 | // referenced slice |
---|
| 771 | m_bRefenced = pSrc->m_bRefenced; |
---|
| 772 | |
---|
| 773 | // access channel |
---|
| 774 | m_pcSPS = pSrc->m_pcSPS; |
---|
| 775 | m_pcPPS = pSrc->m_pcPPS; |
---|
[56] | 776 | m_pcRPS = pSrc->m_pcRPS; |
---|
| 777 | m_iLastIDR = pSrc->m_iLastIDR; |
---|
| 778 | |
---|
[2] | 779 | m_pcPic = pSrc->m_pcPic; |
---|
[56] | 780 | m_pcAPS = pSrc->m_pcAPS; |
---|
| 781 | m_iAPSId = pSrc->m_iAPSId; |
---|
[2] | 782 | |
---|
| 783 | m_uiColDir = pSrc->m_uiColDir; |
---|
[56] | 784 | #if COLLOCATED_REF_IDX |
---|
| 785 | m_colRefIdx = pSrc->m_colRefIdx; |
---|
| 786 | #endif |
---|
| 787 | #if ALF_CHROMA_LAMBDA || SAO_CHROMA_LAMBDA |
---|
| 788 | m_dLambdaLuma = pSrc->m_dLambdaLuma; |
---|
| 789 | m_dLambdaChroma = pSrc->m_dLambdaChroma; |
---|
| 790 | #else |
---|
[2] | 791 | m_dLambda = pSrc->m_dLambda; |
---|
[56] | 792 | #endif |
---|
[2] | 793 | for (i = 0; i < 2; i++) |
---|
| 794 | { |
---|
| 795 | for (j = 0; j < MAX_NUM_REF; j++) |
---|
| 796 | { |
---|
| 797 | for (k =0; k < MAX_NUM_REF; k++) |
---|
| 798 | { |
---|
| 799 | m_abEqualRef[i][j][k] = pSrc->m_abEqualRef[i][j][k]; |
---|
| 800 | } |
---|
| 801 | } |
---|
| 802 | } |
---|
| 803 | |
---|
| 804 | m_bNoBackPredFlag = pSrc->m_bNoBackPredFlag; |
---|
| 805 | m_bRefIdxCombineCoding = pSrc->m_bRefIdxCombineCoding; |
---|
[56] | 806 | |
---|
| 807 | m_uiTLayer = pSrc->m_uiTLayer; |
---|
| 808 | m_bTLayerSwitchingFlag = pSrc->m_bTLayerSwitchingFlag; |
---|
| 809 | |
---|
[2] | 810 | m_uiSliceMode = pSrc->m_uiSliceMode; |
---|
| 811 | m_uiSliceArgument = pSrc->m_uiSliceArgument; |
---|
| 812 | m_uiSliceCurStartCUAddr = pSrc->m_uiSliceCurStartCUAddr; |
---|
| 813 | m_uiSliceCurEndCUAddr = pSrc->m_uiSliceCurEndCUAddr; |
---|
| 814 | m_uiSliceIdx = pSrc->m_uiSliceIdx; |
---|
| 815 | m_uiEntropySliceMode = pSrc->m_uiEntropySliceMode; |
---|
[5] | 816 | m_uiEntropySliceArgument = pSrc->m_uiEntropySliceArgument; |
---|
[2] | 817 | m_uiEntropySliceCurStartCUAddr = pSrc->m_uiEntropySliceCurStartCUAddr; |
---|
| 818 | m_uiEntropySliceCurEndCUAddr = pSrc->m_uiEntropySliceCurEndCUAddr; |
---|
| 819 | m_bNextSlice = pSrc->m_bNextSlice; |
---|
| 820 | m_bNextEntropySlice = pSrc->m_bNextEntropySlice; |
---|
[56] | 821 | m_iTileMarkerFlag = pSrc->m_iTileMarkerFlag; |
---|
[2] | 822 | for ( int e=0 ; e<2 ; e++ ) |
---|
[56] | 823 | for ( int n=0 ; n<MAX_NUM_REF ; n++ ) |
---|
| 824 | memcpy(m_weightPredTable[e][n], pSrc->m_weightPredTable[e][n], sizeof(wpScalingParam)*3 ); |
---|
| 825 | |
---|
| 826 | m_saoEnabledFlag = pSrc->m_saoEnabledFlag; |
---|
[443] | 827 | #if LGE_SAO_MIGRATION_D0091 |
---|
| 828 | m_saoEnabledFlagChroma = pSrc->m_saoEnabledFlagChroma; |
---|
| 829 | #else |
---|
[56] | 830 | m_saoInterleavingFlag = pSrc->m_saoInterleavingFlag; |
---|
| 831 | m_saoEnabledFlagCb = pSrc->m_saoEnabledFlagCb; |
---|
| 832 | m_saoEnabledFlagCr = pSrc->m_saoEnabledFlagCr; |
---|
[443] | 833 | #endif |
---|
[56] | 834 | #if CABAC_INIT_FLAG |
---|
| 835 | m_cabacInitFlag = pSrc->m_cabacInitFlag; |
---|
[2] | 836 | #endif |
---|
[56] | 837 | m_numEntryPointOffsets = pSrc->m_numEntryPointOffsets; |
---|
| 838 | |
---|
| 839 | m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero; |
---|
[443] | 840 | #if SHARP_ILLUCOMP_PARSE_D0060 |
---|
| 841 | m_bApplyIC = pSrc->m_bApplyIC; |
---|
| 842 | m_icSkipParseFlag = pSrc->m_icSkipParseFlag; |
---|
| 843 | #endif |
---|
[2] | 844 | } |
---|
| 845 | |
---|
[56] | 846 | int TComSlice::m_prevPOC = 0; |
---|
| 847 | /** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag. |
---|
| 848 | * \param uiTLayer Temporal layer ID of the current slice |
---|
| 849 | * The decoder calls this function to set temporal_layer_switching_point_flag for each temporal layer based on |
---|
| 850 | * the SPS's temporal_id_nesting_flag and the parsed PPS. Then, current slice's temporal layer ID and |
---|
| 851 | * temporal_layer_switching_point_flag is set accordingly. |
---|
| 852 | */ |
---|
| 853 | Void TComSlice::setTLayerInfo( UInt uiTLayer ) |
---|
[2] | 854 | { |
---|
[56] | 855 | |
---|
| 856 | m_uiTLayer = uiTLayer; |
---|
[2] | 857 | } |
---|
| 858 | |
---|
[296] | 859 | #if H0566_TLA_SET_FOR_SWITCHING_POINTS |
---|
[56] | 860 | /** Function for checking if this is a switching-point |
---|
| 861 | */ |
---|
| 862 | Bool TComSlice::isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet) |
---|
[2] | 863 | { |
---|
[56] | 864 | TComPic* rpcPic; |
---|
| 865 | // loop through all pictures in the reference picture buffer |
---|
| 866 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 867 | while ( iterPic != rcListPic.end()) |
---|
| 868 | { |
---|
| 869 | rpcPic = *(iterPic++); |
---|
| 870 | if(rpcPic->getSlice(0)->isReferenced() && rpcPic->getPOC() != getPOC()) |
---|
| 871 | { |
---|
| 872 | if(rpcPic->getTLayer() >= getTLayer()) |
---|
| 873 | { |
---|
| 874 | return false; |
---|
| 875 | } |
---|
| 876 | } |
---|
| 877 | } |
---|
| 878 | return true; |
---|
| 879 | } |
---|
| 880 | #endif |
---|
| 881 | |
---|
| 882 | /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. |
---|
| 883 | */ |
---|
| 884 | Void TComSlice::applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet) |
---|
| 885 | { |
---|
| 886 | TComPic* rpcPic; |
---|
| 887 | Int i, isReference; |
---|
| 888 | |
---|
| 889 | Int j = 0; |
---|
| 890 | // loop through all pictures in the reference picture buffer |
---|
| 891 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 892 | while ( iterPic != rcListPic.end()) |
---|
| 893 | { |
---|
| 894 | j++; |
---|
| 895 | rpcPic = *(iterPic++); |
---|
| 896 | |
---|
| 897 | isReference = 0; |
---|
| 898 | // loop through all pictures in the Reference Picture Set to see if the picture should be kept as reference picture |
---|
| 899 | for(i=0;i<pReferencePictureSet->getNumberOfPositivePictures()+pReferencePictureSet->getNumberOfNegativePictures();i++) |
---|
| 900 | { |
---|
[210] | 901 | #if QC_IV_AS_LT_B0046 |
---|
| 902 | if( rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i)) |
---|
| 903 | #else |
---|
[56] | 904 | if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i)) |
---|
[210] | 905 | #endif |
---|
[56] | 906 | { |
---|
| 907 | isReference = 1; |
---|
| 908 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
| 909 | rpcPic->setIsLongTerm(0); |
---|
| 910 | } |
---|
| 911 | } |
---|
| 912 | // long term pictures |
---|
| 913 | for(;i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
| 914 | { |
---|
[210] | 915 | #if QC_IV_AS_LT_B0046 |
---|
| 916 | if( (rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i)%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) |
---|
| 917 | #else |
---|
[56] | 918 | 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())) |
---|
[210] | 919 | #endif |
---|
[56] | 920 | { |
---|
| 921 | isReference = 1; |
---|
| 922 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
| 923 | } |
---|
| 924 | } |
---|
| 925 | // mark the picture as "unused for reference" if it is not in |
---|
| 926 | // the Reference Picture Set |
---|
| 927 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && isReference == 0) |
---|
| 928 | { |
---|
| 929 | rpcPic->getSlice( 0 )->setReferenced( false ); |
---|
| 930 | rpcPic->setIsLongTerm(0); |
---|
| 931 | } |
---|
| 932 | } |
---|
| 933 | } |
---|
| 934 | |
---|
| 935 | /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. |
---|
| 936 | */ |
---|
| 937 | Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool outputFlag, Int pocRandomAccess) |
---|
| 938 | { |
---|
| 939 | TComPic* rpcPic; |
---|
| 940 | Int i, isAvailable, j; |
---|
| 941 | Int atLeastOneLost = 0; |
---|
| 942 | Int atLeastOneRemoved = 0; |
---|
| 943 | Int iPocLost = 0; |
---|
| 944 | |
---|
| 945 | // loop through all long-term pictures in the Reference Picture Set |
---|
| 946 | // to see if the picture should be kept as reference picture |
---|
| 947 | for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
| 948 | { |
---|
| 949 | j = 0; |
---|
| 950 | isAvailable = 0; |
---|
| 951 | // loop through all pictures in the reference picture buffer |
---|
| 952 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 953 | while ( iterPic != rcListPic.end()) |
---|
| 954 | { |
---|
| 955 | j++; |
---|
| 956 | rpcPic = *(iterPic++); |
---|
| 957 | 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()) |
---|
| 958 | { |
---|
| 959 | isAvailable = 1; |
---|
| 960 | } |
---|
| 961 | } |
---|
| 962 | // if there was no such long-term check the short terms |
---|
| 963 | if(!isAvailable) |
---|
| 964 | { |
---|
| 965 | iterPic = rcListPic.begin(); |
---|
| 966 | while ( iterPic != rcListPic.end()) |
---|
| 967 | { |
---|
| 968 | j++; |
---|
| 969 | rpcPic = *(iterPic++); |
---|
| 970 | |
---|
| 971 | 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()) |
---|
| 972 | { |
---|
| 973 | isAvailable = 1; |
---|
| 974 | rpcPic->setIsLongTerm(1); |
---|
| 975 | break; |
---|
[2] | 976 | } |
---|
[56] | 977 | } |
---|
| 978 | } |
---|
| 979 | // report that a picture is lost if it is in the Reference Picture Set |
---|
| 980 | // but not available as reference picture |
---|
| 981 | if(isAvailable == 0) |
---|
| 982 | { |
---|
| 983 | if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) |
---|
| 984 | { |
---|
| 985 | if(!pReferencePictureSet->getUsed(i) ) |
---|
| 986 | { |
---|
| 987 | if(outputFlag) |
---|
| 988 | printf("\nLong-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
| 989 | atLeastOneRemoved = 1; |
---|
[2] | 990 | } |
---|
[56] | 991 | else |
---|
| 992 | { |
---|
| 993 | if(outputFlag) |
---|
| 994 | printf("\nLong-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
| 995 | atLeastOneLost = 1; |
---|
| 996 | iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); |
---|
[2] | 997 | } |
---|
| 998 | } |
---|
[56] | 999 | } |
---|
| 1000 | } |
---|
| 1001 | // loop through all short-term pictures in the Reference Picture Set |
---|
| 1002 | // to see if the picture should be kept as reference picture |
---|
| 1003 | for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++) |
---|
| 1004 | { |
---|
| 1005 | j = 0; |
---|
| 1006 | isAvailable = 0; |
---|
| 1007 | // loop through all pictures in the reference picture buffer |
---|
| 1008 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1009 | while ( iterPic != rcListPic.end()) |
---|
| 1010 | { |
---|
| 1011 | j++; |
---|
| 1012 | rpcPic = *(iterPic++); |
---|
| 1013 | |
---|
| 1014 | if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
| 1015 | { |
---|
| 1016 | isAvailable = 1; |
---|
| 1017 | } |
---|
| 1018 | } |
---|
| 1019 | // report that a picture is lost if it is in the Reference Picture Set |
---|
| 1020 | // but not available as reference picture |
---|
| 1021 | if(isAvailable == 0) |
---|
| 1022 | { |
---|
| 1023 | if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) |
---|
| 1024 | { |
---|
| 1025 | if(!pReferencePictureSet->getUsed(i) ) |
---|
| 1026 | { |
---|
| 1027 | if(outputFlag) |
---|
| 1028 | printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
| 1029 | atLeastOneRemoved = 1; |
---|
| 1030 | } |
---|
| 1031 | else |
---|
| 1032 | { |
---|
| 1033 | if(outputFlag) |
---|
| 1034 | printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
| 1035 | atLeastOneLost = 1; |
---|
| 1036 | iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); |
---|
| 1037 | } |
---|
| 1038 | } |
---|
| 1039 | } |
---|
| 1040 | } |
---|
| 1041 | if(atLeastOneLost) |
---|
| 1042 | { |
---|
| 1043 | return iPocLost+1; |
---|
[2] | 1044 | } |
---|
[56] | 1045 | if(atLeastOneRemoved) |
---|
| 1046 | { |
---|
| 1047 | return -2; |
---|
| 1048 | } |
---|
| 1049 | else |
---|
| 1050 | return 0; |
---|
[2] | 1051 | } |
---|
| 1052 | |
---|
[56] | 1053 | /** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set |
---|
| 1054 | */ |
---|
| 1055 | Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet) |
---|
| 1056 | { |
---|
| 1057 | TComPic* rpcPic; |
---|
| 1058 | Int i, j; |
---|
| 1059 | Int k = 0; |
---|
| 1060 | Int nrOfNegativePictures = 0; |
---|
| 1061 | Int nrOfPositivePictures = 0; |
---|
| 1062 | TComReferencePictureSet* pcRPS = this->getLocalRPS(); |
---|
| 1063 | |
---|
| 1064 | // loop through all pictures in the Reference Picture Set |
---|
| 1065 | for(i=0;i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
| 1066 | { |
---|
| 1067 | j = 0; |
---|
| 1068 | // loop through all pictures in the reference picture buffer |
---|
| 1069 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1070 | while ( iterPic != rcListPic.end()) |
---|
| 1071 | { |
---|
| 1072 | j++; |
---|
| 1073 | rpcPic = *(iterPic++); |
---|
| 1074 | |
---|
| 1075 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
| 1076 | { |
---|
| 1077 | // This picture exists as a reference picture |
---|
| 1078 | // and should be added to the explicit Reference Picture Set |
---|
| 1079 | pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i)); |
---|
| 1080 | pcRPS->setUsed(k, pReferencePictureSet->getUsed(i)); |
---|
| 1081 | if(pcRPS->getDeltaPOC(k) < 0) |
---|
| 1082 | nrOfNegativePictures++; |
---|
| 1083 | else |
---|
| 1084 | nrOfPositivePictures++; |
---|
| 1085 | k++; |
---|
| 1086 | } |
---|
| 1087 | } |
---|
| 1088 | } |
---|
| 1089 | pcRPS->setNumberOfNegativePictures(nrOfNegativePictures); |
---|
| 1090 | pcRPS->setNumberOfPositivePictures(nrOfPositivePictures); |
---|
| 1091 | pcRPS->setNumberOfPictures(nrOfNegativePictures+nrOfPositivePictures); |
---|
| 1092 | // This is a simplistic inter rps example. A smarter encoder will look for a better reference RPS to do the |
---|
| 1093 | // inter RPS prediction with. Here we just use the reference used by pReferencePictureSet. |
---|
| 1094 | // If pReferencePictureSet is not inter_RPS_predicted, then inter_RPS_prediction is for the current RPS also disabled. |
---|
| 1095 | if (!pReferencePictureSet->getInterRPSPrediction()) |
---|
| 1096 | { |
---|
| 1097 | pcRPS->setInterRPSPrediction(false); |
---|
| 1098 | pcRPS->setNumRefIdc(0); |
---|
| 1099 | } |
---|
| 1100 | else |
---|
| 1101 | { |
---|
| 1102 | Int rIdx = this->getRPSidx() - pReferencePictureSet->getDeltaRIdxMinus1() - 1; |
---|
| 1103 | Int deltaRPS = pReferencePictureSet->getDeltaRPS(); |
---|
| 1104 | TComReferencePictureSet* pcRefRPS = this->getSPS()->getRPSList()->getReferencePictureSet(rIdx); |
---|
| 1105 | Int iRefPics = pcRefRPS->getNumberOfPictures(); |
---|
| 1106 | Int iNewIdc=0; |
---|
| 1107 | for(i=0; i<= iRefPics; i++) |
---|
| 1108 | { |
---|
| 1109 | Int deltaPOC = ((i != iRefPics)? pcRefRPS->getDeltaPOC(i) : 0); // check if the reference abs POC is >= 0 |
---|
| 1110 | Int iRefIdc = 0; |
---|
| 1111 | for (j=0; j < pcRPS->getNumberOfPictures(); j++) // loop through the pictures in the new RPS |
---|
| 1112 | { |
---|
| 1113 | if ( (deltaPOC + deltaRPS) == pcRPS->getDeltaPOC(j)) |
---|
| 1114 | { |
---|
| 1115 | if (pcRPS->getUsed(j)) |
---|
| 1116 | { |
---|
| 1117 | iRefIdc = 1; |
---|
| 1118 | } |
---|
| 1119 | else |
---|
| 1120 | { |
---|
| 1121 | iRefIdc = 2; |
---|
| 1122 | } |
---|
| 1123 | } |
---|
| 1124 | } |
---|
| 1125 | pcRPS->setRefIdc(i, iRefIdc); |
---|
| 1126 | iNewIdc++; |
---|
| 1127 | } |
---|
| 1128 | pcRPS->setInterRPSPrediction(true); |
---|
| 1129 | pcRPS->setNumRefIdc(iNewIdc); |
---|
| 1130 | pcRPS->setDeltaRPS(deltaRPS); |
---|
| 1131 | pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx()); |
---|
| 1132 | } |
---|
| 1133 | |
---|
| 1134 | this->setRPS(pcRPS); |
---|
| 1135 | this->setRPSidx(-1); |
---|
| 1136 | } |
---|
| 1137 | |
---|
| 1138 | Void TComSlice::decodingMarkingForNoTMVP( TComList<TComPic*>& rcListPic, Int currentPOC ) |
---|
| 1139 | { |
---|
| 1140 | TComList<TComPic*>::iterator it; |
---|
| 1141 | for ( it = rcListPic.begin(); it != rcListPic.end(); it++ ) |
---|
| 1142 | { |
---|
| 1143 | if ( (*it)->getSlice(0)->getPOC() != currentPOC ) |
---|
| 1144 | { |
---|
| 1145 | (*it)->setUsedForTMVP( false ); |
---|
| 1146 | } |
---|
| 1147 | } |
---|
| 1148 | } |
---|
| 1149 | |
---|
| 1150 | /** get AC and DC values for weighted pred |
---|
| 1151 | * \param *wp |
---|
| 1152 | * \returns Void |
---|
| 1153 | */ |
---|
| 1154 | Void TComSlice::getWpAcDcParam(wpACDCParam *&wp) |
---|
| 1155 | { |
---|
| 1156 | wp = m_weightACDCParam; |
---|
| 1157 | } |
---|
| 1158 | |
---|
| 1159 | /** init AC and DC values for weighted pred |
---|
| 1160 | * \returns Void |
---|
| 1161 | */ |
---|
| 1162 | Void TComSlice::initWpAcDcParam() |
---|
| 1163 | { |
---|
| 1164 | for(Int iComp = 0; iComp < 3; iComp++ ) |
---|
| 1165 | { |
---|
| 1166 | m_weightACDCParam[iComp].iAC = 0; |
---|
| 1167 | m_weightACDCParam[iComp].iDC = 0; |
---|
| 1168 | } |
---|
| 1169 | } |
---|
| 1170 | |
---|
| 1171 | /** get WP tables for weighted pred |
---|
| 1172 | * \param RefPicList |
---|
| 1173 | * \param iRefIdx |
---|
| 1174 | * \param *&wpScalingParam |
---|
| 1175 | * \returns Void |
---|
| 1176 | */ |
---|
| 1177 | Void TComSlice::getWpScaling( RefPicList e, Int iRefIdx, wpScalingParam *&wp ) |
---|
| 1178 | { |
---|
| 1179 | wp = m_weightPredTable[e][iRefIdx]; |
---|
| 1180 | } |
---|
| 1181 | |
---|
| 1182 | /** reset Default WP tables settings : no weight. |
---|
| 1183 | * \param wpScalingParam |
---|
| 1184 | * \returns Void |
---|
| 1185 | */ |
---|
[2] | 1186 | Void TComSlice::resetWpScaling(wpScalingParam wp[2][MAX_NUM_REF][3]) |
---|
| 1187 | { |
---|
[56] | 1188 | for ( int e=0 ; e<2 ; e++ ) |
---|
| 1189 | { |
---|
[2] | 1190 | for ( int i=0 ; i<MAX_NUM_REF ; i++ ) |
---|
[56] | 1191 | { |
---|
| 1192 | for ( int yuv=0 ; yuv<3 ; yuv++ ) |
---|
| 1193 | { |
---|
[2] | 1194 | wpScalingParam *pwp = &(wp[e][i][yuv]); |
---|
| 1195 | pwp->bPresentFlag = false; |
---|
| 1196 | pwp->uiLog2WeightDenom = 0; |
---|
| 1197 | pwp->uiLog2WeightDenom = 0; |
---|
| 1198 | pwp->iWeight = 1; |
---|
| 1199 | pwp->iOffset = 0; |
---|
| 1200 | } |
---|
[56] | 1201 | } |
---|
[2] | 1202 | } |
---|
| 1203 | } |
---|
| 1204 | |
---|
[56] | 1205 | /** init WP table |
---|
| 1206 | * \returns Void |
---|
| 1207 | */ |
---|
[2] | 1208 | Void TComSlice::initWpScaling() |
---|
| 1209 | { |
---|
| 1210 | initWpScaling(m_weightPredTable); |
---|
| 1211 | } |
---|
| 1212 | |
---|
[56] | 1213 | /** set WP tables |
---|
| 1214 | * \param wpScalingParam |
---|
| 1215 | * \returns Void |
---|
| 1216 | */ |
---|
[2] | 1217 | Void TComSlice::initWpScaling(wpScalingParam wp[2][MAX_NUM_REF][3]) |
---|
| 1218 | { |
---|
[56] | 1219 | for ( int e=0 ; e<2 ; e++ ) |
---|
| 1220 | { |
---|
[2] | 1221 | for ( int i=0 ; i<MAX_NUM_REF ; i++ ) |
---|
[56] | 1222 | { |
---|
| 1223 | for ( int yuv=0 ; yuv<3 ; yuv++ ) |
---|
| 1224 | { |
---|
[2] | 1225 | wpScalingParam *pwp = &(wp[e][i][yuv]); |
---|
| 1226 | if ( !pwp->bPresentFlag ) { |
---|
| 1227 | // Inferring values not present : |
---|
| 1228 | pwp->iWeight = (1 << pwp->uiLog2WeightDenom); |
---|
| 1229 | pwp->iOffset = 0; |
---|
| 1230 | } |
---|
| 1231 | |
---|
| 1232 | pwp->w = pwp->iWeight; |
---|
| 1233 | pwp->o = pwp->iOffset * (1 << (g_uiBitDepth-8)); |
---|
| 1234 | pwp->shift = pwp->uiLog2WeightDenom; |
---|
| 1235 | pwp->round = (pwp->uiLog2WeightDenom>=1) ? (1 << (pwp->uiLog2WeightDenom-1)) : (0); |
---|
| 1236 | } |
---|
[56] | 1237 | } |
---|
[2] | 1238 | } |
---|
| 1239 | } |
---|
| 1240 | |
---|
[56] | 1241 | /** get WP tables for weighted pred of LC |
---|
| 1242 | * \param iRefIdxLC |
---|
| 1243 | * \param *&wpScalingParam |
---|
| 1244 | * \returns Void |
---|
| 1245 | */ |
---|
| 1246 | Void TComSlice::getWpScalingLC( Int iRefIdx, wpScalingParam *&wp ) |
---|
[2] | 1247 | { |
---|
[56] | 1248 | wp = m_weightPredTableLC[iRefIdx]; |
---|
[2] | 1249 | } |
---|
[56] | 1250 | /** reset Default WP tables settings for LC : no weight. |
---|
| 1251 | * \param wpScalingParam |
---|
| 1252 | * \returns Void |
---|
| 1253 | */ |
---|
| 1254 | Void TComSlice::resetWpScalingLC(wpScalingParam wp[2*MAX_NUM_REF][3]) |
---|
| 1255 | { |
---|
| 1256 | for ( int i=0 ; i<2*MAX_NUM_REF ; i++ ) |
---|
| 1257 | { |
---|
| 1258 | for ( int yuv=0 ; yuv<3 ; yuv++ ) |
---|
| 1259 | { |
---|
| 1260 | wpScalingParam *pwp = &(wp[i][yuv]); |
---|
| 1261 | pwp->bPresentFlag = false; |
---|
| 1262 | pwp->uiLog2WeightDenom = 0; |
---|
| 1263 | pwp->uiLog2WeightDenom = 0; |
---|
| 1264 | pwp->iWeight = 1; |
---|
| 1265 | pwp->iOffset = 0; |
---|
| 1266 | } |
---|
| 1267 | } |
---|
| 1268 | } |
---|
| 1269 | /** set current WP tables settings for LC |
---|
| 1270 | * \returns Void |
---|
| 1271 | */ |
---|
| 1272 | Void TComSlice::setWpParamforLC() |
---|
| 1273 | { |
---|
| 1274 | for ( Int iRefIdx=0 ; iRefIdx<getNumRefIdx(REF_PIC_LIST_C) ; iRefIdx++ ) |
---|
| 1275 | { |
---|
| 1276 | RefPicList eRefPicList = (RefPicList)getListIdFromIdxOfLC(iRefIdx); |
---|
| 1277 | Int iCombRefIdx = getRefIdxFromIdxOfLC(iRefIdx); |
---|
[2] | 1278 | |
---|
[56] | 1279 | wpScalingParam *wp_src, *wp_dst; |
---|
| 1280 | getWpScalingLC(iRefIdx, wp_src); |
---|
| 1281 | getWpScaling(eRefPicList, iCombRefIdx, wp_dst); |
---|
| 1282 | copyWPtable(wp_src, wp_dst); |
---|
| 1283 | |
---|
| 1284 | if(eRefPicList == REF_PIC_LIST_0) |
---|
| 1285 | { |
---|
| 1286 | Int iRefIdxL1 = getRefIdxOfL1FromRefIdxOfL0(iCombRefIdx); |
---|
| 1287 | if(iRefIdxL1 >= 0) |
---|
| 1288 | { |
---|
| 1289 | getWpScaling(REF_PIC_LIST_1, iRefIdxL1, wp_dst); |
---|
| 1290 | copyWPtable(wp_src, wp_dst); |
---|
| 1291 | } |
---|
| 1292 | } |
---|
| 1293 | if(eRefPicList == REF_PIC_LIST_1) |
---|
| 1294 | { |
---|
| 1295 | Int iRefIdxL0 = getRefIdxOfL0FromRefIdxOfL1(iCombRefIdx); |
---|
| 1296 | if(iRefIdxL0 >= 0) |
---|
| 1297 | { |
---|
| 1298 | getWpScaling(REF_PIC_LIST_0, iRefIdxL0, wp_dst); |
---|
| 1299 | copyWPtable(wp_src, wp_dst); |
---|
| 1300 | } |
---|
| 1301 | } |
---|
| 1302 | } |
---|
| 1303 | initWpScaling(); |
---|
| 1304 | } |
---|
| 1305 | /** copy source WP tables to destination table for LC |
---|
| 1306 | * \param wpScalingParam *&wp_src : source |
---|
| 1307 | * \param wpScalingParam *&wp_dst : destination |
---|
| 1308 | * \returns Void |
---|
| 1309 | */ |
---|
| 1310 | Void TComSlice::copyWPtable(wpScalingParam *&wp_src, wpScalingParam *&wp_dst) |
---|
[2] | 1311 | { |
---|
[56] | 1312 | for ( Int iComp = 0; iComp < 3; iComp++ ) |
---|
[2] | 1313 | { |
---|
[56] | 1314 | wp_dst[iComp].uiLog2WeightDenom = (iComp==0) ? wp_src[0].uiLog2WeightDenom : wp_src[1].uiLog2WeightDenom; |
---|
| 1315 | wp_dst[iComp].bPresentFlag = wp_src[iComp].bPresentFlag; |
---|
| 1316 | wp_dst[iComp].iWeight = wp_src[iComp].iWeight; |
---|
| 1317 | wp_dst[iComp].iOffset = wp_src[iComp].iOffset; |
---|
[2] | 1318 | } |
---|
| 1319 | } |
---|
| 1320 | |
---|
[189] | 1321 | #if LGE_ILLUCOMP_B0045 |
---|
| 1322 | Void TComSlice::xSetApplyIC() |
---|
| 1323 | { |
---|
| 1324 | Int iMaxPelValue = (1<<g_uiBitDepth); |
---|
| 1325 | Int *aiRefOrgHist; |
---|
| 1326 | Int *aiCurrHist; |
---|
| 1327 | aiRefOrgHist = new Int; |
---|
| 1328 | aiCurrHist = new Int; |
---|
| 1329 | aiRefOrgHist = (Int *)xMalloc(Int,iMaxPelValue); |
---|
| 1330 | aiCurrHist = (Int *)xMalloc(Int,iMaxPelValue); |
---|
| 1331 | memset(aiRefOrgHist, 0, iMaxPelValue*sizeof(Int) ); |
---|
| 1332 | memset(aiCurrHist, 0, iMaxPelValue*sizeof(Int) ); |
---|
| 1333 | // Reference Idx Number |
---|
| 1334 | Int iNumRefIdx = getNumRefIdx( REF_PIC_LIST_0 ); |
---|
| 1335 | TComPic* pcCurrPic = NULL; |
---|
| 1336 | TComPic* pcRefPic = NULL; |
---|
| 1337 | TComPicYuv* pcCurrPicYuv = NULL; |
---|
| 1338 | TComPicYuv* pcRefPicYuvOrg = NULL; |
---|
| 1339 | pcCurrPic = getPic(); |
---|
| 1340 | pcCurrPicYuv = pcCurrPic->getPicYuvOrg(); |
---|
| 1341 | Int iWidth = pcCurrPicYuv->getWidth(); |
---|
| 1342 | Int iHeight = pcCurrPicYuv->getHeight(); |
---|
| 1343 | |
---|
| 1344 | |
---|
| 1345 | // Get InterView Reference picture |
---|
| 1346 | // !!!!! Assume only one Interview Reference Picture in L0 |
---|
| 1347 | for (Int i = 0; i < iNumRefIdx; i++) |
---|
| 1348 | { |
---|
| 1349 | pcRefPic = getRefPic( REF_PIC_LIST_0, i); |
---|
| 1350 | if (pcRefPic != NULL) |
---|
| 1351 | { |
---|
| 1352 | // Current Picture |
---|
| 1353 | if (pcCurrPic->getViewId() != pcRefPic->getViewId()) |
---|
| 1354 | { |
---|
| 1355 | pcRefPicYuvOrg = pcRefPic->getPicYuvOrg(); |
---|
| 1356 | } |
---|
| 1357 | } |
---|
| 1358 | } |
---|
| 1359 | if (pcRefPicYuvOrg != NULL) |
---|
| 1360 | { |
---|
| 1361 | Pel* pCurrY = pcCurrPicYuv ->getLumaAddr(); |
---|
| 1362 | Pel* pRefOrgY = pcRefPicYuvOrg ->getLumaAddr(); |
---|
| 1363 | Int iCurrStride = pcCurrPicYuv->getStride(); |
---|
| 1364 | Int iRefStride = pcRefPicYuvOrg->getStride(); |
---|
| 1365 | Int iSumOrgSAD = 0; |
---|
[296] | 1366 | #if LGE_ILLUCOMP_DEPTH_C0046 |
---|
| 1367 | Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05; |
---|
| 1368 | #else |
---|
[189] | 1369 | double dThresholdOrgSAD = 0.05; |
---|
[296] | 1370 | #endif |
---|
[189] | 1371 | // Histogram building - luminance |
---|
| 1372 | for ( Int y = 0; y < iHeight; y++) |
---|
| 1373 | { |
---|
| 1374 | for ( Int x = 0; x < iWidth; x++) |
---|
| 1375 | { |
---|
| 1376 | aiCurrHist[pCurrY[x]]++; |
---|
| 1377 | aiRefOrgHist[pRefOrgY[x]]++; |
---|
| 1378 | } |
---|
| 1379 | pCurrY += iCurrStride; |
---|
| 1380 | pRefOrgY += iRefStride; |
---|
| 1381 | } |
---|
| 1382 | // Calc SAD |
---|
| 1383 | for (Int i = 0; i < iMaxPelValue; i++) |
---|
| 1384 | { |
---|
| 1385 | iSumOrgSAD += abs(aiCurrHist[i] - aiRefOrgHist[i]); |
---|
| 1386 | } |
---|
| 1387 | // Setting |
---|
| 1388 | if ( iSumOrgSAD > Int(dThresholdOrgSAD * iWidth * iHeight) ) |
---|
| 1389 | { |
---|
| 1390 | m_bApplyIC = true; |
---|
| 1391 | } |
---|
| 1392 | else |
---|
| 1393 | { |
---|
| 1394 | m_bApplyIC = false; |
---|
| 1395 | } |
---|
| 1396 | } |
---|
| 1397 | xFree(aiCurrHist); |
---|
| 1398 | xFree(aiRefOrgHist); |
---|
| 1399 | aiCurrHist = NULL; |
---|
| 1400 | aiRefOrgHist = NULL; |
---|
| 1401 | } |
---|
| 1402 | #endif |
---|
| 1403 | |
---|
[443] | 1404 | #if MERL_VSP_NBDV_RefVId_Fix_D0166 |
---|
| 1405 | TComPic* TComSlice::getDepthRefPic(Int viewId, Int poc) |
---|
| 1406 | { |
---|
| 1407 | TComPic* pPic = NULL; |
---|
| 1408 | |
---|
| 1409 | if (m_pcListDepthPic[viewId] == NULL) |
---|
| 1410 | return NULL; |
---|
| 1411 | |
---|
| 1412 | for( TComList<TComPic*>::iterator it = m_pcListDepthPic[viewId]->begin(); it != m_pcListDepthPic[viewId]->end(); it++ ) |
---|
| 1413 | { |
---|
| 1414 | TComPic* currPic = *it; |
---|
| 1415 | TComSlice* currSlice = currPic->getCurrSlice(); |
---|
| 1416 | Bool isDepth = currSlice->getIsDepth(); |
---|
| 1417 | //assert(isDepth); |
---|
| 1418 | if( isDepth && currPic->getPOC() == poc && currPic->getViewId() == viewId ) // (*it)->getSPS()->isDepth() |
---|
| 1419 | { |
---|
| 1420 | pPic = *it; |
---|
| 1421 | break; |
---|
| 1422 | } |
---|
| 1423 | } |
---|
| 1424 | |
---|
| 1425 | return pPic; |
---|
| 1426 | } |
---|
| 1427 | #endif |
---|
| 1428 | |
---|
| 1429 | |
---|
| 1430 | #if QC_ARP_D0177 |
---|
| 1431 | Void TComSlice::setARPStepNum() |
---|
| 1432 | { |
---|
| 1433 | Bool bAllIvRef = false; |
---|
| 1434 | if(!getSPS()->getUseAdvRP()) |
---|
| 1435 | m_nARPStepNum = 0; |
---|
| 1436 | else |
---|
| 1437 | { |
---|
| 1438 | for( Int iRefListId = 0; iRefListId < 2; iRefListId++ ) |
---|
| 1439 | { |
---|
| 1440 | RefPicList eRefPicList = RefPicList( iRefListId ); |
---|
| 1441 | Int iNumRefIdx = getNumRefIdx(eRefPicList); |
---|
| 1442 | if( iNumRefIdx <= 0 ) |
---|
| 1443 | continue; |
---|
| 1444 | for (Int i = 0; i < iNumRefIdx; i++) |
---|
| 1445 | { |
---|
| 1446 | if(getRefPic( REF_PIC_LIST_0, i)->getPOC() != getPOC()) |
---|
| 1447 | { |
---|
| 1448 | bAllIvRef = true; |
---|
| 1449 | break; |
---|
| 1450 | } |
---|
| 1451 | } |
---|
| 1452 | if( bAllIvRef == true ) |
---|
| 1453 | break; |
---|
| 1454 | } |
---|
| 1455 | if(bAllIvRef== true) |
---|
| 1456 | m_nARPStepNum = getSPS()->getARPStepNum(); |
---|
| 1457 | else |
---|
| 1458 | m_nARPStepNum = 0; |
---|
| 1459 | } |
---|
| 1460 | } |
---|
| 1461 | #endif |
---|
[77] | 1462 | // ------------------------------------------------------------------------------------------------ |
---|
| 1463 | // Video parameter set (VPS) |
---|
| 1464 | // ------------------------------------------------------------------------------------------------ |
---|
[210] | 1465 | #if QC_MVHEVC_B0046 |
---|
| 1466 | TComVPS::TComVPS() |
---|
| 1467 | : m_VPSId ( 0) |
---|
| 1468 | , m_uiMaxTLayers ( 1) |
---|
| 1469 | , m_uiMaxLayers ( 1) |
---|
| 1470 | , m_bTemporalIdNestingFlag (false) |
---|
| 1471 | , m_uiNumHRDParameter ( 0) |
---|
| 1472 | , m_numAddiLayerOperationPoints (2) |
---|
| 1473 | , m_numAddiProLevelSets ( 1) |
---|
| 1474 | { |
---|
| 1475 | for( Int i = 0; i < MAX_LAYER_NUM; i++) |
---|
| 1476 | { |
---|
| 1477 | m_numOpLayerIdMinus1[i] = 0; |
---|
| 1478 | if(i) |
---|
| 1479 | m_numDirectRefLayer[i] = 1; |
---|
| 1480 | else |
---|
| 1481 | m_numDirectRefLayer[i] = 0; |
---|
| 1482 | for( Int j = 0; j < MAX_LAYER_NUM; j++) |
---|
| 1483 | { |
---|
| 1484 | m_numDirectRefID[i][j] = 0; |
---|
| 1485 | m_numOpLayerId[i][j] = 0; |
---|
| 1486 | } |
---|
| 1487 | m_uiViewId[i] = 0; |
---|
| 1488 | m_iViewOrderIdx[i] = 0; |
---|
| 1489 | } |
---|
| 1490 | |
---|
| 1491 | for( Int i = 0; i < MAX_TLAYER; i++) |
---|
| 1492 | { |
---|
| 1493 | m_numReorderPics[i] = 0; |
---|
| 1494 | m_uiMaxDecPicBuffering[i] = 0; |
---|
| 1495 | m_uiMaxLatencyIncrease[i] = 0; |
---|
| 1496 | } |
---|
| 1497 | } |
---|
| 1498 | |
---|
| 1499 | TComVPS::~TComVPS() |
---|
| 1500 | { |
---|
| 1501 | } |
---|
| 1502 | #else |
---|
[77] | 1503 | #if VIDYO_VPS_INTEGRATION |
---|
| 1504 | TComVPS::TComVPS() |
---|
| 1505 | : m_VPSId ( 0) |
---|
| 1506 | , m_uiMaxTLayers ( 1) |
---|
| 1507 | , m_uiMaxLayers ( 1) |
---|
| 1508 | , m_bTemporalIdNestingFlag (false) |
---|
| 1509 | , m_uiExtensionType ( 0) |
---|
| 1510 | { |
---|
| 1511 | for( Int i = 0; i < MAX_LAYER_NUM; i++) |
---|
| 1512 | { |
---|
| 1513 | m_uiDependentLayer[i] = i? i-1: 0; |
---|
| 1514 | m_bDependentFlag[i] = false; |
---|
| 1515 | m_uiViewId[i] = 0; |
---|
| 1516 | m_bDepthFlag[i] = 0; |
---|
| 1517 | m_iViewOrderIdx[i] = 0; |
---|
| 1518 | } |
---|
| 1519 | |
---|
| 1520 | for( Int i = 0; i < MAX_TLAYER; i++) |
---|
| 1521 | { |
---|
| 1522 | m_numReorderPics[i] = 0; |
---|
| 1523 | m_uiMaxDecPicBuffering[i] = 0; |
---|
| 1524 | m_uiMaxLatencyIncrease[i] = 0; |
---|
| 1525 | } |
---|
| 1526 | } |
---|
[56] | 1527 | |
---|
[77] | 1528 | TComVPS::~TComVPS() |
---|
| 1529 | { |
---|
[100] | 1530 | |
---|
| 1531 | |
---|
[77] | 1532 | } |
---|
| 1533 | |
---|
| 1534 | #endif |
---|
[210] | 1535 | #endif |
---|
[77] | 1536 | |
---|
[2] | 1537 | // ------------------------------------------------------------------------------------------------ |
---|
| 1538 | // Sequence parameter set (SPS) |
---|
| 1539 | // ------------------------------------------------------------------------------------------------ |
---|
| 1540 | |
---|
| 1541 | TComSPS::TComSPS() |
---|
[210] | 1542 | #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 |
---|
[77] | 1543 | : m_VPSId ( 0) |
---|
| 1544 | , m_SPSId ( 0) |
---|
| 1545 | #else |
---|
[56] | 1546 | : m_SPSId ( 0) |
---|
[77] | 1547 | #endif |
---|
[56] | 1548 | , m_ProfileIdc ( 0) |
---|
| 1549 | , m_LevelIdc ( 0) |
---|
| 1550 | , m_chromaFormatIdc (CHROMA_420) |
---|
| 1551 | , m_uiMaxTLayers ( 1) |
---|
| 1552 | // Structure |
---|
| 1553 | , m_picWidthInLumaSamples (352) |
---|
| 1554 | , m_picHeightInLumaSamples (288) |
---|
| 1555 | , m_picCroppingFlag (false) |
---|
| 1556 | , m_picCropLeftOffset ( 0) |
---|
| 1557 | , m_picCropRightOffset ( 0) |
---|
| 1558 | , m_picCropTopOffset ( 0) |
---|
| 1559 | , m_picCropBottomOffset ( 0) |
---|
| 1560 | , m_uiMaxCUWidth ( 32) |
---|
| 1561 | , m_uiMaxCUHeight ( 32) |
---|
| 1562 | , m_uiMaxCUDepth ( 3) |
---|
| 1563 | , m_uiMinTrDepth ( 0) |
---|
| 1564 | , m_uiMaxTrDepth ( 1) |
---|
| 1565 | , m_bLongTermRefsPresent (false) |
---|
| 1566 | , m_iNumberOfUsableInterViewRefs( 0 ) |
---|
| 1567 | , m_uiQuadtreeTULog2MaxSize ( 0) |
---|
| 1568 | , m_uiQuadtreeTULog2MinSize ( 0) |
---|
| 1569 | , m_uiQuadtreeTUMaxDepthInter ( 0) |
---|
| 1570 | , m_uiQuadtreeTUMaxDepthIntra ( 0) |
---|
| 1571 | // Tool list |
---|
| 1572 | , m_usePCM (false) |
---|
| 1573 | , m_pcmLog2MaxSize ( 5) |
---|
| 1574 | , m_uiPCMLog2MinSize ( 7) |
---|
| 1575 | , m_bDisInter4x4 ( 1) |
---|
| 1576 | , m_bUseALF (false) |
---|
| 1577 | , m_bALFCoefInSlice (false) |
---|
| 1578 | , m_bUseLMChroma (false) |
---|
| 1579 | , m_bUseLComb (false) |
---|
| 1580 | , m_bLCMod (false) |
---|
[210] | 1581 | #if QC_MVHEVC_B0046 |
---|
| 1582 | , m_restrictedRefPicListsFlag ( 0) |
---|
| 1583 | #else |
---|
[56] | 1584 | , m_restrictedRefPicListsFlag ( 1) |
---|
[210] | 1585 | #endif |
---|
[56] | 1586 | , m_listsModificationPresentFlag( 0) |
---|
| 1587 | , m_uiBitDepth ( 8) |
---|
| 1588 | , m_uiBitIncrement ( 0) |
---|
| 1589 | , m_qpBDOffsetY ( 0) |
---|
| 1590 | , m_qpBDOffsetC ( 0) |
---|
| 1591 | #if LOSSLESS_CODING |
---|
| 1592 | , m_useLossless (false) |
---|
| 1593 | #endif |
---|
| 1594 | , m_uiPCMBitDepthLuma ( 8) |
---|
| 1595 | , m_uiPCMBitDepthChroma ( 8) |
---|
| 1596 | , m_bPCMFilterDisableFlag (false) |
---|
| 1597 | , m_uiBitsForPOC ( 8) |
---|
| 1598 | , m_uiMaxTrSize ( 32) |
---|
| 1599 | , m_bLFCrossSliceBoundaryFlag (false) |
---|
| 1600 | , m_bUseSAO (false) |
---|
[5] | 1601 | #if HHI_MPI |
---|
[56] | 1602 | , m_bUseMVI (false) |
---|
[5] | 1603 | #endif |
---|
[56] | 1604 | , m_bLFCrossTileBoundaryFlag (false) |
---|
| 1605 | , m_iUniformSpacingIdr ( 0 ) |
---|
| 1606 | , m_iTileBoundaryIndependenceIdr ( 0 ) |
---|
| 1607 | , m_iNumColumnsMinus1 ( 0 ) |
---|
| 1608 | , m_puiColumnWidth ( NULL ) |
---|
| 1609 | , m_iNumRowsMinus1 ( 0 ) |
---|
| 1610 | , m_puiRowHeight ( NULL ) |
---|
| 1611 | , m_bTemporalIdNestingFlag (false) |
---|
| 1612 | , m_scalingListEnabledFlag (false) |
---|
| 1613 | , m_tilesOrEntropyCodingSyncIdc( 0 ) |
---|
| 1614 | , m_numSubstreams ( 0 ) |
---|
| 1615 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 1616 | , m_bUseDMM (false) |
---|
| 1617 | #endif |
---|
[210] | 1618 | #if FLEX_CODING_ORDER_M23723 && HHI_DMM_PRED_TEX |
---|
| 1619 | , m_bUseDMM34 (false) |
---|
| 1620 | #endif |
---|
[332] | 1621 | #if H3D_QTL |
---|
[189] | 1622 | , m_bUseQTLPC (false) |
---|
[115] | 1623 | #endif |
---|
[56] | 1624 | { |
---|
| 1625 | // AMVP parameter |
---|
| 1626 | ::memset( m_aeAMVPMode, 0, sizeof( m_aeAMVPMode ) ); |
---|
| 1627 | for ( Int i = 0; i < MAX_TLAYER; i++ ) |
---|
| 1628 | { |
---|
| 1629 | m_uiMaxLatencyIncrease[i] = 0; |
---|
| 1630 | m_uiMaxDecPicBuffering[i] = 0; |
---|
| 1631 | m_numReorderPics[i] = 0; |
---|
| 1632 | } |
---|
[42] | 1633 | |
---|
[2] | 1634 | m_uiViewId = 0; |
---|
| 1635 | m_iViewOrderIdx = 0; |
---|
| 1636 | m_bDepth = false; |
---|
| 1637 | m_uiCamParPrecision = 0; |
---|
| 1638 | m_bCamParInSliceHeader = false; |
---|
| 1639 | ::memset( m_aaiCodedScale, 0x00, sizeof( m_aaiCodedScale ) ); |
---|
| 1640 | ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) ); |
---|
| 1641 | |
---|
[5] | 1642 | #if DEPTH_MAP_GENERATION |
---|
[2] | 1643 | m_uiPredDepthMapGeneration = 0; |
---|
| 1644 | m_uiPdmPrecision = 0; |
---|
| 1645 | ::memset( m_aiPdmScaleNomDelta, 0x00, sizeof( m_aiPdmScaleNomDelta ) ); |
---|
| 1646 | ::memset( m_aiPdmOffset, 0x00, sizeof( m_aiPdmOffset ) ); |
---|
[5] | 1647 | #endif |
---|
[296] | 1648 | #if H3D_IVMP |
---|
[5] | 1649 | m_uiMultiviewMvPredMode = 0; |
---|
| 1650 | #endif |
---|
[443] | 1651 | #if QC_ARP_D0177 |
---|
| 1652 | m_nUseAdvResPred = 0; |
---|
| 1653 | m_nARPStepNum = 1; |
---|
| 1654 | #endif |
---|
[56] | 1655 | ::memset( m_aiUsableInterViewRefs, 0, sizeof( m_aiUsableInterViewRefs ) ); |
---|
[189] | 1656 | |
---|
| 1657 | #if RWTH_SDC_DLT_B0036 |
---|
| 1658 | m_bUseDLT = false; |
---|
| 1659 | |
---|
| 1660 | m_uiBitsPerDepthValue = g_uiBitDepth; |
---|
| 1661 | m_uiNumDepthmapValues = 0; |
---|
| 1662 | m_uiDepthValue2Idx = NULL; |
---|
| 1663 | m_uiIdx2DepthValue = NULL; |
---|
| 1664 | #endif |
---|
[2] | 1665 | } |
---|
| 1666 | |
---|
| 1667 | TComSPS::~TComSPS() |
---|
| 1668 | { |
---|
[56] | 1669 | if( m_iNumColumnsMinus1 > 0 && m_iUniformSpacingIdr == 0 ) |
---|
| 1670 | { |
---|
| 1671 | delete [] m_puiColumnWidth; |
---|
| 1672 | m_puiColumnWidth = NULL; |
---|
| 1673 | } |
---|
| 1674 | if( m_iNumRowsMinus1 > 0 && m_iUniformSpacingIdr == 0 ) |
---|
| 1675 | { |
---|
| 1676 | delete [] m_puiRowHeight; |
---|
| 1677 | m_puiRowHeight = NULL; |
---|
| 1678 | } |
---|
[2] | 1679 | } |
---|
| 1680 | |
---|
[189] | 1681 | #if RWTH_SDC_DLT_B0036 |
---|
| 1682 | Void TComSPS::setDepthLUTs(UInt* uidx2DepthValue, UInt uiNumDepthValues) |
---|
| 1683 | { |
---|
| 1684 | UInt uiMaxDepthValue = g_uiIBDI_MAX; |
---|
| 1685 | |
---|
| 1686 | // allocate some memory |
---|
| 1687 | if( m_uiNumDepthmapValues == 0 ) |
---|
| 1688 | { |
---|
| 1689 | m_uiNumDepthmapValues = uiMaxDepthValue+1; |
---|
| 1690 | m_uiBitsPerDepthValue = (UInt)ceil(Log2(m_uiNumDepthmapValues)); |
---|
| 1691 | |
---|
| 1692 | m_uiDepthValue2Idx = (UInt*) xMalloc(UInt, m_uiNumDepthmapValues); |
---|
| 1693 | m_uiIdx2DepthValue = (UInt*) xMalloc(UInt, m_uiNumDepthmapValues); |
---|
| 1694 | |
---|
| 1695 | //default mapping |
---|
| 1696 | for (Int i=0; i<m_uiNumDepthmapValues; i++) |
---|
| 1697 | { |
---|
| 1698 | m_uiDepthValue2Idx[i] = i; |
---|
| 1699 | m_uiIdx2DepthValue[i] = i; |
---|
| 1700 | } |
---|
| 1701 | } |
---|
| 1702 | |
---|
| 1703 | if( uidx2DepthValue == NULL || uiNumDepthValues == 0 ) // default mapping only |
---|
| 1704 | return; |
---|
| 1705 | |
---|
| 1706 | // copy idx2DepthValue to internal array |
---|
| 1707 | memcpy(m_uiIdx2DepthValue, uidx2DepthValue, uiNumDepthValues*sizeof(UInt)); |
---|
| 1708 | |
---|
| 1709 | for(Int p=0; p<=uiMaxDepthValue; p++) |
---|
| 1710 | { |
---|
| 1711 | Int iIdxDown = 0; |
---|
| 1712 | Int iIdxUp = uiNumDepthValues-1; |
---|
| 1713 | Bool bFound = false; |
---|
| 1714 | |
---|
| 1715 | // iterate over indices to find lower closest depth |
---|
| 1716 | Int i = 1; |
---|
| 1717 | while(!bFound && i<uiNumDepthValues) |
---|
| 1718 | { |
---|
| 1719 | if( m_uiIdx2DepthValue[i] > p ) |
---|
| 1720 | { |
---|
| 1721 | iIdxDown = i-1; |
---|
| 1722 | bFound = true; |
---|
| 1723 | } |
---|
| 1724 | |
---|
| 1725 | i++; |
---|
| 1726 | } |
---|
| 1727 | // iterate over indices to find upper closest depth |
---|
| 1728 | i = uiNumDepthValues-2; |
---|
| 1729 | bFound = false; |
---|
| 1730 | while(!bFound && i>=0) |
---|
| 1731 | { |
---|
| 1732 | if( m_uiIdx2DepthValue[i] < p ) |
---|
| 1733 | { |
---|
| 1734 | iIdxUp = i+1; |
---|
| 1735 | bFound = true; |
---|
| 1736 | } |
---|
| 1737 | |
---|
| 1738 | i--; |
---|
| 1739 | } |
---|
| 1740 | |
---|
| 1741 | // assert monotony |
---|
| 1742 | assert(iIdxDown<=iIdxUp); |
---|
| 1743 | |
---|
| 1744 | // assign closer depth value/idx |
---|
| 1745 | if( abs(p-(Int)m_uiIdx2DepthValue[iIdxDown]) < abs(p-(Int)m_uiIdx2DepthValue[iIdxUp]) ) |
---|
| 1746 | { |
---|
| 1747 | m_uiDepthValue2Idx[p] = iIdxDown; |
---|
| 1748 | } |
---|
| 1749 | else |
---|
| 1750 | { |
---|
| 1751 | m_uiDepthValue2Idx[p] = iIdxUp; |
---|
| 1752 | } |
---|
| 1753 | |
---|
| 1754 | } |
---|
| 1755 | |
---|
| 1756 | // update globals |
---|
| 1757 | m_uiNumDepthmapValues = uiNumDepthValues; |
---|
| 1758 | m_uiBitsPerDepthValue = (UInt)ceil(Log2(m_uiNumDepthmapValues)); |
---|
| 1759 | } |
---|
| 1760 | #endif |
---|
| 1761 | |
---|
[2] | 1762 | TComPPS::TComPPS() |
---|
[56] | 1763 | : m_PPSId (0) |
---|
| 1764 | , m_SPSId (0) |
---|
| 1765 | , m_picInitQPMinus26 (0) |
---|
| 1766 | , m_useDQP (false) |
---|
| 1767 | , m_bConstrainedIntraPred (false) |
---|
| 1768 | , m_pcSPS (NULL) |
---|
| 1769 | , m_uiMaxCuDQPDepth (0) |
---|
| 1770 | , m_uiMinCuDQPSize (0) |
---|
| 1771 | , m_iChromaQpOffset (0) |
---|
| 1772 | , m_iChromaQpOffset2nd (0) |
---|
| 1773 | , m_iSliceGranularity (0) |
---|
| 1774 | , m_iTileBehaviorControlPresentFlag (0) |
---|
| 1775 | , m_bLFCrossTileBoundaryFlag (true) |
---|
| 1776 | , m_iColumnRowInfoPresent (0) |
---|
| 1777 | , m_iUniformSpacingIdr (0) |
---|
| 1778 | , m_iNumColumnsMinus1 (0) |
---|
| 1779 | , m_puiColumnWidth (NULL) |
---|
| 1780 | , m_iNumRowsMinus1 (0) |
---|
| 1781 | , m_puiRowHeight (NULL) |
---|
| 1782 | , m_iNumSubstreams (1) |
---|
| 1783 | , m_signHideFlag(0) |
---|
| 1784 | , m_signHidingThreshold(0) |
---|
| 1785 | #if CABAC_INIT_FLAG |
---|
| 1786 | , m_cabacInitPresentFlag (false) |
---|
| 1787 | , m_encCABACTableIdx (0) |
---|
[189] | 1788 | #if FIX_POZNAN_CABAC_INIT_FLAG |
---|
[101] | 1789 | , m_encPrevPOC (0) |
---|
[56] | 1790 | #endif |
---|
[101] | 1791 | #endif |
---|
[2] | 1792 | { |
---|
| 1793 | } |
---|
| 1794 | |
---|
| 1795 | TComPPS::~TComPPS() |
---|
| 1796 | { |
---|
[56] | 1797 | if( m_iNumColumnsMinus1 > 0 && m_iUniformSpacingIdr == 0 ) |
---|
| 1798 | { |
---|
| 1799 | if (m_puiColumnWidth) delete [] m_puiColumnWidth; |
---|
| 1800 | m_puiColumnWidth = NULL; |
---|
| 1801 | } |
---|
| 1802 | if( m_iNumRowsMinus1 > 0 && m_iUniformSpacingIdr == 0 ) |
---|
| 1803 | { |
---|
| 1804 | if (m_puiRowHeight) delete [] m_puiRowHeight; |
---|
| 1805 | m_puiRowHeight = NULL; |
---|
| 1806 | } |
---|
[2] | 1807 | } |
---|
| 1808 | |
---|
| 1809 | Void |
---|
| 1810 | TComSPS::initMultiviewSPS( UInt uiViewId, Int iViewOrderIdx, UInt uiCamParPrecision, Bool bCamParSlice, Int** aaiScale, Int** aaiOffset ) |
---|
| 1811 | { |
---|
[210] | 1812 | #if !QC_MVHEVC_B0046 |
---|
[2] | 1813 | AOT( uiViewId == 0 && iViewOrderIdx != 0 ); |
---|
| 1814 | AOT( uiViewId != 0 && iViewOrderIdx == 0 ); |
---|
| 1815 | AOT( uiViewId != 0 && !bCamParSlice && ( aaiScale == 0 || aaiOffset == 0 ) ); |
---|
[210] | 1816 | #endif |
---|
[2] | 1817 | m_uiViewId = uiViewId; |
---|
| 1818 | m_iViewOrderIdx = iViewOrderIdx; |
---|
| 1819 | m_bDepth = false; |
---|
| 1820 | m_uiCamParPrecision = ( m_uiViewId ? uiCamParPrecision : 0 ); |
---|
| 1821 | m_bCamParInSliceHeader = ( m_uiViewId ? bCamParSlice : false ); |
---|
| 1822 | ::memset( m_aaiCodedScale, 0x00, sizeof( m_aaiCodedScale ) ); |
---|
| 1823 | ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) ); |
---|
[210] | 1824 | #if !QC_MVHEVC_B0046 |
---|
[2] | 1825 | if( !m_bCamParInSliceHeader ) |
---|
| 1826 | { |
---|
| 1827 | for( UInt uiBaseViewId = 0; uiBaseViewId < m_uiViewId; uiBaseViewId++ ) |
---|
| 1828 | { |
---|
| 1829 | m_aaiCodedScale [ 0 ][ uiBaseViewId ] = aaiScale [ uiBaseViewId ][ m_uiViewId ]; |
---|
| 1830 | m_aaiCodedScale [ 1 ][ uiBaseViewId ] = aaiScale [ m_uiViewId ][ uiBaseViewId ]; |
---|
| 1831 | m_aaiCodedOffset[ 0 ][ uiBaseViewId ] = aaiOffset[ uiBaseViewId ][ m_uiViewId ]; |
---|
| 1832 | m_aaiCodedOffset[ 1 ][ uiBaseViewId ] = aaiOffset[ m_uiViewId ][ uiBaseViewId ]; |
---|
| 1833 | } |
---|
| 1834 | } |
---|
[210] | 1835 | #endif |
---|
[2] | 1836 | } |
---|
| 1837 | |
---|
| 1838 | Void |
---|
[313] | 1839 | #if FCO_FIX_SPS_CHANGE |
---|
| 1840 | TComSPS::initMultiviewSPSDepth( UInt uiViewId, Int iViewOrderIdx, UInt uiCamParPrecision, Bool bCamParSlice, Int** aaiScale, Int** aaiOffset ) |
---|
| 1841 | #else |
---|
[2] | 1842 | TComSPS::initMultiviewSPSDepth( UInt uiViewId, Int iViewOrderIdx ) |
---|
[313] | 1843 | #endif |
---|
[2] | 1844 | { |
---|
| 1845 | AOT( uiViewId == 0 && iViewOrderIdx != 0 ); |
---|
| 1846 | AOT( uiViewId != 0 && iViewOrderIdx == 0 ); |
---|
| 1847 | |
---|
| 1848 | m_uiViewId = uiViewId; |
---|
| 1849 | m_iViewOrderIdx = iViewOrderIdx; |
---|
| 1850 | m_bDepth = true; |
---|
[313] | 1851 | #if FCO_FIX_SPS_CHANGE |
---|
| 1852 | m_uiCamParPrecision = ( m_uiViewId ? uiCamParPrecision : 0 ); |
---|
| 1853 | m_bCamParInSliceHeader = ( m_uiViewId ? bCamParSlice : false ); |
---|
| 1854 | #else |
---|
[2] | 1855 | m_uiCamParPrecision = 0; |
---|
| 1856 | m_bCamParInSliceHeader = false; |
---|
[313] | 1857 | #endif |
---|
[2] | 1858 | ::memset( m_aaiCodedScale, 0x00, sizeof( m_aaiCodedScale ) ); |
---|
| 1859 | ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) ); |
---|
[313] | 1860 | #if FCO_FIX_SPS_CHANGE |
---|
| 1861 | #if !QC_MVHEVC_B0046 |
---|
| 1862 | if( !m_bCamParInSliceHeader ) |
---|
| 1863 | { |
---|
| 1864 | for( UInt uiBaseViewId = 0; uiBaseViewId < m_uiViewId; uiBaseViewId++ ) |
---|
| 1865 | { |
---|
| 1866 | m_aaiCodedScale [ 0 ][ uiBaseViewId ] = aaiScale [ uiBaseViewId ][ m_uiViewId ]; |
---|
| 1867 | m_aaiCodedScale [ 1 ][ uiBaseViewId ] = aaiScale [ m_uiViewId ][ uiBaseViewId ]; |
---|
| 1868 | m_aaiCodedOffset[ 0 ][ uiBaseViewId ] = aaiOffset[ uiBaseViewId ][ m_uiViewId ]; |
---|
| 1869 | m_aaiCodedOffset[ 1 ][ uiBaseViewId ] = aaiOffset[ m_uiViewId ][ uiBaseViewId ]; |
---|
| 1870 | } |
---|
| 1871 | } |
---|
| 1872 | #endif |
---|
| 1873 | #endif |
---|
| 1874 | |
---|
[2] | 1875 | } |
---|
| 1876 | |
---|
[5] | 1877 | #if DEPTH_MAP_GENERATION |
---|
[2] | 1878 | Void |
---|
| 1879 | TComSPS::setPredDepthMapGeneration( UInt uiViewId, Bool bIsDepth, UInt uiPdmGenMode, UInt uiPdmMvPredMode, UInt uiPdmPrec, Int** aaiPdmScaleNomDelta, Int** aaiPdmOffset ) |
---|
[5] | 1880 | { |
---|
[2] | 1881 | AOF( m_uiViewId == uiViewId ); |
---|
| 1882 | AOF( m_bDepth == bIsDepth ); |
---|
| 1883 | AOT( ( uiViewId == 0 || bIsDepth ) && uiPdmGenMode ); |
---|
| 1884 | AOT( uiPdmGenMode && ( aaiPdmScaleNomDelta == 0 || aaiPdmOffset == 0 ) ); |
---|
| 1885 | AOT( uiPdmMvPredMode && uiPdmGenMode == 0 ); |
---|
[56] | 1886 | |
---|
[2] | 1887 | m_uiPredDepthMapGeneration = uiPdmGenMode; |
---|
[296] | 1888 | #if H3D_IVMP |
---|
[2] | 1889 | m_uiMultiviewMvPredMode = uiPdmMvPredMode; |
---|
[5] | 1890 | #endif |
---|
[56] | 1891 | |
---|
[2] | 1892 | m_uiPdmPrecision = ( m_uiPredDepthMapGeneration ? uiPdmPrec : 0 ); |
---|
| 1893 | ::memset( m_aiPdmScaleNomDelta, 0x00, sizeof( m_aiPdmScaleNomDelta ) ); |
---|
| 1894 | ::memset( m_aiPdmOffset, 0x00, sizeof( m_aiPdmOffset ) ); |
---|
| 1895 | if( m_uiPredDepthMapGeneration ) |
---|
| 1896 | { |
---|
| 1897 | for( UInt uiBaseId = 0; uiBaseId < m_uiViewId; uiBaseId++ ) |
---|
| 1898 | { |
---|
| 1899 | m_aiPdmScaleNomDelta[ uiBaseId ] = aaiPdmScaleNomDelta[ m_uiViewId ][ uiBaseId ]; |
---|
| 1900 | m_aiPdmOffset [ uiBaseId ] = aaiPdmOffset [ m_uiViewId ][ uiBaseId ]; |
---|
| 1901 | } |
---|
| 1902 | } |
---|
| 1903 | } |
---|
[5] | 1904 | #endif |
---|
[56] | 1905 | |
---|
| 1906 | TComReferencePictureSet::TComReferencePictureSet() |
---|
| 1907 | : m_numberOfPictures (0) |
---|
| 1908 | , m_numberOfNegativePictures (0) |
---|
| 1909 | , m_numberOfPositivePictures (0) |
---|
| 1910 | , m_numberOfLongtermPictures (0) |
---|
| 1911 | , m_interRPSPrediction (0) |
---|
| 1912 | , m_deltaRIdxMinus1 (0) |
---|
| 1913 | , m_deltaRPS (0) |
---|
| 1914 | , m_numRefIdc (0) |
---|
| 1915 | { |
---|
| 1916 | ::memset( m_deltaPOC, 0, sizeof(m_deltaPOC) ); |
---|
| 1917 | ::memset( m_POC, 0, sizeof(m_POC) ); |
---|
| 1918 | ::memset( m_used, 0, sizeof(m_used) ); |
---|
| 1919 | ::memset( m_refIdc, 0, sizeof(m_refIdc) ); |
---|
| 1920 | } |
---|
| 1921 | |
---|
| 1922 | TComReferencePictureSet::~TComReferencePictureSet() |
---|
| 1923 | { |
---|
| 1924 | } |
---|
| 1925 | |
---|
| 1926 | Void TComReferencePictureSet::setUsed(Int bufferNum, Bool used) |
---|
| 1927 | { |
---|
| 1928 | m_used[bufferNum] = used; |
---|
| 1929 | } |
---|
| 1930 | |
---|
| 1931 | Void TComReferencePictureSet::setDeltaPOC(Int bufferNum, Int deltaPOC) |
---|
| 1932 | { |
---|
| 1933 | m_deltaPOC[bufferNum] = deltaPOC; |
---|
| 1934 | } |
---|
| 1935 | |
---|
| 1936 | Void TComReferencePictureSet::setNumberOfPictures(Int numberOfPictures) |
---|
| 1937 | { |
---|
| 1938 | m_numberOfPictures = numberOfPictures; |
---|
| 1939 | } |
---|
| 1940 | |
---|
| 1941 | Int TComReferencePictureSet::getUsed(Int bufferNum) |
---|
| 1942 | { |
---|
| 1943 | return m_used[bufferNum]; |
---|
| 1944 | } |
---|
| 1945 | |
---|
| 1946 | Int TComReferencePictureSet::getDeltaPOC(Int bufferNum) |
---|
| 1947 | { |
---|
| 1948 | return m_deltaPOC[bufferNum]; |
---|
| 1949 | } |
---|
| 1950 | |
---|
| 1951 | Int TComReferencePictureSet::getNumberOfPictures() |
---|
| 1952 | { |
---|
| 1953 | return m_numberOfPictures; |
---|
| 1954 | } |
---|
| 1955 | |
---|
| 1956 | Int TComReferencePictureSet::getPOC(Int bufferNum) |
---|
| 1957 | { |
---|
| 1958 | return m_POC[bufferNum]; |
---|
| 1959 | } |
---|
| 1960 | Void TComReferencePictureSet::setPOC(Int bufferNum, Int POC) |
---|
| 1961 | { |
---|
| 1962 | m_POC[bufferNum] = POC; |
---|
| 1963 | } |
---|
| 1964 | |
---|
| 1965 | /** set the reference idc value at uiBufferNum entry to the value of iRefIdc |
---|
| 1966 | * \param uiBufferNum |
---|
| 1967 | * \param iRefIdc |
---|
| 1968 | * \returns Void |
---|
| 1969 | */ |
---|
| 1970 | Void TComReferencePictureSet::setRefIdc(Int bufferNum, Int refIdc) |
---|
| 1971 | { |
---|
| 1972 | m_refIdc[bufferNum] = refIdc; |
---|
| 1973 | } |
---|
| 1974 | |
---|
| 1975 | /** get the reference idc value at uiBufferNum |
---|
| 1976 | * \param uiBufferNum |
---|
| 1977 | * \returns Int |
---|
| 1978 | */ |
---|
| 1979 | Int TComReferencePictureSet::getRefIdc(Int bufferNum) |
---|
| 1980 | { |
---|
| 1981 | return m_refIdc[bufferNum]; |
---|
| 1982 | } |
---|
| 1983 | |
---|
| 1984 | /** Sorts the deltaPOC and Used by current values in the RPS based on the deltaPOC values. |
---|
| 1985 | * deltaPOC values are sorted with -ve values before the +ve values. -ve values are in decreasing order. |
---|
| 1986 | * +ve values are in increasing order. |
---|
| 1987 | * \returns Void |
---|
| 1988 | */ |
---|
| 1989 | Void TComReferencePictureSet::sortDeltaPOC() |
---|
| 1990 | { |
---|
| 1991 | // sort in increasing order (smallest first) |
---|
| 1992 | for(Int j=1; j < getNumberOfPictures(); j++) |
---|
| 1993 | { |
---|
| 1994 | Int deltaPOC = getDeltaPOC(j); |
---|
| 1995 | Bool used = getUsed(j); |
---|
| 1996 | for (Int k=j-1; k >= 0; k--) |
---|
| 1997 | { |
---|
| 1998 | Int temp = getDeltaPOC(k); |
---|
| 1999 | if (deltaPOC < temp) |
---|
| 2000 | { |
---|
| 2001 | setDeltaPOC(k+1, temp); |
---|
| 2002 | setUsed(k+1, getUsed(k)); |
---|
| 2003 | setDeltaPOC(k, deltaPOC); |
---|
| 2004 | setUsed(k, used); |
---|
| 2005 | } |
---|
| 2006 | } |
---|
| 2007 | } |
---|
| 2008 | // flip the negative values to largest first |
---|
| 2009 | Int numNegPics = getNumberOfNegativePictures(); |
---|
| 2010 | for(Int j=0, k=numNegPics-1; j < numNegPics>>1; j++, k--) |
---|
| 2011 | { |
---|
| 2012 | Int deltaPOC = getDeltaPOC(j); |
---|
| 2013 | Bool used = getUsed(j); |
---|
| 2014 | setDeltaPOC(j, getDeltaPOC(k)); |
---|
| 2015 | setUsed(j, getUsed(k)); |
---|
| 2016 | setDeltaPOC(k, deltaPOC); |
---|
| 2017 | setUsed(k, used); |
---|
| 2018 | } |
---|
| 2019 | } |
---|
| 2020 | |
---|
| 2021 | /** Prints the deltaPOC and RefIdc (if available) values in the RPS. |
---|
| 2022 | * A "*" is added to the deltaPOC value if it is Used bu current. |
---|
| 2023 | * \returns Void |
---|
| 2024 | */ |
---|
| 2025 | Void TComReferencePictureSet::printDeltaPOC() |
---|
| 2026 | { |
---|
| 2027 | printf("DeltaPOC = { "); |
---|
| 2028 | for(Int j=0; j < getNumberOfPictures(); j++) |
---|
| 2029 | { |
---|
| 2030 | printf("%d%s ", getDeltaPOC(j), (getUsed(j)==1)?"*":""); |
---|
| 2031 | } |
---|
| 2032 | if (getInterRPSPrediction()) |
---|
| 2033 | { |
---|
| 2034 | printf("}, RefIdc = { "); |
---|
| 2035 | for(Int j=0; j < getNumRefIdc(); j++) |
---|
| 2036 | { |
---|
| 2037 | printf("%d ", getRefIdc(j)); |
---|
| 2038 | } |
---|
| 2039 | } |
---|
| 2040 | printf("}\n"); |
---|
| 2041 | } |
---|
| 2042 | |
---|
| 2043 | TComRPSList::TComRPSList() |
---|
| 2044 | { |
---|
| 2045 | } |
---|
| 2046 | |
---|
| 2047 | TComRPSList::~TComRPSList() |
---|
| 2048 | { |
---|
| 2049 | } |
---|
| 2050 | |
---|
| 2051 | Void TComRPSList::create( Int numberOfReferencePictureSets) |
---|
| 2052 | { |
---|
| 2053 | m_numberOfReferencePictureSets = numberOfReferencePictureSets; |
---|
| 2054 | m_referencePictureSets = new TComReferencePictureSet[numberOfReferencePictureSets]; |
---|
| 2055 | } |
---|
| 2056 | |
---|
| 2057 | Void TComRPSList::destroy() |
---|
| 2058 | { |
---|
| 2059 | delete [] m_referencePictureSets; |
---|
| 2060 | m_numberOfReferencePictureSets = 0; |
---|
| 2061 | m_referencePictureSets = NULL; |
---|
| 2062 | } |
---|
| 2063 | |
---|
| 2064 | |
---|
| 2065 | |
---|
| 2066 | TComReferencePictureSet* TComRPSList::getReferencePictureSet(Int referencePictureSetNum) |
---|
| 2067 | { |
---|
| 2068 | return &m_referencePictureSets[referencePictureSetNum]; |
---|
| 2069 | } |
---|
| 2070 | |
---|
| 2071 | Int TComRPSList::getNumberOfReferencePictureSets() |
---|
| 2072 | { |
---|
| 2073 | return m_numberOfReferencePictureSets; |
---|
| 2074 | } |
---|
| 2075 | |
---|
| 2076 | Void TComRPSList::setNumberOfReferencePictureSets(Int numberOfReferencePictureSets) |
---|
| 2077 | { |
---|
| 2078 | m_numberOfReferencePictureSets = numberOfReferencePictureSets; |
---|
| 2079 | } |
---|
| 2080 | |
---|
| 2081 | TComRefPicListModification::TComRefPicListModification() |
---|
| 2082 | : m_bRefPicListModificationFlagL0 (false) |
---|
| 2083 | , m_bRefPicListModificationFlagL1 (false) |
---|
| 2084 | { |
---|
| 2085 | ::memset( m_RefPicSetIdxL0, 0, sizeof(m_RefPicSetIdxL0) ); |
---|
| 2086 | ::memset( m_RefPicSetIdxL1, 0, sizeof(m_RefPicSetIdxL1) ); |
---|
| 2087 | } |
---|
| 2088 | |
---|
| 2089 | TComRefPicListModification::~TComRefPicListModification() |
---|
| 2090 | { |
---|
| 2091 | } |
---|
| 2092 | |
---|
| 2093 | TComAPS::TComAPS() |
---|
| 2094 | { |
---|
| 2095 | m_apsID = 0; |
---|
| 2096 | m_bAlfEnabled = false; |
---|
| 2097 | m_bSaoEnabled = false; |
---|
| 2098 | m_pSaoParam = NULL; |
---|
| 2099 | m_alfParamSet = NULL; |
---|
| 2100 | m_scalingList = NULL; |
---|
| 2101 | m_scalingListEnabled = false; |
---|
| 2102 | } |
---|
| 2103 | |
---|
| 2104 | TComAPS::~TComAPS() |
---|
| 2105 | { |
---|
| 2106 | |
---|
| 2107 | } |
---|
| 2108 | |
---|
| 2109 | TComAPS& TComAPS::operator= (const TComAPS& src) |
---|
| 2110 | { |
---|
| 2111 | m_apsID = src.m_apsID; |
---|
| 2112 | m_loopFilterOffsetInAPS = src.m_loopFilterOffsetInAPS; |
---|
| 2113 | m_loopFilterDisable = src.m_loopFilterDisable; |
---|
| 2114 | m_loopFilterBetaOffsetDiv2 = src.m_loopFilterBetaOffsetDiv2; |
---|
| 2115 | m_loopFilterTcOffsetDiv2 = src.m_loopFilterTcOffsetDiv2; |
---|
| 2116 | m_bAlfEnabled = src.m_bAlfEnabled; |
---|
| 2117 | m_bSaoEnabled = src.m_bSaoEnabled; |
---|
| 2118 | m_pSaoParam = src.m_pSaoParam; |
---|
| 2119 | m_alfParamSet = src.m_alfParamSet; |
---|
| 2120 | m_scalingList = src.m_scalingList; |
---|
| 2121 | m_scalingListEnabled = src.m_scalingListEnabled; |
---|
[443] | 2122 | #if !LGE_SAO_MIGRATION_D0091 |
---|
[56] | 2123 | m_saoInterleavingFlag = src.m_saoInterleavingFlag; |
---|
[443] | 2124 | #endif |
---|
[56] | 2125 | |
---|
| 2126 | return *this; |
---|
| 2127 | } |
---|
| 2128 | |
---|
| 2129 | Void TComAPS::createSaoParam() |
---|
| 2130 | { |
---|
| 2131 | m_pSaoParam = new SAOParam; |
---|
| 2132 | } |
---|
| 2133 | |
---|
| 2134 | Void TComAPS::destroySaoParam() |
---|
| 2135 | { |
---|
| 2136 | if(m_pSaoParam != NULL) |
---|
| 2137 | { |
---|
| 2138 | delete m_pSaoParam; |
---|
| 2139 | m_pSaoParam = NULL; |
---|
| 2140 | } |
---|
| 2141 | } |
---|
| 2142 | |
---|
| 2143 | Void TComAPS::createAlfParam() |
---|
| 2144 | { |
---|
| 2145 | m_alfParamSet = new AlfParamSet; |
---|
| 2146 | } |
---|
| 2147 | Void TComAPS::destroyAlfParam() |
---|
| 2148 | { |
---|
| 2149 | if(m_alfParamSet != NULL) |
---|
| 2150 | { |
---|
| 2151 | delete m_alfParamSet; |
---|
| 2152 | m_alfParamSet = NULL; |
---|
| 2153 | } |
---|
| 2154 | } |
---|
| 2155 | |
---|
| 2156 | Void TComAPS::createScalingList() |
---|
| 2157 | { |
---|
| 2158 | m_scalingList = new TComScalingList; |
---|
| 2159 | } |
---|
| 2160 | Void TComAPS::destroyScalingList() |
---|
| 2161 | { |
---|
| 2162 | delete m_scalingList; |
---|
| 2163 | } |
---|
| 2164 | |
---|
| 2165 | TComScalingList::TComScalingList() |
---|
| 2166 | { |
---|
| 2167 | init(); |
---|
| 2168 | } |
---|
| 2169 | TComScalingList::~TComScalingList() |
---|
| 2170 | { |
---|
| 2171 | destroy(); |
---|
| 2172 | } |
---|
| 2173 | |
---|
| 2174 | /** set default quantization matrix to array |
---|
| 2175 | */ |
---|
| 2176 | Void TComSlice::setDefaultScalingList() |
---|
| 2177 | { |
---|
| 2178 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 2179 | { |
---|
| 2180 | for(UInt listId=0;listId<g_scalingListNum[sizeId];listId++) |
---|
| 2181 | { |
---|
| 2182 | getScalingList()->processDefaultMarix(sizeId, listId); |
---|
| 2183 | } |
---|
| 2184 | } |
---|
| 2185 | } |
---|
| 2186 | /** check if use default quantization matrix |
---|
| 2187 | * \returns true if use default quantization matrix in all size |
---|
| 2188 | */ |
---|
| 2189 | Bool TComSlice::checkDefaultScalingList() |
---|
| 2190 | { |
---|
| 2191 | UInt defaultCounter=0; |
---|
| 2192 | |
---|
| 2193 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 2194 | { |
---|
| 2195 | for(UInt listId=0;listId<g_scalingListNum[sizeId];listId++) |
---|
| 2196 | { |
---|
| 2197 | if(getScalingList()->getUseDefaultScalingMatrixFlag(sizeId,listId)) |
---|
| 2198 | { |
---|
| 2199 | defaultCounter++; |
---|
| 2200 | } |
---|
| 2201 | } |
---|
| 2202 | } |
---|
| 2203 | return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? true : false; // -4 for 32x32 |
---|
| 2204 | } |
---|
| 2205 | /** get scaling matrix from RefMatrixID |
---|
| 2206 | * \param sizeId size index |
---|
| 2207 | * \param Index of input matrix |
---|
| 2208 | * \param Index of reference matrix |
---|
| 2209 | */ |
---|
| 2210 | Void TComScalingList::processRefMatrix( UInt sizeId, UInt listId , UInt refListId ) |
---|
| 2211 | { |
---|
| 2212 | ::memcpy(getScalingListAddress(sizeId, listId),getScalingListAddress(sizeId, refListId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
| 2213 | } |
---|
| 2214 | /** parse syntax infomation |
---|
| 2215 | * \param pchFile syntax infomation |
---|
| 2216 | * \returns false if successful |
---|
| 2217 | */ |
---|
| 2218 | Bool TComScalingList::xParseScalingList(char* pchFile) |
---|
| 2219 | { |
---|
| 2220 | FILE *fp; |
---|
| 2221 | Char line[1024]; |
---|
| 2222 | UInt sizeIdc,listIdc; |
---|
| 2223 | UInt i,size = 0; |
---|
| 2224 | Int *src=0,data; |
---|
| 2225 | Char *ret; |
---|
| 2226 | UInt retval; |
---|
| 2227 | |
---|
| 2228 | if((fp = fopen(pchFile,"r")) == (FILE*)NULL) |
---|
| 2229 | { |
---|
| 2230 | printf("can't open file %s :: set Default Matrix\n",pchFile); |
---|
| 2231 | return true; |
---|
| 2232 | } |
---|
| 2233 | |
---|
| 2234 | for(sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) |
---|
| 2235 | { |
---|
| 2236 | size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeIdc]); |
---|
| 2237 | for(listIdc = 0; listIdc < g_scalingListNum[sizeIdc]; listIdc++) |
---|
| 2238 | { |
---|
| 2239 | src = getScalingListAddress(sizeIdc, listIdc); |
---|
| 2240 | |
---|
| 2241 | fseek(fp,0,0); |
---|
| 2242 | do |
---|
| 2243 | { |
---|
| 2244 | ret = fgets(line, 1024, fp); |
---|
| 2245 | if ((ret==NULL)||(strstr(line, MatrixType[sizeIdc][listIdc])==NULL && feof(fp))) |
---|
| 2246 | { |
---|
| 2247 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
| 2248 | return true; |
---|
| 2249 | } |
---|
| 2250 | } |
---|
| 2251 | while (strstr(line, MatrixType[sizeIdc][listIdc]) == NULL); |
---|
| 2252 | for (i=0; i<size; i++) |
---|
| 2253 | { |
---|
| 2254 | retval = fscanf(fp, "%d,", &data); |
---|
| 2255 | if (retval!=1) |
---|
| 2256 | { |
---|
| 2257 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
| 2258 | return true; |
---|
| 2259 | } |
---|
| 2260 | src[i] = data; |
---|
| 2261 | } |
---|
| 2262 | //set DC value for default matrix check |
---|
| 2263 | setScalingListDC(sizeIdc,listIdc,src[0]); |
---|
| 2264 | |
---|
| 2265 | if(sizeIdc > SCALING_LIST_8x8) |
---|
| 2266 | { |
---|
| 2267 | fseek(fp,0,0); |
---|
| 2268 | do |
---|
| 2269 | { |
---|
| 2270 | ret = fgets(line, 1024, fp); |
---|
| 2271 | if ((ret==NULL)||(strstr(line, MatrixType_DC[sizeIdc][listIdc])==NULL && feof(fp))) |
---|
| 2272 | { |
---|
| 2273 | printf("Error: can't read DC :: set Default Matrix\n"); |
---|
| 2274 | return true; |
---|
| 2275 | } |
---|
| 2276 | } |
---|
| 2277 | while (strstr(line, MatrixType_DC[sizeIdc][listIdc]) == NULL); |
---|
| 2278 | retval = fscanf(fp, "%d,", &data); |
---|
| 2279 | if (retval!=1) |
---|
| 2280 | { |
---|
| 2281 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
| 2282 | return true; |
---|
| 2283 | } |
---|
| 2284 | //overwrite DC value when size of matrix is larger than 16x16 |
---|
| 2285 | setScalingListDC(sizeIdc,listIdc,data); |
---|
| 2286 | } |
---|
| 2287 | } |
---|
| 2288 | } |
---|
| 2289 | fclose(fp); |
---|
| 2290 | return false; |
---|
| 2291 | } |
---|
| 2292 | |
---|
| 2293 | /** initialization process of quantization matrix array |
---|
| 2294 | */ |
---|
| 2295 | Void TComScalingList::init() |
---|
| 2296 | { |
---|
| 2297 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 2298 | { |
---|
| 2299 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
| 2300 | { |
---|
| 2301 | m_scalingListCoef[sizeId][listId] = new Int [min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])]; |
---|
| 2302 | } |
---|
| 2303 | } |
---|
| 2304 | m_scalingListCoef[SCALING_LIST_32x32][3] = m_scalingListCoef[SCALING_LIST_32x32][1]; // copy address for 32x32 |
---|
| 2305 | } |
---|
| 2306 | /** destroy quantization matrix array |
---|
| 2307 | */ |
---|
| 2308 | Void TComScalingList::destroy() |
---|
| 2309 | { |
---|
| 2310 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 2311 | { |
---|
| 2312 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
| 2313 | { |
---|
| 2314 | if(m_scalingListCoef[sizeId][listId]) delete [] m_scalingListCoef[sizeId][listId]; |
---|
| 2315 | } |
---|
| 2316 | } |
---|
| 2317 | } |
---|
| 2318 | /** get default address of quantization matrix |
---|
| 2319 | * \param sizeId size index |
---|
| 2320 | * \param listId list index |
---|
| 2321 | * \returns pointer of quantization matrix |
---|
| 2322 | */ |
---|
| 2323 | Int* TComScalingList::getScalingListDefaultAddress(UInt sizeId, UInt listId) |
---|
| 2324 | { |
---|
| 2325 | Int *src = 0; |
---|
| 2326 | switch(sizeId) |
---|
| 2327 | { |
---|
| 2328 | case SCALING_LIST_4x4: |
---|
| 2329 | src = (listId<3) ? g_quantIntraDefault4x4 : g_quantInterDefault4x4; |
---|
| 2330 | break; |
---|
| 2331 | case SCALING_LIST_8x8: |
---|
| 2332 | src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
| 2333 | break; |
---|
| 2334 | case SCALING_LIST_16x16: |
---|
| 2335 | src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
| 2336 | break; |
---|
| 2337 | case SCALING_LIST_32x32: |
---|
| 2338 | src = (listId<1) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
| 2339 | break; |
---|
| 2340 | default: |
---|
| 2341 | assert(0); |
---|
| 2342 | src = NULL; |
---|
| 2343 | break; |
---|
| 2344 | } |
---|
| 2345 | return src; |
---|
| 2346 | } |
---|
| 2347 | /** process of default matrix |
---|
| 2348 | * \param sizeId size index |
---|
| 2349 | * \param Index of input matrix |
---|
| 2350 | */ |
---|
| 2351 | Void TComScalingList::processDefaultMarix(UInt sizeId, UInt listId) |
---|
| 2352 | { |
---|
| 2353 | ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
| 2354 | setUseDefaultScalingMatrixFlag(sizeId,listId,true); |
---|
| 2355 | setScalingListDC(sizeId,listId,SCALING_LIST_DC); |
---|
| 2356 | } |
---|
| 2357 | /** check DC value of matrix for default matrix signaling |
---|
| 2358 | */ |
---|
| 2359 | Void TComScalingList::checkDcOfMatrix() |
---|
| 2360 | { |
---|
| 2361 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 2362 | { |
---|
| 2363 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
| 2364 | { |
---|
| 2365 | setUseDefaultScalingMatrixFlag(sizeId,listId,false); |
---|
| 2366 | //check default matrix? |
---|
| 2367 | if(getScalingListDC(sizeId,listId) == 0) |
---|
| 2368 | { |
---|
| 2369 | processDefaultMarix(sizeId, listId); |
---|
| 2370 | } |
---|
| 2371 | } |
---|
| 2372 | } |
---|
| 2373 | } |
---|
| 2374 | |
---|
| 2375 | ParameterSetManager::ParameterSetManager() |
---|
| 2376 | : m_spsMap(MAX_NUM_SPS) |
---|
| 2377 | , m_ppsMap(MAX_NUM_PPS) |
---|
| 2378 | , m_apsMap(MAX_NUM_APS) |
---|
[210] | 2379 | #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 |
---|
[77] | 2380 | , m_vpsMap(MAX_NUM_VPS) |
---|
| 2381 | #endif |
---|
[56] | 2382 | { |
---|
| 2383 | } |
---|
| 2384 | |
---|
| 2385 | |
---|
| 2386 | ParameterSetManager::~ParameterSetManager() |
---|
| 2387 | { |
---|
| 2388 | } |
---|
| 2389 | |
---|
| 2390 | //! \} |
---|