[313] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 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 |
---|
| 4 | * granted under this license. |
---|
| 5 | * |
---|
[593] | 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC |
---|
[313] | 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. |
---|
| 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
| 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 | |
---|
| 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 | #include "TLibEncoder/TEncSbac.h" |
---|
| 42 | #include "TLibDecoder/TDecSbac.h" |
---|
| 43 | |
---|
| 44 | //! \ingroup TLibCommon |
---|
| 45 | //! \{ |
---|
| 46 | |
---|
| 47 | #if SVC_EXTENSION |
---|
[442] | 48 | ParameterSetMap<TComVPS> ParameterSetManager::m_vpsMap(MAX_NUM_VPS); |
---|
| 49 | Int ParameterSetManager::m_activeVPSId = -1; |
---|
[313] | 50 | #endif |
---|
| 51 | |
---|
| 52 | TComSlice::TComSlice() |
---|
| 53 | : m_iPPSId ( -1 ) |
---|
| 54 | , m_iPOC ( 0 ) |
---|
| 55 | , m_iLastIDR ( 0 ) |
---|
| 56 | , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR_W_RADL ) |
---|
| 57 | , m_eSliceType ( I_SLICE ) |
---|
| 58 | , m_iSliceQp ( 0 ) |
---|
| 59 | , m_dependentSliceSegmentFlag ( false ) |
---|
| 60 | #if ADAPTIVE_QP_SELECTION |
---|
| 61 | , m_iSliceQpBase ( 0 ) |
---|
| 62 | #endif |
---|
| 63 | , m_deblockingFilterDisable ( false ) |
---|
| 64 | , m_deblockingFilterOverrideFlag ( false ) |
---|
| 65 | , m_deblockingFilterBetaOffsetDiv2 ( 0 ) |
---|
| 66 | , m_deblockingFilterTcOffsetDiv2 ( 0 ) |
---|
| 67 | , m_bCheckLDC ( false ) |
---|
| 68 | , m_iSliceQpDelta ( 0 ) |
---|
| 69 | , m_iSliceQpDeltaCb ( 0 ) |
---|
| 70 | , m_iSliceQpDeltaCr ( 0 ) |
---|
| 71 | , m_iDepth ( 0 ) |
---|
| 72 | , m_bRefenced ( false ) |
---|
| 73 | , m_pcSPS ( NULL ) |
---|
| 74 | , m_pcPPS ( NULL ) |
---|
| 75 | , m_pcPic ( NULL ) |
---|
| 76 | , m_colFromL0Flag ( 1 ) |
---|
| 77 | , m_colRefIdx ( 0 ) |
---|
| 78 | , m_uiTLayer ( 0 ) |
---|
| 79 | , m_bTLayerSwitchingFlag ( false ) |
---|
| 80 | , m_sliceMode ( 0 ) |
---|
| 81 | , m_sliceArgument ( 0 ) |
---|
| 82 | , m_sliceCurStartCUAddr ( 0 ) |
---|
| 83 | , m_sliceCurEndCUAddr ( 0 ) |
---|
| 84 | , m_sliceIdx ( 0 ) |
---|
| 85 | , m_sliceSegmentMode ( 0 ) |
---|
| 86 | , m_sliceSegmentArgument ( 0 ) |
---|
| 87 | , m_sliceSegmentCurStartCUAddr ( 0 ) |
---|
| 88 | , m_sliceSegmentCurEndCUAddr ( 0 ) |
---|
| 89 | , m_nextSlice ( false ) |
---|
| 90 | , m_nextSliceSegment ( false ) |
---|
| 91 | , m_sliceBits ( 0 ) |
---|
| 92 | , m_sliceSegmentBits ( 0 ) |
---|
| 93 | , m_bFinalized ( false ) |
---|
| 94 | , m_uiTileOffstForMultES ( 0 ) |
---|
| 95 | , m_puiSubstreamSizes ( NULL ) |
---|
| 96 | , m_cabacInitFlag ( false ) |
---|
| 97 | , m_bLMvdL1Zero ( false ) |
---|
| 98 | , m_numEntryPointOffsets ( 0 ) |
---|
| 99 | , m_temporalLayerNonReferenceFlag ( false ) |
---|
| 100 | , m_enableTMVPFlag ( true ) |
---|
[494] | 101 | #if SVC_EXTENSION |
---|
| 102 | , m_layerId ( 0 ) |
---|
| 103 | #if REF_IDX_MFM |
---|
| 104 | , m_bMFMEnabledFlag ( false ) |
---|
| 105 | #endif |
---|
| 106 | #if POC_RESET_FLAG |
---|
| 107 | , m_bPocResetFlag ( false ) |
---|
| 108 | #endif |
---|
| 109 | , m_bDiscardableFlag ( false ) |
---|
[540] | 110 | #if O0149_CROSS_LAYER_BLA_FLAG |
---|
| 111 | , m_bCrossLayerBLAFlag ( false ) |
---|
| 112 | #endif |
---|
[494] | 113 | #endif //SVC_EXTENSION |
---|
[313] | 114 | { |
---|
| 115 | m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0; |
---|
| 116 | |
---|
| 117 | #if SVC_EXTENSION |
---|
| 118 | memset( m_pcBaseColPic, 0, sizeof( m_pcBaseColPic ) ); |
---|
| 119 | m_activeNumILRRefIdx = 0; |
---|
| 120 | m_interLayerPredEnabledFlag = 0; |
---|
| 121 | ::memset( m_interLayerPredLayerIdc, 0, sizeof(m_interLayerPredLayerIdc) ); |
---|
[494] | 122 | #endif //SVC_EXTENSION |
---|
[313] | 123 | |
---|
| 124 | initEqualRef(); |
---|
| 125 | |
---|
[540] | 126 | for (Int component = 0; component < 3; component++) |
---|
| 127 | { |
---|
| 128 | m_lambdas[component] = 0.0; |
---|
| 129 | } |
---|
| 130 | |
---|
[313] | 131 | for ( Int idx = 0; idx < MAX_NUM_REF; idx++ ) |
---|
| 132 | { |
---|
| 133 | m_list1IdxToList0Idx[idx] = -1; |
---|
| 134 | } |
---|
| 135 | for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++) |
---|
| 136 | { |
---|
| 137 | m_apcRefPicList [0][iNumCount] = NULL; |
---|
| 138 | m_apcRefPicList [1][iNumCount] = NULL; |
---|
| 139 | m_aiRefPOCList [0][iNumCount] = 0; |
---|
| 140 | m_aiRefPOCList [1][iNumCount] = 0; |
---|
| 141 | } |
---|
| 142 | resetWpScaling(); |
---|
| 143 | initWpAcDcParam(); |
---|
| 144 | m_saoEnabledFlag = false; |
---|
[540] | 145 | m_saoEnabledFlagChroma = false; |
---|
[313] | 146 | } |
---|
| 147 | |
---|
| 148 | TComSlice::~TComSlice() |
---|
| 149 | { |
---|
| 150 | delete[] m_puiSubstreamSizes; |
---|
| 151 | m_puiSubstreamSizes = NULL; |
---|
| 152 | } |
---|
| 153 | |
---|
| 154 | |
---|
| 155 | #if SVC_EXTENSION |
---|
| 156 | Void TComSlice::initSlice( UInt layerId ) |
---|
| 157 | #else |
---|
| 158 | Void TComSlice::initSlice() |
---|
| 159 | #endif |
---|
| 160 | { |
---|
| 161 | #if SVC_EXTENSION |
---|
| 162 | m_layerId = layerId; |
---|
| 163 | m_activeNumILRRefIdx = 0; |
---|
| 164 | m_interLayerPredEnabledFlag = 0; |
---|
[442] | 165 | #endif |
---|
| 166 | m_aiNumRefIdx[0] = 0; |
---|
| 167 | m_aiNumRefIdx[1] = 0; |
---|
| 168 | |
---|
[313] | 169 | m_colFromL0Flag = 1; |
---|
| 170 | |
---|
| 171 | m_colRefIdx = 0; |
---|
| 172 | initEqualRef(); |
---|
| 173 | m_bCheckLDC = false; |
---|
| 174 | m_iSliceQpDeltaCb = 0; |
---|
| 175 | m_iSliceQpDeltaCr = 0; |
---|
| 176 | |
---|
| 177 | m_maxNumMergeCand = MRG_MAX_NUM_CANDS; |
---|
| 178 | |
---|
| 179 | m_bFinalized=false; |
---|
| 180 | |
---|
| 181 | m_tileByteLocation.clear(); |
---|
| 182 | m_cabacInitFlag = false; |
---|
| 183 | m_numEntryPointOffsets = 0; |
---|
| 184 | m_enableTMVPFlag = true; |
---|
| 185 | } |
---|
| 186 | |
---|
| 187 | Bool TComSlice::getRapPicFlag() |
---|
| 188 | { |
---|
| 189 | return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL |
---|
| 190 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP |
---|
| 191 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP |
---|
| 192 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 193 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 194 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA; |
---|
| 195 | } |
---|
| 196 | |
---|
| 197 | /** |
---|
| 198 | - allocate table to contain substream sizes to be written to the slice header. |
---|
| 199 | . |
---|
| 200 | \param uiNumSubstreams Number of substreams -- the allocation will be this value - 1. |
---|
| 201 | */ |
---|
| 202 | Void TComSlice::allocSubstreamSizes(UInt uiNumSubstreams) |
---|
| 203 | { |
---|
| 204 | delete[] m_puiSubstreamSizes; |
---|
| 205 | m_puiSubstreamSizes = new UInt[uiNumSubstreams > 0 ? uiNumSubstreams-1 : 0]; |
---|
| 206 | } |
---|
| 207 | |
---|
| 208 | Void TComSlice::sortPicList(TComList<TComPic*>& rcListPic) |
---|
| 209 | { |
---|
| 210 | TComPic* pcPicExtract; |
---|
| 211 | TComPic* pcPicInsert; |
---|
| 212 | |
---|
| 213 | TComList<TComPic*>::iterator iterPicExtract; |
---|
| 214 | TComList<TComPic*>::iterator iterPicExtract_1; |
---|
| 215 | TComList<TComPic*>::iterator iterPicInsert; |
---|
| 216 | |
---|
| 217 | for (Int i = 1; i < (Int)(rcListPic.size()); i++) |
---|
| 218 | { |
---|
| 219 | iterPicExtract = rcListPic.begin(); |
---|
| 220 | for (Int j = 0; j < i; j++) iterPicExtract++; |
---|
| 221 | pcPicExtract = *(iterPicExtract); |
---|
| 222 | pcPicExtract->setCurrSliceIdx(0); |
---|
| 223 | |
---|
| 224 | iterPicInsert = rcListPic.begin(); |
---|
| 225 | while (iterPicInsert != iterPicExtract) |
---|
| 226 | { |
---|
| 227 | pcPicInsert = *(iterPicInsert); |
---|
| 228 | pcPicInsert->setCurrSliceIdx(0); |
---|
| 229 | if (pcPicInsert->getPOC() >= pcPicExtract->getPOC()) |
---|
| 230 | { |
---|
| 231 | break; |
---|
| 232 | } |
---|
| 233 | |
---|
| 234 | iterPicInsert++; |
---|
| 235 | } |
---|
| 236 | |
---|
| 237 | iterPicExtract_1 = iterPicExtract; iterPicExtract_1++; |
---|
| 238 | |
---|
| 239 | // swap iterPicExtract and iterPicInsert, iterPicExtract = curr. / iterPicInsert = insertion position |
---|
| 240 | rcListPic.insert (iterPicInsert, iterPicExtract, iterPicExtract_1); |
---|
| 241 | rcListPic.erase (iterPicExtract); |
---|
| 242 | } |
---|
| 243 | } |
---|
| 244 | |
---|
| 245 | TComPic* TComSlice::xGetRefPic (TComList<TComPic*>& rcListPic, |
---|
| 246 | Int poc) |
---|
| 247 | { |
---|
| 248 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 249 | TComPic* pcPic = *(iterPic); |
---|
| 250 | while ( iterPic != rcListPic.end() ) |
---|
| 251 | { |
---|
| 252 | if(pcPic->getPOC() == poc) |
---|
| 253 | { |
---|
| 254 | break; |
---|
| 255 | } |
---|
| 256 | iterPic++; |
---|
[540] | 257 | #if SVC_EXTENSION |
---|
| 258 | // return NULL, if picture with requested POC is not in the list, otherwise iterator goes outside of the list |
---|
| 259 | if( iterPic == rcListPic.end() ) |
---|
| 260 | { |
---|
| 261 | return NULL; |
---|
| 262 | } |
---|
| 263 | #endif |
---|
[313] | 264 | pcPic = *(iterPic); |
---|
| 265 | } |
---|
[442] | 266 | #if POC_RESET_FLAG |
---|
| 267 | assert( pcPic->getSlice(0)->isReferenced() ); |
---|
| 268 | #endif |
---|
[313] | 269 | return pcPic; |
---|
| 270 | } |
---|
| 271 | |
---|
| 272 | |
---|
| 273 | TComPic* TComSlice::xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb) |
---|
| 274 | { |
---|
| 275 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 276 | TComPic* pcPic = *(iterPic); |
---|
| 277 | TComPic* pcStPic = pcPic; |
---|
| 278 | |
---|
| 279 | Int pocCycle = 1 << getSPS()->getBitsForPOC(); |
---|
| 280 | if (!pocHasMsb) |
---|
| 281 | { |
---|
[442] | 282 | poc = poc & (pocCycle - 1); |
---|
[313] | 283 | } |
---|
| 284 | |
---|
| 285 | while ( iterPic != rcListPic.end() ) |
---|
| 286 | { |
---|
| 287 | pcPic = *(iterPic); |
---|
| 288 | if (pcPic && pcPic->getPOC()!=this->getPOC() && pcPic->getSlice( 0 )->isReferenced()) |
---|
| 289 | { |
---|
| 290 | Int picPoc = pcPic->getPOC(); |
---|
| 291 | if (!pocHasMsb) |
---|
| 292 | { |
---|
[442] | 293 | picPoc = picPoc & (pocCycle - 1); |
---|
[313] | 294 | } |
---|
| 295 | |
---|
[540] | 296 | #if POC_RESET_RPS |
---|
| 297 | if( ((!pocHasMsb) && ((poc & (pocCycle-1)) == picPoc)) || ( pocHasMsb && (poc == picPoc)) ) |
---|
| 298 | #else |
---|
[313] | 299 | if (poc == picPoc) |
---|
[540] | 300 | #endif |
---|
[313] | 301 | { |
---|
| 302 | if (pcPic->getIsLongTerm()) |
---|
| 303 | { |
---|
| 304 | return pcPic; |
---|
| 305 | } |
---|
| 306 | else |
---|
| 307 | { |
---|
| 308 | pcStPic = pcPic; |
---|
| 309 | } |
---|
| 310 | break; |
---|
| 311 | } |
---|
| 312 | } |
---|
| 313 | |
---|
| 314 | iterPic++; |
---|
| 315 | } |
---|
| 316 | |
---|
| 317 | return pcStPic; |
---|
| 318 | } |
---|
| 319 | |
---|
| 320 | Void TComSlice::setRefPOCList() |
---|
| 321 | { |
---|
| 322 | for (Int iDir = 0; iDir < 2; iDir++) |
---|
| 323 | { |
---|
| 324 | for (Int iNumRefIdx = 0; iNumRefIdx < m_aiNumRefIdx[iDir]; iNumRefIdx++) |
---|
| 325 | { |
---|
| 326 | m_aiRefPOCList[iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getPOC(); |
---|
| 327 | } |
---|
| 328 | } |
---|
| 329 | |
---|
| 330 | } |
---|
| 331 | |
---|
| 332 | Void TComSlice::setList1IdxToList0Idx() |
---|
| 333 | { |
---|
| 334 | Int idxL0, idxL1; |
---|
| 335 | for ( idxL1 = 0; idxL1 < getNumRefIdx( REF_PIC_LIST_1 ); idxL1++ ) |
---|
| 336 | { |
---|
| 337 | m_list1IdxToList0Idx[idxL1] = -1; |
---|
| 338 | for ( idxL0 = 0; idxL0 < getNumRefIdx( REF_PIC_LIST_0 ); idxL0++ ) |
---|
| 339 | { |
---|
| 340 | if ( m_apcRefPicList[REF_PIC_LIST_0][idxL0]->getPOC() == m_apcRefPicList[REF_PIC_LIST_1][idxL1]->getPOC() ) |
---|
| 341 | { |
---|
| 342 | m_list1IdxToList0Idx[idxL1] = idxL0; |
---|
| 343 | break; |
---|
| 344 | } |
---|
| 345 | } |
---|
| 346 | } |
---|
| 347 | } |
---|
| 348 | |
---|
| 349 | #if SVC_EXTENSION |
---|
| 350 | Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr, TComPic** ilpPic) |
---|
| 351 | #else |
---|
| 352 | Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr ) |
---|
| 353 | #endif |
---|
| 354 | { |
---|
| 355 | if (!checkNumPocTotalCurr) |
---|
| 356 | { |
---|
| 357 | if (m_eSliceType == I_SLICE) |
---|
| 358 | { |
---|
| 359 | ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); |
---|
| 360 | ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); |
---|
| 361 | |
---|
| 362 | return; |
---|
| 363 | } |
---|
| 364 | |
---|
| 365 | m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); |
---|
| 366 | m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); |
---|
| 367 | } |
---|
| 368 | |
---|
| 369 | TComPic* pcRefPic= NULL; |
---|
| 370 | TComPic* RefPicSetStCurr0[16]; |
---|
| 371 | TComPic* RefPicSetStCurr1[16]; |
---|
| 372 | TComPic* RefPicSetLtCurr[16]; |
---|
| 373 | UInt NumPocStCurr0 = 0; |
---|
| 374 | UInt NumPocStCurr1 = 0; |
---|
| 375 | UInt NumPocLtCurr = 0; |
---|
| 376 | Int i; |
---|
| 377 | |
---|
[442] | 378 | #if SVC_EXTENSION |
---|
[313] | 379 | if( m_layerId == 0 || ( m_layerId > 0 && ( m_activeNumILRRefIdx == 0 || !((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA)) ) ) ) |
---|
| 380 | { |
---|
| 381 | #endif |
---|
| 382 | for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++) |
---|
| 383 | { |
---|
| 384 | if(m_pcRPS->getUsed(i)) |
---|
| 385 | { |
---|
| 386 | pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); |
---|
| 387 | pcRefPic->setIsLongTerm(0); |
---|
| 388 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 389 | RefPicSetStCurr0[NumPocStCurr0] = pcRefPic; |
---|
| 390 | NumPocStCurr0++; |
---|
| 391 | pcRefPic->setCheckLTMSBPresent(false); |
---|
| 392 | } |
---|
| 393 | } |
---|
| 394 | |
---|
| 395 | for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++) |
---|
| 396 | { |
---|
| 397 | if(m_pcRPS->getUsed(i)) |
---|
| 398 | { |
---|
| 399 | pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); |
---|
| 400 | pcRefPic->setIsLongTerm(0); |
---|
| 401 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 402 | RefPicSetStCurr1[NumPocStCurr1] = pcRefPic; |
---|
| 403 | NumPocStCurr1++; |
---|
| 404 | pcRefPic->setCheckLTMSBPresent(false); |
---|
| 405 | } |
---|
| 406 | } |
---|
| 407 | |
---|
| 408 | for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--) |
---|
| 409 | { |
---|
| 410 | if(m_pcRPS->getUsed(i)) |
---|
| 411 | { |
---|
| 412 | pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); |
---|
| 413 | pcRefPic->setIsLongTerm(1); |
---|
| 414 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 415 | RefPicSetLtCurr[NumPocLtCurr] = pcRefPic; |
---|
| 416 | NumPocLtCurr++; |
---|
| 417 | } |
---|
| 418 | if(pcRefPic==NULL) |
---|
| 419 | { |
---|
| 420 | pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); |
---|
| 421 | } |
---|
| 422 | pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); |
---|
| 423 | } |
---|
[442] | 424 | #if SVC_EXTENSION |
---|
[313] | 425 | } |
---|
| 426 | #endif |
---|
| 427 | |
---|
[442] | 428 | #if SVC_EXTENSION |
---|
[313] | 429 | for( i = 0; i < m_activeNumILRRefIdx; i++ ) |
---|
| 430 | { |
---|
| 431 | UInt refLayerIdc = m_interLayerPredLayerIdc[i]; |
---|
| 432 | //inter-layer reference picture |
---|
[494] | 433 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
| 434 | Int maxTidIlRefPicsPlus1 = ( m_layerId > 0 && m_activeNumILRRefIdx > 0)? m_pcVPS->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId) : 0; |
---|
| 435 | #else |
---|
[442] | 436 | Int maxTidIlRefPicsPlus1 = ( m_layerId > 0 && m_activeNumILRRefIdx > 0)? m_pcVPS->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()) : 0; |
---|
[494] | 437 | #endif |
---|
[442] | 438 | if( m_layerId > 0 && m_activeNumILRRefIdx > 0 && ( ( (Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<= maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) ) ) |
---|
[313] | 439 | { |
---|
| 440 | #if REF_IDX_MFM |
---|
| 441 | if(!(m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) && getMFMEnabledFlag()) |
---|
| 442 | { |
---|
| 443 | ilpPic[refLayerIdc]->copyUpsampledMvField( refLayerIdc, m_pcBaseColPic[refLayerIdc] ); |
---|
| 444 | } |
---|
| 445 | else |
---|
| 446 | { |
---|
| 447 | ilpPic[refLayerIdc]->initUpsampledMvField(); |
---|
| 448 | } |
---|
| 449 | #endif |
---|
| 450 | ilpPic[refLayerIdc]->setIsLongTerm(1); |
---|
| 451 | } |
---|
| 452 | } |
---|
| 453 | #endif |
---|
| 454 | // ref_pic_list_init |
---|
| 455 | TComPic* rpsCurrList0[MAX_NUM_REF+1]; |
---|
| 456 | TComPic* rpsCurrList1[MAX_NUM_REF+1]; |
---|
[442] | 457 | #if SVC_EXTENSION |
---|
[313] | 458 | Int numInterLayerRPSPics = 0; |
---|
| 459 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
| 460 | if( m_layerId > 0 && m_activeNumILRRefIdx > 0 ) |
---|
| 461 | #else |
---|
| 462 | if( m_layerId > 0 ) |
---|
| 463 | #endif |
---|
| 464 | { |
---|
| 465 | for( i=0; i < m_pcVPS->getNumDirectRefLayers( m_layerId ); i++ ) |
---|
| 466 | { |
---|
[494] | 467 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
| 468 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[i]->getSlice(0)->getLayerId(),m_layerId); |
---|
| 469 | #else |
---|
[442] | 470 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[i]->getSlice(0)->getLayerId()); |
---|
[494] | 471 | #endif |
---|
[442] | 472 | if( ((Int)(ilpPic[i]->getSlice(0)->getTLayer())<= maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[i]->getSlice(0)->getRapPicFlag() ) ) |
---|
[313] | 473 | { |
---|
| 474 | numInterLayerRPSPics++; |
---|
[569] | 475 | #if DISCARDABLE_PIC_RPS |
---|
| 476 | assert( ilpPic[i]->getSlice(0)->getDiscardableFlag() == 0 ); // Inter-layer RPS shall not contain picture with discardable_flag = 1. |
---|
| 477 | #endif |
---|
[313] | 478 | } |
---|
| 479 | } |
---|
| 480 | if (numInterLayerRPSPics < m_activeNumILRRefIdx) |
---|
| 481 | { |
---|
| 482 | m_activeNumILRRefIdx = numInterLayerRPSPics; |
---|
| 483 | } |
---|
[442] | 484 | #if MAX_ONE_RESAMPLING_DIRECT_LAYERS |
---|
| 485 | #if SCALABILITY_MASK_E0104 |
---|
| 486 | if( m_pcVPS->getScalabilityMask(2) ) |
---|
| 487 | #else |
---|
[313] | 488 | if( m_pcVPS->getScalabilityMask(1) ) |
---|
[442] | 489 | #endif |
---|
[313] | 490 | { |
---|
| 491 | Int numResampler = 0; |
---|
[442] | 492 | #if MOTION_RESAMPLING_CONSTRAINT |
---|
| 493 | Int numMotionResamplers = 0; |
---|
| 494 | Int refResamplingLayer[MAX_LAYERS]; |
---|
| 495 | memset( refResamplingLayer, 0, sizeof( refResamplingLayer ) ); |
---|
| 496 | #endif |
---|
[540] | 497 | #if !RESAMPLING_CONSTRAINT_BUG_FIX |
---|
[313] | 498 | const Window &scalEL = getSPS()->getScaledRefLayerWindow(m_interLayerPredLayerIdc[i]); |
---|
| 499 | Int scalingOffset = ((scalEL.getWindowLeftOffset() == 0 ) && |
---|
| 500 | (scalEL.getWindowRightOffset() == 0 ) && |
---|
| 501 | (scalEL.getWindowTopOffset() == 0 ) && |
---|
| 502 | (scalEL.getWindowBottomOffset() == 0 ) |
---|
| 503 | ); |
---|
[540] | 504 | #endif |
---|
[313] | 505 | |
---|
| 506 | for( i=0; i < m_activeNumILRRefIdx; i++ ) |
---|
| 507 | { |
---|
| 508 | UInt refLayerIdc = m_interLayerPredLayerIdc[i]; |
---|
[540] | 509 | #if RESAMPLING_CONSTRAINT_BUG_FIX |
---|
| 510 | #if O0098_SCALED_REF_LAYER_ID |
---|
| 511 | const Window &scalEL = getSPS()->getScaledRefLayerWindowForLayer(m_pcVPS->getRefLayerId( m_layerId, m_interLayerPredLayerIdc[i] )); |
---|
| 512 | #else |
---|
| 513 | const Window &scalEL = getSPS()->getScaledRefLayerWindow(m_interLayerPredLayerIdc[i]); |
---|
| 514 | #endif |
---|
| 515 | Int scalingOffset = ((scalEL.getWindowLeftOffset() == 0 ) && |
---|
| 516 | (scalEL.getWindowRightOffset() == 0 ) && |
---|
| 517 | (scalEL.getWindowTopOffset() == 0 ) && |
---|
| 518 | (scalEL.getWindowBottomOffset() == 0 ) |
---|
| 519 | ); |
---|
| 520 | #endif |
---|
[442] | 521 | if(!( g_posScalingFactor[refLayerIdc][0] == 65536 && g_posScalingFactor[refLayerIdc][1] == 65536 ) || (!scalingOffset)) // ratio 1x |
---|
[313] | 522 | { |
---|
[442] | 523 | #if MOTION_RESAMPLING_CONSTRAINT |
---|
| 524 | UInt predType = m_pcVPS->getDirectDependencyType( m_layerId, m_pcVPS->getRefLayerId( m_layerId, refLayerIdc ) ) + 1; |
---|
| 525 | |
---|
| 526 | if( predType & 0x1 ) |
---|
| 527 | { |
---|
| 528 | numResampler++; |
---|
| 529 | refResamplingLayer[i] = refLayerIdc + 1; |
---|
| 530 | } |
---|
| 531 | |
---|
| 532 | if( predType & 0x2 ) |
---|
| 533 | { |
---|
| 534 | numMotionResamplers++; |
---|
| 535 | refResamplingLayer[i] -= refLayerIdc + 1; |
---|
| 536 | } |
---|
| 537 | #else |
---|
[313] | 538 | numResampler++; |
---|
[442] | 539 | #endif |
---|
[313] | 540 | } |
---|
| 541 | } |
---|
[442] | 542 | |
---|
| 543 | // When both picture sample values and picture motion field resampling processes are invoked for decoding of a particular picture, they shall be applied to the same reference layer picture. |
---|
| 544 | if( m_activeNumILRRefIdx > 1 && numResampler > 0 ) |
---|
| 545 | { |
---|
| 546 | for( i=0; i < m_activeNumILRRefIdx; i++ ) |
---|
| 547 | { |
---|
| 548 | assert( refResamplingLayer[i] >= 0 && "Motion and sample inter-layer prediction shall be from the same layer" ); |
---|
| 549 | } |
---|
| 550 | } |
---|
[313] | 551 | |
---|
[442] | 552 | // Bitstream constraint for SHVC: The picture resampling process as specified in subclause G.8.1.4.1 shall not be invoked more than once for decoding of each particular picture. |
---|
[313] | 553 | assert(numResampler <= 1); |
---|
[442] | 554 | #if MOTION_RESAMPLING_CONSTRAINT |
---|
| 555 | assert( numMotionResamplers <= 1 && "Up to 1 motion resampling is allowed" ); |
---|
| 556 | #endif |
---|
[313] | 557 | } |
---|
| 558 | #endif |
---|
| 559 | } |
---|
| 560 | Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + m_activeNumILRRefIdx; |
---|
[494] | 561 | #else //SVC_EXTENSION |
---|
[313] | 562 | Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr; |
---|
[494] | 563 | #endif //SVC_EXTENSION |
---|
[540] | 564 | |
---|
[313] | 565 | if (checkNumPocTotalCurr) |
---|
| 566 | { |
---|
| 567 | // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr: |
---|
[557] | 568 | #if SVC_EXTENSION // inter-layer prediction is allowed for BLA, CRA pictures of nuh_layer_id>0 |
---|
[313] | 569 | // – If the current picture is a BLA or CRA picture with nuh_layer_id equal to 0, the value of NumPocTotalCurr shall be equal to 0. |
---|
| 570 | // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. |
---|
| 571 | if (getRapPicFlag() && getLayerId()==0) |
---|
| 572 | #else |
---|
| 573 | // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. |
---|
| 574 | // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. |
---|
| 575 | if (getRapPicFlag()) |
---|
| 576 | #endif |
---|
| 577 | { |
---|
| 578 | assert(numPocTotalCurr == 0); |
---|
| 579 | } |
---|
| 580 | |
---|
| 581 | if (m_eSliceType == I_SLICE) |
---|
[559] | 582 | { |
---|
[313] | 583 | ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); |
---|
| 584 | ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); |
---|
[559] | 585 | |
---|
[313] | 586 | return; |
---|
| 587 | } |
---|
[559] | 588 | |
---|
[313] | 589 | assert(numPocTotalCurr > 0); |
---|
[559] | 590 | |
---|
[313] | 591 | m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); |
---|
| 592 | m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); |
---|
| 593 | } |
---|
| 594 | |
---|
| 595 | Int cIdx = 0; |
---|
| 596 | for ( i=0; i<NumPocStCurr0; i++, cIdx++) |
---|
| 597 | { |
---|
| 598 | rpsCurrList0[cIdx] = RefPicSetStCurr0[i]; |
---|
| 599 | } |
---|
[442] | 600 | #if SVC_EXTENSION |
---|
[345] | 601 | #if RPL_INIT_N0316_N0082 |
---|
| 602 | if( m_layerId > 0 ) |
---|
[494] | 603 | { |
---|
[345] | 604 | for( i = 0; i < m_activeNumILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++) |
---|
| 605 | { |
---|
| 606 | Int refLayerIdc = m_interLayerPredLayerIdc[i]; |
---|
[494] | 607 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
| 608 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId); |
---|
| 609 | #else |
---|
[442] | 610 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()); |
---|
[494] | 611 | #endif |
---|
[442] | 612 | if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) ) |
---|
[494] | 613 | { |
---|
[345] | 614 | rpsCurrList0[cIdx] = ilpPic[refLayerIdc]; |
---|
[494] | 615 | } |
---|
[345] | 616 | } |
---|
| 617 | } |
---|
| 618 | #endif |
---|
[494] | 619 | #endif //SVC_EXTENSION |
---|
[313] | 620 | for ( i=0; i<NumPocStCurr1; i++, cIdx++) |
---|
| 621 | { |
---|
| 622 | rpsCurrList0[cIdx] = RefPicSetStCurr1[i]; |
---|
| 623 | } |
---|
| 624 | for ( i=0; i<NumPocLtCurr; i++, cIdx++) |
---|
| 625 | { |
---|
| 626 | rpsCurrList0[cIdx] = RefPicSetLtCurr[i]; |
---|
| 627 | } |
---|
[345] | 628 | #if !RPL_INIT_N0316_N0082 |
---|
[442] | 629 | #if SVC_EXTENSION |
---|
[313] | 630 | if( m_layerId > 0 ) |
---|
| 631 | { |
---|
| 632 | for( i = 0; i < m_activeNumILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++) |
---|
| 633 | { |
---|
| 634 | Int refLayerIdc = m_interLayerPredLayerIdc[i]; |
---|
[494] | 635 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
| 636 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId); |
---|
| 637 | #else |
---|
| 638 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()); |
---|
| 639 | #endif |
---|
[442] | 640 | if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) ) |
---|
[494] | 641 | { |
---|
| 642 | rpsCurrList0[cIdx] = ilpPic[refLayerIdc]; |
---|
| 643 | } |
---|
[313] | 644 | } |
---|
| 645 | } |
---|
| 646 | #endif |
---|
[345] | 647 | #endif |
---|
[313] | 648 | assert(cIdx == numPocTotalCurr); |
---|
| 649 | |
---|
| 650 | if (m_eSliceType==B_SLICE) |
---|
| 651 | { |
---|
| 652 | cIdx = 0; |
---|
| 653 | for ( i=0; i<NumPocStCurr1; i++, cIdx++) |
---|
| 654 | { |
---|
| 655 | rpsCurrList1[cIdx] = RefPicSetStCurr1[i]; |
---|
| 656 | } |
---|
| 657 | for ( i=0; i<NumPocStCurr0; i++, cIdx++) |
---|
| 658 | { |
---|
| 659 | rpsCurrList1[cIdx] = RefPicSetStCurr0[i]; |
---|
| 660 | } |
---|
| 661 | for ( i=0; i<NumPocLtCurr; i++, cIdx++) |
---|
| 662 | { |
---|
| 663 | rpsCurrList1[cIdx] = RefPicSetLtCurr[i]; |
---|
| 664 | } |
---|
| 665 | |
---|
[442] | 666 | #if SVC_EXTENSION |
---|
[313] | 667 | if( m_layerId > 0 ) |
---|
| 668 | { |
---|
| 669 | for( i = 0; i < m_activeNumILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++) |
---|
| 670 | { |
---|
| 671 | Int refLayerIdc = m_interLayerPredLayerIdc[i]; |
---|
[494] | 672 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
| 673 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId); |
---|
| 674 | #else |
---|
[442] | 675 | Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()); |
---|
[494] | 676 | #endif |
---|
[442] | 677 | if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) ) |
---|
[494] | 678 | { |
---|
| 679 | rpsCurrList1[cIdx] = ilpPic[refLayerIdc]; |
---|
| 680 | } |
---|
[313] | 681 | } |
---|
| 682 | } |
---|
[494] | 683 | #endif //SVC_EXTENSION |
---|
[313] | 684 | |
---|
| 685 | assert(cIdx == numPocTotalCurr); |
---|
| 686 | } |
---|
| 687 | |
---|
| 688 | ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm)); |
---|
| 689 | |
---|
| 690 | for (Int rIdx = 0; rIdx < m_aiNumRefIdx[0]; rIdx ++) |
---|
| 691 | { |
---|
| 692 | cIdx = m_RefPicListModification.getRefPicListModificationFlagL0() ? m_RefPicListModification.getRefPicSetIdxL0(rIdx) : rIdx % numPocTotalCurr; |
---|
| 693 | assert(cIdx >= 0 && cIdx < numPocTotalCurr); |
---|
| 694 | m_apcRefPicList[0][rIdx] = rpsCurrList0[ cIdx ]; |
---|
[349] | 695 | #if RPL_INIT_N0316_N0082 |
---|
[442] | 696 | m_bIsUsedAsLongTerm[0][rIdx] = ( cIdx >= NumPocStCurr0 && cIdx < NumPocStCurr0 + m_activeNumILRRefIdx ) || ( cIdx >= NumPocStCurr0 + NumPocStCurr1 + m_activeNumILRRefIdx ); |
---|
[349] | 697 | #else |
---|
[313] | 698 | m_bIsUsedAsLongTerm[0][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 ); |
---|
[349] | 699 | #endif |
---|
[313] | 700 | } |
---|
| 701 | if ( m_eSliceType != B_SLICE ) |
---|
| 702 | { |
---|
| 703 | m_aiNumRefIdx[1] = 0; |
---|
| 704 | ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1])); |
---|
| 705 | } |
---|
| 706 | else |
---|
| 707 | { |
---|
| 708 | for (Int rIdx = 0; rIdx < m_aiNumRefIdx[1]; rIdx ++) |
---|
| 709 | { |
---|
| 710 | cIdx = m_RefPicListModification.getRefPicListModificationFlagL1() ? m_RefPicListModification.getRefPicSetIdxL1(rIdx) : rIdx % numPocTotalCurr; |
---|
| 711 | assert(cIdx >= 0 && cIdx < numPocTotalCurr); |
---|
| 712 | m_apcRefPicList[1][rIdx] = rpsCurrList1[ cIdx ]; |
---|
| 713 | m_bIsUsedAsLongTerm[1][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 ); |
---|
| 714 | } |
---|
| 715 | } |
---|
| 716 | } |
---|
| 717 | |
---|
[442] | 718 | #if SVC_EXTENSION |
---|
[313] | 719 | Void TComSlice::setRefPicListModificationSvc() |
---|
| 720 | { |
---|
| 721 | if( !m_pcPPS->getListsModificationPresentFlag()) |
---|
| 722 | { |
---|
| 723 | return; |
---|
| 724 | } |
---|
| 725 | |
---|
| 726 | if(m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) |
---|
| 727 | { |
---|
| 728 | return; |
---|
| 729 | } |
---|
| 730 | |
---|
| 731 | TComRefPicListModification* refPicListModification = &m_RefPicListModification; |
---|
| 732 | Int numberOfRpsCurrTempList = this->getNumRpsCurrTempList(); // total number of ref pics in listTemp0 including inter-layer ref pics |
---|
[345] | 733 | #if RPL_INIT_N0316_N0082 |
---|
| 734 | Int numberOfPocBeforeCurr = this->getNumNegativeRpsCurrTempList(); // number of negative temporal ref pics |
---|
| 735 | #endif |
---|
[313] | 736 | |
---|
[442] | 737 | #if N0147_IRAP_ALIGN_FLAG |
---|
| 738 | assert(m_aiNumRefIdx[REF_PIC_LIST_0] > 0); |
---|
| 739 | assert(m_aiNumRefIdx[REF_PIC_LIST_1] > 0); |
---|
| 740 | #else |
---|
[313] | 741 | assert(m_aiNumRefIdx[REF_PIC_LIST_0] > 1); |
---|
| 742 | assert(m_aiNumRefIdx[REF_PIC_LIST_1] > 1); |
---|
[442] | 743 | #endif |
---|
[313] | 744 | |
---|
| 745 | //set L0 inter-layer reference picture modification |
---|
[345] | 746 | #if RPL_INIT_N0316_N0082 |
---|
| 747 | Bool hasModification = (m_aiNumRefIdx[REF_PIC_LIST_0] == (numberOfPocBeforeCurr + m_activeNumILRRefIdx)) ? false : true; |
---|
| 748 | #else |
---|
[313] | 749 | Bool hasModification = (m_aiNumRefIdx[REF_PIC_LIST_0] == numberOfRpsCurrTempList) ? false : true; |
---|
[345] | 750 | #endif |
---|
[442] | 751 | #if N0147_IRAP_ALIGN_FLAG |
---|
| 752 | hasModification = hasModification && ( m_aiNumRefIdx[REF_PIC_LIST_0] > 1 ); |
---|
| 753 | #endif |
---|
[313] | 754 | refPicListModification->setRefPicListModificationFlagL0(hasModification); |
---|
| 755 | if(hasModification) |
---|
| 756 | { |
---|
| 757 | for(Int i = 0; i < min(m_aiNumRefIdx[REF_PIC_LIST_0], numberOfRpsCurrTempList); i++) |
---|
| 758 | { |
---|
| 759 | refPicListModification->setRefPicSetIdxL0(i, i); |
---|
| 760 | } |
---|
| 761 | if(m_aiNumRefIdx[REF_PIC_LIST_0] > numberOfRpsCurrTempList) |
---|
| 762 | { |
---|
| 763 | // repeat last ref pic when the number of active ref idx are more than RPS entries |
---|
| 764 | for (Int i = numberOfRpsCurrTempList; i < m_aiNumRefIdx[REF_PIC_LIST_0]; i ++) |
---|
| 765 | { |
---|
| 766 | refPicListModification->setRefPicSetIdxL0(i, numberOfRpsCurrTempList - 1); |
---|
| 767 | } |
---|
| 768 | } |
---|
| 769 | else |
---|
| 770 | { |
---|
| 771 | for(Int i = m_activeNumILRRefIdx; i > 0; i-- ) |
---|
| 772 | { |
---|
[345] | 773 | #if RPL_INIT_N0316_N0082 |
---|
| 774 | if((numberOfPocBeforeCurr) >= m_aiNumRefIdx[REF_PIC_LIST_0]) |
---|
[442] | 775 | { |
---|
[345] | 776 | refPicListModification->setRefPicSetIdxL0(m_aiNumRefIdx[REF_PIC_LIST_0] - i, numberOfPocBeforeCurr); |
---|
[442] | 777 | } |
---|
[345] | 778 | else |
---|
| 779 | { |
---|
| 780 | refPicListModification->setRefPicSetIdxL0(m_aiNumRefIdx[REF_PIC_LIST_0] - i, numberOfPocBeforeCurr); |
---|
| 781 | for (Int j = numberOfPocBeforeCurr; j < (m_aiNumRefIdx[REF_PIC_LIST_0] - i); j++) |
---|
[442] | 782 | { |
---|
[345] | 783 | refPicListModification->setRefPicSetIdxL0(j, j + m_activeNumILRRefIdx); |
---|
[442] | 784 | } |
---|
[345] | 785 | } |
---|
| 786 | #else |
---|
[313] | 787 | refPicListModification->setRefPicSetIdxL0(m_aiNumRefIdx[REF_PIC_LIST_0] - i, numberOfRpsCurrTempList - i); |
---|
[345] | 788 | #endif |
---|
[313] | 789 | } |
---|
| 790 | } |
---|
| 791 | } |
---|
| 792 | |
---|
| 793 | //set L1 inter-layer reference picture modification |
---|
| 794 | hasModification = (m_aiNumRefIdx[REF_PIC_LIST_1] == numberOfRpsCurrTempList) ? false : true; |
---|
[442] | 795 | #if N0147_IRAP_ALIGN_FLAG |
---|
| 796 | hasModification = hasModification && ( m_aiNumRefIdx[REF_PIC_LIST_1] > 1 ); |
---|
| 797 | #endif |
---|
| 798 | |
---|
[313] | 799 | refPicListModification->setRefPicListModificationFlagL1(hasModification); |
---|
| 800 | if(hasModification) |
---|
| 801 | { |
---|
| 802 | for(Int i = 0; i < min(m_aiNumRefIdx[REF_PIC_LIST_1], numberOfRpsCurrTempList); i++) |
---|
| 803 | { |
---|
| 804 | refPicListModification->setRefPicSetIdxL1(i, i); |
---|
| 805 | } |
---|
| 806 | if(m_aiNumRefIdx[REF_PIC_LIST_1] > numberOfRpsCurrTempList) |
---|
| 807 | { |
---|
| 808 | for (Int i = numberOfRpsCurrTempList; i < m_aiNumRefIdx[REF_PIC_LIST_1]; i ++) |
---|
| 809 | { |
---|
| 810 | // repeat last ref pic when the number of active ref idx are more than RPS entries |
---|
| 811 | refPicListModification->setRefPicSetIdxL1(i, numberOfRpsCurrTempList - 1); |
---|
| 812 | } |
---|
| 813 | } |
---|
| 814 | else |
---|
| 815 | { |
---|
| 816 | for(Int i = m_activeNumILRRefIdx; i > 0; i-- ) |
---|
| 817 | { |
---|
| 818 | refPicListModification->setRefPicSetIdxL1(m_aiNumRefIdx[REF_PIC_LIST_1] - i, numberOfRpsCurrTempList - i); |
---|
| 819 | } |
---|
| 820 | } |
---|
| 821 | } |
---|
| 822 | return; |
---|
| 823 | } |
---|
| 824 | #endif |
---|
[345] | 825 | #if RPL_INIT_N0316_N0082 |
---|
| 826 | Int TComSlice::getNumNegativeRpsCurrTempList() |
---|
| 827 | { |
---|
| 828 | if( m_eSliceType == I_SLICE ) |
---|
| 829 | { |
---|
| 830 | return 0; |
---|
| 831 | } |
---|
[313] | 832 | |
---|
[345] | 833 | Int numPocBeforeCurr = 0; |
---|
| 834 | for( UInt i = 0; i < m_pcRPS->getNumberOfNegativePictures(); i++ ) |
---|
| 835 | { |
---|
| 836 | if(m_pcRPS->getUsed(i)) |
---|
| 837 | { |
---|
| 838 | numPocBeforeCurr++; |
---|
| 839 | } |
---|
| 840 | } |
---|
| 841 | |
---|
| 842 | return numPocBeforeCurr; |
---|
| 843 | } |
---|
| 844 | #endif |
---|
[313] | 845 | Int TComSlice::getNumRpsCurrTempList() |
---|
| 846 | { |
---|
| 847 | Int numRpsCurrTempList = 0; |
---|
| 848 | |
---|
[442] | 849 | #if SVC_EXTENSION |
---|
[313] | 850 | if( m_eSliceType == I_SLICE || ( m_pcSPS->getLayerId() && |
---|
| 851 | (m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && |
---|
| 852 | (m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) ) ) |
---|
| 853 | #else |
---|
| 854 | if (m_eSliceType == I_SLICE) |
---|
| 855 | #endif |
---|
| 856 | { |
---|
[442] | 857 | #if SVC_EXTENSION |
---|
[313] | 858 | return m_activeNumILRRefIdx; |
---|
| 859 | #else |
---|
| 860 | return 0; |
---|
| 861 | #endif |
---|
| 862 | } |
---|
| 863 | for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++) |
---|
| 864 | { |
---|
| 865 | if(m_pcRPS->getUsed(i)) |
---|
| 866 | { |
---|
| 867 | numRpsCurrTempList++; |
---|
| 868 | } |
---|
| 869 | } |
---|
[442] | 870 | #if SVC_EXTENSION |
---|
[313] | 871 | if( m_layerId > 0 ) |
---|
| 872 | { |
---|
| 873 | numRpsCurrTempList += m_activeNumILRRefIdx; |
---|
[540] | 874 | } |
---|
[313] | 875 | #endif |
---|
| 876 | |
---|
| 877 | return numRpsCurrTempList; |
---|
| 878 | } |
---|
| 879 | |
---|
| 880 | Void TComSlice::initEqualRef() |
---|
| 881 | { |
---|
| 882 | for (Int iDir = 0; iDir < 2; iDir++) |
---|
| 883 | { |
---|
| 884 | for (Int iRefIdx1 = 0; iRefIdx1 < MAX_NUM_REF; iRefIdx1++) |
---|
| 885 | { |
---|
| 886 | for (Int iRefIdx2 = iRefIdx1; iRefIdx2 < MAX_NUM_REF; iRefIdx2++) |
---|
| 887 | { |
---|
| 888 | m_abEqualRef[iDir][iRefIdx1][iRefIdx2] = m_abEqualRef[iDir][iRefIdx2][iRefIdx1] = (iRefIdx1 == iRefIdx2? true : false); |
---|
| 889 | } |
---|
| 890 | } |
---|
| 891 | } |
---|
| 892 | } |
---|
| 893 | |
---|
| 894 | Void TComSlice::checkColRefIdx(UInt curSliceIdx, TComPic* pic) |
---|
| 895 | { |
---|
| 896 | Int i; |
---|
| 897 | TComSlice* curSlice = pic->getSlice(curSliceIdx); |
---|
| 898 | Int currColRefPOC = curSlice->getRefPOC( RefPicList(1-curSlice->getColFromL0Flag()), curSlice->getColRefIdx()); |
---|
| 899 | TComSlice* preSlice; |
---|
| 900 | Int preColRefPOC; |
---|
| 901 | for(i=curSliceIdx-1; i>=0; i--) |
---|
| 902 | { |
---|
| 903 | preSlice = pic->getSlice(i); |
---|
| 904 | if(preSlice->getSliceType() != I_SLICE) |
---|
| 905 | { |
---|
| 906 | preColRefPOC = preSlice->getRefPOC( RefPicList(1-preSlice->getColFromL0Flag()), preSlice->getColRefIdx()); |
---|
| 907 | if(currColRefPOC != preColRefPOC) |
---|
| 908 | { |
---|
| 909 | printf("Collocated_ref_idx shall always be the same for all slices of a coded picture!\n"); |
---|
| 910 | exit(EXIT_FAILURE); |
---|
| 911 | } |
---|
| 912 | else |
---|
| 913 | { |
---|
| 914 | break; |
---|
| 915 | } |
---|
| 916 | } |
---|
| 917 | } |
---|
| 918 | } |
---|
| 919 | |
---|
[442] | 920 | Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic) |
---|
[313] | 921 | { |
---|
| 922 | for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++) |
---|
| 923 | { |
---|
| 924 | if(pocCRA < MAX_UINT && getPOC() > pocCRA) |
---|
| 925 | { |
---|
| 926 | assert(getPOC()+pReferencePictureSet->getDeltaPOC(i) >= pocCRA); |
---|
| 927 | } |
---|
| 928 | } |
---|
| 929 | for(Int i = pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i < pReferencePictureSet->getNumberOfPictures(); i++) |
---|
| 930 | { |
---|
| 931 | if(pocCRA < MAX_UINT && getPOC() > pocCRA) |
---|
| 932 | { |
---|
| 933 | if (!pReferencePictureSet->getCheckLTMSBPresent(i)) |
---|
| 934 | { |
---|
| 935 | assert(xGetLongTermRefPic(rcListPic, pReferencePictureSet->getPOC(i), false)->getPOC() >= pocCRA); |
---|
| 936 | } |
---|
| 937 | else |
---|
| 938 | { |
---|
| 939 | assert(pReferencePictureSet->getPOC(i) >= pocCRA); |
---|
| 940 | } |
---|
| 941 | } |
---|
| 942 | } |
---|
| 943 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found |
---|
| 944 | { |
---|
| 945 | pocCRA = getPOC(); |
---|
[442] | 946 | associatedIRAPType = getNalUnitType(); |
---|
[313] | 947 | } |
---|
| 948 | else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found |
---|
| 949 | { |
---|
| 950 | pocCRA = getPOC(); |
---|
[442] | 951 | associatedIRAPType = getNalUnitType(); |
---|
[313] | 952 | } |
---|
| 953 | else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 954 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 955 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) // BLA picture found |
---|
| 956 | { |
---|
| 957 | pocCRA = getPOC(); |
---|
[442] | 958 | associatedIRAPType = getNalUnitType(); |
---|
[313] | 959 | } |
---|
| 960 | } |
---|
| 961 | |
---|
| 962 | /** Function for marking the reference pictures when an IDR/CRA/CRANT/BLA/BLANT is encountered. |
---|
| 963 | * \param pocCRA POC of the CRA/CRANT/BLA/BLANT picture |
---|
| 964 | * \param bRefreshPending flag indicating if a deferred decoding refresh is pending |
---|
| 965 | * \param rcListPic reference to the reference picture list |
---|
| 966 | * This function marks the reference pictures as "unused for reference" in the following conditions. |
---|
| 967 | * If the nal_unit_type is IDR/BLA/BLANT, all pictures in the reference picture list |
---|
| 968 | * are marked as "unused for reference" |
---|
| 969 | * If the nal_unit_type is BLA/BLANT, set the pocCRA to the temporal reference of the current picture. |
---|
| 970 | * Otherwise |
---|
| 971 | * If the bRefreshPending flag is true (a deferred decoding refresh is pending) and the current |
---|
| 972 | * temporal reference is greater than the temporal reference of the latest CRA/CRANT/BLA/BLANT picture (pocCRA), |
---|
| 973 | * mark all reference pictures except the latest CRA/CRANT/BLA/BLANT picture as "unused for reference" and set |
---|
| 974 | * the bRefreshPending flag to false. |
---|
| 975 | * If the nal_unit_type is CRA/CRANT, set the bRefreshPending flag to true and pocCRA to the temporal |
---|
| 976 | * reference of the current picture. |
---|
| 977 | * Note that the current picture is already placed in the reference list and its marking is not changed. |
---|
| 978 | * If the current picture has a nal_ref_idc that is not 0, it will remain marked as "used for reference". |
---|
| 979 | */ |
---|
[540] | 980 | #if NO_CLRAS_OUTPUT_FLAG |
---|
| 981 | Void TComSlice::decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag) |
---|
| 982 | #else |
---|
[313] | 983 | Void TComSlice::decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic) |
---|
[540] | 984 | #endif |
---|
[313] | 985 | { |
---|
| 986 | TComPic* rpcPic; |
---|
[593] | 987 | #if !FIX1172 |
---|
[442] | 988 | setAssociatedIRAPPOC(pocCRA); |
---|
[593] | 989 | #endif |
---|
[313] | 990 | Int pocCurr = getPOC(); |
---|
| 991 | |
---|
| 992 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 993 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 994 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP |
---|
| 995 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL |
---|
| 996 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR or BLA picture |
---|
| 997 | { |
---|
| 998 | // mark all pictures as not used for reference |
---|
| 999 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1000 | while (iterPic != rcListPic.end()) |
---|
| 1001 | { |
---|
| 1002 | rpcPic = *(iterPic); |
---|
| 1003 | rpcPic->setCurrSliceIdx(0); |
---|
[540] | 1004 | #if NO_CLRAS_OUTPUT_FLAG |
---|
| 1005 | if (noClrasOutputFlag) |
---|
| 1006 | { |
---|
| 1007 | if (rpcPic->getPOC() != pocCurr) rpcPic->getSlice(0)->setReferenced(false); // all layers |
---|
| 1008 | } |
---|
| 1009 | else |
---|
| 1010 | { |
---|
| 1011 | if (rpcPic->getPOC() != pocCurr && rpcPic->getLayerId() == m_layerId) rpcPic->getSlice(0)->setReferenced(false); // only current layer |
---|
| 1012 | } |
---|
| 1013 | #else |
---|
[313] | 1014 | if (rpcPic->getPOC() != pocCurr) rpcPic->getSlice(0)->setReferenced(false); |
---|
[540] | 1015 | #endif |
---|
[313] | 1016 | iterPic++; |
---|
| 1017 | } |
---|
| 1018 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 1019 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 1020 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) |
---|
| 1021 | { |
---|
| 1022 | pocCRA = pocCurr; |
---|
| 1023 | } |
---|
| 1024 | } |
---|
| 1025 | else // CRA or No DR |
---|
| 1026 | { |
---|
| 1027 | if (bRefreshPending==true && pocCurr > pocCRA) // CRA reference marking pending |
---|
| 1028 | { |
---|
| 1029 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1030 | while (iterPic != rcListPic.end()) |
---|
| 1031 | { |
---|
| 1032 | rpcPic = *(iterPic); |
---|
| 1033 | if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) |
---|
| 1034 | { |
---|
| 1035 | rpcPic->getSlice(0)->setReferenced(false); |
---|
| 1036 | } |
---|
| 1037 | iterPic++; |
---|
| 1038 | } |
---|
| 1039 | bRefreshPending = false; |
---|
| 1040 | } |
---|
| 1041 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found |
---|
| 1042 | { |
---|
| 1043 | bRefreshPending = true; |
---|
| 1044 | pocCRA = pocCurr; |
---|
| 1045 | } |
---|
| 1046 | } |
---|
| 1047 | } |
---|
| 1048 | |
---|
| 1049 | Void TComSlice::copySliceInfo(TComSlice *pSrc) |
---|
| 1050 | { |
---|
| 1051 | assert( pSrc != NULL ); |
---|
| 1052 | |
---|
| 1053 | Int i, j, k; |
---|
| 1054 | |
---|
| 1055 | m_iPOC = pSrc->m_iPOC; |
---|
| 1056 | m_eNalUnitType = pSrc->m_eNalUnitType; |
---|
| 1057 | m_eSliceType = pSrc->m_eSliceType; |
---|
| 1058 | m_iSliceQp = pSrc->m_iSliceQp; |
---|
| 1059 | #if ADAPTIVE_QP_SELECTION |
---|
| 1060 | m_iSliceQpBase = pSrc->m_iSliceQpBase; |
---|
| 1061 | #endif |
---|
| 1062 | m_deblockingFilterDisable = pSrc->m_deblockingFilterDisable; |
---|
| 1063 | m_deblockingFilterOverrideFlag = pSrc->m_deblockingFilterOverrideFlag; |
---|
| 1064 | m_deblockingFilterBetaOffsetDiv2 = pSrc->m_deblockingFilterBetaOffsetDiv2; |
---|
| 1065 | m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2; |
---|
| 1066 | |
---|
| 1067 | for (i = 0; i < 2; i++) |
---|
| 1068 | { |
---|
| 1069 | m_aiNumRefIdx[i] = pSrc->m_aiNumRefIdx[i]; |
---|
| 1070 | } |
---|
| 1071 | |
---|
| 1072 | for (i = 0; i < MAX_NUM_REF; i++) |
---|
| 1073 | { |
---|
| 1074 | m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i]; |
---|
| 1075 | } |
---|
| 1076 | m_bCheckLDC = pSrc->m_bCheckLDC; |
---|
| 1077 | m_iSliceQpDelta = pSrc->m_iSliceQpDelta; |
---|
| 1078 | m_iSliceQpDeltaCb = pSrc->m_iSliceQpDeltaCb; |
---|
| 1079 | m_iSliceQpDeltaCr = pSrc->m_iSliceQpDeltaCr; |
---|
| 1080 | for (i = 0; i < 2; i++) |
---|
| 1081 | { |
---|
| 1082 | for (j = 0; j < MAX_NUM_REF; j++) |
---|
| 1083 | { |
---|
| 1084 | m_apcRefPicList[i][j] = pSrc->m_apcRefPicList[i][j]; |
---|
| 1085 | m_aiRefPOCList[i][j] = pSrc->m_aiRefPOCList[i][j]; |
---|
| 1086 | } |
---|
| 1087 | } |
---|
| 1088 | for (i = 0; i < 2; i++) |
---|
| 1089 | { |
---|
| 1090 | for (j = 0; j < MAX_NUM_REF + 1; j++) |
---|
| 1091 | { |
---|
| 1092 | m_bIsUsedAsLongTerm[i][j] = pSrc->m_bIsUsedAsLongTerm[i][j]; |
---|
| 1093 | } |
---|
| 1094 | } |
---|
| 1095 | m_iDepth = pSrc->m_iDepth; |
---|
| 1096 | |
---|
| 1097 | // referenced slice |
---|
| 1098 | m_bRefenced = pSrc->m_bRefenced; |
---|
| 1099 | |
---|
| 1100 | // access channel |
---|
| 1101 | #if SVC_EXTENSION |
---|
| 1102 | m_pcVPS = pSrc->m_pcVPS; |
---|
[494] | 1103 | m_layerId = pSrc->m_layerId; |
---|
[313] | 1104 | m_activeNumILRRefIdx = pSrc->m_activeNumILRRefIdx; |
---|
| 1105 | m_interLayerPredEnabledFlag = pSrc->m_interLayerPredEnabledFlag; |
---|
| 1106 | memcpy( m_interLayerPredLayerIdc, pSrc->m_interLayerPredLayerIdc, sizeof( m_interLayerPredLayerIdc ) ); |
---|
| 1107 | #endif |
---|
| 1108 | m_pcSPS = pSrc->m_pcSPS; |
---|
| 1109 | m_pcPPS = pSrc->m_pcPPS; |
---|
| 1110 | m_pcRPS = pSrc->m_pcRPS; |
---|
| 1111 | m_iLastIDR = pSrc->m_iLastIDR; |
---|
| 1112 | |
---|
| 1113 | m_pcPic = pSrc->m_pcPic; |
---|
| 1114 | |
---|
| 1115 | m_colFromL0Flag = pSrc->m_colFromL0Flag; |
---|
| 1116 | m_colRefIdx = pSrc->m_colRefIdx; |
---|
[540] | 1117 | setLambdas(pSrc->getLambdas()); |
---|
[313] | 1118 | for (i = 0; i < 2; i++) |
---|
| 1119 | { |
---|
| 1120 | for (j = 0; j < MAX_NUM_REF; j++) |
---|
| 1121 | { |
---|
| 1122 | for (k =0; k < MAX_NUM_REF; k++) |
---|
| 1123 | { |
---|
| 1124 | m_abEqualRef[i][j][k] = pSrc->m_abEqualRef[i][j][k]; |
---|
| 1125 | } |
---|
| 1126 | } |
---|
| 1127 | } |
---|
| 1128 | |
---|
| 1129 | m_uiTLayer = pSrc->m_uiTLayer; |
---|
| 1130 | m_bTLayerSwitchingFlag = pSrc->m_bTLayerSwitchingFlag; |
---|
| 1131 | |
---|
| 1132 | m_sliceMode = pSrc->m_sliceMode; |
---|
| 1133 | m_sliceArgument = pSrc->m_sliceArgument; |
---|
| 1134 | m_sliceCurStartCUAddr = pSrc->m_sliceCurStartCUAddr; |
---|
| 1135 | m_sliceCurEndCUAddr = pSrc->m_sliceCurEndCUAddr; |
---|
| 1136 | m_sliceIdx = pSrc->m_sliceIdx; |
---|
| 1137 | m_sliceSegmentMode = pSrc->m_sliceSegmentMode; |
---|
| 1138 | m_sliceSegmentArgument = pSrc->m_sliceSegmentArgument; |
---|
| 1139 | m_sliceSegmentCurStartCUAddr = pSrc->m_sliceSegmentCurStartCUAddr; |
---|
| 1140 | m_sliceSegmentCurEndCUAddr = pSrc->m_sliceSegmentCurEndCUAddr; |
---|
| 1141 | m_nextSlice = pSrc->m_nextSlice; |
---|
| 1142 | m_nextSliceSegment = pSrc->m_nextSliceSegment; |
---|
| 1143 | for ( Int e=0 ; e<2 ; e++ ) |
---|
| 1144 | { |
---|
| 1145 | for ( Int n=0 ; n<MAX_NUM_REF ; n++ ) |
---|
| 1146 | { |
---|
| 1147 | memcpy(m_weightPredTable[e][n], pSrc->m_weightPredTable[e][n], sizeof(wpScalingParam)*3 ); |
---|
| 1148 | } |
---|
| 1149 | } |
---|
| 1150 | m_saoEnabledFlag = pSrc->m_saoEnabledFlag; |
---|
| 1151 | m_saoEnabledFlagChroma = pSrc->m_saoEnabledFlagChroma; |
---|
| 1152 | m_cabacInitFlag = pSrc->m_cabacInitFlag; |
---|
| 1153 | m_numEntryPointOffsets = pSrc->m_numEntryPointOffsets; |
---|
| 1154 | |
---|
| 1155 | m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero; |
---|
| 1156 | m_LFCrossSliceBoundaryFlag = pSrc->m_LFCrossSliceBoundaryFlag; |
---|
| 1157 | m_enableTMVPFlag = pSrc->m_enableTMVPFlag; |
---|
| 1158 | m_maxNumMergeCand = pSrc->m_maxNumMergeCand; |
---|
| 1159 | } |
---|
| 1160 | |
---|
[442] | 1161 | Int TComSlice::m_prevTid0POC = 0; |
---|
[313] | 1162 | |
---|
| 1163 | /** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag. |
---|
| 1164 | * \param uiTLayer Temporal layer ID of the current slice |
---|
| 1165 | * The decoder calls this function to set temporal_layer_switching_point_flag for each temporal layer based on |
---|
| 1166 | * the SPS's temporal_id_nesting_flag and the parsed PPS. Then, current slice's temporal layer ID and |
---|
| 1167 | * temporal_layer_switching_point_flag is set accordingly. |
---|
| 1168 | */ |
---|
| 1169 | Void TComSlice::setTLayerInfo( UInt uiTLayer ) |
---|
| 1170 | { |
---|
| 1171 | m_uiTLayer = uiTLayer; |
---|
| 1172 | } |
---|
| 1173 | |
---|
| 1174 | /** Function for checking if this is a switching-point |
---|
| 1175 | */ |
---|
| 1176 | Bool TComSlice::isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic ) |
---|
| 1177 | { |
---|
| 1178 | TComPic* rpcPic; |
---|
| 1179 | // loop through all pictures in the reference picture buffer |
---|
| 1180 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1181 | while ( iterPic != rcListPic.end()) |
---|
| 1182 | { |
---|
| 1183 | rpcPic = *(iterPic++); |
---|
| 1184 | if(rpcPic->getSlice(0)->isReferenced() && rpcPic->getPOC() != getPOC()) |
---|
| 1185 | { |
---|
| 1186 | if(rpcPic->getTLayer() >= getTLayer()) |
---|
| 1187 | { |
---|
| 1188 | return false; |
---|
| 1189 | } |
---|
| 1190 | } |
---|
| 1191 | } |
---|
| 1192 | return true; |
---|
| 1193 | } |
---|
| 1194 | |
---|
| 1195 | /** Function for checking if this is a STSA candidate |
---|
| 1196 | */ |
---|
| 1197 | Bool TComSlice::isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic ) |
---|
| 1198 | { |
---|
| 1199 | TComPic* rpcPic; |
---|
| 1200 | |
---|
| 1201 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1202 | while ( iterPic != rcListPic.end()) |
---|
| 1203 | { |
---|
| 1204 | rpcPic = *(iterPic++); |
---|
| 1205 | if(rpcPic->getSlice(0)->isReferenced() && (rpcPic->getUsedByCurr()==true) && rpcPic->getPOC() != getPOC()) |
---|
| 1206 | { |
---|
| 1207 | if(rpcPic->getTLayer() >= getTLayer()) |
---|
| 1208 | { |
---|
| 1209 | return false; |
---|
| 1210 | } |
---|
| 1211 | } |
---|
| 1212 | } |
---|
| 1213 | return true; |
---|
| 1214 | } |
---|
| 1215 | |
---|
[442] | 1216 | |
---|
| 1217 | Void TComSlice::checkLeadingPictureRestrictions(TComList<TComPic*>& rcListPic) |
---|
| 1218 | { |
---|
| 1219 | TComPic* rpcPic; |
---|
| 1220 | |
---|
| 1221 | Int nalUnitType = this->getNalUnitType(); |
---|
| 1222 | |
---|
| 1223 | // When a picture is a leading picture, it shall be a RADL or RASL picture. |
---|
| 1224 | if(this->getAssociatedIRAPPOC() > this->getPOC()) |
---|
| 1225 | { |
---|
| 1226 | // Do not check IRAP pictures since they may get a POC lower than their associated IRAP |
---|
| 1227 | if(nalUnitType < NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
| 1228 | nalUnitType > NAL_UNIT_RESERVED_IRAP_VCL23) |
---|
| 1229 | { |
---|
| 1230 | assert(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1231 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || |
---|
| 1232 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1233 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R); |
---|
| 1234 | } |
---|
| 1235 | } |
---|
| 1236 | |
---|
| 1237 | // When a picture is a trailing picture, it shall not be a RADL or RASL picture. |
---|
| 1238 | if(this->getAssociatedIRAPPOC() < this->getPOC()) |
---|
| 1239 | { |
---|
| 1240 | assert(nalUnitType != NAL_UNIT_CODED_SLICE_RASL_N && |
---|
| 1241 | nalUnitType != NAL_UNIT_CODED_SLICE_RASL_R && |
---|
| 1242 | nalUnitType != NAL_UNIT_CODED_SLICE_RADL_N && |
---|
| 1243 | nalUnitType != NAL_UNIT_CODED_SLICE_RADL_R); |
---|
| 1244 | } |
---|
| 1245 | |
---|
| 1246 | // No RASL pictures shall be present in the bitstream that are associated |
---|
| 1247 | // with a BLA picture having nal_unit_type equal to BLA_W_RADL or BLA_N_LP. |
---|
| 1248 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1249 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
| 1250 | { |
---|
| 1251 | assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_W_RADL && |
---|
| 1252 | this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_N_LP); |
---|
| 1253 | } |
---|
| 1254 | |
---|
| 1255 | // No RASL pictures shall be present in the bitstream that are associated with |
---|
| 1256 | // an IDR picture. |
---|
| 1257 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1258 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
| 1259 | { |
---|
| 1260 | assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_N_LP && |
---|
| 1261 | this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL); |
---|
| 1262 | } |
---|
| 1263 | |
---|
| 1264 | // No RADL pictures shall be present in the bitstream that are associated with |
---|
| 1265 | // a BLA picture having nal_unit_type equal to BLA_N_LP or that are associated |
---|
| 1266 | // with an IDR picture having nal_unit_type equal to IDR_N_LP. |
---|
| 1267 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1268 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R) |
---|
| 1269 | { |
---|
| 1270 | assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_N_LP && |
---|
| 1271 | this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_N_LP); |
---|
| 1272 | } |
---|
| 1273 | |
---|
| 1274 | // loop through all pictures in the reference picture buffer |
---|
| 1275 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1276 | while ( iterPic != rcListPic.end()) |
---|
| 1277 | { |
---|
| 1278 | rpcPic = *(iterPic++); |
---|
[593] | 1279 | #if BUGFIX_INTRAPERIOD |
---|
| 1280 | if(!rpcPic->getReconMark()) |
---|
| 1281 | { |
---|
| 1282 | continue; |
---|
| 1283 | } |
---|
| 1284 | #endif |
---|
[442] | 1285 | if (rpcPic->getPOC() == this->getPOC()) |
---|
| 1286 | { |
---|
| 1287 | continue; |
---|
| 1288 | } |
---|
| 1289 | |
---|
| 1290 | // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture |
---|
| 1291 | // in decoding order shall precede the IRAP picture in output order. |
---|
| 1292 | // (Note that any picture following in output order would be present in the DPB) |
---|
| 1293 | if(rpcPic->getSlice(0)->getPicOutputFlag() == 1) |
---|
| 1294 | { |
---|
| 1295 | if(nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP || |
---|
| 1296 | nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
| 1297 | nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL || |
---|
| 1298 | nalUnitType == NAL_UNIT_CODED_SLICE_CRA || |
---|
| 1299 | nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP || |
---|
| 1300 | nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL) |
---|
| 1301 | { |
---|
| 1302 | assert(rpcPic->getPOC() < this->getPOC()); |
---|
| 1303 | } |
---|
| 1304 | } |
---|
| 1305 | |
---|
| 1306 | // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture |
---|
| 1307 | // in decoding order shall precede any RADL picture associated with the IRAP |
---|
| 1308 | // picture in output order. |
---|
| 1309 | if(rpcPic->getSlice(0)->getPicOutputFlag() == 1) |
---|
| 1310 | { |
---|
| 1311 | if((nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1312 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R)) |
---|
| 1313 | { |
---|
| 1314 | // rpcPic precedes the IRAP in decoding order |
---|
| 1315 | if(this->getAssociatedIRAPPOC() > rpcPic->getSlice(0)->getAssociatedIRAPPOC()) |
---|
| 1316 | { |
---|
| 1317 | // rpcPic must not be the IRAP picture |
---|
| 1318 | if(this->getAssociatedIRAPPOC() != rpcPic->getPOC()) |
---|
| 1319 | { |
---|
| 1320 | assert(rpcPic->getPOC() < this->getPOC()); |
---|
| 1321 | } |
---|
| 1322 | } |
---|
| 1323 | } |
---|
| 1324 | } |
---|
| 1325 | |
---|
| 1326 | // When a picture is a leading picture, it shall precede, in decoding order, |
---|
| 1327 | // all trailing pictures that are associated with the same IRAP picture. |
---|
| 1328 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1329 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || |
---|
| 1330 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1331 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R) |
---|
| 1332 | { |
---|
| 1333 | if(rpcPic->getSlice(0)->getAssociatedIRAPPOC() == this->getAssociatedIRAPPOC()) |
---|
| 1334 | { |
---|
| 1335 | // rpcPic is a picture that preceded the leading in decoding order since it exist in the DPB |
---|
| 1336 | // rpcPic would violate the constraint if it was a trailing picture |
---|
| 1337 | assert(rpcPic->getPOC() <= this->getAssociatedIRAPPOC()); |
---|
| 1338 | } |
---|
| 1339 | } |
---|
| 1340 | |
---|
| 1341 | // Any RASL picture associated with a CRA or BLA picture shall precede any |
---|
| 1342 | // RADL picture associated with the CRA or BLA picture in output order |
---|
| 1343 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1344 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
| 1345 | { |
---|
| 1346 | if((this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_N_LP || |
---|
| 1347 | this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
| 1348 | this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL || |
---|
| 1349 | this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) && |
---|
| 1350 | this->getAssociatedIRAPPOC() == rpcPic->getSlice(0)->getAssociatedIRAPPOC()) |
---|
| 1351 | { |
---|
| 1352 | if(rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1353 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R) |
---|
| 1354 | { |
---|
| 1355 | assert(rpcPic->getPOC() > this->getPOC()); |
---|
| 1356 | } |
---|
| 1357 | } |
---|
| 1358 | } |
---|
| 1359 | |
---|
| 1360 | // Any RASL picture associated with a CRA picture shall follow, in output |
---|
| 1361 | // order, any IRAP picture that precedes the CRA picture in decoding order. |
---|
| 1362 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1363 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
| 1364 | { |
---|
| 1365 | if(this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) |
---|
| 1366 | { |
---|
| 1367 | if(rpcPic->getSlice(0)->getPOC() < this->getAssociatedIRAPPOC() && |
---|
| 1368 | (rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP || |
---|
| 1369 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
| 1370 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL || |
---|
| 1371 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || |
---|
| 1372 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || |
---|
| 1373 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)) |
---|
| 1374 | { |
---|
| 1375 | assert(this->getPOC() > rpcPic->getSlice(0)->getPOC()); |
---|
| 1376 | } |
---|
| 1377 | } |
---|
| 1378 | } |
---|
| 1379 | } |
---|
| 1380 | } |
---|
| 1381 | |
---|
[593] | 1382 | |
---|
| 1383 | |
---|
[313] | 1384 | /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. |
---|
| 1385 | */ |
---|
| 1386 | Void TComSlice::applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet) |
---|
| 1387 | { |
---|
| 1388 | TComPic* rpcPic; |
---|
| 1389 | Int i, isReference; |
---|
| 1390 | |
---|
[442] | 1391 | checkLeadingPictureRestrictions(rcListPic); |
---|
| 1392 | |
---|
[313] | 1393 | // loop through all pictures in the reference picture buffer |
---|
| 1394 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1395 | while ( iterPic != rcListPic.end()) |
---|
| 1396 | { |
---|
| 1397 | rpcPic = *(iterPic++); |
---|
| 1398 | |
---|
| 1399 | if(!rpcPic->getSlice( 0 )->isReferenced()) |
---|
| 1400 | { |
---|
| 1401 | continue; |
---|
| 1402 | } |
---|
| 1403 | |
---|
| 1404 | isReference = 0; |
---|
| 1405 | // loop through all pictures in the Reference Picture Set |
---|
| 1406 | // to see if the picture should be kept as reference picture |
---|
| 1407 | for(i=0;i<pReferencePictureSet->getNumberOfPositivePictures()+pReferencePictureSet->getNumberOfNegativePictures();i++) |
---|
| 1408 | { |
---|
| 1409 | if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i)) |
---|
| 1410 | { |
---|
| 1411 | isReference = 1; |
---|
| 1412 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
| 1413 | rpcPic->setIsLongTerm(0); |
---|
| 1414 | } |
---|
| 1415 | } |
---|
| 1416 | for(;i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
| 1417 | { |
---|
| 1418 | if(pReferencePictureSet->getCheckLTMSBPresent(i)==true) |
---|
| 1419 | { |
---|
| 1420 | if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()) == pReferencePictureSet->getPOC(i)) |
---|
| 1421 | { |
---|
| 1422 | isReference = 1; |
---|
| 1423 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
| 1424 | } |
---|
| 1425 | } |
---|
| 1426 | else |
---|
| 1427 | { |
---|
[442] | 1428 | Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); |
---|
| 1429 | Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1); |
---|
| 1430 | Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1); |
---|
| 1431 | if(rpcPic->getIsLongTerm() && curPoc == refPoc) |
---|
[313] | 1432 | { |
---|
| 1433 | isReference = 1; |
---|
| 1434 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
| 1435 | } |
---|
| 1436 | } |
---|
| 1437 | |
---|
| 1438 | } |
---|
[569] | 1439 | #if DISCARDABLE_PIC_RPS |
---|
| 1440 | if( isReference ) // Current picture is in the temporal RPS |
---|
| 1441 | { |
---|
| 1442 | assert( rpcPic->getSlice(0)->getDiscardableFlag() == 0 ); // Temporal RPS shall not contain picture with discardable_flag equal to 1 |
---|
| 1443 | } |
---|
| 1444 | #endif |
---|
[313] | 1445 | // mark the picture as "unused for reference" if it is not in |
---|
| 1446 | // the Reference Picture Set |
---|
| 1447 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && isReference == 0) |
---|
| 1448 | { |
---|
| 1449 | rpcPic->getSlice( 0 )->setReferenced( false ); |
---|
| 1450 | rpcPic->setUsedByCurr(0); |
---|
| 1451 | rpcPic->setIsLongTerm(0); |
---|
| 1452 | } |
---|
| 1453 | //check that pictures of higher temporal layers are not used |
---|
| 1454 | assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getTLayer()<=this->getTLayer()); |
---|
| 1455 | //check that pictures of higher or equal temporal layer are not in the RPS if the current picture is a TSA picture |
---|
[540] | 1456 | if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_R || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N) |
---|
[313] | 1457 | { |
---|
| 1458 | assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getTLayer()<this->getTLayer()); |
---|
| 1459 | } |
---|
| 1460 | //check that pictures marked as temporal layer non-reference pictures are not used for reference |
---|
| 1461 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && rpcPic->getTLayer()==this->getTLayer()) |
---|
| 1462 | { |
---|
| 1463 | assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getSlice( 0 )->getTemporalLayerNonReferenceFlag()==false); |
---|
| 1464 | } |
---|
| 1465 | } |
---|
| 1466 | } |
---|
| 1467 | |
---|
| 1468 | /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. |
---|
| 1469 | */ |
---|
| 1470 | Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess) |
---|
| 1471 | { |
---|
| 1472 | TComPic* rpcPic; |
---|
| 1473 | Int i, isAvailable; |
---|
| 1474 | Int atLeastOneLost = 0; |
---|
| 1475 | Int atLeastOneRemoved = 0; |
---|
| 1476 | Int iPocLost = 0; |
---|
| 1477 | |
---|
| 1478 | // loop through all long-term pictures in the Reference Picture Set |
---|
| 1479 | // to see if the picture should be kept as reference picture |
---|
| 1480 | for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
| 1481 | { |
---|
| 1482 | isAvailable = 0; |
---|
| 1483 | // loop through all pictures in the reference picture buffer |
---|
| 1484 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1485 | while ( iterPic != rcListPic.end()) |
---|
| 1486 | { |
---|
| 1487 | rpcPic = *(iterPic++); |
---|
| 1488 | if(pReferencePictureSet->getCheckLTMSBPresent(i)==true) |
---|
| 1489 | { |
---|
| 1490 | if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()) == pReferencePictureSet->getPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
| 1491 | { |
---|
| 1492 | isAvailable = 1; |
---|
| 1493 | } |
---|
| 1494 | } |
---|
| 1495 | else |
---|
| 1496 | { |
---|
[442] | 1497 | Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); |
---|
| 1498 | Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1); |
---|
| 1499 | Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1); |
---|
| 1500 | if(rpcPic->getIsLongTerm() && curPoc == refPoc && rpcPic->getSlice(0)->isReferenced()) |
---|
[313] | 1501 | { |
---|
| 1502 | isAvailable = 1; |
---|
| 1503 | } |
---|
| 1504 | } |
---|
| 1505 | } |
---|
| 1506 | // if there was no such long-term check the short terms |
---|
| 1507 | if(!isAvailable) |
---|
| 1508 | { |
---|
| 1509 | iterPic = rcListPic.begin(); |
---|
| 1510 | while ( iterPic != rcListPic.end()) |
---|
| 1511 | { |
---|
| 1512 | rpcPic = *(iterPic++); |
---|
| 1513 | |
---|
| 1514 | Int pocCycle = 1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); |
---|
| 1515 | Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC(); |
---|
| 1516 | Int refPoc = pReferencePictureSet->getPOC(i); |
---|
| 1517 | if (!pReferencePictureSet->getCheckLTMSBPresent(i)) |
---|
| 1518 | { |
---|
[442] | 1519 | curPoc = curPoc & (pocCycle - 1); |
---|
| 1520 | refPoc = refPoc & (pocCycle - 1); |
---|
[313] | 1521 | } |
---|
| 1522 | |
---|
| 1523 | if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc) |
---|
| 1524 | { |
---|
| 1525 | isAvailable = 1; |
---|
| 1526 | rpcPic->setIsLongTerm(1); |
---|
| 1527 | break; |
---|
| 1528 | } |
---|
| 1529 | } |
---|
| 1530 | } |
---|
| 1531 | // report that a picture is lost if it is in the Reference Picture Set |
---|
| 1532 | // but not available as reference picture |
---|
| 1533 | if(isAvailable == 0) |
---|
| 1534 | { |
---|
| 1535 | if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) |
---|
| 1536 | { |
---|
| 1537 | if(!pReferencePictureSet->getUsed(i) ) |
---|
| 1538 | { |
---|
| 1539 | if(printErrors) |
---|
| 1540 | { |
---|
| 1541 | printf("\nLong-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
| 1542 | } |
---|
| 1543 | atLeastOneRemoved = 1; |
---|
| 1544 | } |
---|
| 1545 | else |
---|
| 1546 | { |
---|
| 1547 | if(printErrors) |
---|
| 1548 | { |
---|
| 1549 | printf("\nLong-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
| 1550 | } |
---|
| 1551 | atLeastOneLost = 1; |
---|
| 1552 | iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); |
---|
| 1553 | } |
---|
| 1554 | } |
---|
| 1555 | } |
---|
| 1556 | } |
---|
| 1557 | // loop through all short-term pictures in the Reference Picture Set |
---|
| 1558 | // to see if the picture should be kept as reference picture |
---|
| 1559 | for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++) |
---|
| 1560 | { |
---|
| 1561 | isAvailable = 0; |
---|
| 1562 | // loop through all pictures in the reference picture buffer |
---|
| 1563 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1564 | while ( iterPic != rcListPic.end()) |
---|
| 1565 | { |
---|
| 1566 | rpcPic = *(iterPic++); |
---|
| 1567 | |
---|
| 1568 | if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
| 1569 | { |
---|
| 1570 | isAvailable = 1; |
---|
| 1571 | } |
---|
| 1572 | } |
---|
| 1573 | // report that a picture is lost if it is in the Reference Picture Set |
---|
| 1574 | // but not available as reference picture |
---|
| 1575 | if(isAvailable == 0) |
---|
| 1576 | { |
---|
| 1577 | if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) |
---|
| 1578 | { |
---|
| 1579 | if(!pReferencePictureSet->getUsed(i) ) |
---|
| 1580 | { |
---|
| 1581 | if(printErrors) |
---|
| 1582 | { |
---|
| 1583 | printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
| 1584 | } |
---|
| 1585 | atLeastOneRemoved = 1; |
---|
| 1586 | } |
---|
| 1587 | else |
---|
| 1588 | { |
---|
| 1589 | if(printErrors) |
---|
| 1590 | { |
---|
| 1591 | printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
| 1592 | } |
---|
| 1593 | atLeastOneLost = 1; |
---|
| 1594 | iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); |
---|
| 1595 | } |
---|
| 1596 | } |
---|
| 1597 | } |
---|
| 1598 | } |
---|
| 1599 | if(atLeastOneLost) |
---|
| 1600 | { |
---|
| 1601 | return iPocLost+1; |
---|
| 1602 | } |
---|
| 1603 | if(atLeastOneRemoved) |
---|
| 1604 | { |
---|
| 1605 | return -2; |
---|
| 1606 | } |
---|
| 1607 | else |
---|
| 1608 | { |
---|
| 1609 | return 0; |
---|
| 1610 | } |
---|
| 1611 | } |
---|
| 1612 | |
---|
| 1613 | /** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set |
---|
| 1614 | */ |
---|
| 1615 | Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP) |
---|
| 1616 | { |
---|
| 1617 | TComPic* rpcPic; |
---|
| 1618 | Int i, j; |
---|
| 1619 | Int k = 0; |
---|
| 1620 | Int nrOfNegativePictures = 0; |
---|
| 1621 | Int nrOfPositivePictures = 0; |
---|
| 1622 | TComReferencePictureSet* pcRPS = this->getLocalRPS(); |
---|
| 1623 | |
---|
| 1624 | // loop through all pictures in the Reference Picture Set |
---|
| 1625 | for(i=0;i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
| 1626 | { |
---|
| 1627 | j = 0; |
---|
| 1628 | // loop through all pictures in the reference picture buffer |
---|
| 1629 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1630 | while ( iterPic != rcListPic.end()) |
---|
| 1631 | { |
---|
| 1632 | j++; |
---|
| 1633 | rpcPic = *(iterPic++); |
---|
| 1634 | |
---|
| 1635 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
| 1636 | { |
---|
| 1637 | // This picture exists as a reference picture |
---|
| 1638 | // and should be added to the explicit Reference Picture Set |
---|
| 1639 | pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i)); |
---|
| 1640 | pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP)); |
---|
| 1641 | if(pcRPS->getDeltaPOC(k) < 0) |
---|
| 1642 | { |
---|
| 1643 | nrOfNegativePictures++; |
---|
| 1644 | } |
---|
| 1645 | else |
---|
| 1646 | { |
---|
| 1647 | nrOfPositivePictures++; |
---|
| 1648 | } |
---|
| 1649 | k++; |
---|
| 1650 | } |
---|
| 1651 | } |
---|
| 1652 | } |
---|
| 1653 | pcRPS->setNumberOfNegativePictures(nrOfNegativePictures); |
---|
| 1654 | pcRPS->setNumberOfPositivePictures(nrOfPositivePictures); |
---|
| 1655 | pcRPS->setNumberOfPictures(nrOfNegativePictures+nrOfPositivePictures); |
---|
| 1656 | // This is a simplistic inter rps example. A smarter encoder will look for a better reference RPS to do the |
---|
| 1657 | // inter RPS prediction with. Here we just use the reference used by pReferencePictureSet. |
---|
| 1658 | // If pReferencePictureSet is not inter_RPS_predicted, then inter_RPS_prediction is for the current RPS also disabled. |
---|
| 1659 | if (!pReferencePictureSet->getInterRPSPrediction()) |
---|
| 1660 | { |
---|
| 1661 | pcRPS->setInterRPSPrediction(false); |
---|
| 1662 | pcRPS->setNumRefIdc(0); |
---|
| 1663 | } |
---|
| 1664 | else |
---|
| 1665 | { |
---|
| 1666 | Int rIdx = this->getRPSidx() - pReferencePictureSet->getDeltaRIdxMinus1() - 1; |
---|
| 1667 | Int deltaRPS = pReferencePictureSet->getDeltaRPS(); |
---|
| 1668 | TComReferencePictureSet* pcRefRPS = this->getSPS()->getRPSList()->getReferencePictureSet(rIdx); |
---|
| 1669 | Int iRefPics = pcRefRPS->getNumberOfPictures(); |
---|
| 1670 | Int iNewIdc=0; |
---|
| 1671 | for(i=0; i<= iRefPics; i++) |
---|
| 1672 | { |
---|
| 1673 | Int deltaPOC = ((i != iRefPics)? pcRefRPS->getDeltaPOC(i) : 0); // check if the reference abs POC is >= 0 |
---|
| 1674 | Int iRefIdc = 0; |
---|
| 1675 | for (j=0; j < pcRPS->getNumberOfPictures(); j++) // loop through the pictures in the new RPS |
---|
| 1676 | { |
---|
| 1677 | if ( (deltaPOC + deltaRPS) == pcRPS->getDeltaPOC(j)) |
---|
| 1678 | { |
---|
| 1679 | if (pcRPS->getUsed(j)) |
---|
| 1680 | { |
---|
| 1681 | iRefIdc = 1; |
---|
| 1682 | } |
---|
| 1683 | else |
---|
| 1684 | { |
---|
| 1685 | iRefIdc = 2; |
---|
| 1686 | } |
---|
| 1687 | } |
---|
| 1688 | } |
---|
| 1689 | pcRPS->setRefIdc(i, iRefIdc); |
---|
| 1690 | iNewIdc++; |
---|
| 1691 | } |
---|
| 1692 | pcRPS->setInterRPSPrediction(true); |
---|
| 1693 | pcRPS->setNumRefIdc(iNewIdc); |
---|
| 1694 | pcRPS->setDeltaRPS(deltaRPS); |
---|
| 1695 | pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx()); |
---|
| 1696 | } |
---|
| 1697 | |
---|
| 1698 | this->setRPS(pcRPS); |
---|
| 1699 | this->setRPSidx(-1); |
---|
| 1700 | } |
---|
| 1701 | |
---|
| 1702 | /** get AC and DC values for weighted pred |
---|
| 1703 | * \param *wp |
---|
| 1704 | * \returns Void |
---|
| 1705 | */ |
---|
| 1706 | Void TComSlice::getWpAcDcParam(wpACDCParam *&wp) |
---|
| 1707 | { |
---|
| 1708 | wp = m_weightACDCParam; |
---|
| 1709 | } |
---|
| 1710 | |
---|
| 1711 | /** init AC and DC values for weighted pred |
---|
| 1712 | * \returns Void |
---|
| 1713 | */ |
---|
| 1714 | Void TComSlice::initWpAcDcParam() |
---|
| 1715 | { |
---|
| 1716 | for(Int iComp = 0; iComp < 3; iComp++ ) |
---|
| 1717 | { |
---|
| 1718 | m_weightACDCParam[iComp].iAC = 0; |
---|
| 1719 | m_weightACDCParam[iComp].iDC = 0; |
---|
| 1720 | } |
---|
| 1721 | } |
---|
| 1722 | |
---|
| 1723 | /** get WP tables for weighted pred |
---|
| 1724 | * \param RefPicList |
---|
| 1725 | * \param iRefIdx |
---|
| 1726 | * \param *&wpScalingParam |
---|
| 1727 | * \returns Void |
---|
| 1728 | */ |
---|
| 1729 | Void TComSlice::getWpScaling( RefPicList e, Int iRefIdx, wpScalingParam *&wp ) |
---|
| 1730 | { |
---|
| 1731 | wp = m_weightPredTable[e][iRefIdx]; |
---|
| 1732 | } |
---|
| 1733 | |
---|
| 1734 | /** reset Default WP tables settings : no weight. |
---|
| 1735 | * \param wpScalingParam |
---|
| 1736 | * \returns Void |
---|
| 1737 | */ |
---|
| 1738 | Void TComSlice::resetWpScaling() |
---|
| 1739 | { |
---|
| 1740 | for ( Int e=0 ; e<2 ; e++ ) |
---|
| 1741 | { |
---|
| 1742 | for ( Int i=0 ; i<MAX_NUM_REF ; i++ ) |
---|
| 1743 | { |
---|
| 1744 | for ( Int yuv=0 ; yuv<3 ; yuv++ ) |
---|
| 1745 | { |
---|
| 1746 | wpScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); |
---|
| 1747 | pwp->bPresentFlag = false; |
---|
| 1748 | pwp->uiLog2WeightDenom = 0; |
---|
| 1749 | pwp->uiLog2WeightDenom = 0; |
---|
| 1750 | pwp->iWeight = 1; |
---|
| 1751 | pwp->iOffset = 0; |
---|
| 1752 | } |
---|
| 1753 | } |
---|
| 1754 | } |
---|
| 1755 | } |
---|
| 1756 | |
---|
| 1757 | /** init WP table |
---|
| 1758 | * \returns Void |
---|
| 1759 | */ |
---|
| 1760 | Void TComSlice::initWpScaling() |
---|
| 1761 | { |
---|
| 1762 | for ( Int e=0 ; e<2 ; e++ ) |
---|
| 1763 | { |
---|
| 1764 | for ( Int i=0 ; i<MAX_NUM_REF ; i++ ) |
---|
| 1765 | { |
---|
| 1766 | for ( Int yuv=0 ; yuv<3 ; yuv++ ) |
---|
| 1767 | { |
---|
| 1768 | wpScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); |
---|
| 1769 | if ( !pwp->bPresentFlag ) |
---|
| 1770 | { |
---|
| 1771 | // Inferring values not present : |
---|
| 1772 | pwp->iWeight = (1 << pwp->uiLog2WeightDenom); |
---|
| 1773 | pwp->iOffset = 0; |
---|
| 1774 | } |
---|
| 1775 | |
---|
| 1776 | pwp->w = pwp->iWeight; |
---|
| 1777 | Int bitDepth = yuv ? g_bitDepthC : g_bitDepthY; |
---|
| 1778 | pwp->o = pwp->iOffset << (bitDepth-8); |
---|
| 1779 | pwp->shift = pwp->uiLog2WeightDenom; |
---|
| 1780 | pwp->round = (pwp->uiLog2WeightDenom>=1) ? (1 << (pwp->uiLog2WeightDenom-1)) : (0); |
---|
| 1781 | } |
---|
| 1782 | } |
---|
| 1783 | } |
---|
| 1784 | } |
---|
| 1785 | |
---|
[442] | 1786 | #if REPN_FORMAT_IN_VPS |
---|
| 1787 | UInt TComSlice::getPicWidthInLumaSamples() |
---|
| 1788 | { |
---|
| 1789 | TComSPS *sps = getSPS(); |
---|
| 1790 | TComVPS *vps = getVPS(); |
---|
| 1791 | UInt retVal, layerId = getLayerId(); |
---|
[540] | 1792 | #if O0096_REP_FORMAT_INDEX |
---|
| 1793 | if ( layerId == 0 ) |
---|
| 1794 | { |
---|
| 1795 | retVal = sps->getPicWidthInLumaSamples(); |
---|
| 1796 | } |
---|
| 1797 | else |
---|
| 1798 | { |
---|
| 1799 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getPicWidthVpsInLumaSamples(); |
---|
| 1800 | } |
---|
| 1801 | #else |
---|
[442] | 1802 | if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() ) |
---|
| 1803 | { |
---|
| 1804 | retVal = sps->getPicWidthInLumaSamples(); |
---|
| 1805 | } |
---|
| 1806 | else |
---|
| 1807 | { |
---|
| 1808 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getPicWidthVpsInLumaSamples(); |
---|
| 1809 | } |
---|
[540] | 1810 | #endif |
---|
[442] | 1811 | return retVal; |
---|
| 1812 | } |
---|
| 1813 | UInt TComSlice::getPicHeightInLumaSamples() |
---|
| 1814 | { |
---|
| 1815 | TComSPS *sps = getSPS(); |
---|
| 1816 | TComVPS *vps = getVPS(); |
---|
| 1817 | UInt retVal, layerId = getLayerId(); |
---|
[540] | 1818 | #if O0096_REP_FORMAT_INDEX |
---|
| 1819 | if( layerId == 0 ) |
---|
| 1820 | { |
---|
| 1821 | retVal = sps->getPicHeightInLumaSamples(); |
---|
| 1822 | } |
---|
| 1823 | else |
---|
| 1824 | { |
---|
| 1825 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getPicHeightVpsInLumaSamples(); |
---|
| 1826 | } |
---|
| 1827 | #else |
---|
[442] | 1828 | if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() ) |
---|
| 1829 | { |
---|
| 1830 | retVal = sps->getPicHeightInLumaSamples(); |
---|
| 1831 | } |
---|
| 1832 | else |
---|
| 1833 | { |
---|
| 1834 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getPicHeightVpsInLumaSamples(); |
---|
| 1835 | } |
---|
[540] | 1836 | #endif |
---|
[442] | 1837 | return retVal; |
---|
| 1838 | } |
---|
[494] | 1839 | #if AUXILIARY_PICTURES |
---|
| 1840 | ChromaFormat TComSlice::getChromaFormatIdc() |
---|
| 1841 | #else |
---|
[442] | 1842 | UInt TComSlice::getChromaFormatIdc() |
---|
[494] | 1843 | #endif |
---|
[442] | 1844 | { |
---|
| 1845 | TComSPS *sps = getSPS(); |
---|
| 1846 | TComVPS *vps = getVPS(); |
---|
[494] | 1847 | #if AUXILIARY_PICTURES |
---|
| 1848 | ChromaFormat retVal; |
---|
| 1849 | UInt layerId = getLayerId(); |
---|
| 1850 | #else |
---|
[442] | 1851 | UInt retVal, layerId = getLayerId(); |
---|
[494] | 1852 | #endif |
---|
[540] | 1853 | #if O0096_REP_FORMAT_INDEX |
---|
| 1854 | if( layerId == 0 ) |
---|
| 1855 | { |
---|
| 1856 | retVal = sps->getChromaFormatIdc(); |
---|
| 1857 | } |
---|
| 1858 | else |
---|
| 1859 | { |
---|
| 1860 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getChromaFormatVpsIdc(); |
---|
| 1861 | } |
---|
| 1862 | #else |
---|
[442] | 1863 | if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() ) |
---|
| 1864 | { |
---|
| 1865 | retVal = sps->getChromaFormatIdc(); |
---|
| 1866 | } |
---|
| 1867 | else |
---|
| 1868 | { |
---|
| 1869 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getChromaFormatVpsIdc(); |
---|
| 1870 | } |
---|
[540] | 1871 | #endif |
---|
[442] | 1872 | return retVal; |
---|
| 1873 | } |
---|
| 1874 | UInt TComSlice::getBitDepthY() |
---|
| 1875 | { |
---|
| 1876 | TComSPS *sps = getSPS(); |
---|
| 1877 | TComVPS *vps = getVPS(); |
---|
| 1878 | UInt retVal, layerId = getLayerId(); |
---|
[540] | 1879 | #if O0096_REP_FORMAT_INDEX |
---|
| 1880 | if( layerId == 0 ) |
---|
| 1881 | { |
---|
| 1882 | retVal = sps->getBitDepthY(); |
---|
| 1883 | } |
---|
| 1884 | else |
---|
| 1885 | { |
---|
| 1886 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getBitDepthVpsLuma(); |
---|
| 1887 | } |
---|
| 1888 | #else |
---|
[442] | 1889 | if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() ) |
---|
| 1890 | { |
---|
| 1891 | retVal = sps->getBitDepthY(); |
---|
| 1892 | } |
---|
| 1893 | else |
---|
| 1894 | { |
---|
| 1895 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsLuma(); |
---|
| 1896 | } |
---|
[540] | 1897 | #endif |
---|
[442] | 1898 | return retVal; |
---|
| 1899 | } |
---|
| 1900 | UInt TComSlice::getBitDepthC() |
---|
| 1901 | { |
---|
| 1902 | TComSPS *sps = getSPS(); |
---|
| 1903 | TComVPS *vps = getVPS(); |
---|
| 1904 | UInt retVal, layerId = getLayerId(); |
---|
[540] | 1905 | #if O0096_REP_FORMAT_INDEX |
---|
| 1906 | if( layerId == 0 ) |
---|
| 1907 | { |
---|
| 1908 | retVal = sps->getBitDepthC(); |
---|
| 1909 | } |
---|
| 1910 | else |
---|
| 1911 | { |
---|
| 1912 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getBitDepthVpsChroma(); |
---|
| 1913 | } |
---|
| 1914 | #else |
---|
[442] | 1915 | if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() ) |
---|
| 1916 | { |
---|
| 1917 | retVal = sps->getBitDepthC(); |
---|
| 1918 | } |
---|
| 1919 | else |
---|
| 1920 | { |
---|
| 1921 | retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsChroma(); |
---|
| 1922 | } |
---|
[540] | 1923 | #endif |
---|
[442] | 1924 | return retVal; |
---|
| 1925 | } |
---|
| 1926 | Int TComSlice::getQpBDOffsetY() |
---|
| 1927 | { |
---|
| 1928 | return (getBitDepthY() - 8) * 6; |
---|
| 1929 | } |
---|
| 1930 | Int TComSlice::getQpBDOffsetC() |
---|
| 1931 | { |
---|
| 1932 | return (getBitDepthC() - 8) * 6; |
---|
| 1933 | } |
---|
| 1934 | |
---|
| 1935 | RepFormat::RepFormat() |
---|
[494] | 1936 | #if AUXILIARY_PICTURES |
---|
| 1937 | : m_chromaFormatVpsIdc (CHROMA_420) |
---|
| 1938 | #else |
---|
[442] | 1939 | : m_chromaFormatVpsIdc (0) |
---|
[494] | 1940 | #endif |
---|
[442] | 1941 | , m_separateColourPlaneVpsFlag (false) |
---|
| 1942 | , m_picWidthVpsInLumaSamples (0) |
---|
| 1943 | , m_picHeightVpsInLumaSamples (0) |
---|
| 1944 | , m_bitDepthVpsLuma (0) |
---|
| 1945 | , m_bitDepthVpsChroma (0) |
---|
| 1946 | {} |
---|
[582] | 1947 | #if RESOLUTION_BASED_DPB |
---|
| 1948 | Void RepFormat::init() |
---|
| 1949 | { |
---|
| 1950 | m_chromaFormatVpsIdc = CHROMA_420; |
---|
| 1951 | m_separateColourPlaneVpsFlag = false; |
---|
| 1952 | m_picWidthVpsInLumaSamples = 0; |
---|
| 1953 | m_picHeightVpsInLumaSamples = 0; |
---|
| 1954 | m_bitDepthVpsLuma = 0; |
---|
| 1955 | m_bitDepthVpsChroma = 0; |
---|
| 1956 | } |
---|
[442] | 1957 | #endif |
---|
[582] | 1958 | #endif |
---|
[442] | 1959 | |
---|
[313] | 1960 | // ------------------------------------------------------------------------------------------------ |
---|
| 1961 | // Video parameter set (VPS) |
---|
| 1962 | // ------------------------------------------------------------------------------------------------ |
---|
[494] | 1963 | #if SVC_EXTENSION |
---|
[313] | 1964 | TComVPS::TComVPS() |
---|
| 1965 | : m_VPSId ( 0) |
---|
| 1966 | , m_uiMaxTLayers ( 1) |
---|
| 1967 | , m_uiMaxLayers ( 1) |
---|
| 1968 | , m_bTemporalIdNestingFlag (false) |
---|
| 1969 | , m_numHrdParameters ( 0) |
---|
| 1970 | #if !VPS_RENAME |
---|
| 1971 | , m_maxNuhReservedZeroLayerId ( 0) |
---|
| 1972 | #endif |
---|
| 1973 | , m_hrdParameters (NULL) |
---|
| 1974 | , m_hrdOpSetIdx (NULL) |
---|
| 1975 | , m_cprmsPresentFlag (NULL) |
---|
| 1976 | #if VPS_RENAME |
---|
| 1977 | , m_maxLayerId (0) |
---|
| 1978 | , m_numLayerSets (0) |
---|
| 1979 | #endif |
---|
| 1980 | #if VPS_EXTN_OP_LAYER_SETS |
---|
| 1981 | , m_numOutputLayerSets (0) |
---|
| 1982 | #endif |
---|
| 1983 | , m_numProfileTierLevel (0) |
---|
[576] | 1984 | #if !VPS_EXTN_UEV_CODING |
---|
[313] | 1985 | , m_moreOutputLayerSetsThanDefaultFlag (false) |
---|
[576] | 1986 | #endif |
---|
[313] | 1987 | , m_numAddOutputLayerSets (0) |
---|
[577] | 1988 | #if P0295_DEFAULT_OUT_LAYER_IDC |
---|
| 1989 | , m_defaultTargetOutputLayerIdc (0) |
---|
| 1990 | #else |
---|
[550] | 1991 | #if O0109_DEFAULT_ONE_OUT_LAYER_IDC |
---|
| 1992 | , m_defaultOneTargetOutputLayerIdc (0) |
---|
| 1993 | #else |
---|
[313] | 1994 | , m_defaultOneTargetOutputLayerFlag (false) |
---|
[550] | 1995 | #endif |
---|
[577] | 1996 | #endif |
---|
[442] | 1997 | #if VPS_VUI_BITRATE_PICRATE |
---|
| 1998 | , m_bitRatePresentVpsFlag (false) |
---|
| 1999 | , m_picRatePresentVpsFlag (false) |
---|
| 2000 | #endif |
---|
| 2001 | #if REPN_FORMAT_IN_VPS |
---|
| 2002 | , m_repFormatIdxPresentFlag (true) |
---|
| 2003 | , m_vpsNumRepFormats (1) |
---|
| 2004 | #endif |
---|
| 2005 | #if VIEW_ID_RELATED_SIGNALING |
---|
[550] | 2006 | #if O0109_VIEW_ID_LEN |
---|
| 2007 | , m_viewIdLen (0) |
---|
| 2008 | #else |
---|
[442] | 2009 | , m_viewIdLenMinus1 (0) |
---|
| 2010 | #endif |
---|
[550] | 2011 | #endif |
---|
[556] | 2012 | #if !P0307_REMOVE_VPS_VUI_OFFSET |
---|
[550] | 2013 | #if VPS_VUI_OFFSET |
---|
| 2014 | , m_vpsVuiOffset (0) |
---|
| 2015 | #endif |
---|
[556] | 2016 | #endif |
---|
| 2017 | #if P0307_VPS_NON_VUI_EXTENSION |
---|
| 2018 | , m_vpsNonVuiExtLength (0) |
---|
| 2019 | #endif |
---|
[313] | 2020 | { |
---|
| 2021 | for( Int i = 0; i < MAX_TLAYER; i++) |
---|
| 2022 | { |
---|
| 2023 | m_numReorderPics[i] = 0; |
---|
| 2024 | m_uiMaxDecPicBuffering[i] = 1; |
---|
| 2025 | m_uiMaxLatencyIncrease[i] = 0; |
---|
| 2026 | } |
---|
| 2027 | #if VPS_EXTN_MASK_AND_DIM_INFO |
---|
| 2028 | m_avcBaseLayerFlag = false; |
---|
| 2029 | m_splittingFlag = false; |
---|
| 2030 | ::memset(m_scalabilityMask, 0, sizeof(m_scalabilityMask)); |
---|
| 2031 | ::memset(m_dimensionIdLen, 0, sizeof(m_dimensionIdLen)); |
---|
| 2032 | m_nuhLayerIdPresentFlag = false; |
---|
| 2033 | ::memset(m_layerIdInNuh, 0, sizeof(m_layerIdInNuh)); |
---|
| 2034 | ::memset(m_dimensionId, 0, sizeof(m_dimensionId)); |
---|
| 2035 | |
---|
| 2036 | m_numScalabilityTypes = 0; |
---|
| 2037 | ::memset(m_layerIdInVps, 0, sizeof(m_layerIdInVps)); |
---|
| 2038 | #endif |
---|
| 2039 | #if VPS_EXTN_PROFILE_INFO |
---|
| 2040 | ::memset(m_profilePresentFlag, 0, sizeof(m_profilePresentFlag)); |
---|
[552] | 2041 | #if !P0048_REMOVE_PROFILE_REF |
---|
[313] | 2042 | ::memset(m_profileLayerSetRef, 0, sizeof(m_profileLayerSetRef)); |
---|
| 2043 | #endif |
---|
[552] | 2044 | #endif |
---|
[313] | 2045 | #if VPS_EXTN_OP_LAYER_SETS |
---|
| 2046 | ::memset(m_layerIdIncludedFlag, 0, sizeof(m_layerIdIncludedFlag)); |
---|
| 2047 | // Consider dynamic allocation for outputLayerSetIdx and outputLayerFlag |
---|
| 2048 | ::memset(m_outputLayerSetIdx, 0, sizeof(m_outputLayerSetIdx)); |
---|
| 2049 | ::memset(m_outputLayerFlag, 0, sizeof(m_outputLayerFlag)); |
---|
| 2050 | #endif |
---|
| 2051 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 2052 | ::memset(m_directDependencyFlag, 0, sizeof(m_directDependencyFlag)); |
---|
| 2053 | ::memset(m_numDirectRefLayers, 0, sizeof(m_numDirectRefLayers )); |
---|
| 2054 | ::memset(m_refLayerId, 0, sizeof(m_refLayerId )); |
---|
| 2055 | m_directDepTypeLen = 2; |
---|
| 2056 | ::memset(m_directDependencyType, 0, sizeof(m_directDependencyType)); |
---|
| 2057 | #endif |
---|
| 2058 | #if DERIVE_LAYER_ID_LIST_VARIABLES |
---|
| 2059 | ::memset(m_layerSetLayerIdList, 0, sizeof(m_layerSetLayerIdList)); |
---|
| 2060 | ::memset(m_numLayerInIdList, 0, sizeof(m_numLayerInIdList )); |
---|
| 2061 | #endif |
---|
| 2062 | ::memset(m_profileLevelTierIdx, 0, sizeof(m_profileLevelTierIdx)); |
---|
| 2063 | m_maxOneActiveRefLayerFlag = true; |
---|
[494] | 2064 | #if O0062_POC_LSB_NOT_PRESENT_FLAG |
---|
| 2065 | ::memset(m_pocLsbNotPresentFlag, 0, sizeof(m_pocLsbNotPresentFlag)); |
---|
| 2066 | #endif |
---|
[540] | 2067 | #if O0223_PICTURE_TYPES_ALIGN_FLAG |
---|
| 2068 | m_crossLayerPictureTypeAlignFlag = true; |
---|
| 2069 | #endif |
---|
[442] | 2070 | #if N0147_IRAP_ALIGN_FLAG |
---|
| 2071 | m_crossLayerIrapAlignFlag = true; |
---|
| 2072 | #endif |
---|
[345] | 2073 | #if N0120_MAX_TID_REF_PRESENT_FLAG |
---|
[442] | 2074 | m_maxTidRefPresentFlag = true; |
---|
[345] | 2075 | #endif |
---|
[313] | 2076 | for( Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++) |
---|
| 2077 | { |
---|
[494] | 2078 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
[551] | 2079 | for( Int j = 0; j < MAX_VPS_LAYER_ID_PLUS1; j++) |
---|
| 2080 | { |
---|
| 2081 | m_maxTidIlRefPicsPlus1[i][j] = m_uiMaxTLayers + 1; |
---|
| 2082 | } |
---|
[494] | 2083 | #else |
---|
[442] | 2084 | m_maxTidIlRefPicsPlus1[i] = m_uiMaxTLayers + 1; |
---|
[494] | 2085 | #endif |
---|
[313] | 2086 | } |
---|
[540] | 2087 | #if VPS_VUI_TILES_NOT_IN_USE__FLAG |
---|
[551] | 2088 | m_tilesNotInUseFlag = true; |
---|
| 2089 | ::memset(m_tilesInUseFlag, 0, sizeof(m_tilesInUseFlag)); |
---|
| 2090 | ::memset(m_loopFilterNotAcrossTilesFlag, 0, sizeof(m_loopFilterNotAcrossTilesFlag)); |
---|
[540] | 2091 | #endif |
---|
[442] | 2092 | #if TILE_BOUNDARY_ALIGNED_FLAG |
---|
[551] | 2093 | ::memset(m_tileBoundariesAlignedFlag, 0, sizeof(m_tileBoundariesAlignedFlag)); |
---|
[442] | 2094 | #endif |
---|
[540] | 2095 | #if VPS_VUI_WPP_NOT_IN_USE__FLAG |
---|
[551] | 2096 | m_wppNotInUseFlag = true; |
---|
| 2097 | ::memset(m_wppInUseFlag, 0, sizeof(m_wppInUseFlag)); |
---|
[540] | 2098 | #endif |
---|
[442] | 2099 | #if N0160_VUI_EXT_ILP_REF |
---|
[551] | 2100 | m_ilpRestrictedRefLayersFlag = false; |
---|
| 2101 | ::memset(m_minSpatialSegmentOffsetPlus1, 0, sizeof(m_minSpatialSegmentOffsetPlus1)); |
---|
| 2102 | ::memset(m_ctuBasedOffsetEnabledFlag, 0, sizeof(m_ctuBasedOffsetEnabledFlag)); |
---|
| 2103 | ::memset(m_minHorizontalCtuOffsetPlus1, 0, sizeof(m_minHorizontalCtuOffsetPlus1)); |
---|
[442] | 2104 | #endif |
---|
[540] | 2105 | #if VPS_VUI_VIDEO_SIGNAL |
---|
[551] | 2106 | m_vidSigPresentVpsFlag=true; |
---|
| 2107 | m_vpsVidSigInfo=1; |
---|
| 2108 | ::memset( m_vpsVidSigIdx, 0, sizeof(m_vpsVidSigIdx) ); |
---|
| 2109 | m_vpsVidSigIdx[0]=0; |
---|
| 2110 | for (Int i=0; i < 16; i++) |
---|
| 2111 | { |
---|
| 2112 | m_vpsVidFormat[i] = 5; |
---|
| 2113 | m_vpsFullRangeFlag[i] = false; |
---|
| 2114 | m_vpsColorPrimaries[i] = 2; |
---|
| 2115 | m_vpsTransChar[i] = 2; |
---|
| 2116 | m_vpsMatCoeff[i] = 2; |
---|
| 2117 | } |
---|
[540] | 2118 | #endif |
---|
[442] | 2119 | #if VPS_VUI_BITRATE_PICRATE |
---|
| 2120 | ::memset(m_bitRatePresentFlag, 0, sizeof(m_bitRatePresentFlag)); |
---|
| 2121 | ::memset(m_picRatePresentFlag, 0, sizeof(m_picRatePresentFlag)); |
---|
| 2122 | ::memset(m_avgBitRate , 0, sizeof(m_avgBitRate) ); |
---|
| 2123 | ::memset(m_maxBitRate , 0, sizeof(m_maxBitRate) ); |
---|
| 2124 | ::memset(m_constPicRateIdc , 0, sizeof(m_constPicRateIdc) ); |
---|
| 2125 | ::memset(m_avgPicRate , 0, sizeof(m_avgPicRate) ); |
---|
| 2126 | #endif |
---|
| 2127 | #if REPN_FORMAT_IN_VPS |
---|
| 2128 | ::memset( m_vpsRepFormatIdx, 0, sizeof(m_vpsRepFormatIdx) ); |
---|
| 2129 | #endif |
---|
| 2130 | #if VIEW_ID_RELATED_SIGNALING |
---|
| 2131 | ::memset(m_viewIdVal, 0, sizeof(m_viewIdVal)); |
---|
| 2132 | #endif |
---|
[540] | 2133 | #if O0092_0094_DEPENDENCY_CONSTRAINT |
---|
| 2134 | for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) |
---|
| 2135 | { |
---|
| 2136 | m_numberRefLayers[i] = 0; |
---|
| 2137 | for (Int j = 0; j < MAX_NUM_LAYER_IDS; j++) |
---|
| 2138 | { |
---|
| 2139 | m_recursiveRefLayerFlag[i][j] = 0; |
---|
| 2140 | } |
---|
| 2141 | } |
---|
| 2142 | #endif |
---|
| 2143 | #if VPS_DPB_SIZE_TABLE |
---|
| 2144 | ::memset( m_subLayerFlagInfoPresentFlag, 0, sizeof(m_subLayerFlagInfoPresentFlag ) ); |
---|
| 2145 | ::memset( m_subLayerDpbInfoPresentFlag, 0, sizeof(m_subLayerDpbInfoPresentFlag ) ); |
---|
| 2146 | ::memset( m_maxVpsDecPicBufferingMinus1, 0, sizeof(m_maxVpsDecPicBufferingMinus1 ) ); |
---|
[582] | 2147 | #if RESOLUTION_BASED_DPB |
---|
| 2148 | ::memset( m_maxVpsLayerDecPicBuffMinus1, 0, sizeof(m_maxVpsLayerDecPicBuffMinus1 ) ); |
---|
| 2149 | #endif |
---|
[540] | 2150 | ::memset( m_maxVpsNumReorderPics, 0, sizeof(m_maxVpsNumReorderPics ) ); |
---|
| 2151 | ::memset( m_maxVpsLatencyIncreasePlus1, 0, sizeof(m_maxVpsLatencyIncreasePlus1 ) ); |
---|
| 2152 | ::memset( m_numSubDpbs , 0, sizeof(m_numSubDpbs) ); |
---|
| 2153 | #endif |
---|
[313] | 2154 | } |
---|
[494] | 2155 | #else |
---|
| 2156 | TComVPS::TComVPS() |
---|
| 2157 | : m_VPSId ( 0) |
---|
| 2158 | , m_uiMaxTLayers ( 1) |
---|
| 2159 | , m_uiMaxLayers ( 1) |
---|
| 2160 | , m_bTemporalIdNestingFlag (false) |
---|
| 2161 | , m_numHrdParameters ( 0) |
---|
| 2162 | , m_maxNuhReservedZeroLayerId ( 0) |
---|
| 2163 | , m_hrdParameters (NULL) |
---|
| 2164 | , m_hrdOpSetIdx (NULL) |
---|
| 2165 | , m_cprmsPresentFlag (NULL) |
---|
| 2166 | { |
---|
| 2167 | for( Int i = 0; i < MAX_TLAYER; i++) |
---|
| 2168 | { |
---|
| 2169 | m_numReorderPics[i] = 0; |
---|
| 2170 | m_uiMaxDecPicBuffering[i] = 1; |
---|
| 2171 | m_uiMaxLatencyIncrease[i] = 0; |
---|
| 2172 | } |
---|
| 2173 | } |
---|
| 2174 | #endif //SVC_EXTENSION |
---|
[313] | 2175 | |
---|
| 2176 | TComVPS::~TComVPS() |
---|
| 2177 | { |
---|
| 2178 | if( m_hrdParameters != NULL ) delete[] m_hrdParameters; |
---|
| 2179 | if( m_hrdOpSetIdx != NULL ) delete[] m_hrdOpSetIdx; |
---|
| 2180 | if( m_cprmsPresentFlag != NULL ) delete[] m_cprmsPresentFlag; |
---|
| 2181 | } |
---|
| 2182 | #if DERIVE_LAYER_ID_LIST_VARIABLES |
---|
| 2183 | Void TComVPS::deriveLayerIdListVariables() |
---|
| 2184 | { |
---|
| 2185 | // For layer 0 |
---|
[593] | 2186 | m_numLayerInIdList[0] = 1; |
---|
| 2187 | m_layerSetLayerIdList[0][0] = 0; |
---|
| 2188 | |
---|
[313] | 2189 | // For other layers |
---|
| 2190 | Int i, m, n; |
---|
[596] | 2191 | for( i = 1; i < m_numLayerSets; i++ ) |
---|
[313] | 2192 | { |
---|
| 2193 | n = 0; |
---|
[593] | 2194 | for( m = 0; m <= m_maxLayerId; m++) |
---|
[313] | 2195 | { |
---|
[593] | 2196 | if( m_layerIdIncludedFlag[i][m] ) |
---|
[313] | 2197 | { |
---|
[596] | 2198 | m_layerSetLayerIdList[i][n++] = m; |
---|
[313] | 2199 | } |
---|
| 2200 | } |
---|
[593] | 2201 | m_numLayerInIdList[i] = n; |
---|
[313] | 2202 | } |
---|
| 2203 | } |
---|
| 2204 | #endif |
---|
[582] | 2205 | #if !RESOLUTION_BASED_DPB |
---|
[540] | 2206 | #if VPS_DPB_SIZE_TABLE |
---|
| 2207 | Void TComVPS::deriveNumberOfSubDpbs() |
---|
[442] | 2208 | { |
---|
[540] | 2209 | // Derive number of sub-DPBs |
---|
[579] | 2210 | #if CHANGE_NUMSUBDPB_IDX |
---|
| 2211 | // For layer set 0 |
---|
| 2212 | setNumSubDpbs(0, 1); |
---|
| 2213 | // For other layer sets |
---|
| 2214 | for( Int i = 1; i < getNumLayerSets(); i++) |
---|
| 2215 | { |
---|
| 2216 | setNumSubDpbs( i, getNumLayersInIdList( i ) ); |
---|
| 2217 | } |
---|
| 2218 | #else |
---|
[540] | 2219 | // For output layer set 0 |
---|
| 2220 | setNumSubDpbs(0, 1); |
---|
| 2221 | // For other output layer sets |
---|
| 2222 | for( Int i = 1; i < getNumOutputLayerSets(); i++) |
---|
| 2223 | { |
---|
| 2224 | setNumSubDpbs( i, getNumLayersInIdList( getOutputLayerSetIdx(i)) ); |
---|
| 2225 | } |
---|
[579] | 2226 | #endif |
---|
[540] | 2227 | } |
---|
| 2228 | #endif |
---|
[582] | 2229 | #endif |
---|
[540] | 2230 | #if VPS_VUI_TILES_NOT_IN_USE__FLAG |
---|
| 2231 | Void TComVPS::setTilesNotInUseFlag(Bool x) |
---|
| 2232 | { |
---|
| 2233 | m_tilesNotInUseFlag = x; |
---|
| 2234 | if (m_tilesNotInUseFlag) |
---|
| 2235 | { |
---|
| 2236 | for (int i = 0; i < getMaxLayers(); i++) |
---|
| 2237 | { |
---|
| 2238 | m_tilesInUseFlag[i] = m_loopFilterNotAcrossTilesFlag[i] = m_tilesNotInUseFlag; |
---|
| 2239 | } |
---|
| 2240 | } |
---|
| 2241 | #if TILE_BOUNDARY_ALIGNED_FLAG |
---|
| 2242 | if (m_tilesNotInUseFlag) |
---|
| 2243 | { |
---|
| 2244 | for (int i = 1; i < getMaxLayers(); i++) |
---|
| 2245 | { |
---|
| 2246 | for(int j = 0; j < getNumDirectRefLayers(getLayerIdInNuh(i)); j++) |
---|
| 2247 | { |
---|
| 2248 | setTileBoundariesAlignedFlag(i, j, m_tilesNotInUseFlag); |
---|
[442] | 2249 | } |
---|
| 2250 | } |
---|
| 2251 | } |
---|
[540] | 2252 | #endif |
---|
[442] | 2253 | } |
---|
| 2254 | #endif |
---|
[540] | 2255 | #if VPS_VUI_WPP_NOT_IN_USE__FLAG |
---|
| 2256 | Void TComVPS::setWppNotInUseFlag(Bool x) |
---|
| 2257 | { |
---|
| 2258 | m_wppNotInUseFlag = x; |
---|
| 2259 | if (m_wppNotInUseFlag) |
---|
| 2260 | { |
---|
| 2261 | for (int i = 0; i < getMaxLayers(); i++) |
---|
| 2262 | { |
---|
| 2263 | m_wppInUseFlag[i] = m_wppNotInUseFlag; |
---|
| 2264 | } |
---|
| 2265 | } |
---|
| 2266 | } |
---|
| 2267 | #endif |
---|
| 2268 | #if O0092_0094_DEPENDENCY_CONSTRAINT |
---|
| 2269 | Void TComVPS::setRefLayersFlags(Int currLayerId) |
---|
| 2270 | { |
---|
| 2271 | for (Int i = 0; i < getNumDirectRefLayers(currLayerId); i++) |
---|
| 2272 | { |
---|
| 2273 | UInt refLayerId = getRefLayerId(currLayerId, i); |
---|
| 2274 | setRecursiveRefLayerFlag(currLayerId, refLayerId, true); |
---|
| 2275 | for (Int k = 0; k < MAX_NUM_LAYER_IDS; k++) |
---|
| 2276 | { |
---|
| 2277 | setRecursiveRefLayerFlag(currLayerId, k, (getRecursiveRefLayerFlag(currLayerId, k) | getRecursiveRefLayerFlag(refLayerId, k))); |
---|
| 2278 | } |
---|
| 2279 | } |
---|
| 2280 | } |
---|
[442] | 2281 | |
---|
[540] | 2282 | Void TComVPS::setNumRefLayers(Int currLayerId) |
---|
| 2283 | { |
---|
| 2284 | for (Int i = 0; i <= getMaxLayers(); i++) |
---|
| 2285 | { |
---|
| 2286 | UInt iNuhLId = getLayerIdInNuh(i); |
---|
| 2287 | setRefLayersFlags(iNuhLId); |
---|
| 2288 | for (UInt j = 0; j < MAX_NUM_LAYER_IDS; j++) |
---|
| 2289 | { |
---|
| 2290 | m_numberRefLayers[iNuhLId] += (getRecursiveRefLayerFlag(iNuhLId, j) == true ? 1 : 0); |
---|
| 2291 | } |
---|
| 2292 | } |
---|
| 2293 | } |
---|
| 2294 | #endif |
---|
| 2295 | |
---|
[442] | 2296 | #if VIEW_ID_RELATED_SIGNALING |
---|
| 2297 | Int TComVPS::getNumViews() |
---|
| 2298 | { |
---|
| 2299 | Int numViews = 1; |
---|
| 2300 | for( Int i = 0; i <= getMaxLayers() - 1; i++ ) |
---|
| 2301 | { |
---|
| 2302 | Int lId = getLayerIdInNuh( i ); |
---|
| 2303 | if ( i > 0 && ( getViewIndex( lId ) != getScalabilityId( i - 1, VIEW_ORDER_INDEX ) ) ) |
---|
| 2304 | { |
---|
| 2305 | numViews++; |
---|
| 2306 | } |
---|
| 2307 | } |
---|
| 2308 | |
---|
| 2309 | return numViews; |
---|
| 2310 | } |
---|
| 2311 | Int TComVPS::getScalabilityId( Int layerIdInVps, ScalabilityType scalType ) |
---|
| 2312 | { |
---|
| 2313 | return getScalabilityMask( scalType ) ? getDimensionId( layerIdInVps, scalTypeToScalIdx( scalType ) ) : 0; |
---|
| 2314 | } |
---|
| 2315 | Int TComVPS::scalTypeToScalIdx( ScalabilityType scalType ) |
---|
| 2316 | { |
---|
| 2317 | assert( scalType >= 0 && scalType <= MAX_VPS_NUM_SCALABILITY_TYPES ); |
---|
| 2318 | assert( scalType == MAX_VPS_NUM_SCALABILITY_TYPES || getScalabilityMask( scalType ) ); |
---|
| 2319 | Int scalIdx = 0; |
---|
| 2320 | for( Int curScalType = 0; curScalType < scalType; curScalType++ ) |
---|
| 2321 | { |
---|
| 2322 | scalIdx += ( getScalabilityMask( curScalType ) ? 1 : 0 ); |
---|
| 2323 | |
---|
| 2324 | } |
---|
| 2325 | |
---|
| 2326 | return scalIdx; |
---|
| 2327 | } |
---|
| 2328 | #endif |
---|
[580] | 2329 | #if VPS_DPB_SIZE_TABLE |
---|
| 2330 | Void TComVPS::determineSubDpbInfoFlags() |
---|
| 2331 | { |
---|
| 2332 | for(Int i = 1; i < getNumOutputLayerSets(); i++) |
---|
| 2333 | { |
---|
| 2334 | Int layerSetIdxForOutputLayerSet = getOutputLayerSetIdx( i ); |
---|
| 2335 | // For each output layer set, set the DPB size for each layer and the reorder/latency value the maximum for all layers |
---|
| 2336 | Bool checkFlagOuter = false; // Used to calculate sub_layer_flag_info_present_flag |
---|
| 2337 | Bool checkFlagInner[MAX_TLAYER]; // Used to calculate sub_layer_dpb_info_present_flag |
---|
| 2338 | |
---|
| 2339 | for(Int j = 0; j < getMaxTLayers(); j++) |
---|
| 2340 | { |
---|
| 2341 | // -------------------------------------------------------- |
---|
| 2342 | // To determine value of m_subLayerDpbInfoPresentFlag |
---|
| 2343 | // -------------------------------------------------------- |
---|
| 2344 | if( j == 0 ) // checkFlagInner[0] is always 1 |
---|
| 2345 | { |
---|
| 2346 | checkFlagInner[j] = true; // Always signal sub-layer DPB information for the first sub-layer |
---|
| 2347 | } |
---|
| 2348 | else |
---|
| 2349 | { |
---|
| 2350 | checkFlagInner[j] = false; // Initialize to be false. If the values of the current sub-layers matches with the earlier sub-layer, |
---|
| 2351 | // then will be continue to be false - i.e. the j-th sub-layer DPB info is not signaled |
---|
| 2352 | checkFlagInner[j] |= ( getMaxVpsNumReorderPics(i, j) != getMaxVpsNumReorderPics(i, j - 1) ); |
---|
| 2353 | #if CHANGE_NUMSUBDPB_IDX |
---|
[582] | 2354 | for(Int subDpbIdx = 0; subDpbIdx < getNumSubDpbs(layerSetIdxForOutputLayerSet) && !checkFlagInner[j]; subDpbIdx++) // If checkFlagInner[j] is true, break and signal the values |
---|
[580] | 2355 | #else |
---|
| 2356 | for(Int k = 0; k < getNumSubDpbs(i) && !checkFlagInner[j]; k++) // If checkFlagInner[j] is true, break and signal the values |
---|
| 2357 | #endif |
---|
| 2358 | { |
---|
[582] | 2359 | checkFlagInner[j] |= ( getMaxVpsDecPicBufferingMinus1(i, subDpbIdx, j - 1) != getMaxVpsDecPicBufferingMinus1(i, subDpbIdx, j) ); |
---|
[580] | 2360 | } |
---|
[582] | 2361 | #if RESOLUTION_BASED_DPB |
---|
| 2362 | for(Int layerIdx = 0; layerIdx < this->getNumLayersInIdList(layerSetIdxForOutputLayerSet) && !checkFlagInner[j]; layerIdx++) // If checkFlagInner[j] is true, break and signal the values |
---|
| 2363 | { |
---|
| 2364 | checkFlagInner[j] |= ( getMaxVpsLayerDecPicBuffMinus1(i, layerIdx, j - 1) != getMaxVpsLayerDecPicBuffMinus1(i, layerIdx, j) ); |
---|
| 2365 | } |
---|
| 2366 | #endif |
---|
[580] | 2367 | } |
---|
| 2368 | // If checkFlagInner[j] = true, then some value needs to be signalled for the j-th sub-layer |
---|
| 2369 | setSubLayerDpbInfoPresentFlag( i, j, checkFlagInner[j] ); |
---|
| 2370 | } |
---|
| 2371 | |
---|
| 2372 | // -------------------------------------------------------- |
---|
| 2373 | // To determine value of m_subLayerFlagInfoPresentFlag |
---|
| 2374 | // -------------------------------------------------------- |
---|
| 2375 | |
---|
| 2376 | for(Int j = 1; j < getMaxTLayers(); j++) // Check if DPB info of any of non-zero sub-layers is signaled. If so set flag to one |
---|
| 2377 | { |
---|
| 2378 | if( getSubLayerDpbInfoPresentFlag(i, j) ) |
---|
| 2379 | { |
---|
| 2380 | checkFlagOuter = true; |
---|
| 2381 | break; |
---|
| 2382 | } |
---|
| 2383 | } |
---|
| 2384 | setSubLayerFlagInfoPresentFlag( i, checkFlagOuter ); |
---|
| 2385 | } |
---|
| 2386 | } |
---|
| 2387 | #endif |
---|
[582] | 2388 | #if RESOLUTION_BASED_DPB |
---|
| 2389 | Void TComVPS::assignSubDpbIndices() |
---|
| 2390 | { |
---|
| 2391 | RepFormat layerRepFormat [MAX_LAYERS]; |
---|
| 2392 | RepFormat subDpbRepFormat [MAX_LAYERS]; |
---|
| 2393 | |
---|
| 2394 | for(Int lsIdx = 0; lsIdx < this->getNumLayerSets(); lsIdx++) |
---|
| 2395 | { |
---|
| 2396 | for(Int j = 0; j < MAX_LAYERS; j++) |
---|
| 2397 | { |
---|
| 2398 | layerRepFormat [j].init(); |
---|
| 2399 | subDpbRepFormat[j].init(); |
---|
| 2400 | } |
---|
| 2401 | |
---|
| 2402 | // Assign resolution, bit-depth, colour format for each layer in the layer set |
---|
| 2403 | for(Int i = 0; i < this->getNumLayersInIdList( lsIdx ); i++) |
---|
| 2404 | { |
---|
| 2405 | Int layerIdxInVps = this->getLayerIdInVps( this->getLayerSetLayerIdList(lsIdx, i) ); |
---|
| 2406 | Int repFormatIdx = this->getVpsRepFormatIdx( layerIdxInVps ); |
---|
| 2407 | RepFormat* repFormat = this->getVpsRepFormat( repFormatIdx ); |
---|
| 2408 | |
---|
| 2409 | // Assign the rep_format() to the layer |
---|
| 2410 | layerRepFormat[i] = *repFormat; |
---|
| 2411 | } |
---|
| 2412 | |
---|
| 2413 | // ---------------------------------------- |
---|
| 2414 | // Sub-DPB assignment |
---|
| 2415 | // ---------------------------------------- |
---|
| 2416 | // For the base layer |
---|
| 2417 | m_subDpbAssigned[lsIdx][0] = 0; |
---|
| 2418 | subDpbRepFormat[0] = layerRepFormat[0]; |
---|
| 2419 | |
---|
| 2420 | // Sub-DPB counter |
---|
| 2421 | Int subDpbCtr = 1; |
---|
| 2422 | |
---|
| 2423 | for(Int i = 1; i < this->getNumLayersInIdList( lsIdx ); i++) |
---|
| 2424 | { |
---|
| 2425 | Bool newSubDpbFlag = true; |
---|
| 2426 | for(Int j = 0; (j < subDpbCtr) && (newSubDpbFlag); j++) |
---|
| 2427 | { |
---|
| 2428 | if( RepFormat::checkSameSubDpb( layerRepFormat[i], subDpbRepFormat[j] ) ) |
---|
| 2429 | { |
---|
| 2430 | // Belong to i-th sub-DPB |
---|
| 2431 | m_subDpbAssigned[lsIdx][i] = j; |
---|
| 2432 | newSubDpbFlag = false; |
---|
| 2433 | } |
---|
| 2434 | } |
---|
| 2435 | if( newSubDpbFlag ) |
---|
| 2436 | { |
---|
| 2437 | // New sub-DPB |
---|
| 2438 | subDpbRepFormat[subDpbCtr] = layerRepFormat[i]; |
---|
| 2439 | m_subDpbAssigned[lsIdx][i] = subDpbCtr; |
---|
| 2440 | subDpbCtr++; // Increment # subDpbs |
---|
| 2441 | } |
---|
| 2442 | } |
---|
| 2443 | m_numSubDpbs[lsIdx] = subDpbCtr; |
---|
| 2444 | } |
---|
| 2445 | } |
---|
| 2446 | Int TComVPS::findLayerIdxInLayerSet ( Int lsIdx, Int nuhLayerId ) |
---|
| 2447 | { |
---|
| 2448 | for(Int i = 0; i < this->getNumLayersInIdList(lsIdx); i++) |
---|
| 2449 | { |
---|
| 2450 | if( this->getLayerSetLayerIdList( lsIdx, i) == nuhLayerId ) |
---|
| 2451 | { |
---|
| 2452 | return i; |
---|
| 2453 | } |
---|
| 2454 | } |
---|
| 2455 | return -1; // Layer not found |
---|
| 2456 | } |
---|
| 2457 | // RepFormat Assignment operator |
---|
| 2458 | RepFormat& RepFormat::operator= (const RepFormat &other) |
---|
| 2459 | { |
---|
| 2460 | if( this != &other) |
---|
| 2461 | { |
---|
| 2462 | m_chromaAndBitDepthVpsPresentFlag = other.m_chromaAndBitDepthVpsPresentFlag; |
---|
| 2463 | m_chromaFormatVpsIdc = other.m_chromaFormatVpsIdc; |
---|
| 2464 | m_separateColourPlaneVpsFlag = other.m_separateColourPlaneVpsFlag; |
---|
| 2465 | m_picWidthVpsInLumaSamples = other.m_picWidthVpsInLumaSamples; |
---|
| 2466 | m_picHeightVpsInLumaSamples = other.m_picHeightVpsInLumaSamples; |
---|
| 2467 | m_bitDepthVpsLuma = other.m_bitDepthVpsLuma; |
---|
| 2468 | m_bitDepthVpsChroma = other.m_bitDepthVpsChroma; |
---|
| 2469 | } |
---|
| 2470 | return *this; |
---|
| 2471 | } |
---|
| 2472 | |
---|
| 2473 | // Check whether x and y share the same resolution, chroma format and bit-depth. |
---|
| 2474 | Bool RepFormat::checkSameSubDpb(const RepFormat &x, const RepFormat &y) |
---|
| 2475 | { |
---|
| 2476 | return ( (x.m_chromaFormatVpsIdc == y.m_chromaFormatVpsIdc) |
---|
| 2477 | && (x.m_picWidthVpsInLumaSamples == y.m_picWidthVpsInLumaSamples) |
---|
| 2478 | && (x.m_picHeightVpsInLumaSamples == y.m_picHeightVpsInLumaSamples) |
---|
| 2479 | && (x.m_bitDepthVpsLuma == y.m_bitDepthVpsLuma) |
---|
| 2480 | && (x.m_bitDepthVpsChroma == y.m_bitDepthVpsChroma) |
---|
| 2481 | ); |
---|
| 2482 | } |
---|
| 2483 | #endif |
---|
[313] | 2484 | // ------------------------------------------------------------------------------------------------ |
---|
| 2485 | // Sequence parameter set (SPS) |
---|
| 2486 | // ------------------------------------------------------------------------------------------------ |
---|
| 2487 | |
---|
| 2488 | TComSPS::TComSPS() |
---|
| 2489 | : m_SPSId ( 0) |
---|
| 2490 | , m_VPSId ( 0) |
---|
| 2491 | , m_chromaFormatIdc (CHROMA_420) |
---|
| 2492 | , m_uiMaxTLayers ( 1) |
---|
| 2493 | // Structure |
---|
| 2494 | , m_picWidthInLumaSamples (352) |
---|
| 2495 | , m_picHeightInLumaSamples (288) |
---|
| 2496 | , m_log2MinCodingBlockSize ( 0) |
---|
| 2497 | , m_log2DiffMaxMinCodingBlockSize (0) |
---|
| 2498 | , m_uiMaxCUWidth ( 32) |
---|
| 2499 | , m_uiMaxCUHeight ( 32) |
---|
| 2500 | , m_uiMaxCUDepth ( 3) |
---|
| 2501 | , m_bLongTermRefsPresent (false) |
---|
| 2502 | , m_uiQuadtreeTULog2MaxSize ( 0) |
---|
| 2503 | , m_uiQuadtreeTULog2MinSize ( 0) |
---|
| 2504 | , m_uiQuadtreeTUMaxDepthInter ( 0) |
---|
| 2505 | , m_uiQuadtreeTUMaxDepthIntra ( 0) |
---|
| 2506 | // Tool list |
---|
| 2507 | , m_usePCM (false) |
---|
| 2508 | , m_pcmLog2MaxSize ( 5) |
---|
| 2509 | , m_uiPCMLog2MinSize ( 7) |
---|
| 2510 | , m_bitDepthY ( 8) |
---|
| 2511 | , m_bitDepthC ( 8) |
---|
| 2512 | , m_qpBDOffsetY ( 0) |
---|
| 2513 | , m_qpBDOffsetC ( 0) |
---|
| 2514 | , m_uiPCMBitDepthLuma ( 8) |
---|
| 2515 | , m_uiPCMBitDepthChroma ( 8) |
---|
| 2516 | , m_bPCMFilterDisableFlag (false) |
---|
| 2517 | , m_uiBitsForPOC ( 8) |
---|
| 2518 | , m_numLongTermRefPicSPS ( 0) |
---|
| 2519 | , m_uiMaxTrSize ( 32) |
---|
| 2520 | , m_bUseSAO (false) |
---|
| 2521 | , m_bTemporalIdNestingFlag (false) |
---|
| 2522 | , m_scalingListEnabledFlag (false) |
---|
| 2523 | , m_useStrongIntraSmoothing (false) |
---|
| 2524 | , m_vuiParametersPresentFlag (false) |
---|
| 2525 | , m_vuiParameters () |
---|
[494] | 2526 | #if SVC_EXTENSION |
---|
| 2527 | , m_layerId ( 0 ) |
---|
| 2528 | , m_numScaledRefLayerOffsets ( 0 ) |
---|
[442] | 2529 | #if REPN_FORMAT_IN_VPS |
---|
| 2530 | , m_updateRepFormatFlag (false) |
---|
[540] | 2531 | #if O0096_REP_FORMAT_INDEX |
---|
| 2532 | , m_updateRepFormatIndex (0) |
---|
[442] | 2533 | #endif |
---|
[540] | 2534 | #endif |
---|
| 2535 | #if SCALINGLIST_INFERRING |
---|
| 2536 | , m_inferScalingListFlag ( false ) |
---|
| 2537 | , m_scalingListRefLayerId ( 0 ) |
---|
| 2538 | #endif |
---|
[494] | 2539 | #endif //SVC_EXTENSION |
---|
[313] | 2540 | { |
---|
| 2541 | for ( Int i = 0; i < MAX_TLAYER; i++ ) |
---|
| 2542 | { |
---|
| 2543 | m_uiMaxLatencyIncrease[i] = 0; |
---|
| 2544 | m_uiMaxDecPicBuffering[i] = 1; |
---|
| 2545 | m_numReorderPics[i] = 0; |
---|
| 2546 | } |
---|
| 2547 | m_scalingList = new TComScalingList; |
---|
| 2548 | ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps)); |
---|
| 2549 | ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag)); |
---|
| 2550 | } |
---|
| 2551 | |
---|
| 2552 | TComSPS::~TComSPS() |
---|
| 2553 | { |
---|
[540] | 2554 | #if SCALINGLIST_INFERRING |
---|
| 2555 | if( !m_inferScalingListFlag ) |
---|
| 2556 | #endif |
---|
[313] | 2557 | delete m_scalingList; |
---|
| 2558 | m_RPSList.destroy(); |
---|
| 2559 | } |
---|
| 2560 | |
---|
| 2561 | Void TComSPS::createRPSList( Int numRPS ) |
---|
| 2562 | { |
---|
| 2563 | m_RPSList.destroy(); |
---|
| 2564 | m_RPSList.create(numRPS); |
---|
| 2565 | } |
---|
| 2566 | |
---|
| 2567 | Void TComSPS::setHrdParameters( UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess ) |
---|
| 2568 | { |
---|
| 2569 | if( !getVuiParametersPresentFlag() ) |
---|
| 2570 | { |
---|
| 2571 | return; |
---|
| 2572 | } |
---|
| 2573 | |
---|
| 2574 | TComVUI *vui = getVuiParameters(); |
---|
| 2575 | TComHRD *hrd = vui->getHrdParameters(); |
---|
| 2576 | |
---|
| 2577 | TimingInfo *timingInfo = vui->getTimingInfo(); |
---|
[442] | 2578 | #if TIMING_INFO_NONZERO_LAYERID_SPS |
---|
| 2579 | if( getLayerId() > 0 ) |
---|
[313] | 2580 | { |
---|
[442] | 2581 | timingInfo->setTimingInfoPresentFlag( false ); |
---|
[313] | 2582 | } |
---|
[442] | 2583 | else |
---|
| 2584 | { |
---|
| 2585 | #endif |
---|
| 2586 | timingInfo->setTimingInfoPresentFlag( true ); |
---|
| 2587 | switch( frameRate ) |
---|
| 2588 | { |
---|
| 2589 | case 24: |
---|
| 2590 | timingInfo->setNumUnitsInTick( 1125000 ); timingInfo->setTimeScale ( 27000000 ); |
---|
| 2591 | break; |
---|
| 2592 | case 25: |
---|
| 2593 | timingInfo->setNumUnitsInTick( 1080000 ); timingInfo->setTimeScale ( 27000000 ); |
---|
| 2594 | break; |
---|
| 2595 | case 30: |
---|
| 2596 | timingInfo->setNumUnitsInTick( 900900 ); timingInfo->setTimeScale ( 27000000 ); |
---|
| 2597 | break; |
---|
| 2598 | case 50: |
---|
| 2599 | timingInfo->setNumUnitsInTick( 540000 ); timingInfo->setTimeScale ( 27000000 ); |
---|
| 2600 | break; |
---|
| 2601 | case 60: |
---|
| 2602 | timingInfo->setNumUnitsInTick( 450450 ); timingInfo->setTimeScale ( 27000000 ); |
---|
| 2603 | break; |
---|
| 2604 | default: |
---|
| 2605 | timingInfo->setNumUnitsInTick( 1001 ); timingInfo->setTimeScale ( 60000 ); |
---|
| 2606 | break; |
---|
| 2607 | } |
---|
[313] | 2608 | |
---|
[442] | 2609 | Bool rateCnt = ( bitRate > 0 ); |
---|
| 2610 | hrd->setNalHrdParametersPresentFlag( rateCnt ); |
---|
| 2611 | hrd->setVclHrdParametersPresentFlag( rateCnt ); |
---|
[313] | 2612 | |
---|
[442] | 2613 | hrd->setSubPicCpbParamsPresentFlag( ( numDU > 1 ) ); |
---|
[313] | 2614 | |
---|
[442] | 2615 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
| 2616 | { |
---|
| 2617 | hrd->setTickDivisorMinus2( 100 - 2 ); // |
---|
| 2618 | hrd->setDuCpbRemovalDelayLengthMinus1( 7 ); // 8-bit precision ( plus 1 for last DU in AU ) |
---|
| 2619 | hrd->setSubPicCpbParamsInPicTimingSEIFlag( true ); |
---|
| 2620 | hrd->setDpbOutputDelayDuLengthMinus1( 5 + 7 ); // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay |
---|
| 2621 | } |
---|
| 2622 | else |
---|
| 2623 | { |
---|
| 2624 | hrd->setSubPicCpbParamsInPicTimingSEIFlag( false ); |
---|
| 2625 | } |
---|
[313] | 2626 | |
---|
[442] | 2627 | hrd->setBitRateScale( 4 ); // in units of 2~( 6 + 4 ) = 1,024 bps |
---|
| 2628 | hrd->setCpbSizeScale( 6 ); // in units of 2~( 4 + 4 ) = 1,024 bit |
---|
| 2629 | hrd->setDuCpbSizeScale( 6 ); // in units of 2~( 4 + 4 ) = 1,024 bit |
---|
[313] | 2630 | |
---|
[442] | 2631 | hrd->setInitialCpbRemovalDelayLengthMinus1(15); // assuming 0.5 sec, log2( 90,000 * 0.5 ) = 16-bit |
---|
| 2632 | if( randomAccess ) |
---|
| 2633 | { |
---|
| 2634 | hrd->setCpbRemovalDelayLengthMinus1(5); // 32 = 2^5 (plus 1) |
---|
| 2635 | hrd->setDpbOutputDelayLengthMinus1 (5); // 32 + 3 = 2^6 |
---|
| 2636 | } |
---|
| 2637 | else |
---|
| 2638 | { |
---|
| 2639 | hrd->setCpbRemovalDelayLengthMinus1(9); // max. 2^10 |
---|
| 2640 | hrd->setDpbOutputDelayLengthMinus1 (9); // max. 2^10 |
---|
| 2641 | } |
---|
[313] | 2642 | |
---|
| 2643 | /* |
---|
[442] | 2644 | Note: only the case of "vps_max_temporal_layers_minus1 = 0" is supported. |
---|
[313] | 2645 | */ |
---|
[442] | 2646 | Int i, j; |
---|
| 2647 | UInt birateValue, cpbSizeValue; |
---|
| 2648 | UInt ducpbSizeValue; |
---|
| 2649 | UInt duBitRateValue = 0; |
---|
[313] | 2650 | |
---|
[442] | 2651 | for( i = 0; i < MAX_TLAYER; i ++ ) |
---|
[313] | 2652 | { |
---|
[442] | 2653 | hrd->setFixedPicRateFlag( i, 1 ); |
---|
| 2654 | hrd->setPicDurationInTcMinus1( i, 0 ); |
---|
| 2655 | hrd->setLowDelayHrdFlag( i, 0 ); |
---|
| 2656 | hrd->setCpbCntMinus1( i, 0 ); |
---|
[313] | 2657 | |
---|
[442] | 2658 | birateValue = bitRate; |
---|
| 2659 | cpbSizeValue = bitRate; // 1 second |
---|
| 2660 | ducpbSizeValue = bitRate/numDU; |
---|
| 2661 | duBitRateValue = bitRate; |
---|
| 2662 | for( j = 0; j < ( hrd->getCpbCntMinus1( i ) + 1 ); j ++ ) |
---|
| 2663 | { |
---|
| 2664 | hrd->setBitRateValueMinus1( i, j, 0, ( birateValue - 1 ) ); |
---|
| 2665 | hrd->setCpbSizeValueMinus1( i, j, 0, ( cpbSizeValue - 1 ) ); |
---|
| 2666 | hrd->setDuCpbSizeValueMinus1( i, j, 0, ( ducpbSizeValue - 1 ) ); |
---|
| 2667 | hrd->setCbrFlag( i, j, 0, ( j == 0 ) ); |
---|
| 2668 | |
---|
| 2669 | hrd->setBitRateValueMinus1( i, j, 1, ( birateValue - 1) ); |
---|
| 2670 | hrd->setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) ); |
---|
| 2671 | hrd->setDuCpbSizeValueMinus1( i, j, 1, ( ducpbSizeValue - 1 ) ); |
---|
| 2672 | hrd->setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) ); |
---|
| 2673 | hrd->setCbrFlag( i, j, 1, ( j == 0 ) ); |
---|
| 2674 | } |
---|
[313] | 2675 | } |
---|
[442] | 2676 | #if TIMING_INFO_NONZERO_LAYERID_SPS |
---|
[313] | 2677 | } |
---|
[442] | 2678 | #endif |
---|
[313] | 2679 | } |
---|
| 2680 | const Int TComSPS::m_winUnitX[]={1,2,2,1}; |
---|
| 2681 | const Int TComSPS::m_winUnitY[]={1,2,1,1}; |
---|
| 2682 | |
---|
[540] | 2683 | #if O0098_SCALED_REF_LAYER_ID |
---|
| 2684 | Window& TComSPS::getScaledRefLayerWindowForLayer(Int layerId) |
---|
| 2685 | { |
---|
| 2686 | static Window win; |
---|
| 2687 | |
---|
| 2688 | for (Int i = 0; i < m_numScaledRefLayerOffsets; i++) |
---|
| 2689 | { |
---|
| 2690 | if (layerId == m_scaledRefLayerId[i]) |
---|
| 2691 | { |
---|
| 2692 | return m_scaledRefLayerWindow[i]; |
---|
| 2693 | } |
---|
| 2694 | } |
---|
| 2695 | |
---|
| 2696 | win.resetWindow(); // scaled reference layer offsets are inferred to be zero when not present |
---|
| 2697 | return win; |
---|
| 2698 | } |
---|
| 2699 | #endif |
---|
| 2700 | |
---|
[313] | 2701 | TComPPS::TComPPS() |
---|
| 2702 | : m_PPSId (0) |
---|
| 2703 | , m_SPSId (0) |
---|
| 2704 | , m_picInitQPMinus26 (0) |
---|
| 2705 | , m_useDQP (false) |
---|
| 2706 | , m_bConstrainedIntraPred (false) |
---|
| 2707 | , m_bSliceChromaQpFlag (false) |
---|
| 2708 | , m_pcSPS (NULL) |
---|
| 2709 | , m_uiMaxCuDQPDepth (0) |
---|
| 2710 | , m_uiMinCuDQPSize (0) |
---|
| 2711 | , m_chromaCbQpOffset (0) |
---|
| 2712 | , m_chromaCrQpOffset (0) |
---|
| 2713 | , m_numRefIdxL0DefaultActive (1) |
---|
| 2714 | , m_numRefIdxL1DefaultActive (1) |
---|
| 2715 | , m_TransquantBypassEnableFlag (false) |
---|
| 2716 | , m_useTransformSkip (false) |
---|
| 2717 | , m_dependentSliceSegmentsEnabledFlag (false) |
---|
| 2718 | , m_tilesEnabledFlag (false) |
---|
| 2719 | , m_entropyCodingSyncEnabledFlag (false) |
---|
| 2720 | , m_loopFilterAcrossTilesEnabledFlag (true) |
---|
| 2721 | , m_uniformSpacingFlag (0) |
---|
| 2722 | , m_iNumColumnsMinus1 (0) |
---|
| 2723 | , m_puiColumnWidth (NULL) |
---|
| 2724 | , m_iNumRowsMinus1 (0) |
---|
| 2725 | , m_puiRowHeight (NULL) |
---|
| 2726 | , m_iNumSubstreams (1) |
---|
| 2727 | , m_signHideFlag(0) |
---|
| 2728 | , m_cabacInitPresentFlag (false) |
---|
| 2729 | , m_encCABACTableIdx (I_SLICE) |
---|
| 2730 | , m_sliceHeaderExtensionPresentFlag (false) |
---|
| 2731 | , m_loopFilterAcrossSlicesEnabledFlag (false) |
---|
| 2732 | , m_listsModificationPresentFlag( 0) |
---|
| 2733 | , m_numExtraSliceHeaderBits(0) |
---|
[540] | 2734 | #if SCALINGLIST_INFERRING |
---|
| 2735 | , m_inferScalingListFlag ( false ) |
---|
| 2736 | , m_scalingListRefLayerId ( 0 ) |
---|
| 2737 | #endif |
---|
[313] | 2738 | { |
---|
| 2739 | m_scalingList = new TComScalingList; |
---|
| 2740 | } |
---|
| 2741 | |
---|
| 2742 | TComPPS::~TComPPS() |
---|
| 2743 | { |
---|
| 2744 | if( m_iNumColumnsMinus1 > 0 && m_uniformSpacingFlag == 0 ) |
---|
| 2745 | { |
---|
| 2746 | if (m_puiColumnWidth) delete [] m_puiColumnWidth; |
---|
| 2747 | m_puiColumnWidth = NULL; |
---|
| 2748 | } |
---|
| 2749 | if( m_iNumRowsMinus1 > 0 && m_uniformSpacingFlag == 0 ) |
---|
| 2750 | { |
---|
| 2751 | if (m_puiRowHeight) delete [] m_puiRowHeight; |
---|
| 2752 | m_puiRowHeight = NULL; |
---|
| 2753 | } |
---|
[540] | 2754 | |
---|
| 2755 | #if SCALINGLIST_INFERRING |
---|
| 2756 | if( !m_inferScalingListFlag ) |
---|
| 2757 | #endif |
---|
[313] | 2758 | delete m_scalingList; |
---|
| 2759 | } |
---|
| 2760 | |
---|
| 2761 | TComReferencePictureSet::TComReferencePictureSet() |
---|
| 2762 | : m_numberOfPictures (0) |
---|
| 2763 | , m_numberOfNegativePictures (0) |
---|
| 2764 | , m_numberOfPositivePictures (0) |
---|
| 2765 | , m_numberOfLongtermPictures (0) |
---|
| 2766 | , m_interRPSPrediction (0) |
---|
| 2767 | , m_deltaRIdxMinus1 (0) |
---|
| 2768 | , m_deltaRPS (0) |
---|
| 2769 | , m_numRefIdc (0) |
---|
| 2770 | { |
---|
| 2771 | ::memset( m_deltaPOC, 0, sizeof(m_deltaPOC) ); |
---|
| 2772 | ::memset( m_POC, 0, sizeof(m_POC) ); |
---|
| 2773 | ::memset( m_used, 0, sizeof(m_used) ); |
---|
| 2774 | ::memset( m_refIdc, 0, sizeof(m_refIdc) ); |
---|
| 2775 | } |
---|
| 2776 | |
---|
| 2777 | TComReferencePictureSet::~TComReferencePictureSet() |
---|
| 2778 | { |
---|
| 2779 | } |
---|
| 2780 | |
---|
| 2781 | Void TComReferencePictureSet::setUsed(Int bufferNum, Bool used) |
---|
| 2782 | { |
---|
| 2783 | m_used[bufferNum] = used; |
---|
| 2784 | } |
---|
| 2785 | |
---|
| 2786 | Void TComReferencePictureSet::setDeltaPOC(Int bufferNum, Int deltaPOC) |
---|
| 2787 | { |
---|
| 2788 | m_deltaPOC[bufferNum] = deltaPOC; |
---|
| 2789 | } |
---|
| 2790 | |
---|
| 2791 | Void TComReferencePictureSet::setNumberOfPictures(Int numberOfPictures) |
---|
| 2792 | { |
---|
| 2793 | m_numberOfPictures = numberOfPictures; |
---|
| 2794 | } |
---|
| 2795 | |
---|
| 2796 | Int TComReferencePictureSet::getUsed(Int bufferNum) |
---|
| 2797 | { |
---|
| 2798 | return m_used[bufferNum]; |
---|
| 2799 | } |
---|
| 2800 | |
---|
| 2801 | Int TComReferencePictureSet::getDeltaPOC(Int bufferNum) |
---|
| 2802 | { |
---|
| 2803 | return m_deltaPOC[bufferNum]; |
---|
| 2804 | } |
---|
| 2805 | |
---|
| 2806 | Int TComReferencePictureSet::getNumberOfPictures() |
---|
| 2807 | { |
---|
| 2808 | return m_numberOfPictures; |
---|
| 2809 | } |
---|
| 2810 | |
---|
| 2811 | Int TComReferencePictureSet::getPOC(Int bufferNum) |
---|
| 2812 | { |
---|
| 2813 | return m_POC[bufferNum]; |
---|
| 2814 | } |
---|
| 2815 | |
---|
| 2816 | Void TComReferencePictureSet::setPOC(Int bufferNum, Int POC) |
---|
| 2817 | { |
---|
| 2818 | m_POC[bufferNum] = POC; |
---|
| 2819 | } |
---|
| 2820 | |
---|
| 2821 | Bool TComReferencePictureSet::getCheckLTMSBPresent(Int bufferNum) |
---|
| 2822 | { |
---|
| 2823 | return m_bCheckLTMSB[bufferNum]; |
---|
| 2824 | } |
---|
| 2825 | |
---|
| 2826 | Void TComReferencePictureSet::setCheckLTMSBPresent(Int bufferNum, Bool b) |
---|
| 2827 | { |
---|
| 2828 | m_bCheckLTMSB[bufferNum] = b; |
---|
| 2829 | } |
---|
| 2830 | |
---|
| 2831 | /** set the reference idc value at uiBufferNum entry to the value of iRefIdc |
---|
| 2832 | * \param uiBufferNum |
---|
| 2833 | * \param iRefIdc |
---|
| 2834 | * \returns Void |
---|
| 2835 | */ |
---|
| 2836 | Void TComReferencePictureSet::setRefIdc(Int bufferNum, Int refIdc) |
---|
| 2837 | { |
---|
| 2838 | m_refIdc[bufferNum] = refIdc; |
---|
| 2839 | } |
---|
| 2840 | |
---|
| 2841 | /** get the reference idc value at uiBufferNum |
---|
| 2842 | * \param uiBufferNum |
---|
| 2843 | * \returns Int |
---|
| 2844 | */ |
---|
| 2845 | Int TComReferencePictureSet::getRefIdc(Int bufferNum) |
---|
| 2846 | { |
---|
| 2847 | return m_refIdc[bufferNum]; |
---|
| 2848 | } |
---|
| 2849 | |
---|
| 2850 | /** Sorts the deltaPOC and Used by current values in the RPS based on the deltaPOC values. |
---|
| 2851 | * deltaPOC values are sorted with -ve values before the +ve values. -ve values are in decreasing order. |
---|
| 2852 | * +ve values are in increasing order. |
---|
| 2853 | * \returns Void |
---|
| 2854 | */ |
---|
| 2855 | Void TComReferencePictureSet::sortDeltaPOC() |
---|
| 2856 | { |
---|
| 2857 | // sort in increasing order (smallest first) |
---|
| 2858 | for(Int j=1; j < getNumberOfPictures(); j++) |
---|
| 2859 | { |
---|
| 2860 | Int deltaPOC = getDeltaPOC(j); |
---|
| 2861 | Bool used = getUsed(j); |
---|
| 2862 | for (Int k=j-1; k >= 0; k--) |
---|
| 2863 | { |
---|
| 2864 | Int temp = getDeltaPOC(k); |
---|
| 2865 | if (deltaPOC < temp) |
---|
| 2866 | { |
---|
| 2867 | setDeltaPOC(k+1, temp); |
---|
| 2868 | setUsed(k+1, getUsed(k)); |
---|
| 2869 | setDeltaPOC(k, deltaPOC); |
---|
| 2870 | setUsed(k, used); |
---|
| 2871 | } |
---|
| 2872 | } |
---|
| 2873 | } |
---|
| 2874 | // flip the negative values to largest first |
---|
| 2875 | Int numNegPics = getNumberOfNegativePictures(); |
---|
| 2876 | for(Int j=0, k=numNegPics-1; j < numNegPics>>1; j++, k--) |
---|
| 2877 | { |
---|
| 2878 | Int deltaPOC = getDeltaPOC(j); |
---|
| 2879 | Bool used = getUsed(j); |
---|
| 2880 | setDeltaPOC(j, getDeltaPOC(k)); |
---|
| 2881 | setUsed(j, getUsed(k)); |
---|
| 2882 | setDeltaPOC(k, deltaPOC); |
---|
| 2883 | setUsed(k, used); |
---|
| 2884 | } |
---|
| 2885 | } |
---|
| 2886 | |
---|
| 2887 | /** Prints the deltaPOC and RefIdc (if available) values in the RPS. |
---|
| 2888 | * A "*" is added to the deltaPOC value if it is Used bu current. |
---|
| 2889 | * \returns Void |
---|
| 2890 | */ |
---|
| 2891 | Void TComReferencePictureSet::printDeltaPOC() |
---|
| 2892 | { |
---|
| 2893 | printf("DeltaPOC = { "); |
---|
| 2894 | for(Int j=0; j < getNumberOfPictures(); j++) |
---|
| 2895 | { |
---|
| 2896 | printf("%d%s ", getDeltaPOC(j), (getUsed(j)==1)?"*":""); |
---|
| 2897 | } |
---|
| 2898 | if (getInterRPSPrediction()) |
---|
| 2899 | { |
---|
| 2900 | printf("}, RefIdc = { "); |
---|
| 2901 | for(Int j=0; j < getNumRefIdc(); j++) |
---|
| 2902 | { |
---|
| 2903 | printf("%d ", getRefIdc(j)); |
---|
| 2904 | } |
---|
| 2905 | } |
---|
| 2906 | printf("}\n"); |
---|
| 2907 | } |
---|
| 2908 | |
---|
| 2909 | TComRPSList::TComRPSList() |
---|
| 2910 | :m_referencePictureSets (NULL) |
---|
| 2911 | { |
---|
| 2912 | } |
---|
| 2913 | |
---|
| 2914 | TComRPSList::~TComRPSList() |
---|
| 2915 | { |
---|
| 2916 | } |
---|
| 2917 | |
---|
| 2918 | Void TComRPSList::create( Int numberOfReferencePictureSets) |
---|
| 2919 | { |
---|
| 2920 | m_numberOfReferencePictureSets = numberOfReferencePictureSets; |
---|
| 2921 | m_referencePictureSets = new TComReferencePictureSet[numberOfReferencePictureSets]; |
---|
| 2922 | } |
---|
| 2923 | |
---|
| 2924 | Void TComRPSList::destroy() |
---|
| 2925 | { |
---|
| 2926 | if (m_referencePictureSets) |
---|
| 2927 | { |
---|
| 2928 | delete [] m_referencePictureSets; |
---|
| 2929 | } |
---|
| 2930 | m_numberOfReferencePictureSets = 0; |
---|
| 2931 | m_referencePictureSets = NULL; |
---|
| 2932 | } |
---|
| 2933 | |
---|
| 2934 | |
---|
| 2935 | |
---|
| 2936 | TComReferencePictureSet* TComRPSList::getReferencePictureSet(Int referencePictureSetNum) |
---|
| 2937 | { |
---|
| 2938 | return &m_referencePictureSets[referencePictureSetNum]; |
---|
| 2939 | } |
---|
| 2940 | |
---|
| 2941 | Int TComRPSList::getNumberOfReferencePictureSets() |
---|
| 2942 | { |
---|
| 2943 | return m_numberOfReferencePictureSets; |
---|
| 2944 | } |
---|
| 2945 | |
---|
| 2946 | Void TComRPSList::setNumberOfReferencePictureSets(Int numberOfReferencePictureSets) |
---|
| 2947 | { |
---|
| 2948 | m_numberOfReferencePictureSets = numberOfReferencePictureSets; |
---|
| 2949 | } |
---|
| 2950 | |
---|
| 2951 | TComRefPicListModification::TComRefPicListModification() |
---|
| 2952 | : m_bRefPicListModificationFlagL0 (false) |
---|
| 2953 | , m_bRefPicListModificationFlagL1 (false) |
---|
| 2954 | { |
---|
| 2955 | ::memset( m_RefPicSetIdxL0, 0, sizeof(m_RefPicSetIdxL0) ); |
---|
| 2956 | ::memset( m_RefPicSetIdxL1, 0, sizeof(m_RefPicSetIdxL1) ); |
---|
| 2957 | } |
---|
| 2958 | |
---|
| 2959 | TComRefPicListModification::~TComRefPicListModification() |
---|
| 2960 | { |
---|
| 2961 | } |
---|
| 2962 | |
---|
| 2963 | TComScalingList::TComScalingList() |
---|
| 2964 | { |
---|
| 2965 | init(); |
---|
| 2966 | } |
---|
[442] | 2967 | |
---|
[313] | 2968 | TComScalingList::~TComScalingList() |
---|
| 2969 | { |
---|
| 2970 | destroy(); |
---|
| 2971 | } |
---|
| 2972 | |
---|
| 2973 | /** set default quantization matrix to array |
---|
| 2974 | */ |
---|
| 2975 | Void TComSlice::setDefaultScalingList() |
---|
| 2976 | { |
---|
| 2977 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 2978 | { |
---|
| 2979 | for(UInt listId=0;listId<g_scalingListNum[sizeId];listId++) |
---|
| 2980 | { |
---|
[540] | 2981 | getScalingList()->processDefaultMatrix(sizeId, listId); |
---|
[313] | 2982 | } |
---|
| 2983 | } |
---|
| 2984 | } |
---|
| 2985 | /** check if use default quantization matrix |
---|
| 2986 | * \returns true if use default quantization matrix in all size |
---|
| 2987 | */ |
---|
| 2988 | Bool TComSlice::checkDefaultScalingList() |
---|
| 2989 | { |
---|
| 2990 | UInt defaultCounter=0; |
---|
| 2991 | |
---|
| 2992 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 2993 | { |
---|
| 2994 | for(UInt listId=0;listId<g_scalingListNum[sizeId];listId++) |
---|
| 2995 | { |
---|
| 2996 | if( !memcmp(getScalingList()->getScalingListAddress(sizeId,listId), getScalingList()->getScalingListDefaultAddress(sizeId, listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix |
---|
| 2997 | && ((sizeId < SCALING_LIST_16x16) || (getScalingList()->getScalingListDC(sizeId,listId) == 16))) // check DC value |
---|
| 2998 | { |
---|
| 2999 | defaultCounter++; |
---|
| 3000 | } |
---|
| 3001 | } |
---|
| 3002 | } |
---|
| 3003 | return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? false : true; // -4 for 32x32 |
---|
| 3004 | } |
---|
| 3005 | |
---|
| 3006 | /** get scaling matrix from RefMatrixID |
---|
| 3007 | * \param sizeId size index |
---|
| 3008 | * \param Index of input matrix |
---|
| 3009 | * \param Index of reference matrix |
---|
| 3010 | */ |
---|
| 3011 | Void TComScalingList::processRefMatrix( UInt sizeId, UInt listId , UInt refListId ) |
---|
| 3012 | { |
---|
| 3013 | ::memcpy(getScalingListAddress(sizeId, listId),((listId == refListId)? getScalingListDefaultAddress(sizeId, refListId): getScalingListAddress(sizeId, refListId)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
| 3014 | } |
---|
| 3015 | |
---|
| 3016 | /** parse syntax infomation |
---|
| 3017 | * \param pchFile syntax infomation |
---|
| 3018 | * \returns false if successful |
---|
| 3019 | */ |
---|
| 3020 | Bool TComScalingList::xParseScalingList(Char* pchFile) |
---|
| 3021 | { |
---|
| 3022 | FILE *fp; |
---|
| 3023 | Char line[1024]; |
---|
| 3024 | UInt sizeIdc,listIdc; |
---|
| 3025 | UInt i,size = 0; |
---|
| 3026 | Int *src=0,data; |
---|
| 3027 | Char *ret; |
---|
| 3028 | UInt retval; |
---|
| 3029 | |
---|
| 3030 | if((fp = fopen(pchFile,"r")) == (FILE*)NULL) |
---|
| 3031 | { |
---|
| 3032 | printf("can't open file %s :: set Default Matrix\n",pchFile); |
---|
| 3033 | return true; |
---|
| 3034 | } |
---|
| 3035 | |
---|
| 3036 | for(sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) |
---|
| 3037 | { |
---|
| 3038 | size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeIdc]); |
---|
| 3039 | for(listIdc = 0; listIdc < g_scalingListNum[sizeIdc]; listIdc++) |
---|
| 3040 | { |
---|
| 3041 | src = getScalingListAddress(sizeIdc, listIdc); |
---|
| 3042 | |
---|
| 3043 | fseek(fp,0,0); |
---|
| 3044 | do |
---|
| 3045 | { |
---|
| 3046 | ret = fgets(line, 1024, fp); |
---|
| 3047 | if ((ret==NULL)||(strstr(line, MatrixType[sizeIdc][listIdc])==NULL && feof(fp))) |
---|
| 3048 | { |
---|
| 3049 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
| 3050 | return true; |
---|
| 3051 | } |
---|
| 3052 | } |
---|
| 3053 | while (strstr(line, MatrixType[sizeIdc][listIdc]) == NULL); |
---|
| 3054 | for (i=0; i<size; i++) |
---|
| 3055 | { |
---|
| 3056 | retval = fscanf(fp, "%d,", &data); |
---|
| 3057 | if (retval!=1) |
---|
| 3058 | { |
---|
| 3059 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
| 3060 | return true; |
---|
| 3061 | } |
---|
| 3062 | src[i] = data; |
---|
| 3063 | } |
---|
| 3064 | //set DC value for default matrix check |
---|
| 3065 | setScalingListDC(sizeIdc,listIdc,src[0]); |
---|
| 3066 | |
---|
| 3067 | if(sizeIdc > SCALING_LIST_8x8) |
---|
| 3068 | { |
---|
| 3069 | fseek(fp,0,0); |
---|
| 3070 | do |
---|
| 3071 | { |
---|
| 3072 | ret = fgets(line, 1024, fp); |
---|
| 3073 | if ((ret==NULL)||(strstr(line, MatrixType_DC[sizeIdc][listIdc])==NULL && feof(fp))) |
---|
| 3074 | { |
---|
| 3075 | printf("Error: can't read DC :: set Default Matrix\n"); |
---|
| 3076 | return true; |
---|
| 3077 | } |
---|
| 3078 | } |
---|
| 3079 | while (strstr(line, MatrixType_DC[sizeIdc][listIdc]) == NULL); |
---|
| 3080 | retval = fscanf(fp, "%d,", &data); |
---|
| 3081 | if (retval!=1) |
---|
| 3082 | { |
---|
| 3083 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
| 3084 | return true; |
---|
| 3085 | } |
---|
| 3086 | //overwrite DC value when size of matrix is larger than 16x16 |
---|
| 3087 | setScalingListDC(sizeIdc,listIdc,data); |
---|
| 3088 | } |
---|
| 3089 | } |
---|
| 3090 | } |
---|
| 3091 | fclose(fp); |
---|
| 3092 | return false; |
---|
| 3093 | } |
---|
| 3094 | |
---|
| 3095 | /** initialization process of quantization matrix array |
---|
| 3096 | */ |
---|
| 3097 | Void TComScalingList::init() |
---|
| 3098 | { |
---|
| 3099 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 3100 | { |
---|
| 3101 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
| 3102 | { |
---|
| 3103 | m_scalingListCoef[sizeId][listId] = new Int [min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])]; |
---|
| 3104 | } |
---|
| 3105 | } |
---|
| 3106 | m_scalingListCoef[SCALING_LIST_32x32][3] = m_scalingListCoef[SCALING_LIST_32x32][1]; // copy address for 32x32 |
---|
| 3107 | } |
---|
| 3108 | |
---|
| 3109 | /** destroy quantization matrix array |
---|
| 3110 | */ |
---|
| 3111 | Void TComScalingList::destroy() |
---|
| 3112 | { |
---|
| 3113 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 3114 | { |
---|
| 3115 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
| 3116 | { |
---|
| 3117 | if(m_scalingListCoef[sizeId][listId]) delete [] m_scalingListCoef[sizeId][listId]; |
---|
| 3118 | } |
---|
| 3119 | } |
---|
| 3120 | } |
---|
| 3121 | |
---|
| 3122 | /** get default address of quantization matrix |
---|
| 3123 | * \param sizeId size index |
---|
| 3124 | * \param listId list index |
---|
| 3125 | * \returns pointer of quantization matrix |
---|
| 3126 | */ |
---|
| 3127 | Int* TComScalingList::getScalingListDefaultAddress(UInt sizeId, UInt listId) |
---|
| 3128 | { |
---|
| 3129 | Int *src = 0; |
---|
| 3130 | switch(sizeId) |
---|
| 3131 | { |
---|
| 3132 | case SCALING_LIST_4x4: |
---|
| 3133 | src = g_quantTSDefault4x4; |
---|
| 3134 | break; |
---|
| 3135 | case SCALING_LIST_8x8: |
---|
| 3136 | src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
| 3137 | break; |
---|
| 3138 | case SCALING_LIST_16x16: |
---|
| 3139 | src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
| 3140 | break; |
---|
| 3141 | case SCALING_LIST_32x32: |
---|
| 3142 | src = (listId<1) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
| 3143 | break; |
---|
| 3144 | default: |
---|
| 3145 | assert(0); |
---|
| 3146 | src = NULL; |
---|
| 3147 | break; |
---|
| 3148 | } |
---|
| 3149 | return src; |
---|
| 3150 | } |
---|
| 3151 | |
---|
| 3152 | /** process of default matrix |
---|
| 3153 | * \param sizeId size index |
---|
| 3154 | * \param Index of input matrix |
---|
| 3155 | */ |
---|
[540] | 3156 | Void TComScalingList::processDefaultMatrix(UInt sizeId, UInt listId) |
---|
[313] | 3157 | { |
---|
| 3158 | ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
| 3159 | setScalingListDC(sizeId,listId,SCALING_LIST_DC); |
---|
| 3160 | } |
---|
| 3161 | |
---|
| 3162 | /** check DC value of matrix for default matrix signaling |
---|
| 3163 | */ |
---|
| 3164 | Void TComScalingList::checkDcOfMatrix() |
---|
| 3165 | { |
---|
| 3166 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 3167 | { |
---|
| 3168 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
| 3169 | { |
---|
| 3170 | //check default matrix? |
---|
| 3171 | if(getScalingListDC(sizeId,listId) == 0) |
---|
| 3172 | { |
---|
[540] | 3173 | processDefaultMatrix(sizeId, listId); |
---|
[313] | 3174 | } |
---|
| 3175 | } |
---|
| 3176 | } |
---|
| 3177 | } |
---|
| 3178 | |
---|
| 3179 | ParameterSetManager::ParameterSetManager() |
---|
| 3180 | #if SVC_EXTENSION |
---|
| 3181 | : m_spsMap(MAX_NUM_SPS) |
---|
| 3182 | , m_ppsMap(MAX_NUM_PPS) |
---|
| 3183 | , m_activeSPSId(-1) |
---|
| 3184 | , m_activePPSId(-1) |
---|
| 3185 | #else |
---|
| 3186 | : m_vpsMap(MAX_NUM_VPS) |
---|
| 3187 | , m_spsMap(MAX_NUM_SPS) |
---|
| 3188 | , m_ppsMap(MAX_NUM_PPS) |
---|
| 3189 | , m_activeVPSId(-1) |
---|
| 3190 | , m_activeSPSId(-1) |
---|
| 3191 | , m_activePPSId(-1) |
---|
| 3192 | #endif |
---|
| 3193 | { |
---|
| 3194 | } |
---|
| 3195 | |
---|
| 3196 | |
---|
| 3197 | ParameterSetManager::~ParameterSetManager() |
---|
| 3198 | { |
---|
| 3199 | } |
---|
| 3200 | |
---|
| 3201 | //! activate a SPS from a active parameter sets SEI message |
---|
| 3202 | //! \returns true, if activation is successful |
---|
| 3203 | Bool ParameterSetManager::activateSPSWithSEI(Int spsId) |
---|
| 3204 | { |
---|
| 3205 | TComSPS *sps = m_spsMap.getPS(spsId); |
---|
| 3206 | if (sps) |
---|
| 3207 | { |
---|
| 3208 | Int vpsId = sps->getVPSId(); |
---|
| 3209 | if (m_vpsMap.getPS(vpsId)) |
---|
| 3210 | { |
---|
| 3211 | m_activeVPSId = vpsId; |
---|
| 3212 | m_activeSPSId = spsId; |
---|
| 3213 | return true; |
---|
| 3214 | } |
---|
| 3215 | else |
---|
| 3216 | { |
---|
| 3217 | printf("Warning: tried to activate SPS using an Active parameter sets SEI message. Referenced VPS does not exist."); |
---|
| 3218 | } |
---|
| 3219 | } |
---|
| 3220 | else |
---|
| 3221 | { |
---|
| 3222 | printf("Warning: tried to activate non-existing SPS using an Active parameter sets SEI message."); |
---|
| 3223 | } |
---|
| 3224 | return false; |
---|
| 3225 | } |
---|
| 3226 | |
---|
| 3227 | //! activate a PPS and depending on isIDR parameter also SPS and VPS |
---|
| 3228 | //! \returns true, if activation is successful |
---|
| 3229 | Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP) |
---|
| 3230 | { |
---|
| 3231 | TComPPS *pps = m_ppsMap.getPS(ppsId); |
---|
| 3232 | if (pps) |
---|
| 3233 | { |
---|
| 3234 | Int spsId = pps->getSPSId(); |
---|
| 3235 | if (!isIRAP && (spsId != m_activeSPSId)) |
---|
| 3236 | { |
---|
| 3237 | printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP."); |
---|
| 3238 | return false; |
---|
| 3239 | } |
---|
| 3240 | TComSPS *sps = m_spsMap.getPS(spsId); |
---|
| 3241 | if (sps) |
---|
| 3242 | { |
---|
| 3243 | Int vpsId = sps->getVPSId(); |
---|
| 3244 | if (!isIRAP && (vpsId != m_activeVPSId)) |
---|
| 3245 | { |
---|
| 3246 | printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP."); |
---|
| 3247 | return false; |
---|
| 3248 | } |
---|
| 3249 | if (m_vpsMap.getPS(vpsId)) |
---|
| 3250 | { |
---|
| 3251 | m_activePPSId = ppsId; |
---|
| 3252 | m_activeVPSId = vpsId; |
---|
| 3253 | m_activeSPSId = spsId; |
---|
[442] | 3254 | |
---|
[313] | 3255 | return true; |
---|
| 3256 | } |
---|
| 3257 | else |
---|
| 3258 | { |
---|
| 3259 | printf("Warning: tried to activate PPS that refers to a non-existing VPS."); |
---|
| 3260 | } |
---|
| 3261 | } |
---|
| 3262 | else |
---|
| 3263 | { |
---|
| 3264 | printf("Warning: tried to activate a PPS that refers to a non-existing SPS."); |
---|
| 3265 | } |
---|
| 3266 | } |
---|
| 3267 | else |
---|
| 3268 | { |
---|
| 3269 | printf("Warning: tried to activate non-existing PPS."); |
---|
| 3270 | } |
---|
| 3271 | return false; |
---|
| 3272 | } |
---|
| 3273 | |
---|
| 3274 | ProfileTierLevel::ProfileTierLevel() |
---|
| 3275 | : m_profileSpace (0) |
---|
| 3276 | , m_tierFlag (false) |
---|
| 3277 | , m_profileIdc (0) |
---|
| 3278 | , m_levelIdc (0) |
---|
| 3279 | , m_progressiveSourceFlag (false) |
---|
| 3280 | , m_interlacedSourceFlag (false) |
---|
| 3281 | , m_nonPackedConstraintFlag(false) |
---|
| 3282 | , m_frameOnlyConstraintFlag(false) |
---|
| 3283 | { |
---|
| 3284 | ::memset(m_profileCompatibilityFlag, 0, sizeof(m_profileCompatibilityFlag)); |
---|
| 3285 | } |
---|
| 3286 | #if VPS_EXTN_PROFILE_INFO |
---|
| 3287 | Void ProfileTierLevel::copyProfileInfo(ProfileTierLevel *ptl) |
---|
| 3288 | { |
---|
| 3289 | this->setProfileSpace ( ptl->getProfileSpace() ); |
---|
| 3290 | this->setTierFlag ( ptl->getTierFlag() ); |
---|
| 3291 | this->setProfileIdc ( ptl->getProfileIdc() ); |
---|
| 3292 | for(Int j = 0; j < 32; j++) |
---|
| 3293 | { |
---|
| 3294 | this->setProfileCompatibilityFlag(j, ptl->getProfileCompatibilityFlag(j)); |
---|
| 3295 | } |
---|
| 3296 | this->setProgressiveSourceFlag ( ptl->getProgressiveSourceFlag() ); |
---|
| 3297 | this->setInterlacedSourceFlag ( ptl->getInterlacedSourceFlag() ); |
---|
| 3298 | this->setNonPackedConstraintFlag( ptl->getNonPackedConstraintFlag()); |
---|
| 3299 | this->setFrameOnlyConstraintFlag( ptl->getFrameOnlyConstraintFlag()); |
---|
| 3300 | } |
---|
| 3301 | #endif |
---|
| 3302 | |
---|
| 3303 | TComPTL::TComPTL() |
---|
| 3304 | { |
---|
| 3305 | ::memset(m_subLayerProfilePresentFlag, 0, sizeof(m_subLayerProfilePresentFlag)); |
---|
| 3306 | ::memset(m_subLayerLevelPresentFlag, 0, sizeof(m_subLayerLevelPresentFlag )); |
---|
| 3307 | } |
---|
| 3308 | #if VPS_EXTN_PROFILE_INFO |
---|
| 3309 | Void TComPTL::copyProfileInfo(TComPTL *ptl) |
---|
| 3310 | { |
---|
| 3311 | // Copy all information related to general profile |
---|
| 3312 | this->getGeneralPTL()->copyProfileInfo(ptl->getGeneralPTL()); |
---|
| 3313 | } |
---|
| 3314 | #endif |
---|
| 3315 | |
---|
| 3316 | #if SVC_EXTENSION |
---|
| 3317 | #if AVC_SYNTAX |
---|
| 3318 | Void TComSlice::initBaseLayerRPL( TComSlice *pcSlice ) |
---|
| 3319 | { |
---|
| 3320 | // Assumed that RPL of the base layer is same to the EL, otherwise this information should be also dumped and read from the metadata file |
---|
| 3321 | setPOC( pcSlice->getPOC() ); |
---|
| 3322 | if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) |
---|
| 3323 | { |
---|
| 3324 | setSliceType( I_SLICE ); |
---|
| 3325 | } |
---|
| 3326 | else |
---|
| 3327 | { |
---|
| 3328 | setSliceType( pcSlice->getSliceType() ); |
---|
| 3329 | } |
---|
| 3330 | |
---|
| 3331 | if( this->isIntra() ) |
---|
| 3332 | { |
---|
| 3333 | return; |
---|
| 3334 | } |
---|
| 3335 | |
---|
| 3336 | //initialize reference POC of BL |
---|
| 3337 | for( Int iRefPicList = 0; iRefPicList < 2; iRefPicList++ ) |
---|
| 3338 | { |
---|
| 3339 | RefPicList eRefPicList = RefPicList( iRefPicList ); |
---|
| 3340 | |
---|
| 3341 | assert( pcSlice->getNumRefIdx( eRefPicList) >= 0 ); |
---|
| 3342 | setNumRefIdx( eRefPicList, pcSlice->getNumRefIdx( eRefPicList ) - 1 ); |
---|
| 3343 | assert( getNumRefIdx( eRefPicList) <= MAX_NUM_REF); |
---|
| 3344 | |
---|
| 3345 | for(Int refIdx = 0; refIdx < getNumRefIdx( eRefPicList ); refIdx++) |
---|
| 3346 | { |
---|
| 3347 | setRefPOC( pcSlice->getRefPic( eRefPicList, refIdx )->getPOC(), eRefPicList, refIdx ); |
---|
| 3348 | setRefPic( pcSlice->getRefPic( eRefPicList, refIdx ), eRefPicList, refIdx ); |
---|
| 3349 | /* |
---|
| 3350 | // should be set if the base layer has its own instance of the reference picture lists, currently EL RPL is reused. |
---|
| 3351 | getRefPic( eRefPicList, refIdx )->setLayerId( 0 ); |
---|
| 3352 | getRefPic( eRefPicList, refIdx )->setIsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsLongTerm() ); |
---|
| 3353 | */ |
---|
| 3354 | |
---|
| 3355 | } |
---|
| 3356 | } |
---|
| 3357 | return; |
---|
| 3358 | } |
---|
| 3359 | #endif |
---|
| 3360 | |
---|
[540] | 3361 | Bool TComSlice::setBaseColPic( TComList<TComPic*>& rcListPic, UInt refLayerIdc ) |
---|
[313] | 3362 | { |
---|
| 3363 | if(m_layerId == 0) |
---|
| 3364 | { |
---|
| 3365 | memset( m_pcBaseColPic, 0, sizeof( m_pcBaseColPic ) ); |
---|
[540] | 3366 | return false; |
---|
[313] | 3367 | } |
---|
[442] | 3368 | #if POC_RESET_FLAG |
---|
[540] | 3369 | TComPic* pic = xGetRefPic( rcListPic, m_bPocResetFlag ? 0 : m_iPOC ); |
---|
| 3370 | |
---|
| 3371 | if( pic ) |
---|
[442] | 3372 | { |
---|
[540] | 3373 | setBaseColPic(refLayerIdc, pic ); |
---|
[442] | 3374 | } |
---|
| 3375 | else |
---|
| 3376 | { |
---|
[540] | 3377 | return false; |
---|
[442] | 3378 | } |
---|
[540] | 3379 | |
---|
| 3380 | return true; |
---|
[442] | 3381 | #else |
---|
[313] | 3382 | setBaseColPic(refLayerIdc, xGetRefPic(rcListPic, getPOC())); |
---|
[442] | 3383 | #endif |
---|
[313] | 3384 | } |
---|
| 3385 | |
---|
[494] | 3386 | #if MFM_ENCCONSTRAINT |
---|
| 3387 | TComPic* TComSlice::getBaseColPic( TComList<TComPic*>& rcListPic ) |
---|
| 3388 | { |
---|
| 3389 | #if POC_RESET_FLAG |
---|
| 3390 | return xGetRefPic( rcListPic, m_bPocResetFlag ? 0 : m_iPOC ); |
---|
| 3391 | #else |
---|
| 3392 | return xGetRefPic( rcListPic, m_iPOC ); |
---|
| 3393 | #endif |
---|
| 3394 | } |
---|
| 3395 | #endif |
---|
| 3396 | |
---|
[313] | 3397 | #if REF_IDX_MFM |
---|
| 3398 | Void TComSlice::setRefPOCListILP( TComPic** ilpPic, TComPic** pcRefPicRL ) |
---|
| 3399 | { |
---|
| 3400 | for( UInt i = 0; i < m_activeNumILRRefIdx; i++ ) |
---|
| 3401 | { |
---|
| 3402 | UInt refLayerIdc = m_interLayerPredLayerIdc[i]; |
---|
| 3403 | |
---|
| 3404 | TComPic* pcRefPicBL = pcRefPicRL[refLayerIdc]; |
---|
| 3405 | //set reference picture POC of each ILP reference |
---|
| 3406 | Int thePoc = ilpPic[refLayerIdc]->getPOC(); |
---|
[442] | 3407 | assert(thePoc >= 0); |
---|
[313] | 3408 | assert(thePoc == pcRefPicBL->getPOC()); |
---|
| 3409 | |
---|
| 3410 | ilpPic[refLayerIdc]->getSlice(0)->setBaseColPic( refLayerIdc, pcRefPicBL ); |
---|
| 3411 | |
---|
| 3412 | //copy reference pictures marking from the reference layer |
---|
| 3413 | ilpPic[refLayerIdc]->getSlice(0)->copySliceInfo(pcRefPicBL->getSlice(0)); |
---|
| 3414 | |
---|
| 3415 | for( Int refList = 0; refList < 2; refList++ ) |
---|
| 3416 | { |
---|
| 3417 | RefPicList refPicList = RefPicList( refList ); |
---|
| 3418 | |
---|
| 3419 | //set reference POC of ILP |
---|
| 3420 | ilpPic[refLayerIdc]->getSlice(0)->setNumRefIdx(refPicList, pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList)); |
---|
| 3421 | assert(ilpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) >= 0); |
---|
| 3422 | assert(ilpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) <= MAX_NUM_REF); |
---|
| 3423 | |
---|
| 3424 | //initialize reference POC of ILP |
---|
| 3425 | for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx++) |
---|
| 3426 | { |
---|
| 3427 | ilpPic[refLayerIdc]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(refPicList, refIdx), refPicList, refIdx); |
---|
| 3428 | ilpPic[refLayerIdc]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(refPicList, refIdx), refPicList, refIdx); |
---|
| 3429 | } |
---|
| 3430 | |
---|
| 3431 | for(Int refIdx = pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx < MAX_NUM_REF; refIdx++) |
---|
| 3432 | { |
---|
| 3433 | ilpPic[refLayerIdc]->getSlice(0)->setRefPOC(0, refPicList, refIdx); |
---|
| 3434 | ilpPic[refLayerIdc]->getSlice(0)->setRefPic(NULL, refPicList, refIdx); |
---|
| 3435 | } |
---|
| 3436 | } |
---|
| 3437 | } |
---|
| 3438 | return; |
---|
| 3439 | } |
---|
| 3440 | #endif |
---|
| 3441 | |
---|
[494] | 3442 | Void TComSlice::setILRPic(TComPic **pcIlpPic) |
---|
| 3443 | { |
---|
| 3444 | for( Int i = 0; i < m_activeNumILRRefIdx; i++ ) |
---|
| 3445 | { |
---|
| 3446 | Int refLayerIdc = m_interLayerPredLayerIdc[i]; |
---|
| 3447 | |
---|
| 3448 | if( pcIlpPic[refLayerIdc] ) |
---|
| 3449 | { |
---|
| 3450 | pcIlpPic[refLayerIdc]->copyUpsampledPictureYuv( m_pcPic->getFullPelBaseRec( refLayerIdc ), pcIlpPic[refLayerIdc]->getPicYuvRec() ); |
---|
| 3451 | pcIlpPic[refLayerIdc]->getSlice(0)->setPOC( m_iPOC ); |
---|
| 3452 | pcIlpPic[refLayerIdc]->setLayerId( m_pcBaseColPic[refLayerIdc]->getLayerId() ); //set reference layerId |
---|
| 3453 | pcIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension( false ); |
---|
| 3454 | pcIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder(); |
---|
| 3455 | for (Int j=0; j<pcIlpPic[refLayerIdc]->getPicSym()->getNumberOfCUsInFrame(); j++) // set reference CU layerId |
---|
| 3456 | { |
---|
| 3457 | pcIlpPic[refLayerIdc]->getPicSym()->getCU(j)->setLayerId( pcIlpPic[refLayerIdc]->getLayerId() ); |
---|
| 3458 | } |
---|
| 3459 | } |
---|
| 3460 | } |
---|
| 3461 | } |
---|
| 3462 | |
---|
| 3463 | #endif //SVC_EXTENSION |
---|
| 3464 | |
---|
[313] | 3465 | //! \} |
---|