[61] | 1 | /* The copyright in this software is being made available under the BSD |
---|
[5] | 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[56] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[872] | 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC |
---|
[5] | 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
[56] | 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
[5] | 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
| 33 | |
---|
[2] | 34 | /** \file TComSlice.cpp |
---|
| 35 | \brief slice header and SPS class |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include "CommonDef.h" |
---|
| 39 | #include "TComSlice.h" |
---|
| 40 | #include "TComPic.h" |
---|
[608] | 41 | #include "TLibEncoder/TEncSbac.h" |
---|
| 42 | #include "TLibDecoder/TDecSbac.h" |
---|
[2] | 43 | |
---|
[56] | 44 | //! \ingroup TLibCommon |
---|
| 45 | //! \{ |
---|
| 46 | |
---|
[2] | 47 | TComSlice::TComSlice() |
---|
[56] | 48 | : m_iPPSId ( -1 ) |
---|
| 49 | , m_iPOC ( 0 ) |
---|
| 50 | , m_iLastIDR ( 0 ) |
---|
[608] | 51 | , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR_W_RADL ) |
---|
[56] | 52 | , m_eSliceType ( I_SLICE ) |
---|
| 53 | , m_iSliceQp ( 0 ) |
---|
[608] | 54 | , m_dependentSliceSegmentFlag ( false ) |
---|
[56] | 55 | #if ADAPTIVE_QP_SELECTION |
---|
| 56 | , m_iSliceQpBase ( 0 ) |
---|
[2] | 57 | #endif |
---|
[608] | 58 | , m_deblockingFilterDisable ( false ) |
---|
| 59 | , m_deblockingFilterOverrideFlag ( false ) |
---|
| 60 | , m_deblockingFilterBetaOffsetDiv2 ( 0 ) |
---|
| 61 | , m_deblockingFilterTcOffsetDiv2 ( 0 ) |
---|
[56] | 62 | , m_bCheckLDC ( false ) |
---|
| 63 | , m_iSliceQpDelta ( 0 ) |
---|
[608] | 64 | , m_iSliceQpDeltaCb ( 0 ) |
---|
| 65 | , m_iSliceQpDeltaCr ( 0 ) |
---|
[56] | 66 | , m_iDepth ( 0 ) |
---|
| 67 | , m_bRefenced ( false ) |
---|
| 68 | , m_pcSPS ( NULL ) |
---|
| 69 | , m_pcPPS ( NULL ) |
---|
| 70 | , m_pcPic ( NULL ) |
---|
[608] | 71 | , m_colFromL0Flag ( 1 ) |
---|
[56] | 72 | , m_colRefIdx ( 0 ) |
---|
| 73 | , m_uiTLayer ( 0 ) |
---|
| 74 | , m_bTLayerSwitchingFlag ( false ) |
---|
[608] | 75 | , m_sliceMode ( 0 ) |
---|
| 76 | , m_sliceArgument ( 0 ) |
---|
| 77 | , m_sliceCurStartCUAddr ( 0 ) |
---|
| 78 | , m_sliceCurEndCUAddr ( 0 ) |
---|
| 79 | , m_sliceIdx ( 0 ) |
---|
| 80 | , m_sliceSegmentMode ( 0 ) |
---|
| 81 | , m_sliceSegmentArgument ( 0 ) |
---|
| 82 | , m_sliceSegmentCurStartCUAddr ( 0 ) |
---|
| 83 | , m_sliceSegmentCurEndCUAddr ( 0 ) |
---|
| 84 | , m_nextSlice ( false ) |
---|
| 85 | , m_nextSliceSegment ( false ) |
---|
| 86 | , m_sliceBits ( 0 ) |
---|
| 87 | , m_sliceSegmentBits ( 0 ) |
---|
[56] | 88 | , m_bFinalized ( false ) |
---|
| 89 | , m_uiTileOffstForMultES ( 0 ) |
---|
| 90 | , m_puiSubstreamSizes ( NULL ) |
---|
| 91 | , m_cabacInitFlag ( false ) |
---|
[608] | 92 | , m_bLMvdL1Zero ( false ) |
---|
| 93 | , m_numEntryPointOffsets ( 0 ) |
---|
| 94 | , m_temporalLayerNonReferenceFlag ( false ) |
---|
| 95 | , m_enableTMVPFlag ( true ) |
---|
| 96 | #if H_MV |
---|
[622] | 97 | , m_refPicSetInterLayer0 ( NULL ) |
---|
| 98 | , m_refPicSetInterLayer1 ( NULL ) |
---|
[608] | 99 | , m_layerId (0) |
---|
| 100 | , m_viewId (0) |
---|
[622] | 101 | , m_viewIndex (0) |
---|
[608] | 102 | #if H_3D |
---|
| 103 | , m_isDepth (false) |
---|
[56] | 104 | #endif |
---|
[872] | 105 | #if !H_MV_HLS7_GEN |
---|
[622] | 106 | , m_pocResetFlag (false) |
---|
[872] | 107 | #endif |
---|
[773] | 108 | #if H_MV |
---|
[738] | 109 | , m_crossLayerBlaFlag (false) |
---|
| 110 | #endif |
---|
[608] | 111 | , m_discardableFlag (false) |
---|
| 112 | , m_interLayerPredEnabledFlag (false) |
---|
| 113 | , m_numInterLayerRefPicsMinus1 (0) |
---|
[884] | 114 | #if H_MV |
---|
[872] | 115 | , m_sliceSegmentHeaderExtensionLength (0) |
---|
| 116 | , m_pocResetIdc (0) |
---|
| 117 | , m_pocResetPeriodId (0) |
---|
| 118 | , m_fullPocResetFlag (false) |
---|
| 119 | , m_pocLsbVal (0) |
---|
| 120 | , m_pocMsbValPresentFlag (false) |
---|
| 121 | , m_pocMsbVal (0) |
---|
| 122 | , m_pocMsbValRequiredFlag ( false ) |
---|
| 123 | #endif |
---|
[608] | 124 | #if H_3D_IC |
---|
[189] | 125 | , m_bApplyIC ( false ) |
---|
[443] | 126 | , m_icSkipParseFlag ( false ) |
---|
[189] | 127 | #endif |
---|
[608] | 128 | #if H_3D |
---|
| 129 | , m_depthToDisparityB ( NULL ) |
---|
| 130 | , m_depthToDisparityF ( NULL ) |
---|
[443] | 131 | #endif |
---|
[296] | 132 | #endif |
---|
[56] | 133 | { |
---|
[608] | 134 | m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0; |
---|
| 135 | |
---|
[2] | 136 | initEqualRef(); |
---|
[56] | 137 | |
---|
[872] | 138 | for (Int component = 0; component < 3; component++) |
---|
| 139 | { |
---|
| 140 | m_lambdas[component] = 0.0; |
---|
| 141 | } |
---|
| 142 | |
---|
[608] | 143 | for ( Int idx = 0; idx < MAX_NUM_REF; idx++ ) |
---|
[56] | 144 | { |
---|
[608] | 145 | m_list1IdxToList0Idx[idx] = -1; |
---|
| 146 | } |
---|
| 147 | for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++) |
---|
[56] | 148 | { |
---|
[608] | 149 | m_apcRefPicList [0][iNumCount] = NULL; |
---|
| 150 | m_apcRefPicList [1][iNumCount] = NULL; |
---|
| 151 | m_aiRefPOCList [0][iNumCount] = 0; |
---|
| 152 | m_aiRefPOCList [1][iNumCount] = 0; |
---|
| 153 | #if H_MV |
---|
| 154 | m_aiRefLayerIdList[0][iNumCount] = 0; |
---|
| 155 | m_aiRefLayerIdList[1][iNumCount] = 0; |
---|
| 156 | #endif |
---|
[56] | 157 | } |
---|
[608] | 158 | resetWpScaling(); |
---|
[2] | 159 | initWpAcDcParam(); |
---|
[608] | 160 | m_saoEnabledFlag = false; |
---|
[872] | 161 | m_saoEnabledFlagChroma = false; |
---|
[608] | 162 | #if H_MV |
---|
| 163 | for (Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
[210] | 164 | { |
---|
[738] | 165 | m_interLayerPredLayerIdc[ i ] = -1; |
---|
[210] | 166 | } |
---|
| 167 | #endif |
---|
[2] | 168 | } |
---|
| 169 | |
---|
| 170 | TComSlice::~TComSlice() |
---|
| 171 | { |
---|
[608] | 172 | delete[] m_puiSubstreamSizes; |
---|
| 173 | m_puiSubstreamSizes = NULL; |
---|
| 174 | #if H_3D |
---|
| 175 | for( UInt i = 0; i < getViewIndex(); i++ ) |
---|
[56] | 176 | { |
---|
[608] | 177 | if ( m_depthToDisparityB && m_depthToDisparityB[ i ] ) |
---|
[622] | 178 | { |
---|
[608] | 179 | delete[] m_depthToDisparityB [ i ]; |
---|
[622] | 180 | } |
---|
[608] | 181 | |
---|
| 182 | if ( m_depthToDisparityF && m_depthToDisparityF[ i ] ) |
---|
[622] | 183 | { |
---|
[608] | 184 | delete[] m_depthToDisparityF [ i ]; |
---|
[56] | 185 | } |
---|
[622] | 186 | } |
---|
[608] | 187 | |
---|
| 188 | if ( m_depthToDisparityF ) |
---|
[622] | 189 | { |
---|
[608] | 190 | delete[] m_depthToDisparityF; |
---|
[622] | 191 | } |
---|
[608] | 192 | |
---|
| 193 | m_depthToDisparityF = NULL; |
---|
| 194 | |
---|
| 195 | if ( m_depthToDisparityB ) |
---|
| 196 | delete[] m_depthToDisparityB; |
---|
| 197 | |
---|
| 198 | m_depthToDisparityB = NULL; |
---|
| 199 | #endif |
---|
[2] | 200 | } |
---|
| 201 | |
---|
| 202 | |
---|
| 203 | Void TComSlice::initSlice() |
---|
| 204 | { |
---|
| 205 | m_aiNumRefIdx[0] = 0; |
---|
| 206 | m_aiNumRefIdx[1] = 0; |
---|
[5] | 207 | |
---|
[608] | 208 | m_colFromL0Flag = 1; |
---|
[56] | 209 | |
---|
| 210 | m_colRefIdx = 0; |
---|
[2] | 211 | initEqualRef(); |
---|
[56] | 212 | m_bCheckLDC = false; |
---|
[608] | 213 | m_iSliceQpDeltaCb = 0; |
---|
| 214 | m_iSliceQpDeltaCr = 0; |
---|
[56] | 215 | |
---|
[608] | 216 | #if H_3D_IV_MERGE |
---|
| 217 | m_maxNumMergeCand = MRG_MAX_NUM_CANDS_MEM; |
---|
| 218 | #else |
---|
| 219 | m_maxNumMergeCand = MRG_MAX_NUM_CANDS; |
---|
| 220 | #endif |
---|
[56] | 221 | |
---|
| 222 | m_bFinalized=false; |
---|
| 223 | |
---|
[608] | 224 | m_tileByteLocation.clear(); |
---|
[56] | 225 | m_cabacInitFlag = false; |
---|
| 226 | m_numEntryPointOffsets = 0; |
---|
[608] | 227 | m_enableTMVPFlag = true; |
---|
| 228 | #if H_3D_TMVP |
---|
| 229 | m_aiAlterRefIdx[0] = -1; |
---|
| 230 | m_aiAlterRefIdx[1] = -1; |
---|
[56] | 231 | #endif |
---|
[2] | 232 | } |
---|
| 233 | |
---|
[608] | 234 | Bool TComSlice::getRapPicFlag() |
---|
[56] | 235 | { |
---|
[608] | 236 | return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL |
---|
| 237 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP |
---|
| 238 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP |
---|
| 239 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 240 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 241 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA; |
---|
[56] | 242 | } |
---|
| 243 | |
---|
| 244 | /** |
---|
| 245 | - allocate table to contain substream sizes to be written to the slice header. |
---|
| 246 | . |
---|
| 247 | \param uiNumSubstreams Number of substreams -- the allocation will be this value - 1. |
---|
| 248 | */ |
---|
| 249 | Void TComSlice::allocSubstreamSizes(UInt uiNumSubstreams) |
---|
| 250 | { |
---|
| 251 | delete[] m_puiSubstreamSizes; |
---|
| 252 | m_puiSubstreamSizes = new UInt[uiNumSubstreams > 0 ? uiNumSubstreams-1 : 0]; |
---|
| 253 | } |
---|
| 254 | |
---|
[2] | 255 | Void TComSlice::sortPicList (TComList<TComPic*>& rcListPic) |
---|
| 256 | { |
---|
| 257 | TComPic* pcPicExtract; |
---|
| 258 | TComPic* pcPicInsert; |
---|
[5] | 259 | |
---|
[2] | 260 | TComList<TComPic*>::iterator iterPicExtract; |
---|
| 261 | TComList<TComPic*>::iterator iterPicExtract_1; |
---|
| 262 | TComList<TComPic*>::iterator iterPicInsert; |
---|
[5] | 263 | |
---|
[2] | 264 | for (Int i = 1; i < (Int)(rcListPic.size()); i++) |
---|
| 265 | { |
---|
| 266 | iterPicExtract = rcListPic.begin(); |
---|
| 267 | for (Int j = 0; j < i; j++) iterPicExtract++; |
---|
| 268 | pcPicExtract = *(iterPicExtract); |
---|
| 269 | pcPicExtract->setCurrSliceIdx(0); |
---|
[5] | 270 | |
---|
[2] | 271 | iterPicInsert = rcListPic.begin(); |
---|
| 272 | while (iterPicInsert != iterPicExtract) |
---|
| 273 | { |
---|
| 274 | pcPicInsert = *(iterPicInsert); |
---|
| 275 | pcPicInsert->setCurrSliceIdx(0); |
---|
| 276 | if (pcPicInsert->getPOC() >= pcPicExtract->getPOC()) |
---|
| 277 | { |
---|
| 278 | break; |
---|
| 279 | } |
---|
[5] | 280 | |
---|
[2] | 281 | iterPicInsert++; |
---|
| 282 | } |
---|
[5] | 283 | |
---|
[2] | 284 | iterPicExtract_1 = iterPicExtract; iterPicExtract_1++; |
---|
[5] | 285 | |
---|
[2] | 286 | // swap iterPicExtract and iterPicInsert, iterPicExtract = curr. / iterPicInsert = insertion position |
---|
| 287 | rcListPic.insert (iterPicInsert, iterPicExtract, iterPicExtract_1); |
---|
| 288 | rcListPic.erase (iterPicExtract); |
---|
| 289 | } |
---|
| 290 | } |
---|
| 291 | |
---|
[608] | 292 | TComPic* TComSlice::xGetRefPic (TComList<TComPic*>& rcListPic, |
---|
| 293 | Int poc) |
---|
[2] | 294 | { |
---|
[56] | 295 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 296 | TComPic* pcPic = *(iterPic); |
---|
| 297 | while ( iterPic != rcListPic.end() ) |
---|
[2] | 298 | { |
---|
[608] | 299 | if(pcPic->getPOC() == poc) |
---|
[2] | 300 | { |
---|
[56] | 301 | break; |
---|
[2] | 302 | } |
---|
[56] | 303 | iterPic++; |
---|
| 304 | pcPic = *(iterPic); |
---|
[2] | 305 | } |
---|
[56] | 306 | return pcPic; |
---|
| 307 | } |
---|
[2] | 308 | |
---|
[56] | 309 | |
---|
[608] | 310 | TComPic* TComSlice::xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb) |
---|
[56] | 311 | { |
---|
| 312 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 313 | TComPic* pcPic = *(iterPic); |
---|
| 314 | TComPic* pcStPic = pcPic; |
---|
[608] | 315 | |
---|
| 316 | Int pocCycle = 1 << getSPS()->getBitsForPOC(); |
---|
| 317 | if (!pocHasMsb) |
---|
| 318 | { |
---|
[655] | 319 | poc = poc & (pocCycle - 1); |
---|
[608] | 320 | } |
---|
| 321 | |
---|
[56] | 322 | while ( iterPic != rcListPic.end() ) |
---|
| 323 | { |
---|
| 324 | pcPic = *(iterPic); |
---|
[608] | 325 | if (pcPic && pcPic->getPOC()!=this->getPOC() && pcPic->getSlice( 0 )->isReferenced()) |
---|
[56] | 326 | { |
---|
[608] | 327 | Int picPoc = pcPic->getPOC(); |
---|
| 328 | if (!pocHasMsb) |
---|
| 329 | { |
---|
[655] | 330 | picPoc = picPoc & (pocCycle - 1); |
---|
[608] | 331 | } |
---|
| 332 | |
---|
| 333 | if (poc == picPoc) |
---|
| 334 | { |
---|
[56] | 335 | if(pcPic->getIsLongTerm()) |
---|
[608] | 336 | { |
---|
[56] | 337 | return pcPic; |
---|
[608] | 338 | } |
---|
[56] | 339 | else |
---|
[608] | 340 | { |
---|
[56] | 341 | pcStPic = pcPic; |
---|
[608] | 342 | } |
---|
[56] | 343 | break; |
---|
| 344 | } |
---|
[608] | 345 | } |
---|
[56] | 346 | |
---|
| 347 | iterPic++; |
---|
| 348 | } |
---|
[608] | 349 | |
---|
[56] | 350 | return pcStPic; |
---|
[2] | 351 | } |
---|
| 352 | |
---|
[608] | 353 | Void TComSlice::setRefPOCList () |
---|
[56] | 354 | { |
---|
[608] | 355 | for (Int iDir = 0; iDir < 2; iDir++) |
---|
[56] | 356 | { |
---|
[608] | 357 | for (Int iNumRefIdx = 0; iNumRefIdx < m_aiNumRefIdx[iDir]; iNumRefIdx++) |
---|
[56] | 358 | { |
---|
[608] | 359 | m_aiRefPOCList[iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getPOC(); |
---|
| 360 | #if H_MV |
---|
| 361 | m_aiRefLayerIdList[iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getLayerId(); |
---|
| 362 | #endif |
---|
[56] | 363 | } |
---|
| 364 | } |
---|
| 365 | |
---|
| 366 | } |
---|
| 367 | |
---|
[608] | 368 | Void TComSlice::setList1IdxToList0Idx() |
---|
[56] | 369 | { |
---|
[608] | 370 | Int idxL0, idxL1; |
---|
| 371 | for ( idxL1 = 0; idxL1 < getNumRefIdx( REF_PIC_LIST_1 ); idxL1++ ) |
---|
[56] | 372 | { |
---|
[608] | 373 | m_list1IdxToList0Idx[idxL1] = -1; |
---|
| 374 | for ( idxL0 = 0; idxL0 < getNumRefIdx( REF_PIC_LIST_0 ); idxL0++ ) |
---|
[56] | 375 | { |
---|
[608] | 376 | if ( m_apcRefPicList[REF_PIC_LIST_0][idxL0]->getPOC() == m_apcRefPicList[REF_PIC_LIST_1][idxL1]->getPOC() ) |
---|
| 377 | { |
---|
| 378 | m_list1IdxToList0Idx[idxL1] = idxL0; |
---|
| 379 | break; |
---|
| 380 | } |
---|
[56] | 381 | } |
---|
| 382 | } |
---|
| 383 | } |
---|
[872] | 384 | |
---|
[622] | 385 | #if !H_MV |
---|
| 386 | Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr ) |
---|
| 387 | { |
---|
| 388 | if (!checkNumPocTotalCurr) |
---|
| 389 | { |
---|
| 390 | if (m_eSliceType == I_SLICE) |
---|
| 391 | { |
---|
| 392 | ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); |
---|
| 393 | ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); |
---|
| 394 | |
---|
| 395 | return; |
---|
| 396 | } |
---|
| 397 | |
---|
| 398 | m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); |
---|
| 399 | m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); |
---|
| 400 | } |
---|
| 401 | |
---|
| 402 | TComPic* pcRefPic= NULL; |
---|
| 403 | TComPic* RefPicSetStCurr0[16]; |
---|
| 404 | TComPic* RefPicSetStCurr1[16]; |
---|
| 405 | TComPic* RefPicSetLtCurr[16]; |
---|
| 406 | UInt NumPocStCurr0 = 0; |
---|
| 407 | UInt NumPocStCurr1 = 0; |
---|
| 408 | UInt NumPocLtCurr = 0; |
---|
| 409 | Int i; |
---|
| 410 | |
---|
| 411 | for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++) |
---|
| 412 | { |
---|
| 413 | if(m_pcRPS->getUsed(i)) |
---|
| 414 | { |
---|
| 415 | pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); |
---|
| 416 | pcRefPic->setIsLongTerm(0); |
---|
| 417 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 418 | RefPicSetStCurr0[NumPocStCurr0] = pcRefPic; |
---|
| 419 | NumPocStCurr0++; |
---|
| 420 | pcRefPic->setCheckLTMSBPresent(false); |
---|
| 421 | } |
---|
| 422 | } |
---|
| 423 | |
---|
| 424 | for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++) |
---|
| 425 | { |
---|
| 426 | if(m_pcRPS->getUsed(i)) |
---|
| 427 | { |
---|
| 428 | pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); |
---|
| 429 | pcRefPic->setIsLongTerm(0); |
---|
| 430 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 431 | RefPicSetStCurr1[NumPocStCurr1] = pcRefPic; |
---|
| 432 | NumPocStCurr1++; |
---|
| 433 | pcRefPic->setCheckLTMSBPresent(false); |
---|
| 434 | } |
---|
| 435 | } |
---|
| 436 | |
---|
| 437 | for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--) |
---|
| 438 | { |
---|
| 439 | if(m_pcRPS->getUsed(i)) |
---|
| 440 | { |
---|
| 441 | pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); |
---|
| 442 | pcRefPic->setIsLongTerm(1); |
---|
| 443 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 444 | RefPicSetLtCurr[NumPocLtCurr] = pcRefPic; |
---|
| 445 | NumPocLtCurr++; |
---|
| 446 | } |
---|
| 447 | if(pcRefPic==NULL) |
---|
| 448 | { |
---|
| 449 | pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); |
---|
| 450 | } |
---|
| 451 | pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); |
---|
| 452 | } |
---|
| 453 | |
---|
| 454 | // ref_pic_list_init |
---|
| 455 | TComPic* rpsCurrList0[MAX_NUM_REF+1]; |
---|
| 456 | TComPic* rpsCurrList1[MAX_NUM_REF+1]; |
---|
| 457 | Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr; |
---|
| 458 | if (checkNumPocTotalCurr) |
---|
| 459 | { |
---|
| 460 | // 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: |
---|
[655] | 461 | // ?If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. |
---|
| 462 | // ?Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. |
---|
[622] | 463 | if (getRapPicFlag()) |
---|
| 464 | { |
---|
| 465 | assert(numPocTotalCurr == 0); |
---|
| 466 | } |
---|
| 467 | |
---|
| 468 | if (m_eSliceType == I_SLICE) |
---|
| 469 | { |
---|
| 470 | ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); |
---|
| 471 | ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); |
---|
| 472 | |
---|
| 473 | return; |
---|
| 474 | } |
---|
| 475 | |
---|
| 476 | assert(numPocTotalCurr > 0); |
---|
| 477 | |
---|
| 478 | m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); |
---|
| 479 | m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); |
---|
| 480 | } |
---|
| 481 | |
---|
| 482 | Int cIdx = 0; |
---|
| 483 | for ( i=0; i<NumPocStCurr0; i++, cIdx++) |
---|
| 484 | { |
---|
| 485 | rpsCurrList0[cIdx] = RefPicSetStCurr0[i]; |
---|
| 486 | } |
---|
| 487 | for ( i=0; i<NumPocStCurr1; i++, cIdx++) |
---|
| 488 | { |
---|
| 489 | rpsCurrList0[cIdx] = RefPicSetStCurr1[i]; |
---|
| 490 | } |
---|
| 491 | for ( i=0; i<NumPocLtCurr; i++, cIdx++) |
---|
| 492 | { |
---|
| 493 | rpsCurrList0[cIdx] = RefPicSetLtCurr[i]; |
---|
| 494 | } |
---|
| 495 | assert(cIdx == numPocTotalCurr); |
---|
| 496 | |
---|
| 497 | if (m_eSliceType==B_SLICE) |
---|
| 498 | { |
---|
| 499 | cIdx = 0; |
---|
| 500 | for ( i=0; i<NumPocStCurr1; i++, cIdx++) |
---|
| 501 | { |
---|
| 502 | rpsCurrList1[cIdx] = RefPicSetStCurr1[i]; |
---|
| 503 | } |
---|
| 504 | for ( i=0; i<NumPocStCurr0; i++, cIdx++) |
---|
| 505 | { |
---|
| 506 | rpsCurrList1[cIdx] = RefPicSetStCurr0[i]; |
---|
| 507 | } |
---|
| 508 | for ( i=0; i<NumPocLtCurr; i++, cIdx++) |
---|
| 509 | { |
---|
| 510 | rpsCurrList1[cIdx] = RefPicSetLtCurr[i]; |
---|
| 511 | } |
---|
| 512 | assert(cIdx == numPocTotalCurr); |
---|
| 513 | } |
---|
| 514 | |
---|
| 515 | ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm)); |
---|
| 516 | |
---|
| 517 | for (Int rIdx = 0; rIdx < m_aiNumRefIdx[0]; rIdx ++) |
---|
| 518 | { |
---|
| 519 | cIdx = m_RefPicListModification.getRefPicListModificationFlagL0() ? m_RefPicListModification.getRefPicSetIdxL0(rIdx) : rIdx % numPocTotalCurr; |
---|
| 520 | assert(cIdx >= 0 && cIdx < numPocTotalCurr); |
---|
| 521 | m_apcRefPicList[0][rIdx] = rpsCurrList0[ cIdx ]; |
---|
| 522 | m_bIsUsedAsLongTerm[0][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 ); |
---|
| 523 | } |
---|
| 524 | if ( m_eSliceType != B_SLICE ) |
---|
| 525 | { |
---|
| 526 | m_aiNumRefIdx[1] = 0; |
---|
| 527 | ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1])); |
---|
| 528 | } |
---|
| 529 | else |
---|
| 530 | { |
---|
| 531 | for (Int rIdx = 0; rIdx < m_aiNumRefIdx[1]; rIdx ++) |
---|
| 532 | { |
---|
| 533 | cIdx = m_RefPicListModification.getRefPicListModificationFlagL1() ? m_RefPicListModification.getRefPicSetIdxL1(rIdx) : rIdx % numPocTotalCurr; |
---|
| 534 | assert(cIdx >= 0 && cIdx < numPocTotalCurr); |
---|
| 535 | m_apcRefPicList[1][rIdx] = rpsCurrList1[ cIdx ]; |
---|
| 536 | m_bIsUsedAsLongTerm[1][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 ); |
---|
| 537 | } |
---|
| 538 | } |
---|
| 539 | } |
---|
| 540 | |
---|
| 541 | #else |
---|
| 542 | Void TComSlice::getTempRefPicLists( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1, |
---|
| 543 | std::vector<TComPic*> rpsCurrList[2], std::vector<Bool> usedAsLongTerm[2], Int& numPocTotalCurr, Bool checkNumPocTotalCurr ) |
---|
| 544 | { |
---|
| 545 | if (!checkNumPocTotalCurr) |
---|
| 546 | { |
---|
| 547 | if (m_eSliceType == I_SLICE) |
---|
| 548 | { |
---|
| 549 | return; |
---|
| 550 | } |
---|
| 551 | } |
---|
| 552 | |
---|
| 553 | TComPic* pcRefPic= NULL; |
---|
| 554 | TComPic* RefPicSetStCurr0[16]; |
---|
| 555 | TComPic* RefPicSetStCurr1[16]; |
---|
| 556 | TComPic* RefPicSetLtCurr[16]; |
---|
| 557 | UInt NumPocStCurr0 = 0; |
---|
| 558 | UInt NumPocStCurr1 = 0; |
---|
| 559 | UInt NumPocLtCurr = 0; |
---|
| 560 | Int i; |
---|
| 561 | |
---|
| 562 | for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++) |
---|
| 563 | { |
---|
| 564 | if(m_pcRPS->getUsed(i)) |
---|
| 565 | { |
---|
| 566 | pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); |
---|
| 567 | pcRefPic->setIsLongTerm(0); |
---|
| 568 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 569 | RefPicSetStCurr0[NumPocStCurr0] = pcRefPic; |
---|
| 570 | NumPocStCurr0++; |
---|
| 571 | pcRefPic->setCheckLTMSBPresent(false); |
---|
| 572 | } |
---|
| 573 | } |
---|
| 574 | |
---|
| 575 | for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++) |
---|
| 576 | { |
---|
| 577 | if(m_pcRPS->getUsed(i)) |
---|
| 578 | { |
---|
| 579 | pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i)); |
---|
| 580 | pcRefPic->setIsLongTerm(0); |
---|
| 581 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 582 | RefPicSetStCurr1[NumPocStCurr1] = pcRefPic; |
---|
| 583 | NumPocStCurr1++; |
---|
| 584 | pcRefPic->setCheckLTMSBPresent(false); |
---|
| 585 | } |
---|
| 586 | } |
---|
| 587 | |
---|
| 588 | for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--) |
---|
| 589 | { |
---|
| 590 | if(m_pcRPS->getUsed(i)) |
---|
| 591 | { |
---|
| 592 | pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); |
---|
| 593 | pcRefPic->setIsLongTerm(1); |
---|
| 594 | pcRefPic->getPicYuvRec()->extendPicBorder(); |
---|
| 595 | RefPicSetLtCurr[NumPocLtCurr] = pcRefPic; |
---|
| 596 | NumPocLtCurr++; |
---|
| 597 | } |
---|
| 598 | if(pcRefPic==NULL) |
---|
| 599 | { |
---|
| 600 | pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i)); |
---|
| 601 | } |
---|
| 602 | pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); |
---|
| 603 | } |
---|
| 604 | |
---|
| 605 | Int numPocInterCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr; |
---|
| 606 | numPocTotalCurr = numPocInterCurr + getNumActiveRefLayerPics( ); |
---|
| 607 | assert( numPocTotalCurr == getNumRpsCurrTempList() ); |
---|
| 608 | |
---|
| 609 | if (checkNumPocTotalCurr) |
---|
| 610 | { |
---|
| 611 | // 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: |
---|
| 612 | // - If nuh_layer_id is equal to 0 and the current picture is a BLA picture or a CRA picture, the value of NumPocTotalCurr shall be equal to 0. |
---|
| 613 | // - Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0. |
---|
| 614 | if ( getRapPicFlag() && m_layerId == 0 ) |
---|
| 615 | { |
---|
| 616 | assert(numPocTotalCurr == 0); |
---|
| 617 | } |
---|
| 618 | |
---|
| 619 | if (m_eSliceType == I_SLICE) |
---|
| 620 | { |
---|
| 621 | ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); |
---|
| 622 | ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); |
---|
| 623 | |
---|
| 624 | return; |
---|
| 625 | } |
---|
| 626 | |
---|
| 627 | assert(numPocTotalCurr > 0); |
---|
| 628 | |
---|
| 629 | m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0); |
---|
| 630 | m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1); |
---|
| 631 | } |
---|
| 632 | |
---|
| 633 | std::vector<TComPic*>* refPicSetInterLayer[2] = { &refPicSetInterLayer0, &refPicSetInterLayer1}; |
---|
| 634 | Int numPocInterLayer[2] = { getNumActiveRefLayerPics0( ), getNumActiveRefLayerPics1( ) }; |
---|
| 635 | |
---|
| 636 | TComPic** refPicSetStCurr [2] = { RefPicSetStCurr0, RefPicSetStCurr1 }; |
---|
| 637 | Int numPocStCurr[2] = { NumPocStCurr0, NumPocStCurr1 }; |
---|
| 638 | |
---|
| 639 | for (Int li = 0; li < ((m_eSliceType==B_SLICE) ? 2 : 1); li++) |
---|
| 640 | { |
---|
| 641 | rpsCurrList [li].resize(MAX_NUM_REF+1,NULL ); |
---|
| 642 | usedAsLongTerm[li].resize(MAX_NUM_REF+1,false); |
---|
| 643 | |
---|
| 644 | Int cIdx = 0; |
---|
| 645 | for ( i=0; i < numPocStCurr[li]; i++, cIdx++) |
---|
| 646 | { |
---|
| 647 | rpsCurrList[li][cIdx] = refPicSetStCurr[li][i]; |
---|
| 648 | usedAsLongTerm [li][cIdx] = false; |
---|
| 649 | } |
---|
| 650 | |
---|
| 651 | for ( i=0; i < numPocInterLayer[li]; i++, cIdx++) |
---|
| 652 | { |
---|
| 653 | rpsCurrList[li][cIdx] = (*refPicSetInterLayer[li])[i]; |
---|
| 654 | usedAsLongTerm [li][cIdx] = true; |
---|
| 655 | } |
---|
| 656 | |
---|
| 657 | for ( i=0; i < numPocStCurr[1-li]; i++, cIdx++) |
---|
| 658 | { |
---|
| 659 | rpsCurrList[li][cIdx] = refPicSetStCurr[1-li][i]; |
---|
| 660 | usedAsLongTerm [li][cIdx] = false; |
---|
| 661 | } |
---|
| 662 | |
---|
| 663 | for ( i=0; i<NumPocLtCurr; i++, cIdx++) |
---|
| 664 | { |
---|
| 665 | rpsCurrList[li][cIdx] = RefPicSetLtCurr[i]; |
---|
| 666 | usedAsLongTerm [li][cIdx] = true; |
---|
| 667 | } |
---|
| 668 | |
---|
| 669 | for ( i=0; i < numPocInterLayer[1-li]; i++, cIdx++) |
---|
| 670 | { |
---|
| 671 | assert( cIdx < MAX_NUM_REF ); |
---|
| 672 | rpsCurrList[li][cIdx] = (*refPicSetInterLayer[1-li])[i]; |
---|
| 673 | usedAsLongTerm [li][cIdx] = true; |
---|
| 674 | } |
---|
| 675 | |
---|
| 676 | assert(cIdx == numPocTotalCurr); |
---|
| 677 | } |
---|
| 678 | } |
---|
| 679 | |
---|
| 680 | Void TComSlice::setRefPicList( std::vector<TComPic*> rpsCurrList[2], std::vector<Bool> usedAsLongTerm[2], Int numPocTotalCurr, Bool checkNumPocTotalCurr ) |
---|
| 681 | |
---|
| 682 | { |
---|
| 683 | if (!checkNumPocTotalCurr) |
---|
| 684 | { |
---|
| 685 | if (m_eSliceType == I_SLICE) |
---|
| 686 | { |
---|
| 687 | ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList)); |
---|
| 688 | ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx )); |
---|
| 689 | |
---|
| 690 | return; |
---|
| 691 | } |
---|
| 692 | } |
---|
| 693 | |
---|
| 694 | ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm)); |
---|
| 695 | |
---|
| 696 | for (Int li = 0; li < 2; li++) |
---|
| 697 | { |
---|
| 698 | if ( m_eSliceType == P_SLICE && li == 1 ) |
---|
| 699 | { |
---|
| 700 | m_aiNumRefIdx[1] = 0; |
---|
| 701 | ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1])); |
---|
| 702 | } |
---|
| 703 | else |
---|
| 704 | { |
---|
| 705 | for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[ li ] - 1 ); rIdx ++) |
---|
| 706 | { |
---|
| 707 | Bool listModified = m_RefPicListModification.getRefPicListModificationFlagL( li ); |
---|
| 708 | Int orgIdx = listModified ? m_RefPicListModification.getRefPicSetIdxL(li, rIdx) : (rIdx % numPocTotalCurr); |
---|
| 709 | |
---|
| 710 | assert( rpsCurrList[li][ orgIdx ] != NULL ); |
---|
| 711 | m_apcRefPicList [li][rIdx] = rpsCurrList [li][ orgIdx ]; |
---|
| 712 | m_bIsUsedAsLongTerm[li][rIdx] = usedAsLongTerm [li][ orgIdx ] ; |
---|
| 713 | } |
---|
| 714 | } |
---|
| 715 | } |
---|
| 716 | } |
---|
| 717 | #endif |
---|
[608] | 718 | Int TComSlice::getNumRpsCurrTempList() |
---|
| 719 | { |
---|
| 720 | Int numRpsCurrTempList = 0; |
---|
| 721 | |
---|
| 722 | if (m_eSliceType == I_SLICE) |
---|
| 723 | { |
---|
| 724 | return 0; |
---|
| 725 | } |
---|
| 726 | for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++) |
---|
| 727 | { |
---|
| 728 | if(m_pcRPS->getUsed(i)) |
---|
| 729 | { |
---|
| 730 | numRpsCurrTempList++; |
---|
[2] | 731 | } |
---|
| 732 | } |
---|
[608] | 733 | #if H_MV |
---|
| 734 | numRpsCurrTempList = numRpsCurrTempList + getNumActiveRefLayerPics(); |
---|
| 735 | #endif |
---|
| 736 | return numRpsCurrTempList; |
---|
[2] | 737 | } |
---|
| 738 | |
---|
| 739 | Void TComSlice::initEqualRef() |
---|
| 740 | { |
---|
| 741 | for (Int iDir = 0; iDir < 2; iDir++) |
---|
| 742 | { |
---|
| 743 | for (Int iRefIdx1 = 0; iRefIdx1 < MAX_NUM_REF; iRefIdx1++) |
---|
| 744 | { |
---|
| 745 | for (Int iRefIdx2 = iRefIdx1; iRefIdx2 < MAX_NUM_REF; iRefIdx2++) |
---|
| 746 | { |
---|
| 747 | m_abEqualRef[iDir][iRefIdx1][iRefIdx2] = m_abEqualRef[iDir][iRefIdx2][iRefIdx1] = (iRefIdx1 == iRefIdx2? true : false); |
---|
| 748 | } |
---|
| 749 | } |
---|
| 750 | } |
---|
| 751 | } |
---|
[608] | 752 | #if H_3D |
---|
| 753 | #if H_3D_TMVP |
---|
| 754 | Void TComSlice::generateAlterRefforTMVP() |
---|
| 755 | { |
---|
| 756 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
| 757 | { |
---|
| 758 | if ( this->getNumRefIdx( RefPicList( uiRefListIdx ) ) == 0) |
---|
[773] | 759 | { |
---|
[608] | 760 | continue; |
---|
[773] | 761 | } |
---|
[608] | 762 | Bool bZeroIdxLtFlag = this->getRefPic(RefPicList(uiRefListIdx), 0)->getIsLongTerm(); |
---|
| 763 | for(Int i = 1; i < this->getNumRefIdx(RefPicList(uiRefListIdx)); i++ ) |
---|
[2] | 764 | { |
---|
[608] | 765 | if ( ( bZeroIdxLtFlag && !this->getRefPic(RefPicList(uiRefListIdx), i)->getIsLongTerm() ) || |
---|
| 766 | (!bZeroIdxLtFlag && this->getRefPic(RefPicList(uiRefListIdx), i)->getIsLongTerm() ) ) |
---|
| 767 | { |
---|
| 768 | this->setAlterRefIdx(RefPicList(uiRefListIdx),i); |
---|
| 769 | break; |
---|
| 770 | } |
---|
[2] | 771 | } |
---|
| 772 | } |
---|
| 773 | } |
---|
[608] | 774 | #endif |
---|
| 775 | Void TComSlice::setCamparaSlice( Int** aaiScale, Int** aaiOffset ) |
---|
| 776 | { |
---|
[758] | 777 | if( m_pcVPS->hasCamParInSliceHeader( m_viewIndex ) ) |
---|
[608] | 778 | { |
---|
| 779 | for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < m_viewIndex; uiBaseViewIndex++ ) |
---|
| 780 | { |
---|
| 781 | m_aaiCodedScale [ 0 ][ uiBaseViewIndex ] = aaiScale [ uiBaseViewIndex ][ m_viewIndex ]; |
---|
| 782 | m_aaiCodedScale [ 1 ][ uiBaseViewIndex ] = aaiScale [ m_viewIndex ][ uiBaseViewIndex ]; |
---|
| 783 | m_aaiCodedOffset[ 0 ][ uiBaseViewIndex ] = aaiOffset[ uiBaseViewIndex ][ m_viewIndex ]; |
---|
| 784 | m_aaiCodedOffset[ 1 ][ uiBaseViewIndex ] = aaiOffset[ m_viewIndex ][ uiBaseViewIndex ]; |
---|
| 785 | } |
---|
| 786 | } |
---|
| 787 | } |
---|
| 788 | #endif |
---|
[2] | 789 | |
---|
[56] | 790 | Void TComSlice::checkColRefIdx(UInt curSliceIdx, TComPic* pic) |
---|
| 791 | { |
---|
| 792 | Int i; |
---|
| 793 | TComSlice* curSlice = pic->getSlice(curSliceIdx); |
---|
[608] | 794 | Int currColRefPOC = curSlice->getRefPOC( RefPicList(1-curSlice->getColFromL0Flag()), curSlice->getColRefIdx()); |
---|
[56] | 795 | TComSlice* preSlice; |
---|
| 796 | Int preColRefPOC; |
---|
| 797 | for(i=curSliceIdx-1; i>=0; i--) |
---|
| 798 | { |
---|
| 799 | preSlice = pic->getSlice(i); |
---|
| 800 | if(preSlice->getSliceType() != I_SLICE) |
---|
| 801 | { |
---|
[608] | 802 | preColRefPOC = preSlice->getRefPOC( RefPicList(1-preSlice->getColFromL0Flag()), preSlice->getColRefIdx()); |
---|
[56] | 803 | if(currColRefPOC != preColRefPOC) |
---|
| 804 | { |
---|
| 805 | printf("Collocated_ref_idx shall always be the same for all slices of a coded picture!\n"); |
---|
| 806 | exit(EXIT_FAILURE); |
---|
| 807 | } |
---|
| 808 | else |
---|
| 809 | { |
---|
| 810 | break; |
---|
| 811 | } |
---|
| 812 | } |
---|
| 813 | } |
---|
| 814 | } |
---|
[608] | 815 | |
---|
[655] | 816 | Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic) |
---|
[56] | 817 | { |
---|
| 818 | for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++) |
---|
| 819 | { |
---|
| 820 | if(pocCRA < MAX_UINT && getPOC() > pocCRA) |
---|
| 821 | { |
---|
| 822 | assert(getPOC()+pReferencePictureSet->getDeltaPOC(i) >= pocCRA); |
---|
| 823 | } |
---|
| 824 | } |
---|
| 825 | for(Int i = pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i < pReferencePictureSet->getNumberOfPictures(); i++) |
---|
| 826 | { |
---|
| 827 | if(pocCRA < MAX_UINT && getPOC() > pocCRA) |
---|
| 828 | { |
---|
[608] | 829 | if (!pReferencePictureSet->getCheckLTMSBPresent(i)) |
---|
| 830 | { |
---|
| 831 | assert(xGetLongTermRefPic(rcListPic, pReferencePictureSet->getPOC(i), false)->getPOC() >= pocCRA); |
---|
| 832 | } |
---|
| 833 | else |
---|
| 834 | { |
---|
[56] | 835 | assert(pReferencePictureSet->getPOC(i) >= pocCRA); |
---|
| 836 | } |
---|
| 837 | } |
---|
[608] | 838 | } |
---|
| 839 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found |
---|
[56] | 840 | { |
---|
| 841 | pocCRA = getPOC(); |
---|
[655] | 842 | associatedIRAPType = getNalUnitType(); |
---|
[56] | 843 | } |
---|
[608] | 844 | else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found |
---|
| 845 | { |
---|
| 846 | pocCRA = getPOC(); |
---|
[655] | 847 | associatedIRAPType = getNalUnitType(); |
---|
[608] | 848 | } |
---|
| 849 | else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 850 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 851 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) // BLA picture found |
---|
| 852 | { |
---|
| 853 | pocCRA = getPOC(); |
---|
[655] | 854 | associatedIRAPType = getNalUnitType(); |
---|
[608] | 855 | } |
---|
[56] | 856 | } |
---|
[2] | 857 | |
---|
[608] | 858 | /** Function for marking the reference pictures when an IDR/CRA/CRANT/BLA/BLANT is encountered. |
---|
| 859 | * \param pocCRA POC of the CRA/CRANT/BLA/BLANT picture |
---|
[2] | 860 | * \param bRefreshPending flag indicating if a deferred decoding refresh is pending |
---|
| 861 | * \param rcListPic reference to the reference picture list |
---|
| 862 | * This function marks the reference pictures as "unused for reference" in the following conditions. |
---|
[608] | 863 | * If the nal_unit_type is IDR/BLA/BLANT, all pictures in the reference picture list |
---|
| 864 | * are marked as "unused for reference" |
---|
| 865 | * If the nal_unit_type is BLA/BLANT, set the pocCRA to the temporal reference of the current picture. |
---|
| 866 | * Otherwise |
---|
[5] | 867 | * If the bRefreshPending flag is true (a deferred decoding refresh is pending) and the current |
---|
[608] | 868 | * temporal reference is greater than the temporal reference of the latest CRA/CRANT/BLA/BLANT picture (pocCRA), |
---|
| 869 | * mark all reference pictures except the latest CRA/CRANT/BLA/BLANT picture as "unused for reference" and set |
---|
[2] | 870 | * the bRefreshPending flag to false. |
---|
[608] | 871 | * If the nal_unit_type is CRA/CRANT, set the bRefreshPending flag to true and pocCRA to the temporal |
---|
[2] | 872 | * reference of the current picture. |
---|
| 873 | * Note that the current picture is already placed in the reference list and its marking is not changed. |
---|
| 874 | * If the current picture has a nal_ref_idc that is not 0, it will remain marked as "used for reference". |
---|
| 875 | */ |
---|
[56] | 876 | Void TComSlice::decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic) |
---|
[2] | 877 | { |
---|
| 878 | TComPic* rpcPic; |
---|
[872] | 879 | #if !FIX1172 |
---|
[655] | 880 | setAssociatedIRAPPOC(pocCRA); |
---|
[872] | 881 | #endif |
---|
[608] | 882 | Int pocCurr = getPOC(); |
---|
[2] | 883 | |
---|
[608] | 884 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 885 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 886 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP |
---|
| 887 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL |
---|
| 888 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR or BLA picture |
---|
[2] | 889 | { |
---|
| 890 | // mark all pictures as not used for reference |
---|
| 891 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 892 | while (iterPic != rcListPic.end()) |
---|
| 893 | { |
---|
| 894 | rpcPic = *(iterPic); |
---|
| 895 | rpcPic->setCurrSliceIdx(0); |
---|
[608] | 896 | if (rpcPic->getPOC() != pocCurr) rpcPic->getSlice(0)->setReferenced(false); |
---|
[2] | 897 | iterPic++; |
---|
| 898 | } |
---|
[608] | 899 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 900 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 901 | || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) |
---|
| 902 | { |
---|
| 903 | pocCRA = pocCurr; |
---|
| 904 | } |
---|
[2] | 905 | } |
---|
[56] | 906 | else // CRA or No DR |
---|
[2] | 907 | { |
---|
[608] | 908 | if (bRefreshPending==true && pocCurr > pocCRA) // CRA reference marking pending |
---|
[2] | 909 | { |
---|
| 910 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 911 | while (iterPic != rcListPic.end()) |
---|
| 912 | { |
---|
| 913 | rpcPic = *(iterPic); |
---|
[608] | 914 | if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) |
---|
| 915 | { |
---|
| 916 | rpcPic->getSlice(0)->setReferenced(false); |
---|
| 917 | } |
---|
[2] | 918 | iterPic++; |
---|
| 919 | } |
---|
[5] | 920 | bRefreshPending = false; |
---|
[2] | 921 | } |
---|
[608] | 922 | if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found |
---|
[2] | 923 | { |
---|
[5] | 924 | bRefreshPending = true; |
---|
[608] | 925 | pocCRA = pocCurr; |
---|
[2] | 926 | } |
---|
| 927 | } |
---|
| 928 | } |
---|
| 929 | |
---|
| 930 | Void TComSlice::copySliceInfo(TComSlice *pSrc) |
---|
| 931 | { |
---|
| 932 | assert( pSrc != NULL ); |
---|
| 933 | |
---|
| 934 | Int i, j, k; |
---|
| 935 | |
---|
| 936 | m_iPOC = pSrc->m_iPOC; |
---|
[608] | 937 | m_eNalUnitType = pSrc->m_eNalUnitType; |
---|
| 938 | #if H_MV |
---|
| 939 | m_layerId = pSrc->m_layerId; |
---|
| 940 | // GT: Copying of several other values might be be missing here, or is above not necessary? |
---|
[21] | 941 | #endif |
---|
[2] | 942 | m_eSliceType = pSrc->m_eSliceType; |
---|
| 943 | m_iSliceQp = pSrc->m_iSliceQp; |
---|
[56] | 944 | #if ADAPTIVE_QP_SELECTION |
---|
| 945 | m_iSliceQpBase = pSrc->m_iSliceQpBase; |
---|
| 946 | #endif |
---|
[608] | 947 | m_deblockingFilterDisable = pSrc->m_deblockingFilterDisable; |
---|
| 948 | m_deblockingFilterOverrideFlag = pSrc->m_deblockingFilterOverrideFlag; |
---|
| 949 | m_deblockingFilterBetaOffsetDiv2 = pSrc->m_deblockingFilterBetaOffsetDiv2; |
---|
| 950 | m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2; |
---|
[5] | 951 | |
---|
[608] | 952 | for (i = 0; i < 2; i++) |
---|
[2] | 953 | { |
---|
| 954 | m_aiNumRefIdx[i] = pSrc->m_aiNumRefIdx[i]; |
---|
| 955 | } |
---|
| 956 | |
---|
[608] | 957 | for (i = 0; i < MAX_NUM_REF; i++) |
---|
| 958 | { |
---|
| 959 | m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i]; |
---|
| 960 | } |
---|
| 961 | m_bCheckLDC = pSrc->m_bCheckLDC; |
---|
| 962 | m_iSliceQpDelta = pSrc->m_iSliceQpDelta; |
---|
| 963 | m_iSliceQpDeltaCb = pSrc->m_iSliceQpDeltaCb; |
---|
| 964 | m_iSliceQpDeltaCr = pSrc->m_iSliceQpDeltaCr; |
---|
[2] | 965 | for (i = 0; i < 2; i++) |
---|
| 966 | { |
---|
[608] | 967 | for (j = 0; j < MAX_NUM_REF; j++) |
---|
[2] | 968 | { |
---|
[608] | 969 | m_apcRefPicList[i][j] = pSrc->m_apcRefPicList[i][j]; |
---|
| 970 | m_aiRefPOCList[i][j] = pSrc->m_aiRefPOCList[i][j]; |
---|
| 971 | #if H_MV |
---|
| 972 | m_aiRefLayerIdList[i][j] = pSrc->m_aiRefLayerIdList[i][j]; |
---|
| 973 | #endif |
---|
[2] | 974 | } |
---|
| 975 | } |
---|
| 976 | for (i = 0; i < 2; i++) |
---|
| 977 | { |
---|
[608] | 978 | for (j = 0; j < MAX_NUM_REF + 1; j++) |
---|
[2] | 979 | { |
---|
[608] | 980 | m_bIsUsedAsLongTerm[i][j] = pSrc->m_bIsUsedAsLongTerm[i][j]; |
---|
[2] | 981 | } |
---|
[608] | 982 | } |
---|
[2] | 983 | m_iDepth = pSrc->m_iDepth; |
---|
| 984 | |
---|
| 985 | // referenced slice |
---|
| 986 | m_bRefenced = pSrc->m_bRefenced; |
---|
| 987 | |
---|
| 988 | // access channel |
---|
[608] | 989 | #if H_MV |
---|
| 990 | m_pcVPS = pSrc->m_pcVPS; |
---|
| 991 | #endif |
---|
[2] | 992 | m_pcSPS = pSrc->m_pcSPS; |
---|
| 993 | m_pcPPS = pSrc->m_pcPPS; |
---|
[56] | 994 | m_pcRPS = pSrc->m_pcRPS; |
---|
| 995 | m_iLastIDR = pSrc->m_iLastIDR; |
---|
| 996 | |
---|
[2] | 997 | m_pcPic = pSrc->m_pcPic; |
---|
| 998 | |
---|
[608] | 999 | m_colFromL0Flag = pSrc->m_colFromL0Flag; |
---|
[56] | 1000 | m_colRefIdx = pSrc->m_colRefIdx; |
---|
[872] | 1001 | setLambdas(pSrc->getLambdas()); |
---|
[2] | 1002 | for (i = 0; i < 2; i++) |
---|
| 1003 | { |
---|
| 1004 | for (j = 0; j < MAX_NUM_REF; j++) |
---|
| 1005 | { |
---|
| 1006 | for (k =0; k < MAX_NUM_REF; k++) |
---|
| 1007 | { |
---|
| 1008 | m_abEqualRef[i][j][k] = pSrc->m_abEqualRef[i][j][k]; |
---|
| 1009 | } |
---|
| 1010 | } |
---|
| 1011 | } |
---|
| 1012 | |
---|
[56] | 1013 | m_uiTLayer = pSrc->m_uiTLayer; |
---|
| 1014 | m_bTLayerSwitchingFlag = pSrc->m_bTLayerSwitchingFlag; |
---|
| 1015 | |
---|
[608] | 1016 | m_sliceMode = pSrc->m_sliceMode; |
---|
| 1017 | m_sliceArgument = pSrc->m_sliceArgument; |
---|
| 1018 | m_sliceCurStartCUAddr = pSrc->m_sliceCurStartCUAddr; |
---|
| 1019 | m_sliceCurEndCUAddr = pSrc->m_sliceCurEndCUAddr; |
---|
| 1020 | m_sliceIdx = pSrc->m_sliceIdx; |
---|
| 1021 | m_sliceSegmentMode = pSrc->m_sliceSegmentMode; |
---|
| 1022 | m_sliceSegmentArgument = pSrc->m_sliceSegmentArgument; |
---|
| 1023 | m_sliceSegmentCurStartCUAddr = pSrc->m_sliceSegmentCurStartCUAddr; |
---|
| 1024 | m_sliceSegmentCurEndCUAddr = pSrc->m_sliceSegmentCurEndCUAddr; |
---|
| 1025 | m_nextSlice = pSrc->m_nextSlice; |
---|
| 1026 | m_nextSliceSegment = pSrc->m_nextSliceSegment; |
---|
| 1027 | for ( Int e=0 ; e<2 ; e++ ) |
---|
| 1028 | { |
---|
| 1029 | for ( Int n=0 ; n<MAX_NUM_REF ; n++ ) |
---|
| 1030 | { |
---|
[56] | 1031 | memcpy(m_weightPredTable[e][n], pSrc->m_weightPredTable[e][n], sizeof(wpScalingParam)*3 ); |
---|
[608] | 1032 | } |
---|
| 1033 | } |
---|
[56] | 1034 | m_saoEnabledFlag = pSrc->m_saoEnabledFlag; |
---|
[443] | 1035 | m_saoEnabledFlagChroma = pSrc->m_saoEnabledFlagChroma; |
---|
[56] | 1036 | m_cabacInitFlag = pSrc->m_cabacInitFlag; |
---|
| 1037 | m_numEntryPointOffsets = pSrc->m_numEntryPointOffsets; |
---|
| 1038 | |
---|
| 1039 | m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero; |
---|
[608] | 1040 | m_LFCrossSliceBoundaryFlag = pSrc->m_LFCrossSliceBoundaryFlag; |
---|
| 1041 | m_enableTMVPFlag = pSrc->m_enableTMVPFlag; |
---|
| 1042 | m_maxNumMergeCand = pSrc->m_maxNumMergeCand; |
---|
| 1043 | |
---|
| 1044 | #if H_MV |
---|
| 1045 | // Additional slice header syntax elements |
---|
[872] | 1046 | #if !H_MV_HLS7_GEN |
---|
[622] | 1047 | m_pocResetFlag = pSrc->m_pocResetFlag; |
---|
[872] | 1048 | #endif |
---|
[608] | 1049 | m_discardableFlag = pSrc->m_discardableFlag; |
---|
| 1050 | m_interLayerPredEnabledFlag = pSrc->m_interLayerPredEnabledFlag; |
---|
| 1051 | m_numInterLayerRefPicsMinus1 = pSrc->m_numInterLayerRefPicsMinus1; |
---|
| 1052 | |
---|
| 1053 | for (Int layer = 0; layer < MAX_NUM_LAYERS; layer++ ) |
---|
| 1054 | { |
---|
| 1055 | m_interLayerPredLayerIdc[ layer ] = pSrc->m_interLayerPredLayerIdc[ layer ]; |
---|
| 1056 | } |
---|
| 1057 | #endif |
---|
| 1058 | #if H_3D_IC |
---|
[443] | 1059 | m_bApplyIC = pSrc->m_bApplyIC; |
---|
| 1060 | m_icSkipParseFlag = pSrc->m_icSkipParseFlag; |
---|
| 1061 | #endif |
---|
[2] | 1062 | } |
---|
| 1063 | |
---|
[655] | 1064 | Int TComSlice::m_prevTid0POC = 0; |
---|
[608] | 1065 | |
---|
[56] | 1066 | /** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag. |
---|
| 1067 | * \param uiTLayer Temporal layer ID of the current slice |
---|
| 1068 | * The decoder calls this function to set temporal_layer_switching_point_flag for each temporal layer based on |
---|
| 1069 | * the SPS's temporal_id_nesting_flag and the parsed PPS. Then, current slice's temporal layer ID and |
---|
| 1070 | * temporal_layer_switching_point_flag is set accordingly. |
---|
| 1071 | */ |
---|
| 1072 | Void TComSlice::setTLayerInfo( UInt uiTLayer ) |
---|
[2] | 1073 | { |
---|
[56] | 1074 | m_uiTLayer = uiTLayer; |
---|
[2] | 1075 | } |
---|
| 1076 | |
---|
[56] | 1077 | /** Function for checking if this is a switching-point |
---|
| 1078 | */ |
---|
[608] | 1079 | Bool TComSlice::isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic ) |
---|
[2] | 1080 | { |
---|
[56] | 1081 | TComPic* rpcPic; |
---|
| 1082 | // loop through all pictures in the reference picture buffer |
---|
| 1083 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1084 | while ( iterPic != rcListPic.end()) |
---|
| 1085 | { |
---|
| 1086 | rpcPic = *(iterPic++); |
---|
| 1087 | if(rpcPic->getSlice(0)->isReferenced() && rpcPic->getPOC() != getPOC()) |
---|
| 1088 | { |
---|
| 1089 | if(rpcPic->getTLayer() >= getTLayer()) |
---|
| 1090 | { |
---|
| 1091 | return false; |
---|
| 1092 | } |
---|
| 1093 | } |
---|
| 1094 | } |
---|
| 1095 | return true; |
---|
| 1096 | } |
---|
| 1097 | |
---|
[608] | 1098 | /** Function for checking if this is a STSA candidate |
---|
| 1099 | */ |
---|
| 1100 | Bool TComSlice::isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic ) |
---|
| 1101 | { |
---|
| 1102 | TComPic* rpcPic; |
---|
| 1103 | |
---|
| 1104 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1105 | while ( iterPic != rcListPic.end()) |
---|
| 1106 | { |
---|
| 1107 | rpcPic = *(iterPic++); |
---|
| 1108 | if(rpcPic->getSlice(0)->isReferenced() && (rpcPic->getUsedByCurr()==true) && rpcPic->getPOC() != getPOC()) |
---|
| 1109 | { |
---|
| 1110 | if(rpcPic->getTLayer() >= getTLayer()) |
---|
| 1111 | { |
---|
| 1112 | return false; |
---|
| 1113 | } |
---|
| 1114 | } |
---|
| 1115 | } |
---|
| 1116 | return true; |
---|
| 1117 | } |
---|
| 1118 | |
---|
[655] | 1119 | |
---|
| 1120 | Void TComSlice::checkLeadingPictureRestrictions(TComList<TComPic*>& rcListPic) |
---|
| 1121 | { |
---|
| 1122 | TComPic* rpcPic; |
---|
| 1123 | |
---|
| 1124 | Int nalUnitType = this->getNalUnitType(); |
---|
| 1125 | |
---|
| 1126 | // When a picture is a leading picture, it shall be a RADL or RASL picture. |
---|
| 1127 | if(this->getAssociatedIRAPPOC() > this->getPOC()) |
---|
| 1128 | { |
---|
| 1129 | // Do not check IRAP pictures since they may get a POC lower than their associated IRAP |
---|
| 1130 | if(nalUnitType < NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
| 1131 | nalUnitType > NAL_UNIT_RESERVED_IRAP_VCL23) |
---|
| 1132 | { |
---|
| 1133 | assert(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1134 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || |
---|
| 1135 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1136 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R); |
---|
| 1137 | } |
---|
| 1138 | } |
---|
| 1139 | |
---|
| 1140 | // When a picture is a trailing picture, it shall not be a RADL or RASL picture. |
---|
| 1141 | if(this->getAssociatedIRAPPOC() < this->getPOC()) |
---|
| 1142 | { |
---|
| 1143 | assert(nalUnitType != NAL_UNIT_CODED_SLICE_RASL_N && |
---|
| 1144 | nalUnitType != NAL_UNIT_CODED_SLICE_RASL_R && |
---|
| 1145 | nalUnitType != NAL_UNIT_CODED_SLICE_RADL_N && |
---|
| 1146 | nalUnitType != NAL_UNIT_CODED_SLICE_RADL_R); |
---|
| 1147 | } |
---|
| 1148 | |
---|
| 1149 | // No RASL pictures shall be present in the bitstream that are associated |
---|
| 1150 | // with a BLA picture having nal_unit_type equal to BLA_W_RADL or BLA_N_LP. |
---|
| 1151 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1152 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
| 1153 | { |
---|
| 1154 | assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_W_RADL && |
---|
| 1155 | this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_N_LP); |
---|
| 1156 | } |
---|
| 1157 | |
---|
| 1158 | // No RASL pictures shall be present in the bitstream that are associated with |
---|
| 1159 | // an IDR picture. |
---|
| 1160 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1161 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
| 1162 | { |
---|
| 1163 | assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_N_LP && |
---|
| 1164 | this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL); |
---|
| 1165 | } |
---|
| 1166 | |
---|
| 1167 | // No RADL pictures shall be present in the bitstream that are associated with |
---|
| 1168 | // a BLA picture having nal_unit_type equal to BLA_N_LP or that are associated |
---|
| 1169 | // with an IDR picture having nal_unit_type equal to IDR_N_LP. |
---|
| 1170 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1171 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R) |
---|
| 1172 | { |
---|
| 1173 | assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_N_LP && |
---|
| 1174 | this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_N_LP); |
---|
| 1175 | } |
---|
| 1176 | |
---|
| 1177 | // loop through all pictures in the reference picture buffer |
---|
| 1178 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1179 | while ( iterPic != rcListPic.end()) |
---|
| 1180 | { |
---|
| 1181 | rpcPic = *(iterPic++); |
---|
[872] | 1182 | #if BUGFIX_INTRAPERIOD |
---|
| 1183 | if(!rpcPic->getReconMark()) |
---|
| 1184 | { |
---|
| 1185 | continue; |
---|
| 1186 | } |
---|
| 1187 | #endif |
---|
[655] | 1188 | if (rpcPic->getPOC() == this->getPOC()) |
---|
| 1189 | { |
---|
| 1190 | continue; |
---|
| 1191 | } |
---|
| 1192 | |
---|
| 1193 | // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture |
---|
| 1194 | // in decoding order shall precede the IRAP picture in output order. |
---|
| 1195 | // (Note that any picture following in output order would be present in the DPB) |
---|
| 1196 | if(rpcPic->getSlice(0)->getPicOutputFlag() == 1) |
---|
| 1197 | { |
---|
| 1198 | if(nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP || |
---|
| 1199 | nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
| 1200 | nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL || |
---|
| 1201 | nalUnitType == NAL_UNIT_CODED_SLICE_CRA || |
---|
| 1202 | nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP || |
---|
| 1203 | nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL) |
---|
| 1204 | { |
---|
| 1205 | assert(rpcPic->getPOC() < this->getPOC()); |
---|
| 1206 | } |
---|
| 1207 | } |
---|
| 1208 | |
---|
| 1209 | // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture |
---|
| 1210 | // in decoding order shall precede any RADL picture associated with the IRAP |
---|
| 1211 | // picture in output order. |
---|
| 1212 | if(rpcPic->getSlice(0)->getPicOutputFlag() == 1) |
---|
| 1213 | { |
---|
| 1214 | if((nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1215 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R)) |
---|
| 1216 | { |
---|
| 1217 | // rpcPic precedes the IRAP in decoding order |
---|
| 1218 | if(this->getAssociatedIRAPPOC() > rpcPic->getSlice(0)->getAssociatedIRAPPOC()) |
---|
| 1219 | { |
---|
| 1220 | // rpcPic must not be the IRAP picture |
---|
| 1221 | if(this->getAssociatedIRAPPOC() != rpcPic->getPOC()) |
---|
| 1222 | { |
---|
| 1223 | assert(rpcPic->getPOC() < this->getPOC()); |
---|
| 1224 | } |
---|
| 1225 | } |
---|
| 1226 | } |
---|
| 1227 | } |
---|
| 1228 | |
---|
| 1229 | // When a picture is a leading picture, it shall precede, in decoding order, |
---|
| 1230 | // all trailing pictures that are associated with the same IRAP picture. |
---|
| 1231 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1232 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R || |
---|
| 1233 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1234 | nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R) |
---|
| 1235 | { |
---|
| 1236 | if(rpcPic->getSlice(0)->getAssociatedIRAPPOC() == this->getAssociatedIRAPPOC()) |
---|
| 1237 | { |
---|
| 1238 | // rpcPic is a picture that preceded the leading in decoding order since it exist in the DPB |
---|
| 1239 | // rpcPic would violate the constraint if it was a trailing picture |
---|
| 1240 | assert(rpcPic->getPOC() <= this->getAssociatedIRAPPOC()); |
---|
| 1241 | } |
---|
| 1242 | } |
---|
| 1243 | |
---|
| 1244 | // Any RASL picture associated with a CRA or BLA picture shall precede any |
---|
| 1245 | // RADL picture associated with the CRA or BLA picture in output order |
---|
| 1246 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1247 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
| 1248 | { |
---|
| 1249 | if((this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_N_LP || |
---|
| 1250 | this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
| 1251 | this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL || |
---|
| 1252 | this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) && |
---|
| 1253 | this->getAssociatedIRAPPOC() == rpcPic->getSlice(0)->getAssociatedIRAPPOC()) |
---|
| 1254 | { |
---|
| 1255 | if(rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 1256 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R) |
---|
| 1257 | { |
---|
| 1258 | assert(rpcPic->getPOC() > this->getPOC()); |
---|
| 1259 | } |
---|
| 1260 | } |
---|
| 1261 | } |
---|
| 1262 | |
---|
| 1263 | // Any RASL picture associated with a CRA picture shall follow, in output |
---|
| 1264 | // order, any IRAP picture that precedes the CRA picture in decoding order. |
---|
| 1265 | if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
| 1266 | nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R) |
---|
| 1267 | { |
---|
| 1268 | if(this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA) |
---|
| 1269 | { |
---|
| 1270 | if(rpcPic->getSlice(0)->getPOC() < this->getAssociatedIRAPPOC() && |
---|
| 1271 | (rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP || |
---|
| 1272 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP || |
---|
| 1273 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL || |
---|
| 1274 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || |
---|
| 1275 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || |
---|
| 1276 | rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)) |
---|
| 1277 | { |
---|
| 1278 | assert(this->getPOC() > rpcPic->getSlice(0)->getPOC()); |
---|
| 1279 | } |
---|
| 1280 | } |
---|
| 1281 | } |
---|
| 1282 | } |
---|
| 1283 | } |
---|
| 1284 | |
---|
| 1285 | |
---|
[56] | 1286 | /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. |
---|
| 1287 | */ |
---|
| 1288 | Void TComSlice::applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet) |
---|
| 1289 | { |
---|
| 1290 | TComPic* rpcPic; |
---|
| 1291 | Int i, isReference; |
---|
| 1292 | |
---|
[655] | 1293 | checkLeadingPictureRestrictions(rcListPic); |
---|
| 1294 | |
---|
[56] | 1295 | // loop through all pictures in the reference picture buffer |
---|
| 1296 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1297 | while ( iterPic != rcListPic.end()) |
---|
| 1298 | { |
---|
| 1299 | rpcPic = *(iterPic++); |
---|
| 1300 | |
---|
[608] | 1301 | if(!rpcPic->getSlice( 0 )->isReferenced()) |
---|
| 1302 | { |
---|
| 1303 | continue; |
---|
| 1304 | } |
---|
| 1305 | |
---|
[56] | 1306 | isReference = 0; |
---|
[608] | 1307 | // loop through all pictures in the Reference Picture Set |
---|
| 1308 | // to see if the picture should be kept as reference picture |
---|
[56] | 1309 | for(i=0;i<pReferencePictureSet->getNumberOfPositivePictures()+pReferencePictureSet->getNumberOfNegativePictures();i++) |
---|
| 1310 | { |
---|
| 1311 | if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i)) |
---|
| 1312 | { |
---|
| 1313 | isReference = 1; |
---|
| 1314 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
| 1315 | rpcPic->setIsLongTerm(0); |
---|
| 1316 | } |
---|
| 1317 | } |
---|
| 1318 | for(;i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
| 1319 | { |
---|
[608] | 1320 | if(pReferencePictureSet->getCheckLTMSBPresent(i)==true) |
---|
[56] | 1321 | { |
---|
[608] | 1322 | if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()) == pReferencePictureSet->getPOC(i)) |
---|
| 1323 | { |
---|
| 1324 | isReference = 1; |
---|
| 1325 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
| 1326 | } |
---|
[56] | 1327 | } |
---|
[608] | 1328 | else |
---|
| 1329 | { |
---|
[655] | 1330 | Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); |
---|
| 1331 | Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1); |
---|
| 1332 | Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1); |
---|
| 1333 | if(rpcPic->getIsLongTerm() && curPoc == refPoc) |
---|
[608] | 1334 | { |
---|
| 1335 | isReference = 1; |
---|
| 1336 | rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i)); |
---|
| 1337 | } |
---|
| 1338 | } |
---|
| 1339 | |
---|
[56] | 1340 | } |
---|
[884] | 1341 | #if H_MV |
---|
[872] | 1342 | if( isReference ) // Current picture is in the temporal RPS |
---|
| 1343 | { |
---|
| 1344 | assert( rpcPic->getSlice(0)->getDiscardableFlag() == 0 ); // Temporal RPS shall not contain picture with discardable_flag equal to 1 |
---|
| 1345 | } |
---|
| 1346 | #endif |
---|
[56] | 1347 | // mark the picture as "unused for reference" if it is not in |
---|
| 1348 | // the Reference Picture Set |
---|
| 1349 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && isReference == 0) |
---|
| 1350 | { |
---|
| 1351 | rpcPic->getSlice( 0 )->setReferenced( false ); |
---|
[608] | 1352 | rpcPic->setUsedByCurr(0); |
---|
[56] | 1353 | rpcPic->setIsLongTerm(0); |
---|
| 1354 | } |
---|
[608] | 1355 | //check that pictures of higher temporal layers are not used |
---|
| 1356 | assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getTLayer()<=this->getTLayer()); |
---|
| 1357 | //check that pictures of higher or equal temporal layer are not in the RPS if the current picture is a TSA picture |
---|
[872] | 1358 | if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_R || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N) |
---|
[608] | 1359 | { |
---|
| 1360 | assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getTLayer()<this->getTLayer()); |
---|
| 1361 | } |
---|
| 1362 | //check that pictures marked as temporal layer non-reference pictures are not used for reference |
---|
| 1363 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && rpcPic->getTLayer()==this->getTLayer()) |
---|
| 1364 | { |
---|
| 1365 | assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getSlice( 0 )->getTemporalLayerNonReferenceFlag()==false); |
---|
| 1366 | } |
---|
| 1367 | } |
---|
[56] | 1368 | } |
---|
| 1369 | |
---|
| 1370 | /** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet. |
---|
| 1371 | */ |
---|
[608] | 1372 | Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess) |
---|
[56] | 1373 | { |
---|
| 1374 | TComPic* rpcPic; |
---|
[608] | 1375 | Int i, isAvailable; |
---|
[56] | 1376 | Int atLeastOneLost = 0; |
---|
| 1377 | Int atLeastOneRemoved = 0; |
---|
| 1378 | Int iPocLost = 0; |
---|
| 1379 | |
---|
| 1380 | // loop through all long-term pictures in the Reference Picture Set |
---|
| 1381 | // to see if the picture should be kept as reference picture |
---|
| 1382 | for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
| 1383 | { |
---|
| 1384 | isAvailable = 0; |
---|
| 1385 | // loop through all pictures in the reference picture buffer |
---|
| 1386 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1387 | while ( iterPic != rcListPic.end()) |
---|
| 1388 | { |
---|
| 1389 | rpcPic = *(iterPic++); |
---|
[608] | 1390 | if(pReferencePictureSet->getCheckLTMSBPresent(i)==true) |
---|
[56] | 1391 | { |
---|
[608] | 1392 | if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()) == pReferencePictureSet->getPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
| 1393 | { |
---|
| 1394 | isAvailable = 1; |
---|
| 1395 | } |
---|
[56] | 1396 | } |
---|
[608] | 1397 | else |
---|
| 1398 | { |
---|
[655] | 1399 | Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); |
---|
| 1400 | Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1); |
---|
| 1401 | Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1); |
---|
| 1402 | if(rpcPic->getIsLongTerm() && curPoc == refPoc && rpcPic->getSlice(0)->isReferenced()) |
---|
[608] | 1403 | { |
---|
| 1404 | isAvailable = 1; |
---|
| 1405 | } |
---|
| 1406 | } |
---|
[56] | 1407 | } |
---|
| 1408 | // if there was no such long-term check the short terms |
---|
| 1409 | if(!isAvailable) |
---|
| 1410 | { |
---|
| 1411 | iterPic = rcListPic.begin(); |
---|
| 1412 | while ( iterPic != rcListPic.end()) |
---|
| 1413 | { |
---|
| 1414 | rpcPic = *(iterPic++); |
---|
| 1415 | |
---|
[608] | 1416 | Int pocCycle = 1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC(); |
---|
| 1417 | Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC(); |
---|
| 1418 | Int refPoc = pReferencePictureSet->getPOC(i); |
---|
| 1419 | if (!pReferencePictureSet->getCheckLTMSBPresent(i)) |
---|
[56] | 1420 | { |
---|
[655] | 1421 | curPoc = curPoc & (pocCycle - 1); |
---|
| 1422 | refPoc = refPoc & (pocCycle - 1); |
---|
[608] | 1423 | } |
---|
| 1424 | |
---|
| 1425 | if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc) |
---|
| 1426 | { |
---|
[56] | 1427 | isAvailable = 1; |
---|
| 1428 | rpcPic->setIsLongTerm(1); |
---|
| 1429 | break; |
---|
[2] | 1430 | } |
---|
[56] | 1431 | } |
---|
| 1432 | } |
---|
| 1433 | // report that a picture is lost if it is in the Reference Picture Set |
---|
| 1434 | // but not available as reference picture |
---|
| 1435 | if(isAvailable == 0) |
---|
| 1436 | { |
---|
| 1437 | if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) |
---|
| 1438 | { |
---|
| 1439 | if(!pReferencePictureSet->getUsed(i) ) |
---|
| 1440 | { |
---|
[608] | 1441 | if(printErrors) |
---|
| 1442 | { |
---|
[56] | 1443 | printf("\nLong-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
[608] | 1444 | } |
---|
[56] | 1445 | atLeastOneRemoved = 1; |
---|
[2] | 1446 | } |
---|
[56] | 1447 | else |
---|
| 1448 | { |
---|
[608] | 1449 | if(printErrors) |
---|
| 1450 | { |
---|
[56] | 1451 | printf("\nLong-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
[608] | 1452 | } |
---|
[56] | 1453 | atLeastOneLost = 1; |
---|
| 1454 | iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); |
---|
[2] | 1455 | } |
---|
| 1456 | } |
---|
[56] | 1457 | } |
---|
| 1458 | } |
---|
| 1459 | // loop through all short-term pictures in the Reference Picture Set |
---|
| 1460 | // to see if the picture should be kept as reference picture |
---|
| 1461 | for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++) |
---|
| 1462 | { |
---|
| 1463 | isAvailable = 0; |
---|
| 1464 | // loop through all pictures in the reference picture buffer |
---|
| 1465 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1466 | while ( iterPic != rcListPic.end()) |
---|
| 1467 | { |
---|
| 1468 | rpcPic = *(iterPic++); |
---|
| 1469 | |
---|
| 1470 | if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
| 1471 | { |
---|
| 1472 | isAvailable = 1; |
---|
| 1473 | } |
---|
| 1474 | } |
---|
| 1475 | // report that a picture is lost if it is in the Reference Picture Set |
---|
| 1476 | // but not available as reference picture |
---|
| 1477 | if(isAvailable == 0) |
---|
| 1478 | { |
---|
| 1479 | if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess) |
---|
| 1480 | { |
---|
| 1481 | if(!pReferencePictureSet->getUsed(i) ) |
---|
| 1482 | { |
---|
[608] | 1483 | if(printErrors) |
---|
| 1484 | { |
---|
[56] | 1485 | printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
[608] | 1486 | } |
---|
[56] | 1487 | atLeastOneRemoved = 1; |
---|
| 1488 | } |
---|
| 1489 | else |
---|
| 1490 | { |
---|
[608] | 1491 | if(printErrors) |
---|
| 1492 | { |
---|
[56] | 1493 | printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i)); |
---|
[608] | 1494 | } |
---|
[56] | 1495 | atLeastOneLost = 1; |
---|
| 1496 | iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i); |
---|
| 1497 | } |
---|
| 1498 | } |
---|
| 1499 | } |
---|
| 1500 | } |
---|
| 1501 | if(atLeastOneLost) |
---|
| 1502 | { |
---|
| 1503 | return iPocLost+1; |
---|
[2] | 1504 | } |
---|
[56] | 1505 | if(atLeastOneRemoved) |
---|
| 1506 | { |
---|
| 1507 | return -2; |
---|
| 1508 | } |
---|
| 1509 | else |
---|
[608] | 1510 | { |
---|
[56] | 1511 | return 0; |
---|
[608] | 1512 | } |
---|
[2] | 1513 | } |
---|
| 1514 | |
---|
[56] | 1515 | /** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set |
---|
| 1516 | */ |
---|
[608] | 1517 | Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP) |
---|
[56] | 1518 | { |
---|
| 1519 | TComPic* rpcPic; |
---|
| 1520 | Int i, j; |
---|
| 1521 | Int k = 0; |
---|
| 1522 | Int nrOfNegativePictures = 0; |
---|
| 1523 | Int nrOfPositivePictures = 0; |
---|
| 1524 | TComReferencePictureSet* pcRPS = this->getLocalRPS(); |
---|
| 1525 | |
---|
| 1526 | // loop through all pictures in the Reference Picture Set |
---|
| 1527 | for(i=0;i<pReferencePictureSet->getNumberOfPictures();i++) |
---|
| 1528 | { |
---|
| 1529 | j = 0; |
---|
| 1530 | // loop through all pictures in the reference picture buffer |
---|
| 1531 | TComList<TComPic*>::iterator iterPic = rcListPic.begin(); |
---|
| 1532 | while ( iterPic != rcListPic.end()) |
---|
| 1533 | { |
---|
| 1534 | j++; |
---|
| 1535 | rpcPic = *(iterPic++); |
---|
| 1536 | |
---|
| 1537 | if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) |
---|
| 1538 | { |
---|
| 1539 | // This picture exists as a reference picture |
---|
| 1540 | // and should be added to the explicit Reference Picture Set |
---|
| 1541 | pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i)); |
---|
[608] | 1542 | pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP)); |
---|
[56] | 1543 | if(pcRPS->getDeltaPOC(k) < 0) |
---|
[608] | 1544 | { |
---|
[56] | 1545 | nrOfNegativePictures++; |
---|
[608] | 1546 | } |
---|
[56] | 1547 | else |
---|
[608] | 1548 | { |
---|
[56] | 1549 | nrOfPositivePictures++; |
---|
[608] | 1550 | } |
---|
[56] | 1551 | k++; |
---|
| 1552 | } |
---|
| 1553 | } |
---|
| 1554 | } |
---|
| 1555 | pcRPS->setNumberOfNegativePictures(nrOfNegativePictures); |
---|
| 1556 | pcRPS->setNumberOfPositivePictures(nrOfPositivePictures); |
---|
| 1557 | pcRPS->setNumberOfPictures(nrOfNegativePictures+nrOfPositivePictures); |
---|
| 1558 | // This is a simplistic inter rps example. A smarter encoder will look for a better reference RPS to do the |
---|
| 1559 | // inter RPS prediction with. Here we just use the reference used by pReferencePictureSet. |
---|
| 1560 | // If pReferencePictureSet is not inter_RPS_predicted, then inter_RPS_prediction is for the current RPS also disabled. |
---|
| 1561 | if (!pReferencePictureSet->getInterRPSPrediction()) |
---|
| 1562 | { |
---|
| 1563 | pcRPS->setInterRPSPrediction(false); |
---|
| 1564 | pcRPS->setNumRefIdc(0); |
---|
| 1565 | } |
---|
| 1566 | else |
---|
| 1567 | { |
---|
| 1568 | Int rIdx = this->getRPSidx() - pReferencePictureSet->getDeltaRIdxMinus1() - 1; |
---|
| 1569 | Int deltaRPS = pReferencePictureSet->getDeltaRPS(); |
---|
| 1570 | TComReferencePictureSet* pcRefRPS = this->getSPS()->getRPSList()->getReferencePictureSet(rIdx); |
---|
| 1571 | Int iRefPics = pcRefRPS->getNumberOfPictures(); |
---|
| 1572 | Int iNewIdc=0; |
---|
| 1573 | for(i=0; i<= iRefPics; i++) |
---|
| 1574 | { |
---|
| 1575 | Int deltaPOC = ((i != iRefPics)? pcRefRPS->getDeltaPOC(i) : 0); // check if the reference abs POC is >= 0 |
---|
| 1576 | Int iRefIdc = 0; |
---|
| 1577 | for (j=0; j < pcRPS->getNumberOfPictures(); j++) // loop through the pictures in the new RPS |
---|
| 1578 | { |
---|
| 1579 | if ( (deltaPOC + deltaRPS) == pcRPS->getDeltaPOC(j)) |
---|
| 1580 | { |
---|
| 1581 | if (pcRPS->getUsed(j)) |
---|
| 1582 | { |
---|
| 1583 | iRefIdc = 1; |
---|
| 1584 | } |
---|
| 1585 | else |
---|
| 1586 | { |
---|
| 1587 | iRefIdc = 2; |
---|
| 1588 | } |
---|
| 1589 | } |
---|
| 1590 | } |
---|
| 1591 | pcRPS->setRefIdc(i, iRefIdc); |
---|
| 1592 | iNewIdc++; |
---|
| 1593 | } |
---|
| 1594 | pcRPS->setInterRPSPrediction(true); |
---|
| 1595 | pcRPS->setNumRefIdc(iNewIdc); |
---|
| 1596 | pcRPS->setDeltaRPS(deltaRPS); |
---|
| 1597 | pcRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx()); |
---|
| 1598 | } |
---|
| 1599 | |
---|
| 1600 | this->setRPS(pcRPS); |
---|
| 1601 | this->setRPSidx(-1); |
---|
| 1602 | } |
---|
| 1603 | |
---|
| 1604 | /** get AC and DC values for weighted pred |
---|
| 1605 | * \param *wp |
---|
| 1606 | * \returns Void |
---|
| 1607 | */ |
---|
| 1608 | Void TComSlice::getWpAcDcParam(wpACDCParam *&wp) |
---|
| 1609 | { |
---|
| 1610 | wp = m_weightACDCParam; |
---|
| 1611 | } |
---|
| 1612 | |
---|
| 1613 | /** init AC and DC values for weighted pred |
---|
| 1614 | * \returns Void |
---|
| 1615 | */ |
---|
| 1616 | Void TComSlice::initWpAcDcParam() |
---|
| 1617 | { |
---|
| 1618 | for(Int iComp = 0; iComp < 3; iComp++ ) |
---|
| 1619 | { |
---|
| 1620 | m_weightACDCParam[iComp].iAC = 0; |
---|
| 1621 | m_weightACDCParam[iComp].iDC = 0; |
---|
| 1622 | } |
---|
| 1623 | } |
---|
| 1624 | |
---|
| 1625 | /** get WP tables for weighted pred |
---|
| 1626 | * \param RefPicList |
---|
| 1627 | * \param iRefIdx |
---|
| 1628 | * \param *&wpScalingParam |
---|
| 1629 | * \returns Void |
---|
| 1630 | */ |
---|
| 1631 | Void TComSlice::getWpScaling( RefPicList e, Int iRefIdx, wpScalingParam *&wp ) |
---|
| 1632 | { |
---|
| 1633 | wp = m_weightPredTable[e][iRefIdx]; |
---|
| 1634 | } |
---|
| 1635 | |
---|
| 1636 | /** reset Default WP tables settings : no weight. |
---|
| 1637 | * \param wpScalingParam |
---|
| 1638 | * \returns Void |
---|
| 1639 | */ |
---|
[608] | 1640 | Void TComSlice::resetWpScaling() |
---|
[2] | 1641 | { |
---|
[608] | 1642 | for ( Int e=0 ; e<2 ; e++ ) |
---|
[56] | 1643 | { |
---|
[608] | 1644 | for ( Int i=0 ; i<MAX_NUM_REF ; i++ ) |
---|
[56] | 1645 | { |
---|
[608] | 1646 | for ( Int yuv=0 ; yuv<3 ; yuv++ ) |
---|
[56] | 1647 | { |
---|
[608] | 1648 | wpScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); |
---|
[2] | 1649 | pwp->bPresentFlag = false; |
---|
| 1650 | pwp->uiLog2WeightDenom = 0; |
---|
| 1651 | pwp->uiLog2WeightDenom = 0; |
---|
| 1652 | pwp->iWeight = 1; |
---|
| 1653 | pwp->iOffset = 0; |
---|
| 1654 | } |
---|
[56] | 1655 | } |
---|
[2] | 1656 | } |
---|
| 1657 | } |
---|
| 1658 | |
---|
[56] | 1659 | /** init WP table |
---|
| 1660 | * \returns Void |
---|
| 1661 | */ |
---|
[2] | 1662 | Void TComSlice::initWpScaling() |
---|
| 1663 | { |
---|
[608] | 1664 | for ( Int e=0 ; e<2 ; e++ ) |
---|
[56] | 1665 | { |
---|
[608] | 1666 | for ( Int i=0 ; i<MAX_NUM_REF ; i++ ) |
---|
[56] | 1667 | { |
---|
[608] | 1668 | for ( Int yuv=0 ; yuv<3 ; yuv++ ) |
---|
[56] | 1669 | { |
---|
[608] | 1670 | wpScalingParam *pwp = &(m_weightPredTable[e][i][yuv]); |
---|
| 1671 | if ( !pwp->bPresentFlag ) |
---|
| 1672 | { |
---|
[2] | 1673 | // Inferring values not present : |
---|
| 1674 | pwp->iWeight = (1 << pwp->uiLog2WeightDenom); |
---|
| 1675 | pwp->iOffset = 0; |
---|
| 1676 | } |
---|
| 1677 | |
---|
| 1678 | pwp->w = pwp->iWeight; |
---|
[608] | 1679 | Int bitDepth = yuv ? g_bitDepthC : g_bitDepthY; |
---|
| 1680 | pwp->o = pwp->iOffset << (bitDepth-8); |
---|
[2] | 1681 | pwp->shift = pwp->uiLog2WeightDenom; |
---|
| 1682 | pwp->round = (pwp->uiLog2WeightDenom>=1) ? (1 << (pwp->uiLog2WeightDenom-1)) : (0); |
---|
| 1683 | } |
---|
[56] | 1684 | } |
---|
[2] | 1685 | } |
---|
| 1686 | } |
---|
| 1687 | |
---|
[608] | 1688 | // ------------------------------------------------------------------------------------------------ |
---|
| 1689 | // Video parameter set (VPS) |
---|
| 1690 | // ------------------------------------------------------------------------------------------------ |
---|
| 1691 | TComVPS::TComVPS() |
---|
| 1692 | : m_VPSId ( 0) |
---|
| 1693 | , m_uiMaxTLayers ( 1) |
---|
[622] | 1694 | #if H_MV |
---|
| 1695 | , m_uiMaxLayersMinus1 ( 0) |
---|
| 1696 | #else |
---|
[608] | 1697 | , m_uiMaxLayers ( 1) |
---|
[622] | 1698 | #endif |
---|
[608] | 1699 | , m_bTemporalIdNestingFlag (false) |
---|
| 1700 | , m_numHrdParameters ( 0) |
---|
| 1701 | #if H_MV |
---|
| 1702 | , m_maxLayerId ( 0) |
---|
| 1703 | #else |
---|
| 1704 | , m_maxNuhReservedZeroLayerId ( 0) |
---|
| 1705 | #endif |
---|
| 1706 | , m_hrdParameters (NULL) |
---|
| 1707 | , m_hrdOpSetIdx (NULL) |
---|
| 1708 | , m_cprmsPresentFlag (NULL) |
---|
[773] | 1709 | #if H_MV |
---|
[738] | 1710 | , m_dpbSize (NULL) |
---|
[622] | 1711 | , m_vpsVUI ( NULL ) |
---|
| 1712 | #endif |
---|
[2] | 1713 | { |
---|
[608] | 1714 | for( Int i = 0; i < MAX_TLAYER; i++) |
---|
[56] | 1715 | { |
---|
[608] | 1716 | m_numReorderPics[i] = 0; |
---|
| 1717 | m_uiMaxDecPicBuffering[i] = 1; |
---|
| 1718 | m_uiMaxLatencyIncrease[i] = 0; |
---|
| 1719 | } |
---|
| 1720 | #if H_MV |
---|
| 1721 | for (Int lsIdx = 0; lsIdx < MAX_VPS_OP_SETS_PLUS1; lsIdx++ ) |
---|
| 1722 | { |
---|
| 1723 | for( Int layerId = 0; layerId < MAX_VPS_NUH_LAYER_ID_PLUS1; layerId++ ) |
---|
[56] | 1724 | { |
---|
[738] | 1725 | m_layerIdIncludedFlag[lsIdx][layerId] = (( lsIdx == 0 ) && ( layerId == 0 )) ; |
---|
[56] | 1726 | } |
---|
[608] | 1727 | } |
---|
| 1728 | m_vpsNumProfileTierLevelMinus1 = -1; |
---|
| 1729 | |
---|
[872] | 1730 | m_numAddOutputLayerSets = -1; |
---|
| 1731 | m_defaultTargetOutputLayerIdc = 0; |
---|
[608] | 1732 | |
---|
| 1733 | for ( Int i = 0; i < MAX_VPS_OUTPUTLAYER_SETS; i++) |
---|
| 1734 | { |
---|
| 1735 | m_outputLayerSetIdxMinus1[i] = -1; |
---|
| 1736 | m_profileLevelTierIdx[i] = 0; |
---|
| 1737 | for ( Int j = 0; j < MAX_VPS_NUH_LAYER_ID_PLUS1; j++) |
---|
| 1738 | { |
---|
| 1739 | m_outputLayerFlag[i][j] = false; |
---|
| 1740 | } |
---|
[872] | 1741 | m_altOutputLayerFlag[ i ] = false; |
---|
[608] | 1742 | } |
---|
| 1743 | m_maxOneActiveRefLayerFlag = false; |
---|
| 1744 | m_directDepTypeLenMinus2 = 0; |
---|
| 1745 | |
---|
| 1746 | |
---|
| 1747 | m_avcBaseLayerFlag = false; |
---|
[872] | 1748 | m_vpsNonVuiExtensionLength = 0; |
---|
[608] | 1749 | m_splittingFlag = false; |
---|
| 1750 | |
---|
| 1751 | for( Int i = 0; i < MAX_NUM_SCALABILITY_TYPES; i++ ) |
---|
| 1752 | { |
---|
[622] | 1753 | m_scalabilityMaskFlag[i] = false; |
---|
[608] | 1754 | m_dimensionIdLen [i] = -1; |
---|
| 1755 | } |
---|
| 1756 | |
---|
| 1757 | m_vpsNuhLayerIdPresentFlag = false; |
---|
| 1758 | |
---|
| 1759 | for( Int i = 0; i < MAX_VPS_OP_SETS_PLUS1; i++ ) |
---|
| 1760 | { |
---|
| 1761 | m_vpsProfilePresentFlag [i] = false; |
---|
| 1762 | m_outputLayerSetIdxMinus1 [i] = 0; |
---|
| 1763 | for( Int j = 0; j < MAX_VPS_NUH_LAYER_ID_PLUS1; j++ ) |
---|
| 1764 | { |
---|
| 1765 | m_outputLayerFlag[i][j] = false; |
---|
| 1766 | } |
---|
| 1767 | } |
---|
| 1768 | |
---|
| 1769 | for( Int i = 0; i < MAX_NUM_LAYER_IDS; i++ ) |
---|
| 1770 | { |
---|
| 1771 | m_layerIdInVps[i] = (i == 0 ) ? 0 : -1; |
---|
| 1772 | } |
---|
| 1773 | |
---|
| 1774 | for( Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
| 1775 | { |
---|
| 1776 | m_layerIdInNuh [i] = ( i == 0 ) ? 0 : -1; |
---|
| 1777 | m_numDirectRefLayers[i] = 0; |
---|
[622] | 1778 | m_vpsRepFormatIdx [i] = 0; |
---|
[738] | 1779 | m_pocLsbNotPresentFlag[i] = 0; |
---|
[622] | 1780 | m_repFormat [i] = NULL; |
---|
| 1781 | m_viewIdVal [i] = 0; |
---|
| 1782 | |
---|
[608] | 1783 | #if H_3D |
---|
| 1784 | m_viewIndex [i] = -1; |
---|
| 1785 | m_vpsDepthModesFlag [i] = false; |
---|
| 1786 | m_ivMvScalingFlag = true; |
---|
| 1787 | #endif |
---|
| 1788 | |
---|
| 1789 | for( Int j = 0; j < MAX_NUM_LAYERS; j++ ) |
---|
| 1790 | { |
---|
| 1791 | m_directDependencyFlag[i][j] = false; |
---|
| 1792 | m_directDependencyType[i][j] = -1; |
---|
| 1793 | m_refLayerId[i][j] = -1; |
---|
[738] | 1794 | m_maxTidIlRefPicsPlus1[i][j] = 7; |
---|
[608] | 1795 | } |
---|
| 1796 | |
---|
| 1797 | for( Int j = 0; j < MAX_NUM_SCALABILITY_TYPES; j++ ) |
---|
| 1798 | { |
---|
| 1799 | m_dimensionId[i][j] = 0; |
---|
| 1800 | } |
---|
| 1801 | #if H_3D_ARP |
---|
| 1802 | m_uiUseAdvResPred[i] = 0; |
---|
| 1803 | m_uiARPStepNum[i] = 1; |
---|
| 1804 | #endif |
---|
| 1805 | } |
---|
[622] | 1806 | m_vpsVUI = new TComVPSVUI; |
---|
[738] | 1807 | m_dpbSize = new TComDpbSize; |
---|
[773] | 1808 | |
---|
[608] | 1809 | #if H_3D |
---|
| 1810 | for( Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
| 1811 | { |
---|
| 1812 | #if H_3D_IV_MERGE |
---|
| 1813 | m_ivMvPredFlag [ i ] = false; |
---|
[773] | 1814 | #if H_3D_SPIVMP |
---|
[724] | 1815 | m_iSubPULog2Size [ i ] = 0; |
---|
[608] | 1816 | #endif |
---|
[724] | 1817 | #endif |
---|
[608] | 1818 | #if H_3D_VSP |
---|
| 1819 | m_viewSynthesisPredFlag[ i ] = false; |
---|
| 1820 | #endif |
---|
| 1821 | #if H_3D_NBDV_REF |
---|
| 1822 | m_depthRefinementFlag [ i ] = false; |
---|
| 1823 | #endif |
---|
[655] | 1824 | #if H_3D_INTER_SDC |
---|
[608] | 1825 | m_bInterSDCFlag [ i ] = false; |
---|
| 1826 | #endif |
---|
[833] | 1827 | #if H_3D_DBBP |
---|
| 1828 | m_dbbpFlag [ i ] = false; |
---|
| 1829 | #endif |
---|
[773] | 1830 | #if H_3D_IV_MERGE |
---|
[724] | 1831 | m_bMPIFlag [ i ] = false; |
---|
| 1832 | #endif |
---|
[608] | 1833 | } |
---|
| 1834 | #endif |
---|
| 1835 | #endif |
---|
[56] | 1836 | } |
---|
[608] | 1837 | |
---|
| 1838 | TComVPS::~TComVPS() |
---|
[56] | 1839 | { |
---|
[773] | 1840 | if( m_hrdParameters != NULL ) delete[] m_hrdParameters; |
---|
[608] | 1841 | if( m_hrdOpSetIdx != NULL ) delete[] m_hrdOpSetIdx; |
---|
| 1842 | if( m_cprmsPresentFlag != NULL ) delete[] m_cprmsPresentFlag; |
---|
[622] | 1843 | #if H_MV |
---|
| 1844 | if ( m_vpsVUI != NULL ) delete m_vpsVUI; |
---|
[738] | 1845 | if ( m_dpbSize != NULL ) delete m_dpbSize; |
---|
| 1846 | |
---|
[622] | 1847 | for( Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
| 1848 | { |
---|
| 1849 | if (m_repFormat[ i ] != NULL ) delete m_repFormat[ i ]; |
---|
| 1850 | } |
---|
| 1851 | #endif |
---|
[773] | 1852 | #if H_3D |
---|
[758] | 1853 | deleteCamPars(); |
---|
| 1854 | #endif |
---|
[608] | 1855 | } |
---|
| 1856 | |
---|
| 1857 | #if H_MV |
---|
| 1858 | |
---|
| 1859 | Bool TComVPS::checkVPSExtensionSyntax() |
---|
| 1860 | { |
---|
[622] | 1861 | for( Int layer = 1; layer <= getMaxLayersMinus1(); layer++ ) |
---|
[608] | 1862 | { |
---|
| 1863 | // check layer_id_in_nuh constraint |
---|
| 1864 | assert( getLayerIdInNuh( layer ) > getLayerIdInNuh( layer -1 ) ); |
---|
| 1865 | } |
---|
| 1866 | return true; |
---|
[56] | 1867 | } |
---|
[608] | 1868 | |
---|
| 1869 | Int TComVPS::getNumScalabilityTypes() |
---|
[2] | 1870 | { |
---|
[608] | 1871 | return scalTypeToScalIdx( ScalabilityType(MAX_NUM_SCALABILITY_TYPES) ); |
---|
| 1872 | } |
---|
| 1873 | |
---|
| 1874 | Int TComVPS::scalTypeToScalIdx( ScalabilityType scalType ) |
---|
| 1875 | { |
---|
| 1876 | assert( scalType >= 0 && scalType <= MAX_NUM_SCALABILITY_TYPES ); |
---|
[622] | 1877 | assert( scalType == MAX_NUM_SCALABILITY_TYPES || getScalabilityMaskFlag( scalType ) ); |
---|
[608] | 1878 | Int scalIdx = 0; |
---|
| 1879 | for( Int curScalType = 0; curScalType < scalType; curScalType++ ) |
---|
[2] | 1880 | { |
---|
[622] | 1881 | scalIdx += ( getScalabilityMaskFlag( curScalType ) ? 1 : 0 ); |
---|
| 1882 | |
---|
[2] | 1883 | } |
---|
[608] | 1884 | |
---|
| 1885 | return scalIdx; |
---|
[2] | 1886 | } |
---|
[622] | 1887 | Void TComVPS::setScalabilityMaskFlag( UInt val ) |
---|
| 1888 | { |
---|
| 1889 | for ( Int scalType = 0; scalType < MAX_NUM_SCALABILITY_TYPES; scalType++ ) |
---|
| 1890 | { |
---|
| 1891 | setScalabilityMaskFlag( scalType, ( val & (1 << scalType ) ) != 0 ); |
---|
| 1892 | } |
---|
| 1893 | } |
---|
[189] | 1894 | |
---|
[608] | 1895 | Void TComVPS::setRefLayers() |
---|
| 1896 | { |
---|
[622] | 1897 | for( Int i = 0; i <= getMaxLayersMinus1(); i++ ) |
---|
| 1898 | { |
---|
| 1899 | Int iNuhLId = getLayerIdInNuh( i ); |
---|
| 1900 | m_numDirectRefLayers[ iNuhLId ] = 0; |
---|
| 1901 | for( Int j = 0; j < i; j++ ) |
---|
| 1902 | { |
---|
| 1903 | if( getDirectDependencyFlag(i , j) ) |
---|
| 1904 | { |
---|
| 1905 | m_refLayerId[ iNuhLId ][m_numDirectRefLayers[ iNuhLId ]++ ] = getLayerIdInNuh( j ); |
---|
| 1906 | } |
---|
| 1907 | } |
---|
| 1908 | } |
---|
| 1909 | } |
---|
| 1910 | |
---|
| 1911 | Int TComVPS::getRefLayerId( Int layerIdInNuh, Int idx ) |
---|
| 1912 | { |
---|
| 1913 | assert( idx >= 0 && idx < m_numDirectRefLayers[layerIdInNuh] ); |
---|
| 1914 | Int refLayerIdInNuh = m_refLayerId[ layerIdInNuh ][ idx ]; |
---|
| 1915 | assert ( refLayerIdInNuh >= 0 ); |
---|
| 1916 | return refLayerIdInNuh; |
---|
| 1917 | } |
---|
| 1918 | |
---|
| 1919 | Int TComVPS::getScalabilityId( Int layerIdInVps, ScalabilityType scalType ) |
---|
| 1920 | { |
---|
| 1921 | return getScalabilityMaskFlag( scalType ) ? getDimensionId( layerIdInVps, scalTypeToScalIdx( scalType ) ) : 0; |
---|
| 1922 | } |
---|
| 1923 | |
---|
| 1924 | #if H_3D |
---|
| 1925 | Int TComVPS::getLayerIdInNuh( Int viewIndex, Bool depthFlag ) |
---|
| 1926 | { |
---|
| 1927 | Int foundLayerIdinNuh = -1; |
---|
| 1928 | |
---|
| 1929 | for (Int layerIdInVps = 0 ; layerIdInVps <= getMaxLayersMinus1(); layerIdInVps++ ) |
---|
| 1930 | { |
---|
| 1931 | Int layerIdInNuh = getLayerIdInNuh( layerIdInVps ); |
---|
| 1932 | if( ( getViewIndex( layerIdInNuh ) == viewIndex ) && ( getDepthId( layerIdInNuh ) == ( depthFlag ? 1 : 0 ) ) ) |
---|
| 1933 | { |
---|
| 1934 | foundLayerIdinNuh = layerIdInNuh; |
---|
| 1935 | break; |
---|
| 1936 | } |
---|
| 1937 | } |
---|
| 1938 | assert( foundLayerIdinNuh != -1 ); |
---|
| 1939 | |
---|
| 1940 | return foundLayerIdinNuh; |
---|
| 1941 | } |
---|
[773] | 1942 | |
---|
[758] | 1943 | Void TComVPS::createCamPars(Int iNumViews) |
---|
| 1944 | { |
---|
| 1945 | Int i = 0, j = 0; |
---|
| 1946 | |
---|
| 1947 | m_bCamParPresent = new Bool[ iNumViews ]; |
---|
| 1948 | m_bCamParInSliceHeader = new Bool[ iNumViews ]; |
---|
| 1949 | |
---|
| 1950 | m_aaaiCodedScale = new Int**[ iNumViews ]; |
---|
| 1951 | m_aaaiCodedOffset = new Int**[ iNumViews ]; |
---|
| 1952 | for ( i = 0; i < iNumViews ; i++ ) |
---|
| 1953 | { |
---|
[872] | 1954 | m_bCamParInSliceHeader[i] = false; |
---|
[758] | 1955 | m_aaaiCodedScale[i] = new Int*[ 2 ]; |
---|
| 1956 | m_aaaiCodedOffset[i] = new Int*[ 2 ]; |
---|
| 1957 | for ( j = 0; j < 2; j++ ) |
---|
| 1958 | { |
---|
| 1959 | m_aaaiCodedScale[i][j] = new Int[ MAX_NUM_LAYERS ]; |
---|
| 1960 | m_aaaiCodedOffset[i][j] = new Int[ MAX_NUM_LAYERS ]; |
---|
| 1961 | for ( Int k = 0; k < MAX_NUM_LAYERS; k++ ) |
---|
| 1962 | { |
---|
| 1963 | m_aaaiCodedScale[i][j][k] = 0; |
---|
| 1964 | m_aaaiCodedOffset[i][j][k] = 0; |
---|
| 1965 | } |
---|
| 1966 | } |
---|
| 1967 | } |
---|
| 1968 | } |
---|
| 1969 | |
---|
| 1970 | Void TComVPS::deleteCamPars() |
---|
| 1971 | { |
---|
| 1972 | Int iNumViews = getNumViews(); |
---|
| 1973 | Int i = 0, j = 0; |
---|
| 1974 | |
---|
| 1975 | if ( m_bCamParPresent != NULL ) |
---|
| 1976 | { |
---|
| 1977 | delete [] m_bCamParPresent; |
---|
| 1978 | } |
---|
| 1979 | if ( m_bCamParInSliceHeader != NULL ) |
---|
| 1980 | { |
---|
| 1981 | delete [] m_bCamParInSliceHeader; |
---|
| 1982 | } |
---|
| 1983 | |
---|
| 1984 | if ( m_aaaiCodedScale != NULL ) |
---|
| 1985 | { |
---|
| 1986 | for ( i = 0; i < iNumViews ; i++ ) |
---|
| 1987 | { |
---|
| 1988 | for ( j = 0; j < 2; j++ ) |
---|
| 1989 | { |
---|
| 1990 | delete [] m_aaaiCodedScale[i][j]; |
---|
| 1991 | } |
---|
| 1992 | delete [] m_aaaiCodedScale[i]; |
---|
| 1993 | } |
---|
| 1994 | delete [] m_aaaiCodedScale; |
---|
| 1995 | } |
---|
| 1996 | |
---|
| 1997 | if ( m_aaaiCodedOffset != NULL ) |
---|
| 1998 | { |
---|
| 1999 | for ( i = 0; i < iNumViews ; i++ ) |
---|
| 2000 | { |
---|
| 2001 | for ( j = 0; j < 2; j++ ) |
---|
| 2002 | { |
---|
| 2003 | delete [] m_aaaiCodedOffset[i][j]; |
---|
| 2004 | } |
---|
| 2005 | delete [] m_aaaiCodedOffset[i]; |
---|
| 2006 | } |
---|
| 2007 | delete [] m_aaaiCodedOffset; |
---|
| 2008 | } |
---|
| 2009 | } |
---|
| 2010 | |
---|
| 2011 | |
---|
| 2012 | Void |
---|
| 2013 | TComVPS::initCamParaVPS( UInt uiViewIndex, Bool bCamParPresent, UInt uiCamParPrecision, Bool bCamParSlice, Int** aaiScale, Int** aaiOffset ) |
---|
| 2014 | { |
---|
| 2015 | AOT( uiViewIndex != 0 && !bCamParSlice && ( aaiScale == 0 || aaiOffset == 0 ) ); |
---|
| 2016 | |
---|
| 2017 | m_uiCamParPrecision = ( ( uiViewIndex != 0 )? uiCamParPrecision : 0 ); |
---|
| 2018 | m_bCamParPresent[ uiViewIndex ] = (( uiViewIndex != 0 )? bCamParPresent : false ); |
---|
| 2019 | m_bCamParInSliceHeader[ uiViewIndex ] = ( (uiViewIndex != 0)? bCamParSlice : false ); |
---|
| 2020 | |
---|
| 2021 | if( !m_bCamParInSliceHeader[ uiViewIndex ] ) |
---|
| 2022 | { |
---|
| 2023 | for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < uiViewIndex; uiBaseViewIndex++ ) |
---|
| 2024 | { |
---|
| 2025 | m_aaaiCodedScale [ uiViewIndex ][ 0 ][ uiBaseViewIndex ] = aaiScale [ uiBaseViewIndex ][ uiViewIndex ]; |
---|
| 2026 | m_aaaiCodedScale [ uiViewIndex ][ 1 ][ uiBaseViewIndex ] = aaiScale [ uiViewIndex ][ uiBaseViewIndex ]; |
---|
| 2027 | m_aaaiCodedOffset[ uiViewIndex ][ 0 ][ uiBaseViewIndex ] = aaiOffset[ uiBaseViewIndex ][ uiViewIndex ]; |
---|
| 2028 | m_aaaiCodedOffset[ uiViewIndex ][ 1 ][ uiBaseViewIndex ] = aaiOffset[ uiViewIndex ][ uiBaseViewIndex ]; |
---|
| 2029 | } |
---|
| 2030 | } |
---|
| 2031 | } |
---|
| 2032 | |
---|
[622] | 2033 | #endif // H_3D |
---|
[189] | 2034 | |
---|
[608] | 2035 | |
---|
| 2036 | Int TComVPS::xGetDimBitOffset( Int j ) |
---|
| 2037 | { |
---|
| 2038 | Int dimBitOffset = 0; |
---|
| 2039 | if ( getSplittingFlag() && j == getNumScalabilityTypes() ) |
---|
| 2040 | { |
---|
| 2041 | dimBitOffset = 6; |
---|
| 2042 | } |
---|
[443] | 2043 | else |
---|
| 2044 | { |
---|
[608] | 2045 | for (Int dimIdx = 0; dimIdx <= j-1; dimIdx++) |
---|
[443] | 2046 | { |
---|
[608] | 2047 | dimBitOffset += getDimensionIdLen( dimIdx ); |
---|
[443] | 2048 | } |
---|
| 2049 | } |
---|
[608] | 2050 | return dimBitOffset; |
---|
[443] | 2051 | } |
---|
[608] | 2052 | |
---|
| 2053 | Int TComVPS::inferDimensionId( Int i, Int j ) |
---|
[210] | 2054 | { |
---|
[608] | 2055 | return ( ( getLayerIdInNuh( i ) & ( (1 << xGetDimBitOffset( j + 1 ) ) - 1) ) >> xGetDimBitOffset( j ) ); |
---|
[210] | 2056 | } |
---|
| 2057 | |
---|
[608] | 2058 | Int TComVPS::inferLastDimsionIdLenMinus1() |
---|
[210] | 2059 | { |
---|
[608] | 2060 | return ( 5 - xGetDimBitOffset( getNumScalabilityTypes() - 1 ) ); |
---|
[210] | 2061 | } |
---|
[608] | 2062 | |
---|
| 2063 | Int TComVPS::getNumLayersInIdList( Int lsIdx ) |
---|
[77] | 2064 | { |
---|
[608] | 2065 | assert( lsIdx >= 0 ); |
---|
| 2066 | assert( lsIdx <= getVpsNumLayerSetsMinus1() ); |
---|
[738] | 2067 | return (Int) m_layerSetLayerIdList[ lsIdx ].size(); |
---|
[77] | 2068 | } |
---|
[738] | 2069 | |
---|
| 2070 | Int TComVPS::getNumOutputLayerSets() |
---|
| 2071 | { |
---|
[872] | 2072 | return getNumAddOutputLayerSets() + getVpsNumLayerSetsMinus1() + 1; |
---|
[738] | 2073 | } |
---|
| 2074 | |
---|
[622] | 2075 | Int TComVPS::getNumViews() |
---|
| 2076 | { |
---|
| 2077 | Int numViews = 1; |
---|
| 2078 | for( Int i = 0; i <= getMaxLayersMinus1(); i++ ) |
---|
| 2079 | { |
---|
| 2080 | Int lId = getLayerIdInNuh( i ); |
---|
| 2081 | if ( i > 0 && ( getViewIndex( lId ) != getScalabilityId( i - 1, VIEW_ORDER_INDEX ) ) ) |
---|
| 2082 | { |
---|
| 2083 | numViews++; |
---|
| 2084 | } |
---|
| 2085 | } |
---|
| 2086 | |
---|
| 2087 | return numViews; |
---|
| 2088 | } |
---|
| 2089 | |
---|
| 2090 | Bool TComVPS::getInDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps, Int depth /*= 0 */ ) |
---|
| 2091 | { |
---|
| 2092 | assert( depth < 65 ); |
---|
| 2093 | Bool dependentFlag = getDirectDependencyFlag( depLayeridInVps, refLayeridInVps ); |
---|
| 2094 | |
---|
| 2095 | for( Int i = 0; i < depLayeridInVps && !dependentFlag; i++ ) |
---|
| 2096 | { |
---|
| 2097 | if ( getDirectDependencyFlag( depLayeridInVps, i ) ) |
---|
| 2098 | { |
---|
| 2099 | dependentFlag = getInDirectDependencyFlag( i, refLayeridInVps, depth++ ); |
---|
| 2100 | } |
---|
| 2101 | } |
---|
| 2102 | return dependentFlag; |
---|
| 2103 | } |
---|
[738] | 2104 | |
---|
| 2105 | Void TComVPS::deriveLayerSetLayerIdList() |
---|
| 2106 | { |
---|
| 2107 | m_layerSetLayerIdList.resize( getVpsNumLayerSetsMinus1() + 1 ); |
---|
| 2108 | for (Int i = 0; i <= getVpsNumLayerSetsMinus1(); i++ ) |
---|
| 2109 | { |
---|
| 2110 | for( Int m = 0; m <= getVpsMaxLayerId(); m++ ) |
---|
| 2111 | { |
---|
| 2112 | if( getLayerIdIncludedFlag( i, m) ) |
---|
| 2113 | { |
---|
| 2114 | m_layerSetLayerIdList[ i ].push_back( m ); |
---|
| 2115 | } |
---|
| 2116 | } |
---|
| 2117 | } |
---|
| 2118 | } |
---|
| 2119 | |
---|
[872] | 2120 | Void TComVPS::initTargetLayerIdLists() |
---|
| 2121 | { |
---|
| 2122 | m_targetDecLayerIdLists.resize( getNumOutputLayerSets() ); |
---|
| 2123 | m_targetOptLayerIdLists.resize( getNumOutputLayerSets() ); |
---|
| 2124 | } |
---|
| 2125 | |
---|
| 2126 | Void TComVPS::deriveTargetLayerIdList( Int i ) |
---|
| 2127 | { |
---|
| 2128 | Int lsIdx = getLayerSetIdxForOutputLayerSet( i ); |
---|
| 2129 | |
---|
| 2130 | for( Int j = 0; j < getNumLayersInIdList( lsIdx ); j++ ) |
---|
| 2131 | { |
---|
| 2132 | m_targetDecLayerIdLists[i].push_back( m_layerSetLayerIdList[ lsIdx ][ j ] ); |
---|
| 2133 | if( getOutputLayerFlag( i, j )) |
---|
| 2134 | { |
---|
| 2135 | m_targetOptLayerIdLists[i].push_back( m_layerSetLayerIdList[ lsIdx ][ j ] ); |
---|
| 2136 | } |
---|
| 2137 | } |
---|
| 2138 | } |
---|
[884] | 2139 | |
---|
| 2140 | Bool TComVPS::inferOutputLayerFlag( Int i, Int j ) |
---|
[738] | 2141 | { |
---|
[884] | 2142 | Bool outputLayerFlag; |
---|
| 2143 | switch ( getDefaultTargetOutputLayerIdc( ) ) |
---|
[738] | 2144 | { |
---|
[884] | 2145 | case 0: |
---|
| 2146 | outputLayerFlag = true; |
---|
| 2147 | break; |
---|
| 2148 | case 1: |
---|
| 2149 | outputLayerFlag = ( j == m_layerSetLayerIdList[ getLayerSetIdxForOutputLayerSet( i ) ].size() - 1 ); |
---|
| 2150 | break; |
---|
| 2151 | case 2: |
---|
| 2152 | if ( i == 0 && j == 0) |
---|
| 2153 | { |
---|
| 2154 | outputLayerFlag = true; // This is a software only fix for a bug in the spec. In spec outputLayerFlag is neither present nor inferred. |
---|
| 2155 | } |
---|
| 2156 | else |
---|
[738] | 2157 | { |
---|
[884] | 2158 | assert( 0 ); |
---|
| 2159 | } |
---|
| 2160 | break; |
---|
| 2161 | default: |
---|
| 2162 | assert( 0 ); |
---|
| 2163 | break; |
---|
[738] | 2164 | } |
---|
[884] | 2165 | return outputLayerFlag; |
---|
[738] | 2166 | } |
---|
[872] | 2167 | |
---|
[884] | 2168 | Int TComVPS::getMaxSubLayersInLayerSetMinus1( Int i ) |
---|
| 2169 | { |
---|
| 2170 | Int maxSLMinus1 = 0; |
---|
| 2171 | Int optLsIdx = getLayerSetIdxForOutputLayerSet( i ); |
---|
| 2172 | for( Int k = 0; k < getNumLayersInIdList( optLsIdx ); k++ ) |
---|
| 2173 | { |
---|
| 2174 | Int lId = m_layerSetLayerIdList[optLsIdx][k]; |
---|
| 2175 | maxSLMinus1 = std::max( maxSLMinus1, getSubLayersVpsMaxMinus1( getLayerIdInVps( lId ) )); |
---|
| 2176 | } |
---|
| 2177 | return maxSLMinus1; |
---|
| 2178 | } |
---|
| 2179 | |
---|
[608] | 2180 | #endif // H_MV |
---|
[56] | 2181 | |
---|
[2] | 2182 | // ------------------------------------------------------------------------------------------------ |
---|
| 2183 | // Sequence parameter set (SPS) |
---|
| 2184 | // ------------------------------------------------------------------------------------------------ |
---|
| 2185 | |
---|
| 2186 | TComSPS::TComSPS() |
---|
[56] | 2187 | : m_SPSId ( 0) |
---|
[608] | 2188 | , m_VPSId ( 0) |
---|
[56] | 2189 | , m_chromaFormatIdc (CHROMA_420) |
---|
| 2190 | , m_uiMaxTLayers ( 1) |
---|
| 2191 | // Structure |
---|
| 2192 | , m_picWidthInLumaSamples (352) |
---|
| 2193 | , m_picHeightInLumaSamples (288) |
---|
[608] | 2194 | , m_log2MinCodingBlockSize ( 0) |
---|
| 2195 | , m_log2DiffMaxMinCodingBlockSize (0) |
---|
[56] | 2196 | , m_uiMaxCUWidth ( 32) |
---|
| 2197 | , m_uiMaxCUHeight ( 32) |
---|
| 2198 | , m_uiMaxCUDepth ( 3) |
---|
| 2199 | , m_bLongTermRefsPresent (false) |
---|
| 2200 | , m_uiQuadtreeTULog2MaxSize ( 0) |
---|
| 2201 | , m_uiQuadtreeTULog2MinSize ( 0) |
---|
| 2202 | , m_uiQuadtreeTUMaxDepthInter ( 0) |
---|
| 2203 | , m_uiQuadtreeTUMaxDepthIntra ( 0) |
---|
| 2204 | // Tool list |
---|
| 2205 | , m_usePCM (false) |
---|
| 2206 | , m_pcmLog2MaxSize ( 5) |
---|
| 2207 | , m_uiPCMLog2MinSize ( 7) |
---|
[608] | 2208 | #if H_3D_QTLPC |
---|
| 2209 | , m_bUseQTL (false) |
---|
| 2210 | , m_bUsePC (false) |
---|
[210] | 2211 | #endif |
---|
[608] | 2212 | , m_bitDepthY ( 8) |
---|
| 2213 | , m_bitDepthC ( 8) |
---|
[56] | 2214 | , m_qpBDOffsetY ( 0) |
---|
| 2215 | , m_qpBDOffsetC ( 0) |
---|
| 2216 | , m_uiPCMBitDepthLuma ( 8) |
---|
| 2217 | , m_uiPCMBitDepthChroma ( 8) |
---|
| 2218 | , m_bPCMFilterDisableFlag (false) |
---|
| 2219 | , m_uiBitsForPOC ( 8) |
---|
[608] | 2220 | , m_numLongTermRefPicSPS ( 0) |
---|
[56] | 2221 | , m_uiMaxTrSize ( 32) |
---|
| 2222 | , m_bUseSAO (false) |
---|
| 2223 | , m_bTemporalIdNestingFlag (false) |
---|
| 2224 | , m_scalingListEnabledFlag (false) |
---|
[608] | 2225 | , m_useStrongIntraSmoothing (false) |
---|
| 2226 | , m_vuiParametersPresentFlag (false) |
---|
| 2227 | , m_vuiParameters () |
---|
| 2228 | #if H_MV |
---|
[622] | 2229 | , m_pcVPS ( NULL ) |
---|
| 2230 | , m_spsInferScalingListFlag ( false ) |
---|
| 2231 | , m_spsScalingListRefLayerId ( 0 ) |
---|
[738] | 2232 | |
---|
| 2233 | , m_updateRepFormatFlag ( false ) |
---|
| 2234 | , m_spsRepFormatIdx ( 0 ) |
---|
[608] | 2235 | , m_interViewMvVertConstraintFlag (false) |
---|
[56] | 2236 | #endif |
---|
[608] | 2237 | #if H_3D |
---|
| 2238 | , m_bCamParInSliceHeader (false) |
---|
[210] | 2239 | #endif |
---|
[56] | 2240 | { |
---|
| 2241 | for ( Int i = 0; i < MAX_TLAYER; i++ ) |
---|
| 2242 | { |
---|
| 2243 | m_uiMaxLatencyIncrease[i] = 0; |
---|
[608] | 2244 | m_uiMaxDecPicBuffering[i] = 1; |
---|
[56] | 2245 | m_numReorderPics[i] = 0; |
---|
| 2246 | } |
---|
[608] | 2247 | m_scalingList = new TComScalingList; |
---|
| 2248 | ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps)); |
---|
| 2249 | ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag)); |
---|
[773] | 2250 | #if H_MV |
---|
[738] | 2251 | m_spsExtensionFlag = false; |
---|
| 2252 | for( Int i = 0; i < PS_EX_T_MAX_NUM; i++ ) |
---|
| 2253 | { |
---|
| 2254 | m_spsExtensionTypeFlag[ i ] = false; |
---|
| 2255 | } |
---|
| 2256 | m_numScaledRefLayerOffsets = 0; |
---|
| 2257 | |
---|
| 2258 | for (Int i = 0; i < MAX_NUM_SCALED_REF_LAYERS; i++ ) |
---|
| 2259 | { |
---|
| 2260 | m_scaledRefLayerId [i] = -1; |
---|
| 2261 | } |
---|
| 2262 | |
---|
| 2263 | for (Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
| 2264 | { |
---|
| 2265 | m_scaledRefLayerLeftOffset [i] = 0; |
---|
| 2266 | m_scaledRefLayerTopOffset [i] = 0; |
---|
| 2267 | m_scaledRefLayerRightOffset [i] = 0; |
---|
| 2268 | m_scaledRefLayerBottomOffset [i] = 0; |
---|
| 2269 | } |
---|
| 2270 | #endif |
---|
[2] | 2271 | } |
---|
| 2272 | |
---|
| 2273 | TComSPS::~TComSPS() |
---|
| 2274 | { |
---|
[608] | 2275 | delete m_scalingList; |
---|
| 2276 | m_RPSList.destroy(); |
---|
| 2277 | } |
---|
| 2278 | |
---|
| 2279 | Void TComSPS::createRPSList( Int numRPS ) |
---|
| 2280 | { |
---|
| 2281 | m_RPSList.destroy(); |
---|
| 2282 | m_RPSList.create(numRPS); |
---|
| 2283 | } |
---|
| 2284 | |
---|
| 2285 | Void TComSPS::setHrdParameters( UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess ) |
---|
| 2286 | { |
---|
| 2287 | if( !getVuiParametersPresentFlag() ) |
---|
[56] | 2288 | { |
---|
[608] | 2289 | return; |
---|
[56] | 2290 | } |
---|
[608] | 2291 | |
---|
| 2292 | TComVUI *vui = getVuiParameters(); |
---|
| 2293 | TComHRD *hrd = vui->getHrdParameters(); |
---|
| 2294 | |
---|
| 2295 | TimingInfo *timingInfo = vui->getTimingInfo(); |
---|
| 2296 | timingInfo->setTimingInfoPresentFlag( true ); |
---|
| 2297 | switch( frameRate ) |
---|
[56] | 2298 | { |
---|
[608] | 2299 | case 24: |
---|
| 2300 | timingInfo->setNumUnitsInTick( 1125000 ); timingInfo->setTimeScale ( 27000000 ); |
---|
| 2301 | break; |
---|
| 2302 | case 25: |
---|
| 2303 | timingInfo->setNumUnitsInTick( 1080000 ); timingInfo->setTimeScale ( 27000000 ); |
---|
| 2304 | break; |
---|
| 2305 | case 30: |
---|
| 2306 | timingInfo->setNumUnitsInTick( 900900 ); timingInfo->setTimeScale ( 27000000 ); |
---|
| 2307 | break; |
---|
| 2308 | case 50: |
---|
| 2309 | timingInfo->setNumUnitsInTick( 540000 ); timingInfo->setTimeScale ( 27000000 ); |
---|
| 2310 | break; |
---|
| 2311 | case 60: |
---|
| 2312 | timingInfo->setNumUnitsInTick( 450450 ); timingInfo->setTimeScale ( 27000000 ); |
---|
| 2313 | break; |
---|
| 2314 | default: |
---|
| 2315 | timingInfo->setNumUnitsInTick( 1001 ); timingInfo->setTimeScale ( 60000 ); |
---|
| 2316 | break; |
---|
[56] | 2317 | } |
---|
[2] | 2318 | |
---|
[608] | 2319 | Bool rateCnt = ( bitRate > 0 ); |
---|
| 2320 | hrd->setNalHrdParametersPresentFlag( rateCnt ); |
---|
| 2321 | hrd->setVclHrdParametersPresentFlag( rateCnt ); |
---|
| 2322 | |
---|
| 2323 | hrd->setSubPicCpbParamsPresentFlag( ( numDU > 1 ) ); |
---|
| 2324 | |
---|
| 2325 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
[189] | 2326 | { |
---|
[608] | 2327 | hrd->setTickDivisorMinus2( 100 - 2 ); // |
---|
| 2328 | hrd->setDuCpbRemovalDelayLengthMinus1( 7 ); // 8-bit precision ( plus 1 for last DU in AU ) |
---|
| 2329 | hrd->setSubPicCpbParamsInPicTimingSEIFlag( true ); |
---|
| 2330 | hrd->setDpbOutputDelayDuLengthMinus1( 5 + 7 ); // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay |
---|
[189] | 2331 | } |
---|
[608] | 2332 | else |
---|
| 2333 | { |
---|
| 2334 | hrd->setSubPicCpbParamsInPicTimingSEIFlag( false ); |
---|
| 2335 | } |
---|
| 2336 | |
---|
| 2337 | hrd->setBitRateScale( 4 ); // in units of 2~( 6 + 4 ) = 1,024 bps |
---|
| 2338 | hrd->setCpbSizeScale( 6 ); // in units of 2~( 4 + 4 ) = 1,024 bit |
---|
| 2339 | hrd->setDuCpbSizeScale( 6 ); // in units of 2~( 4 + 4 ) = 1,024 bit |
---|
[189] | 2340 | |
---|
[608] | 2341 | hrd->setInitialCpbRemovalDelayLengthMinus1(15); // assuming 0.5 sec, log2( 90,000 * 0.5 ) = 16-bit |
---|
| 2342 | if( randomAccess ) |
---|
[189] | 2343 | { |
---|
[608] | 2344 | hrd->setCpbRemovalDelayLengthMinus1(5); // 32 = 2^5 (plus 1) |
---|
| 2345 | hrd->setDpbOutputDelayLengthMinus1 (5); // 32 + 3 = 2^6 |
---|
| 2346 | } |
---|
| 2347 | else |
---|
| 2348 | { |
---|
| 2349 | hrd->setCpbRemovalDelayLengthMinus1(9); // max. 2^10 |
---|
| 2350 | hrd->setDpbOutputDelayLengthMinus1 (9); // max. 2^10 |
---|
| 2351 | } |
---|
| 2352 | |
---|
| 2353 | /* |
---|
| 2354 | Note: only the case of "vps_max_temporal_layers_minus1 = 0" is supported. |
---|
| 2355 | */ |
---|
| 2356 | Int i, j; |
---|
| 2357 | UInt birateValue, cpbSizeValue; |
---|
| 2358 | UInt ducpbSizeValue; |
---|
| 2359 | UInt duBitRateValue = 0; |
---|
| 2360 | |
---|
| 2361 | for( i = 0; i < MAX_TLAYER; i ++ ) |
---|
| 2362 | { |
---|
| 2363 | hrd->setFixedPicRateFlag( i, 1 ); |
---|
| 2364 | hrd->setPicDurationInTcMinus1( i, 0 ); |
---|
| 2365 | hrd->setLowDelayHrdFlag( i, 0 ); |
---|
| 2366 | hrd->setCpbCntMinus1( i, 0 ); |
---|
| 2367 | |
---|
| 2368 | birateValue = bitRate; |
---|
| 2369 | cpbSizeValue = bitRate; // 1 second |
---|
| 2370 | ducpbSizeValue = bitRate/numDU; |
---|
| 2371 | duBitRateValue = bitRate; |
---|
| 2372 | for( j = 0; j < ( hrd->getCpbCntMinus1( i ) + 1 ); j ++ ) |
---|
[189] | 2373 | { |
---|
[608] | 2374 | hrd->setBitRateValueMinus1( i, j, 0, ( birateValue - 1 ) ); |
---|
| 2375 | hrd->setCpbSizeValueMinus1( i, j, 0, ( cpbSizeValue - 1 ) ); |
---|
| 2376 | hrd->setDuCpbSizeValueMinus1( i, j, 0, ( ducpbSizeValue - 1 ) ); |
---|
| 2377 | hrd->setCbrFlag( i, j, 0, ( j == 0 ) ); |
---|
| 2378 | |
---|
| 2379 | hrd->setBitRateValueMinus1( i, j, 1, ( birateValue - 1) ); |
---|
| 2380 | hrd->setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) ); |
---|
| 2381 | hrd->setDuCpbSizeValueMinus1( i, j, 1, ( ducpbSizeValue - 1 ) ); |
---|
| 2382 | hrd->setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) ); |
---|
| 2383 | hrd->setCbrFlag( i, j, 1, ( j == 0 ) ); |
---|
[189] | 2384 | } |
---|
| 2385 | } |
---|
| 2386 | } |
---|
[608] | 2387 | const Int TComSPS::m_winUnitX[]={1,2,2,1}; |
---|
| 2388 | const Int TComSPS::m_winUnitY[]={1,2,1,1}; |
---|
[189] | 2389 | |
---|
[2] | 2390 | TComPPS::TComPPS() |
---|
[56] | 2391 | : m_PPSId (0) |
---|
| 2392 | , m_SPSId (0) |
---|
| 2393 | , m_picInitQPMinus26 (0) |
---|
| 2394 | , m_useDQP (false) |
---|
| 2395 | , m_bConstrainedIntraPred (false) |
---|
[608] | 2396 | , m_bSliceChromaQpFlag (false) |
---|
[56] | 2397 | , m_pcSPS (NULL) |
---|
| 2398 | , m_uiMaxCuDQPDepth (0) |
---|
| 2399 | , m_uiMinCuDQPSize (0) |
---|
[608] | 2400 | , m_chromaCbQpOffset (0) |
---|
| 2401 | , m_chromaCrQpOffset (0) |
---|
| 2402 | , m_numRefIdxL0DefaultActive (1) |
---|
| 2403 | , m_numRefIdxL1DefaultActive (1) |
---|
| 2404 | , m_TransquantBypassEnableFlag (false) |
---|
| 2405 | , m_useTransformSkip (false) |
---|
| 2406 | , m_dependentSliceSegmentsEnabledFlag (false) |
---|
| 2407 | , m_tilesEnabledFlag (false) |
---|
| 2408 | , m_entropyCodingSyncEnabledFlag (false) |
---|
| 2409 | , m_loopFilterAcrossTilesEnabledFlag (true) |
---|
| 2410 | , m_uniformSpacingFlag (0) |
---|
[56] | 2411 | , m_iNumColumnsMinus1 (0) |
---|
| 2412 | , m_puiColumnWidth (NULL) |
---|
| 2413 | , m_iNumRowsMinus1 (0) |
---|
| 2414 | , m_puiRowHeight (NULL) |
---|
[608] | 2415 | , m_iNumSubstreams (1) |
---|
[56] | 2416 | , m_signHideFlag(0) |
---|
| 2417 | , m_cabacInitPresentFlag (false) |
---|
[608] | 2418 | , m_encCABACTableIdx (I_SLICE) |
---|
| 2419 | , m_sliceHeaderExtensionPresentFlag (false) |
---|
| 2420 | , m_loopFilterAcrossSlicesEnabledFlag (false) |
---|
| 2421 | , m_listsModificationPresentFlag( 0) |
---|
| 2422 | , m_numExtraSliceHeaderBits(0) |
---|
[622] | 2423 | #if H_MV |
---|
| 2424 | , m_ppsInferScalingListFlag(false) |
---|
| 2425 | , m_ppsScalingListRefLayerId(0) |
---|
[872] | 2426 | , m_pocResetInfoPresentFlag(false) |
---|
[773] | 2427 | #if H_3D |
---|
[758] | 2428 | , m_pcDLT(NULL) |
---|
[622] | 2429 | #endif |
---|
[758] | 2430 | #endif |
---|
[2] | 2431 | { |
---|
[608] | 2432 | m_scalingList = new TComScalingList; |
---|
[872] | 2433 | |
---|
[884] | 2434 | #if H_MV |
---|
[872] | 2435 | for( Int i = 0; i < PS_EX_T_MAX_NUM; i++ ) |
---|
| 2436 | { |
---|
| 2437 | m_ppsExtensionTypeFlag[ i ] = false; |
---|
| 2438 | } |
---|
| 2439 | #endif |
---|
[2] | 2440 | } |
---|
| 2441 | |
---|
| 2442 | TComPPS::~TComPPS() |
---|
| 2443 | { |
---|
[608] | 2444 | if( m_iNumColumnsMinus1 > 0 && m_uniformSpacingFlag == 0 ) |
---|
[56] | 2445 | { |
---|
| 2446 | if (m_puiColumnWidth) delete [] m_puiColumnWidth; |
---|
| 2447 | m_puiColumnWidth = NULL; |
---|
| 2448 | } |
---|
[608] | 2449 | if( m_iNumRowsMinus1 > 0 && m_uniformSpacingFlag == 0 ) |
---|
[56] | 2450 | { |
---|
| 2451 | if (m_puiRowHeight) delete [] m_puiRowHeight; |
---|
| 2452 | m_puiRowHeight = NULL; |
---|
| 2453 | } |
---|
[608] | 2454 | delete m_scalingList; |
---|
[2] | 2455 | } |
---|
| 2456 | |
---|
[773] | 2457 | #if H_3D |
---|
[758] | 2458 | TComDLT::TComDLT() |
---|
| 2459 | : m_bDltPresentFlag(false) |
---|
| 2460 | , m_iNumDepthViews(0) |
---|
| 2461 | , m_uiDepthViewBitDepth(8) |
---|
| 2462 | { |
---|
| 2463 | m_uiDepthViewBitDepth = g_bitDepthY; |
---|
| 2464 | |
---|
| 2465 | for( Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
| 2466 | { |
---|
| 2467 | m_bUseDLTFlag [i] = false; |
---|
| 2468 | m_bInterViewDltPredEnableFlag [i] = false; |
---|
| 2469 | |
---|
| 2470 | // allocate some memory and initialize with default mapping |
---|
| 2471 | m_iNumDepthmapValues[i] = ((1 << m_uiDepthViewBitDepth)-1)+1; |
---|
| 2472 | m_iBitsPerDepthValue[i] = numBitsForValue(m_iNumDepthmapValues[i]); |
---|
| 2473 | |
---|
| 2474 | m_iDepthValue2Idx[i] = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]); |
---|
| 2475 | m_iIdx2DepthValue[i] = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]); |
---|
| 2476 | |
---|
| 2477 | //default mapping |
---|
| 2478 | for (Int d=0; d<m_iNumDepthmapValues[i]; d++) |
---|
| 2479 | { |
---|
| 2480 | m_iDepthValue2Idx[i][d] = d; |
---|
| 2481 | m_iIdx2DepthValue[i][d] = d; |
---|
| 2482 | } |
---|
| 2483 | } |
---|
| 2484 | } |
---|
| 2485 | |
---|
| 2486 | TComDLT::~TComDLT() |
---|
| 2487 | { |
---|
| 2488 | for( Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
| 2489 | { |
---|
| 2490 | if ( m_iDepthValue2Idx[i] != NULL ) |
---|
| 2491 | { |
---|
| 2492 | xFree( m_iDepthValue2Idx[i] ); |
---|
| 2493 | m_iDepthValue2Idx[i] = NULL; |
---|
| 2494 | } |
---|
| 2495 | |
---|
| 2496 | if ( m_iIdx2DepthValue[i] != NULL ) |
---|
| 2497 | { |
---|
| 2498 | xFree( m_iIdx2DepthValue[i] ); |
---|
| 2499 | m_iIdx2DepthValue[i] = NULL; |
---|
| 2500 | } |
---|
| 2501 | } |
---|
| 2502 | } |
---|
| 2503 | |
---|
| 2504 | Void TComDLT::setDepthLUTs(Int layerIdInVps, Int* idxToDepthValueTable, Int iNumDepthValues) |
---|
| 2505 | { |
---|
| 2506 | if( idxToDepthValueTable == NULL || iNumDepthValues == 0 ) // default mapping only |
---|
| 2507 | return; |
---|
| 2508 | |
---|
| 2509 | // copy idx2DepthValue to internal array |
---|
| 2510 | memcpy(m_iIdx2DepthValue[layerIdInVps], idxToDepthValueTable, iNumDepthValues*sizeof(UInt)); |
---|
| 2511 | |
---|
| 2512 | UInt uiMaxDepthValue = ((1 << g_bitDepthY)-1); |
---|
| 2513 | for(Int p=0; p<=uiMaxDepthValue; p++) |
---|
| 2514 | { |
---|
| 2515 | Int iIdxDown = 0; |
---|
| 2516 | Int iIdxUp = iNumDepthValues-1; |
---|
| 2517 | Bool bFound = false; |
---|
| 2518 | |
---|
| 2519 | // iterate over indices to find lower closest depth |
---|
| 2520 | Int i = 1; |
---|
| 2521 | while(!bFound && i<iNumDepthValues) |
---|
| 2522 | { |
---|
| 2523 | if( m_iIdx2DepthValue[layerIdInVps][i] > p ) |
---|
| 2524 | { |
---|
| 2525 | iIdxDown = i-1; |
---|
| 2526 | bFound = true; |
---|
| 2527 | } |
---|
| 2528 | |
---|
| 2529 | i++; |
---|
| 2530 | } |
---|
| 2531 | // iterate over indices to find upper closest depth |
---|
| 2532 | i = iNumDepthValues-2; |
---|
| 2533 | bFound = false; |
---|
| 2534 | while(!bFound && i>=0) |
---|
| 2535 | { |
---|
| 2536 | if( m_iIdx2DepthValue[layerIdInVps][i] < p ) |
---|
| 2537 | { |
---|
| 2538 | iIdxUp = i+1; |
---|
| 2539 | bFound = true; |
---|
| 2540 | } |
---|
| 2541 | |
---|
| 2542 | i--; |
---|
| 2543 | } |
---|
| 2544 | |
---|
| 2545 | // assert monotony |
---|
| 2546 | assert(iIdxDown<=iIdxUp); |
---|
| 2547 | |
---|
| 2548 | // assign closer depth value/idx |
---|
| 2549 | if( abs(p-m_iIdx2DepthValue[layerIdInVps][iIdxDown]) < abs(p-m_iIdx2DepthValue[layerIdInVps][iIdxUp]) ) |
---|
| 2550 | { |
---|
| 2551 | m_iDepthValue2Idx[layerIdInVps][p] = iIdxDown; |
---|
| 2552 | } |
---|
| 2553 | else |
---|
| 2554 | { |
---|
| 2555 | m_iDepthValue2Idx[layerIdInVps][p] = iIdxUp; |
---|
| 2556 | } |
---|
| 2557 | |
---|
| 2558 | } |
---|
| 2559 | |
---|
| 2560 | // update DLT variables |
---|
| 2561 | m_iNumDepthmapValues[layerIdInVps] = iNumDepthValues; |
---|
| 2562 | m_iBitsPerDepthValue[layerIdInVps] = numBitsForValue(m_iNumDepthmapValues[layerIdInVps]); |
---|
| 2563 | } |
---|
| 2564 | |
---|
| 2565 | #if H_3D_DELTA_DLT |
---|
| 2566 | Void TComDLT::getDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTOut, UInt *puiDeltaDLTOutNum ) |
---|
| 2567 | { |
---|
| 2568 | Bool abBM0[ 256 ]; |
---|
| 2569 | Bool abBM1[ 256 ]; |
---|
| 2570 | |
---|
| 2571 | memset( abBM0, 0, sizeof( abBM0 )); |
---|
| 2572 | memset( abBM1, 0, sizeof( abBM1 )); |
---|
| 2573 | |
---|
| 2574 | // convert reference DLT to bit string |
---|
| 2575 | for( Int i = 0; i < uiDLTInRefNum; i++ ) |
---|
| 2576 | { |
---|
| 2577 | abBM0[ piDLTInRef[ i ] ] = true; |
---|
| 2578 | } |
---|
| 2579 | // convert internal DLT to bit string |
---|
| 2580 | for( Int i = 0; i < m_iNumDepthmapValues[ layerIdInVps ]; i++ ) |
---|
| 2581 | { |
---|
| 2582 | abBM1[ m_iIdx2DepthValue[ layerIdInVps ][ i ] ] = true; |
---|
| 2583 | } |
---|
| 2584 | |
---|
| 2585 | *puiDeltaDLTOutNum = 0; |
---|
| 2586 | for( Int i = 0; i < 256; i++ ) |
---|
| 2587 | { |
---|
| 2588 | if( abBM0[ i ] ^ abBM1[ i ] ) |
---|
| 2589 | { |
---|
| 2590 | piDeltaDLTOut[ *puiDeltaDLTOutNum ] = i; |
---|
| 2591 | *puiDeltaDLTOutNum = *puiDeltaDLTOutNum + 1; |
---|
| 2592 | } |
---|
| 2593 | } |
---|
| 2594 | } |
---|
| 2595 | |
---|
| 2596 | Void TComDLT::setDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTIn, UInt uiDeltaDLTInNum ) |
---|
| 2597 | { |
---|
| 2598 | Bool abBM0[ 256 ]; |
---|
| 2599 | Bool abBM1[ 256 ]; |
---|
| 2600 | |
---|
| 2601 | memset( abBM0, 0, sizeof( abBM0 )); |
---|
| 2602 | memset( abBM1, 0, sizeof( abBM1 )); |
---|
| 2603 | |
---|
| 2604 | // convert reference DLT to bit string |
---|
| 2605 | for( Int i = 0; i < uiDLTInRefNum; i++ ) |
---|
| 2606 | { |
---|
| 2607 | abBM0[ piDLTInRef[ i ] ] = true; |
---|
| 2608 | } |
---|
| 2609 | // convert delta DLT to bit string |
---|
| 2610 | for( Int i = 0; i < uiDeltaDLTInNum; i++ ) |
---|
| 2611 | { |
---|
| 2612 | abBM1[ piDeltaDLTIn[ i ] ] = true; |
---|
| 2613 | } |
---|
| 2614 | |
---|
| 2615 | Int aiIdx2DepthValue[256]; |
---|
| 2616 | UInt uiNumDepthValues = 0; |
---|
| 2617 | memset( aiIdx2DepthValue, 0, sizeof( aiIdx2DepthValue )); |
---|
| 2618 | |
---|
| 2619 | for( Int i = 0; i < 256; i++ ) |
---|
| 2620 | { |
---|
| 2621 | if( abBM0[ i ] ^ abBM1[ i ] ) |
---|
| 2622 | { |
---|
| 2623 | aiIdx2DepthValue[ uiNumDepthValues++ ] = i; |
---|
| 2624 | } |
---|
| 2625 | } |
---|
| 2626 | |
---|
| 2627 | // update internal tables |
---|
| 2628 | setDepthLUTs(layerIdInVps, aiIdx2DepthValue, uiNumDepthValues); |
---|
| 2629 | } |
---|
| 2630 | #endif |
---|
| 2631 | |
---|
| 2632 | #endif |
---|
| 2633 | |
---|
[622] | 2634 | #if H_MV |
---|
| 2635 | Void TComSPS::inferRepFormat( TComVPS* vps, Int layerIdCurr ) |
---|
| 2636 | { |
---|
| 2637 | if ( layerIdCurr > 0 ) |
---|
| 2638 | { |
---|
[738] | 2639 | Int repFormatIdx = getUpdateRepFormatFlag() ? getSpsRepFormatIdx() : vps->getVpsRepFormatIdx( vps->getLayerIdInVps( layerIdCurr ) ) ; |
---|
| 2640 | TComRepFormat* repFormat = vps->getRepFormat( repFormatIdx ); |
---|
[622] | 2641 | setChromaFormatIdc( repFormat->getChromaFormatVpsIdc() ); |
---|
| 2642 | //// ToDo: add when supported: |
---|
| 2643 | // setSeperateColourPlaneFlag( repFormat->getSeparateColourPlaneVpsFlag() ) ; |
---|
| 2644 | |
---|
| 2645 | setPicWidthInLumaSamples ( repFormat->getPicWidthVpsInLumaSamples() ); |
---|
| 2646 | setPicHeightInLumaSamples( repFormat->getPicHeightVpsInLumaSamples() ); |
---|
| 2647 | |
---|
| 2648 | setBitDepthY ( repFormat->getBitDepthVpsLumaMinus8() + 8 ); |
---|
| 2649 | setQpBDOffsetY ( (Int) (6*( getBitDepthY() - 8 )) ); |
---|
| 2650 | |
---|
| 2651 | setBitDepthC ( repFormat->getBitDepthVpsChromaMinus8() + 8 ); |
---|
| 2652 | setQpBDOffsetC ( (Int) (6* ( getBitDepthC() -8 ) ) ); |
---|
[738] | 2653 | if ( getLayerId() > 0 && getUpdateRepFormatFlag() ) |
---|
[622] | 2654 | { |
---|
| 2655 | assert( getChromaFormatIdc() <= repFormat->getChromaFormatVpsIdc() ); |
---|
| 2656 | //// ToDo: add when supported: |
---|
| 2657 | // assert( getSeperateColourPlaneFlag() <= repFormat->getSeparateColourPlaneVpsFlag() ) ; |
---|
| 2658 | |
---|
| 2659 | assert( getPicWidthInLumaSamples() <= repFormat->getPicWidthVpsInLumaSamples() ); |
---|
| 2660 | assert( getPicHeightInLumaSamples() <= repFormat->getPicHeightVpsInLumaSamples() ); |
---|
| 2661 | |
---|
| 2662 | assert( getBitDepthY() <= repFormat->getBitDepthVpsLumaMinus8() + 8 ); |
---|
| 2663 | assert( getBitDepthC() <= repFormat->getBitDepthVpsChromaMinus8() + 8 ); |
---|
| 2664 | } |
---|
| 2665 | } |
---|
| 2666 | |
---|
| 2667 | // Set conformance window |
---|
| 2668 | Int scal = TComSPS::getWinUnitX( getChromaFormatIdc() ) ; |
---|
| 2669 | getConformanceWindow().scaleOffsets( scal ); |
---|
| 2670 | getVuiParameters()->getDefaultDisplayWindow().scaleOffsets( scal ); |
---|
| 2671 | } |
---|
| 2672 | |
---|
| 2673 | Void TComSPS::inferScalingList( TComSPS* spsSrc ) |
---|
| 2674 | { |
---|
| 2675 | if ( getSpsInferScalingListFlag() ) |
---|
| 2676 | { |
---|
| 2677 | assert( spsSrc != NULL ); |
---|
| 2678 | assert( !spsSrc->getSpsInferScalingListFlag() ); |
---|
| 2679 | getScalingList()->inferFrom( spsSrc->getScalingList() ); |
---|
| 2680 | } |
---|
| 2681 | } |
---|
| 2682 | #endif |
---|
[2] | 2683 | |
---|
[56] | 2684 | TComReferencePictureSet::TComReferencePictureSet() |
---|
| 2685 | : m_numberOfPictures (0) |
---|
| 2686 | , m_numberOfNegativePictures (0) |
---|
| 2687 | , m_numberOfPositivePictures (0) |
---|
| 2688 | , m_numberOfLongtermPictures (0) |
---|
| 2689 | , m_interRPSPrediction (0) |
---|
| 2690 | , m_deltaRIdxMinus1 (0) |
---|
| 2691 | , m_deltaRPS (0) |
---|
| 2692 | , m_numRefIdc (0) |
---|
| 2693 | { |
---|
| 2694 | ::memset( m_deltaPOC, 0, sizeof(m_deltaPOC) ); |
---|
| 2695 | ::memset( m_POC, 0, sizeof(m_POC) ); |
---|
| 2696 | ::memset( m_used, 0, sizeof(m_used) ); |
---|
| 2697 | ::memset( m_refIdc, 0, sizeof(m_refIdc) ); |
---|
| 2698 | } |
---|
| 2699 | |
---|
| 2700 | TComReferencePictureSet::~TComReferencePictureSet() |
---|
| 2701 | { |
---|
| 2702 | } |
---|
| 2703 | |
---|
| 2704 | Void TComReferencePictureSet::setUsed(Int bufferNum, Bool used) |
---|
| 2705 | { |
---|
| 2706 | m_used[bufferNum] = used; |
---|
| 2707 | } |
---|
| 2708 | |
---|
| 2709 | Void TComReferencePictureSet::setDeltaPOC(Int bufferNum, Int deltaPOC) |
---|
| 2710 | { |
---|
| 2711 | m_deltaPOC[bufferNum] = deltaPOC; |
---|
| 2712 | } |
---|
| 2713 | |
---|
| 2714 | Void TComReferencePictureSet::setNumberOfPictures(Int numberOfPictures) |
---|
| 2715 | { |
---|
| 2716 | m_numberOfPictures = numberOfPictures; |
---|
| 2717 | } |
---|
| 2718 | |
---|
| 2719 | Int TComReferencePictureSet::getUsed(Int bufferNum) |
---|
| 2720 | { |
---|
| 2721 | return m_used[bufferNum]; |
---|
| 2722 | } |
---|
| 2723 | |
---|
| 2724 | Int TComReferencePictureSet::getDeltaPOC(Int bufferNum) |
---|
| 2725 | { |
---|
| 2726 | return m_deltaPOC[bufferNum]; |
---|
| 2727 | } |
---|
| 2728 | |
---|
| 2729 | Int TComReferencePictureSet::getNumberOfPictures() |
---|
| 2730 | { |
---|
| 2731 | return m_numberOfPictures; |
---|
| 2732 | } |
---|
| 2733 | |
---|
| 2734 | Int TComReferencePictureSet::getPOC(Int bufferNum) |
---|
| 2735 | { |
---|
| 2736 | return m_POC[bufferNum]; |
---|
| 2737 | } |
---|
[608] | 2738 | |
---|
[56] | 2739 | Void TComReferencePictureSet::setPOC(Int bufferNum, Int POC) |
---|
| 2740 | { |
---|
| 2741 | m_POC[bufferNum] = POC; |
---|
| 2742 | } |
---|
| 2743 | |
---|
[608] | 2744 | Bool TComReferencePictureSet::getCheckLTMSBPresent(Int bufferNum) |
---|
| 2745 | { |
---|
| 2746 | return m_bCheckLTMSB[bufferNum]; |
---|
| 2747 | } |
---|
| 2748 | |
---|
| 2749 | Void TComReferencePictureSet::setCheckLTMSBPresent(Int bufferNum, Bool b) |
---|
| 2750 | { |
---|
| 2751 | m_bCheckLTMSB[bufferNum] = b; |
---|
| 2752 | } |
---|
| 2753 | |
---|
[56] | 2754 | /** set the reference idc value at uiBufferNum entry to the value of iRefIdc |
---|
| 2755 | * \param uiBufferNum |
---|
| 2756 | * \param iRefIdc |
---|
| 2757 | * \returns Void |
---|
| 2758 | */ |
---|
| 2759 | Void TComReferencePictureSet::setRefIdc(Int bufferNum, Int refIdc) |
---|
| 2760 | { |
---|
| 2761 | m_refIdc[bufferNum] = refIdc; |
---|
| 2762 | } |
---|
| 2763 | |
---|
| 2764 | /** get the reference idc value at uiBufferNum |
---|
| 2765 | * \param uiBufferNum |
---|
| 2766 | * \returns Int |
---|
| 2767 | */ |
---|
| 2768 | Int TComReferencePictureSet::getRefIdc(Int bufferNum) |
---|
| 2769 | { |
---|
| 2770 | return m_refIdc[bufferNum]; |
---|
| 2771 | } |
---|
| 2772 | |
---|
| 2773 | /** Sorts the deltaPOC and Used by current values in the RPS based on the deltaPOC values. |
---|
| 2774 | * deltaPOC values are sorted with -ve values before the +ve values. -ve values are in decreasing order. |
---|
| 2775 | * +ve values are in increasing order. |
---|
| 2776 | * \returns Void |
---|
| 2777 | */ |
---|
| 2778 | Void TComReferencePictureSet::sortDeltaPOC() |
---|
| 2779 | { |
---|
| 2780 | // sort in increasing order (smallest first) |
---|
| 2781 | for(Int j=1; j < getNumberOfPictures(); j++) |
---|
| 2782 | { |
---|
| 2783 | Int deltaPOC = getDeltaPOC(j); |
---|
| 2784 | Bool used = getUsed(j); |
---|
| 2785 | for (Int k=j-1; k >= 0; k--) |
---|
| 2786 | { |
---|
| 2787 | Int temp = getDeltaPOC(k); |
---|
| 2788 | if (deltaPOC < temp) |
---|
| 2789 | { |
---|
| 2790 | setDeltaPOC(k+1, temp); |
---|
| 2791 | setUsed(k+1, getUsed(k)); |
---|
| 2792 | setDeltaPOC(k, deltaPOC); |
---|
| 2793 | setUsed(k, used); |
---|
| 2794 | } |
---|
| 2795 | } |
---|
| 2796 | } |
---|
| 2797 | // flip the negative values to largest first |
---|
| 2798 | Int numNegPics = getNumberOfNegativePictures(); |
---|
| 2799 | for(Int j=0, k=numNegPics-1; j < numNegPics>>1; j++, k--) |
---|
| 2800 | { |
---|
| 2801 | Int deltaPOC = getDeltaPOC(j); |
---|
| 2802 | Bool used = getUsed(j); |
---|
| 2803 | setDeltaPOC(j, getDeltaPOC(k)); |
---|
| 2804 | setUsed(j, getUsed(k)); |
---|
| 2805 | setDeltaPOC(k, deltaPOC); |
---|
| 2806 | setUsed(k, used); |
---|
| 2807 | } |
---|
| 2808 | } |
---|
| 2809 | |
---|
| 2810 | /** Prints the deltaPOC and RefIdc (if available) values in the RPS. |
---|
| 2811 | * A "*" is added to the deltaPOC value if it is Used bu current. |
---|
| 2812 | * \returns Void |
---|
| 2813 | */ |
---|
| 2814 | Void TComReferencePictureSet::printDeltaPOC() |
---|
| 2815 | { |
---|
| 2816 | printf("DeltaPOC = { "); |
---|
| 2817 | for(Int j=0; j < getNumberOfPictures(); j++) |
---|
| 2818 | { |
---|
| 2819 | printf("%d%s ", getDeltaPOC(j), (getUsed(j)==1)?"*":""); |
---|
| 2820 | } |
---|
| 2821 | if (getInterRPSPrediction()) |
---|
| 2822 | { |
---|
| 2823 | printf("}, RefIdc = { "); |
---|
| 2824 | for(Int j=0; j < getNumRefIdc(); j++) |
---|
| 2825 | { |
---|
| 2826 | printf("%d ", getRefIdc(j)); |
---|
| 2827 | } |
---|
| 2828 | } |
---|
| 2829 | printf("}\n"); |
---|
| 2830 | } |
---|
| 2831 | |
---|
| 2832 | TComRPSList::TComRPSList() |
---|
[608] | 2833 | :m_referencePictureSets (NULL) |
---|
[56] | 2834 | { |
---|
| 2835 | } |
---|
| 2836 | |
---|
| 2837 | TComRPSList::~TComRPSList() |
---|
| 2838 | { |
---|
| 2839 | } |
---|
| 2840 | |
---|
| 2841 | Void TComRPSList::create( Int numberOfReferencePictureSets) |
---|
| 2842 | { |
---|
| 2843 | m_numberOfReferencePictureSets = numberOfReferencePictureSets; |
---|
| 2844 | m_referencePictureSets = new TComReferencePictureSet[numberOfReferencePictureSets]; |
---|
| 2845 | } |
---|
| 2846 | |
---|
| 2847 | Void TComRPSList::destroy() |
---|
| 2848 | { |
---|
[608] | 2849 | if (m_referencePictureSets) |
---|
| 2850 | { |
---|
| 2851 | delete [] m_referencePictureSets; |
---|
| 2852 | } |
---|
[56] | 2853 | m_numberOfReferencePictureSets = 0; |
---|
| 2854 | m_referencePictureSets = NULL; |
---|
| 2855 | } |
---|
| 2856 | |
---|
| 2857 | |
---|
| 2858 | |
---|
| 2859 | TComReferencePictureSet* TComRPSList::getReferencePictureSet(Int referencePictureSetNum) |
---|
| 2860 | { |
---|
| 2861 | return &m_referencePictureSets[referencePictureSetNum]; |
---|
| 2862 | } |
---|
| 2863 | |
---|
| 2864 | Int TComRPSList::getNumberOfReferencePictureSets() |
---|
| 2865 | { |
---|
| 2866 | return m_numberOfReferencePictureSets; |
---|
| 2867 | } |
---|
| 2868 | |
---|
| 2869 | Void TComRPSList::setNumberOfReferencePictureSets(Int numberOfReferencePictureSets) |
---|
| 2870 | { |
---|
| 2871 | m_numberOfReferencePictureSets = numberOfReferencePictureSets; |
---|
| 2872 | } |
---|
| 2873 | |
---|
| 2874 | TComRefPicListModification::TComRefPicListModification() |
---|
| 2875 | : m_bRefPicListModificationFlagL0 (false) |
---|
| 2876 | , m_bRefPicListModificationFlagL1 (false) |
---|
| 2877 | { |
---|
| 2878 | ::memset( m_RefPicSetIdxL0, 0, sizeof(m_RefPicSetIdxL0) ); |
---|
| 2879 | ::memset( m_RefPicSetIdxL1, 0, sizeof(m_RefPicSetIdxL1) ); |
---|
| 2880 | } |
---|
| 2881 | |
---|
| 2882 | TComRefPicListModification::~TComRefPicListModification() |
---|
| 2883 | { |
---|
| 2884 | } |
---|
| 2885 | |
---|
[608] | 2886 | TComScalingList::TComScalingList() |
---|
[56] | 2887 | { |
---|
[608] | 2888 | init(); |
---|
[56] | 2889 | } |
---|
[608] | 2890 | TComScalingList::~TComScalingList() |
---|
| 2891 | { |
---|
| 2892 | destroy(); |
---|
| 2893 | } |
---|
[56] | 2894 | |
---|
[608] | 2895 | /** set default quantization matrix to array |
---|
| 2896 | */ |
---|
| 2897 | Void TComSlice::setDefaultScalingList() |
---|
[56] | 2898 | { |
---|
[608] | 2899 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 2900 | { |
---|
| 2901 | for(UInt listId=0;listId<g_scalingListNum[sizeId];listId++) |
---|
| 2902 | { |
---|
[872] | 2903 | getScalingList()->processDefaultMatrix(sizeId, listId); |
---|
[608] | 2904 | } |
---|
| 2905 | } |
---|
| 2906 | } |
---|
| 2907 | /** check if use default quantization matrix |
---|
| 2908 | * \returns true if use default quantization matrix in all size |
---|
| 2909 | */ |
---|
| 2910 | Bool TComSlice::checkDefaultScalingList() |
---|
| 2911 | { |
---|
| 2912 | UInt defaultCounter=0; |
---|
[56] | 2913 | |
---|
[608] | 2914 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 2915 | { |
---|
| 2916 | for(UInt listId=0;listId<g_scalingListNum[sizeId];listId++) |
---|
| 2917 | { |
---|
| 2918 | 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 |
---|
| 2919 | && ((sizeId < SCALING_LIST_16x16) || (getScalingList()->getScalingListDC(sizeId,listId) == 16))) // check DC value |
---|
| 2920 | { |
---|
| 2921 | defaultCounter++; |
---|
| 2922 | } |
---|
| 2923 | } |
---|
| 2924 | } |
---|
| 2925 | return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM - 4)) ? false : true; // -4 for 32x32 |
---|
[56] | 2926 | } |
---|
| 2927 | |
---|
[608] | 2928 | #if H_MV |
---|
[622] | 2929 | Void TComSlice::createInterLayerReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1 ) |
---|
| 2930 | { |
---|
| 2931 | refPicSetInterLayer0.clear(); |
---|
| 2932 | refPicSetInterLayer1.clear(); |
---|
| 2933 | |
---|
| 2934 | for( Int i = 0; i < getNumActiveRefLayerPics(); i++ ) |
---|
| 2935 | { |
---|
| 2936 | Int layerIdRef = getRefPicLayerId( i ); |
---|
| 2937 | TComPic* picRef = ivPicLists->getPic( layerIdRef, getPOC() ) ; |
---|
[872] | 2938 | assert ( picRef != 0 ); // There shall be no entry equal to "no reference picture" in RefPicSetInterLayer0 or RefPicSetInterLayer1. |
---|
[622] | 2939 | |
---|
| 2940 | picRef->getPicYuvRec()->extendPicBorder(); |
---|
| 2941 | picRef->setIsLongTerm( true ); |
---|
| 2942 | picRef->getSlice(0)->setReferenced( true ); |
---|
| 2943 | |
---|
| 2944 | Int viewIdCur = getVPS()->getViewId( getLayerId() ); |
---|
| 2945 | Int viewIdZero = getVPS()->getViewId( 0 ); |
---|
| 2946 | Int viewIdRef = getVPS()->getViewId( layerIdRef ); |
---|
| 2947 | |
---|
| 2948 | if ( ( viewIdCur <= viewIdZero && viewIdCur <= viewIdRef ) || ( viewIdCur >= viewIdZero && viewIdCur >= viewIdRef ) ) |
---|
| 2949 | { |
---|
| 2950 | refPicSetInterLayer0.push_back( picRef ); |
---|
| 2951 | } |
---|
| 2952 | else |
---|
| 2953 | { |
---|
| 2954 | refPicSetInterLayer1.push_back( picRef ); |
---|
| 2955 | } |
---|
| 2956 | // Consider to check here: |
---|
| 2957 | // "If the current picture is a RADL picture, there shall be no entry in the RefPicSetInterLayer0 and RefPicSetInterLayer1 that is a RASL picture. " |
---|
[872] | 2958 | assert( picRef->getSlice(0)->getDiscardableFlag() == false ); // "There shall be no picture that has discardable_flag equal to 1 in RefPicSetInterLayer0 or RefPicSetInterLayer1". |
---|
[622] | 2959 | } |
---|
| 2960 | } |
---|
[56] | 2961 | |
---|
[622] | 2962 | Void TComSlice::markIvRefPicsAsShortTerm( std::vector<TComPic*> refPicSetInterLayer0, std::vector<TComPic*> refPicSetInterLayer1 ) |
---|
| 2963 | { |
---|
| 2964 | // Mark as shortterm |
---|
| 2965 | for ( Int i = 0; i < refPicSetInterLayer0.size(); i++ ) |
---|
| 2966 | { |
---|
| 2967 | refPicSetInterLayer0[i]->setIsLongTerm( false ); |
---|
| 2968 | } |
---|
| 2969 | |
---|
| 2970 | for ( Int i = 0; i < refPicSetInterLayer1.size(); i++ ) |
---|
| 2971 | { |
---|
| 2972 | refPicSetInterLayer1[i]->setIsLongTerm( false ); |
---|
| 2973 | } |
---|
| 2974 | |
---|
| 2975 | } |
---|
[608] | 2976 | Void TComSlice::markIvRefPicsAsUnused( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc ) |
---|
[56] | 2977 | { |
---|
[738] | 2978 | // Fill targetDecLayerIdSet with all layers if empty (at encoder side) |
---|
[608] | 2979 | if (targetDecLayerIdSet.size() == 0 ) |
---|
[56] | 2980 | { |
---|
[622] | 2981 | for ( Int layerIdInVps = 0; layerIdInVps <= vps->getMaxLayersMinus1(); layerIdInVps++ ) |
---|
[608] | 2982 | { |
---|
| 2983 | targetDecLayerIdSet.push_back( vps->getLayerIdInNuh( layerIdInVps ) ); |
---|
| 2984 | } |
---|
| 2985 | } |
---|
| 2986 | |
---|
| 2987 | Int numTargetDecLayers = (Int) targetDecLayerIdSet.size(); |
---|
| 2988 | Int latestDecIdx; |
---|
| 2989 | for ( latestDecIdx = 0; latestDecIdx < numTargetDecLayers; latestDecIdx++) |
---|
| 2990 | { |
---|
| 2991 | if ( targetDecLayerIdSet[ latestDecIdx ] == curLayerId ) |
---|
[622] | 2992 | { |
---|
[608] | 2993 | break; |
---|
[884] | 2994 | } |
---|
[608] | 2995 | } |
---|
| 2996 | |
---|
| 2997 | for( Int i = 0; i <= latestDecIdx; i++ ) |
---|
| 2998 | { |
---|
| 2999 | if ( vps->nuhLayerIdIncluded( targetDecLayerIdSet[ i ] ) ) |
---|
| 3000 | { |
---|
| 3001 | TComPic* pcPic = ivPicLists->getPic( targetDecLayerIdSet[ i ], curPoc ); |
---|
[738] | 3002 | if ( pcPic ) |
---|
| 3003 | { |
---|
[884] | 3004 | if( pcPic->getSlice(0)->isReferenced() && pcPic->getSlice(0)->getTemporalLayerNonReferenceFlag() ) |
---|
[608] | 3005 | { |
---|
[884] | 3006 | Bool remainingInterLayerReferencesFlag = false; |
---|
| 3007 | for( Int j = latestDecIdx + 1; j < numTargetDecLayers; j++ ) |
---|
| 3008 | { |
---|
| 3009 | TComVPS* vpsSlice = pcPic->getSlice(0)->getVPS(); |
---|
| 3010 | if ( vps->nuhLayerIdIncluded( targetDecLayerIdSet[ j ] ) ) |
---|
[622] | 3011 | { |
---|
[884] | 3012 | for( Int k = 0; k < vpsSlice->getNumDirectRefLayers( targetDecLayerIdSet[ j ] ); k++ ) |
---|
[622] | 3013 | { |
---|
[884] | 3014 | if ( targetDecLayerIdSet[ i ] == vpsSlice->getRefLayerId( targetDecLayerIdSet[ j ], k ) ) |
---|
| 3015 | { |
---|
| 3016 | remainingInterLayerReferencesFlag = true; |
---|
| 3017 | } |
---|
| 3018 | } |
---|
| 3019 | } |
---|
[608] | 3020 | } |
---|
[884] | 3021 | if( !remainingInterLayerReferencesFlag ) |
---|
| 3022 | { |
---|
| 3023 | pcPic->getSlice(0)->setReferenced( false ); |
---|
[622] | 3024 | } |
---|
| 3025 | } |
---|
[608] | 3026 | } |
---|
| 3027 | } |
---|
[56] | 3028 | } |
---|
| 3029 | } |
---|
| 3030 | |
---|
[622] | 3031 | Void TComSlice::printRefPicList() |
---|
[608] | 3032 | { |
---|
| 3033 | for ( Int li = 0; li < 2; li++) |
---|
| 3034 | { |
---|
| 3035 | std::cout << std::endl << "RefPicListL" << li << ":" << std::endl; |
---|
| 3036 | for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[li]-1); rIdx ++) |
---|
| 3037 | { |
---|
| 3038 | if (rIdx == 0 && li == 0) m_apcRefPicList[li][rIdx]->print( true ); |
---|
| 3039 | |
---|
| 3040 | m_apcRefPicList[li][rIdx]->print( false ); |
---|
| 3041 | } |
---|
| 3042 | } |
---|
| 3043 | } |
---|
| 3044 | |
---|
| 3045 | Void TComSlice::markCurrPic( TComPic* currPic ) |
---|
[56] | 3046 | { |
---|
[608] | 3047 | if ( !currPic->getSlice(0)->getDiscardableFlag() ) |
---|
[56] | 3048 | { |
---|
[608] | 3049 | currPic->getSlice(0)->setReferenced( true ) ; |
---|
| 3050 | currPic->setIsLongTerm( false ); |
---|
[56] | 3051 | } |
---|
[608] | 3052 | else |
---|
| 3053 | { |
---|
| 3054 | currPic->getSlice(0)->setReferenced( false ) ; |
---|
| 3055 | } |
---|
[56] | 3056 | } |
---|
| 3057 | |
---|
[622] | 3058 | Void TComSlice::setRefPicSetInterLayer( std::vector<TComPic*>* refPicSetInterLayer0, std::vector<TComPic*>* refPicSetInterLayer1 ) |
---|
| 3059 | { |
---|
| 3060 | m_refPicSetInterLayer0 = refPicSetInterLayer0; |
---|
| 3061 | m_refPicSetInterLayer1 = refPicSetInterLayer1; |
---|
| 3062 | } |
---|
| 3063 | |
---|
| 3064 | TComPic* TComSlice::getPicFromRefPicSetInterLayer(Int setIdc, Int layerId ) |
---|
| 3065 | { |
---|
| 3066 | assert ( setIdc == 0 || setIdc == 1); |
---|
| 3067 | std::vector<TComPic*>* refPicSetInterLayer = ( setIdc == 0 ? m_refPicSetInterLayer0 : m_refPicSetInterLayer1); |
---|
| 3068 | assert( refPicSetInterLayer != 0 ); |
---|
| 3069 | |
---|
| 3070 | TComPic* pcPic = NULL; |
---|
| 3071 | for ( Int i = 0; i < (*refPicSetInterLayer).size(); i++ ) |
---|
| 3072 | { |
---|
| 3073 | if ((*refPicSetInterLayer)[ i ]->getLayerId() == layerId ) |
---|
| 3074 | { |
---|
| 3075 | pcPic = (*refPicSetInterLayer)[ i ]; |
---|
| 3076 | } |
---|
| 3077 | } |
---|
| 3078 | |
---|
| 3079 | assert(pcPic != NULL); |
---|
| 3080 | return pcPic; |
---|
| 3081 | } |
---|
[738] | 3082 | |
---|
| 3083 | |
---|
| 3084 | Int TComSlice::getRefLayerPicFlag( Int i ) |
---|
| 3085 | { |
---|
| 3086 | TComVPS* vps = getVPS(); |
---|
| 3087 | Int refLayerIdx = vps->getLayerIdInVps( vps->getRefLayerId( getLayerId(), i ) ); |
---|
| 3088 | |
---|
| 3089 | Bool refLayerPicFlag = ( vps->getSubLayersVpsMaxMinus1( refLayerIdx ) >= getTLayer() ) && |
---|
| 3090 | ( vps->getMaxTidIlRefPicsPlus1( refLayerIdx, vps->getLayerIdInVps( getLayerId() )) > getTLayer() ); |
---|
| 3091 | |
---|
| 3092 | return refLayerPicFlag; |
---|
| 3093 | } |
---|
| 3094 | |
---|
| 3095 | Int TComSlice::getRefLayerPicIdc( Int j ) |
---|
| 3096 | { |
---|
| 3097 | Int refLayerPicIdc = -1; |
---|
| 3098 | Int curj = 0; |
---|
| 3099 | for( Int i = 0; i < getVPS()->getNumDirectRefLayers( getLayerId()) ; i++ ) |
---|
| 3100 | { |
---|
| 3101 | if( getRefLayerPicFlag( i ) ) |
---|
| 3102 | { |
---|
| 3103 | if ( curj == j ) |
---|
| 3104 | { |
---|
| 3105 | refLayerPicIdc = i; |
---|
| 3106 | break; |
---|
| 3107 | } |
---|
| 3108 | curj++; |
---|
| 3109 | } |
---|
| 3110 | } |
---|
| 3111 | |
---|
| 3112 | assert( curj == j ); |
---|
| 3113 | assert( refLayerPicIdc != -1 ); |
---|
| 3114 | return refLayerPicIdc; |
---|
| 3115 | } |
---|
| 3116 | |
---|
| 3117 | Int TComSlice::getNumRefLayerPics( ) |
---|
| 3118 | { |
---|
| 3119 | Int numRefLayerPics = 0; |
---|
| 3120 | for( Int i = 0; i < getVPS()->getNumDirectRefLayers( getLayerId()) ; i++ ) |
---|
| 3121 | { |
---|
| 3122 | numRefLayerPics += getRefLayerPicFlag( i ); |
---|
| 3123 | } |
---|
| 3124 | return numRefLayerPics; |
---|
| 3125 | } |
---|
| 3126 | |
---|
| 3127 | |
---|
| 3128 | |
---|
[608] | 3129 | Int TComSlice::getNumActiveRefLayerPics() |
---|
[56] | 3130 | { |
---|
[608] | 3131 | Int numActiveRefLayerPics; |
---|
| 3132 | |
---|
[872] | 3133 | if( getLayerId() == 0 || getNumRefLayerPics() == 0 ) |
---|
[622] | 3134 | { |
---|
| 3135 | numActiveRefLayerPics = 0; |
---|
| 3136 | } |
---|
| 3137 | else if (getVPS()->getAllRefLayersActiveFlag() ) |
---|
| 3138 | { |
---|
[738] | 3139 | numActiveRefLayerPics = getNumRefLayerPics(); |
---|
[622] | 3140 | } |
---|
| 3141 | else if ( !getInterLayerPredEnabledFlag() ) |
---|
| 3142 | { |
---|
| 3143 | numActiveRefLayerPics = 0; |
---|
| 3144 | } |
---|
| 3145 | else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerId() ) == 1 ) |
---|
[608] | 3146 | { |
---|
[872] | 3147 | numActiveRefLayerPics = 1; |
---|
[608] | 3148 | } |
---|
| 3149 | else |
---|
| 3150 | { |
---|
| 3151 | numActiveRefLayerPics = getNumInterLayerRefPicsMinus1() + 1; |
---|
| 3152 | } |
---|
| 3153 | return numActiveRefLayerPics; |
---|
[56] | 3154 | } |
---|
[608] | 3155 | |
---|
| 3156 | Int TComSlice::getRefPicLayerId( Int i ) |
---|
[56] | 3157 | { |
---|
[622] | 3158 | return getVPS()->getRefLayerId( getLayerId(), getInterLayerPredLayerIdc( i ) ); |
---|
[56] | 3159 | } |
---|
| 3160 | |
---|
[608] | 3161 | #if H_3D_ARP |
---|
[724] | 3162 | Void TComSlice::setARPStepNum( TComPicLists*ivPicLists ) |
---|
[608] | 3163 | { |
---|
[724] | 3164 | Bool tempRefPicInListsFlag = false; |
---|
| 3165 | if(!getVPS()->getUseAdvRP(getLayerId()) || this->isIRAP()) |
---|
[56] | 3166 | { |
---|
[608] | 3167 | m_nARPStepNum = 0; |
---|
| 3168 | } |
---|
| 3169 | else |
---|
| 3170 | { |
---|
[724] | 3171 | setFirstTRefIdx (REF_PIC_LIST_0, -1); |
---|
| 3172 | setFirstTRefIdx (REF_PIC_LIST_1, -1); |
---|
| 3173 | for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ ) |
---|
| 3174 | { |
---|
[833] | 3175 | Int diffPOC=MAX_INT; |
---|
| 3176 | Int idx=-1; |
---|
[724] | 3177 | for(Int i = 0; i < getNumRefIdx(RefPicList(refListIdx)); i++ ) |
---|
| 3178 | { |
---|
| 3179 | if ( getRefPic(RefPicList(refListIdx), i)->getPOC() != getPOC() ) |
---|
| 3180 | { |
---|
[833] | 3181 | if( abs(getRefPic(RefPicList(refListIdx), i)->getPOC() - getPOC()) < diffPOC) |
---|
| 3182 | { |
---|
| 3183 | diffPOC=abs(getRefPic(RefPicList(refListIdx), i)->getPOC() - getPOC()); |
---|
| 3184 | idx=i; |
---|
| 3185 | } |
---|
[724] | 3186 | } |
---|
[833] | 3187 | if(idx>=0) |
---|
| 3188 | { |
---|
| 3189 | setFirstTRefIdx (RefPicList(refListIdx), idx); |
---|
| 3190 | } |
---|
[724] | 3191 | } |
---|
| 3192 | } |
---|
| 3193 | tempRefPicInListsFlag = getFirstTRefIdx(REF_PIC_LIST_0) >= 0 || getFirstTRefIdx(REF_PIC_LIST_1) >= 0; |
---|
| 3194 | m_nARPStepNum = tempRefPicInListsFlag ? getVPS()->getARPStepNum(getLayerId()) : 0; |
---|
[773] | 3195 | } |
---|
[608] | 3196 | |
---|
[724] | 3197 | if (tempRefPicInListsFlag) |
---|
| 3198 | { |
---|
| 3199 | for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ ) |
---|
| 3200 | { |
---|
| 3201 | RefPicList eRefPicList = RefPicList( refListIdx ); |
---|
| 3202 | Int prevPOC = getRefPic(eRefPicList, getFirstTRefIdx(eRefPicList) )->getPOC(); |
---|
| 3203 | for( Int i = 0; i < getNumActiveRefLayerPics(); i++ ) |
---|
| 3204 | { |
---|
| 3205 | Int layerIdInNuh = getRefPicLayerId( i ); |
---|
| 3206 | Int viewIdx = getVPS()->getViewId( layerIdInNuh ); |
---|
| 3207 | TComPic*pcPicPrev = ivPicLists->getPic(viewIdx, 0, prevPOC); |
---|
| 3208 | if (getFirstTRefIdx(eRefPicList) >= 0 && pcPicPrev && pcPicPrev->getSlice( 0 )->isReferenced()) |
---|
| 3209 | { |
---|
| 3210 | m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = true; |
---|
| 3211 | } |
---|
| 3212 | else |
---|
| 3213 | { |
---|
| 3214 | m_arpRefPicAvailable[eRefPicList][layerIdInNuh] = false; |
---|
| 3215 | } |
---|
| 3216 | } |
---|
[773] | 3217 | } |
---|
[724] | 3218 | } |
---|
[56] | 3219 | } |
---|
[608] | 3220 | #endif |
---|
| 3221 | #if H_3D_IC |
---|
| 3222 | Void TComSlice::xSetApplyIC() |
---|
| 3223 | { |
---|
| 3224 | Int iMaxPelValue = ( 1 << g_bitDepthY ); |
---|
| 3225 | Int *aiRefOrgHist; |
---|
| 3226 | Int *aiCurrHist; |
---|
| 3227 | aiRefOrgHist = (Int *) xMalloc( Int,iMaxPelValue ); |
---|
| 3228 | aiCurrHist = (Int *) xMalloc( Int,iMaxPelValue ); |
---|
| 3229 | memset( aiRefOrgHist, 0, iMaxPelValue*sizeof(Int) ); |
---|
| 3230 | memset( aiCurrHist, 0, iMaxPelValue*sizeof(Int) ); |
---|
| 3231 | // Reference Idx Number |
---|
| 3232 | Int iNumRefIdx = getNumRefIdx( REF_PIC_LIST_0 ); |
---|
| 3233 | TComPic* pcCurrPic = NULL; |
---|
| 3234 | TComPic* pcRefPic = NULL; |
---|
| 3235 | TComPicYuv* pcCurrPicYuv = NULL; |
---|
| 3236 | TComPicYuv* pcRefPicYuvOrg = NULL; |
---|
| 3237 | pcCurrPic = getPic(); |
---|
| 3238 | pcCurrPicYuv = pcCurrPic->getPicYuvOrg(); |
---|
| 3239 | Int iWidth = pcCurrPicYuv->getWidth(); |
---|
| 3240 | Int iHeight = pcCurrPicYuv->getHeight(); |
---|
| 3241 | |
---|
| 3242 | |
---|
| 3243 | // Get InterView Reference picture |
---|
| 3244 | // !!!!! Assume only one Interview Reference Picture in L0 |
---|
| 3245 | for ( Int i = 0; i < iNumRefIdx; i++ ) |
---|
| 3246 | { |
---|
| 3247 | pcRefPic = getRefPic( REF_PIC_LIST_0, i ); |
---|
| 3248 | if ( pcRefPic != NULL ) |
---|
| 3249 | { |
---|
| 3250 | if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() ) |
---|
| 3251 | { |
---|
| 3252 | pcRefPicYuvOrg = pcRefPic->getPicYuvOrg(); |
---|
| 3253 | } |
---|
| 3254 | } |
---|
| 3255 | } |
---|
| 3256 | |
---|
| 3257 | if ( pcRefPicYuvOrg != NULL ) |
---|
| 3258 | { |
---|
| 3259 | Pel* pCurrY = pcCurrPicYuv ->getLumaAddr(); |
---|
| 3260 | Pel* pRefOrgY = pcRefPicYuvOrg ->getLumaAddr(); |
---|
| 3261 | Int iCurrStride = pcCurrPicYuv->getStride(); |
---|
| 3262 | Int iRefStride = pcRefPicYuvOrg->getStride(); |
---|
| 3263 | Int iSumOrgSAD = 0; |
---|
| 3264 | Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05; |
---|
| 3265 | |
---|
| 3266 | // Histogram building - luminance |
---|
| 3267 | for ( Int y = 0; y < iHeight; y++ ) |
---|
| 3268 | { |
---|
| 3269 | for ( Int x = 0; x < iWidth; x++ ) |
---|
| 3270 | { |
---|
| 3271 | aiCurrHist[pCurrY[x]]++; |
---|
| 3272 | aiRefOrgHist[pRefOrgY[x]]++; |
---|
| 3273 | } |
---|
| 3274 | pCurrY += iCurrStride; |
---|
| 3275 | pRefOrgY += iRefStride; |
---|
| 3276 | } |
---|
| 3277 | // Histogram SAD |
---|
| 3278 | for ( Int i = 0; i < iMaxPelValue; i++ ) |
---|
| 3279 | { |
---|
| 3280 | iSumOrgSAD += abs( aiCurrHist[i] - aiRefOrgHist[i] ); |
---|
| 3281 | } |
---|
| 3282 | // Setting |
---|
| 3283 | if ( iSumOrgSAD > Int( dThresholdOrgSAD * iWidth * iHeight ) ) |
---|
| 3284 | { |
---|
| 3285 | m_bApplyIC = true; |
---|
| 3286 | } |
---|
| 3287 | else |
---|
| 3288 | { |
---|
| 3289 | m_bApplyIC = false; |
---|
| 3290 | } |
---|
| 3291 | } |
---|
| 3292 | |
---|
| 3293 | xFree( aiCurrHist ); |
---|
| 3294 | xFree( aiRefOrgHist ); |
---|
| 3295 | aiCurrHist = NULL; |
---|
| 3296 | aiRefOrgHist = NULL; |
---|
| 3297 | } |
---|
| 3298 | #endif |
---|
| 3299 | #if H_3D |
---|
| 3300 | Void TComSlice::setIvPicLists( TComPicLists* m_ivPicLists ) |
---|
| 3301 | { |
---|
| 3302 | for (Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
| 3303 | { |
---|
| 3304 | for ( Int depthId = 0; depthId < 2; depthId++ ) |
---|
| 3305 | { |
---|
| 3306 | m_ivPicsCurrPoc[ depthId ][ i ] = ( i <= m_viewIndex ) ? m_ivPicLists->getPic( i, ( depthId == 1) , getPOC() ) : NULL; |
---|
| 3307 | } |
---|
| 3308 | } |
---|
| 3309 | } |
---|
| 3310 | Void TComSlice::setDepthToDisparityLUTs() |
---|
| 3311 | { |
---|
| 3312 | Bool setupLUT = false; |
---|
| 3313 | Int layerIdInVPS = getVPS()->getLayerIdInNuh( m_layerId ); |
---|
| 3314 | |
---|
| 3315 | #if H_3D_VSP |
---|
| 3316 | setupLUT = setupLUT || getVPS()->getViewSynthesisPredFlag( layerIdInVPS); |
---|
| 3317 | #endif |
---|
| 3318 | |
---|
| 3319 | #if H_3D_NBDV_REF |
---|
| 3320 | setupLUT = setupLUT || getVPS()->getDepthRefinementFlag( layerIdInVPS ); |
---|
| 3321 | #endif |
---|
| 3322 | |
---|
[773] | 3323 | #if H_3D_IV_MERGE |
---|
[724] | 3324 | setupLUT = setupLUT || ( getVPS()->getIvMvPredFlag(layerIdInVPS ) && getIsDepth() ); |
---|
| 3325 | #endif |
---|
| 3326 | |
---|
[884] | 3327 | #if H_3D_DDD |
---|
[833] | 3328 | if( getIsDepth() && getViewIndex() > 0 ) |
---|
| 3329 | { |
---|
| 3330 | TComSlice *pcTextSlice = getTexturePic()->getSlice( 0 ); |
---|
| 3331 | memcpy( m_aiDDDInvScale, pcTextSlice->m_aiDDDInvScale, sizeof( Int ) * getViewIndex() ); |
---|
| 3332 | memcpy( m_aiDDDInvOffset, pcTextSlice->m_aiDDDInvOffset, sizeof( Int ) * getViewIndex() ); |
---|
| 3333 | memcpy( m_aiDDDShift, pcTextSlice->m_aiDDDShift, sizeof( Int ) * getViewIndex() ); |
---|
| 3334 | } |
---|
| 3335 | #endif |
---|
| 3336 | |
---|
[608] | 3337 | if( !setupLUT ) |
---|
| 3338 | return; |
---|
| 3339 | |
---|
| 3340 | /// GT: Allocation should be moved to a better place later; |
---|
| 3341 | if ( m_depthToDisparityB == NULL ) |
---|
| 3342 | { |
---|
| 3343 | m_depthToDisparityB = new Int*[ getViewIndex() ]; |
---|
| 3344 | for ( Int i = 0; i < getViewIndex(); i++ ) |
---|
| 3345 | { |
---|
| 3346 | m_depthToDisparityB[ i ] = new Int[ Int(1 << g_bitDepthY) ]; |
---|
| 3347 | } |
---|
| 3348 | } |
---|
| 3349 | |
---|
| 3350 | if ( m_depthToDisparityF == NULL ) |
---|
| 3351 | { |
---|
| 3352 | m_depthToDisparityF= new Int*[ getViewIndex() ]; |
---|
| 3353 | for ( Int i = 0; i < getViewIndex(); i++ ) |
---|
| 3354 | { |
---|
| 3355 | m_depthToDisparityF[ i ] = new Int[ Int(1 << g_bitDepthY) ]; |
---|
| 3356 | } |
---|
| 3357 | } |
---|
| 3358 | |
---|
| 3359 | assert( m_depthToDisparityB != NULL ); |
---|
| 3360 | assert( m_depthToDisparityF != NULL ); |
---|
| 3361 | |
---|
[758] | 3362 | TComVPS* vps = getVPS(); |
---|
[608] | 3363 | |
---|
[758] | 3364 | Int log2Div = g_bitDepthY - 1 + vps->getCamParPrecision(); |
---|
| 3365 | Int viewIndex = getViewIndex(); |
---|
| 3366 | |
---|
| 3367 | Bool camParaSH = vps->hasCamParInSliceHeader( viewIndex ); |
---|
| 3368 | |
---|
| 3369 | Int* codScale = camParaSH ? m_aaiCodedScale [ 0 ] : vps->getCodedScale ( viewIndex ); |
---|
| 3370 | Int* codOffset = camParaSH ? m_aaiCodedOffset[ 0 ] : vps->getCodedOffset ( viewIndex ); |
---|
| 3371 | Int* invCodScale = camParaSH ? m_aaiCodedScale [ 1 ] : vps->getInvCodedScale ( viewIndex ); |
---|
| 3372 | Int* invCodOffset = camParaSH ? m_aaiCodedOffset[ 1 ] : vps->getInvCodedOffset( viewIndex ); |
---|
[608] | 3373 | |
---|
| 3374 | for (Int i = 0; i <= ( getViewIndex() - 1); i++) |
---|
| 3375 | { |
---|
| 3376 | for ( Int d = 0; d <= ( ( 1 << g_bitDepthY ) - 1 ); d++ ) |
---|
| 3377 | { |
---|
| 3378 | Int offset = ( codOffset [ i ] << g_bitDepthY ) + ( ( 1 << log2Div ) >> 1 ); |
---|
| 3379 | m_depthToDisparityB[ i ][ d ] = ( codScale [ i ] * d + offset ) >> log2Div; |
---|
| 3380 | |
---|
| 3381 | Int invOffset = ( invCodOffset[ i ] << g_bitDepthY ) + ( ( 1 << log2Div ) >> 1 ); |
---|
| 3382 | m_depthToDisparityF[ i ][ d ] = ( invCodScale[ i ] * d + invOffset ) >> log2Div; |
---|
| 3383 | } |
---|
[833] | 3384 | |
---|
[884] | 3385 | #if H_3D_DDD |
---|
[833] | 3386 | InitializeDDDPara( vps->getCamParPrecision(), codScale[ i ], codOffset[ i ], i ); |
---|
| 3387 | #endif |
---|
[608] | 3388 | } |
---|
| 3389 | } |
---|
| 3390 | #endif |
---|
| 3391 | #endif |
---|
[833] | 3392 | |
---|
[884] | 3393 | #if H_3D_DDD |
---|
[833] | 3394 | Void TComSlice::InitializeDDDPara( UInt uiCamParsCodedPrecision, Int iCodedScale,Int iCodedOffset, Int iBaseViewIdx ) |
---|
| 3395 | { |
---|
| 3396 | UInt uiViewId = getViewIndex(); |
---|
| 3397 | |
---|
| 3398 | if( uiViewId == 0 ) |
---|
| 3399 | { |
---|
| 3400 | m_aiDDDInvScale[ iBaseViewIdx ] = m_aiDDDInvOffset[ iBaseViewIdx ] = m_aiDDDShift[ iBaseViewIdx ] = 0; |
---|
| 3401 | return; |
---|
| 3402 | } |
---|
| 3403 | |
---|
| 3404 | |
---|
| 3405 | Int iSign = iCodedScale >= 0 ? 1 : -1; |
---|
| 3406 | iCodedScale = abs( iCodedScale ); |
---|
| 3407 | |
---|
| 3408 | Int iBitWidth = 0; |
---|
| 3409 | |
---|
| 3410 | const Int iInvPres = 9; |
---|
| 3411 | |
---|
| 3412 | while( ((( 1 << iBitWidth ) << 1 ) <= iCodedScale ) ) |
---|
| 3413 | { |
---|
| 3414 | iBitWidth ++; |
---|
| 3415 | } |
---|
| 3416 | iBitWidth += iInvPres; |
---|
| 3417 | Int iTargetValue = 1 << iBitWidth; |
---|
| 3418 | |
---|
| 3419 | Int iMinError = MAX_INT; |
---|
| 3420 | Int iBestD = 1 << ( iInvPres - 1 ); |
---|
| 3421 | for( Int d = 1 << ( iInvPres - 1 ); d < ( 1 << iInvPres ); d++ ) |
---|
| 3422 | { |
---|
| 3423 | Int iError = abs( iCodedScale * d - iTargetValue ); |
---|
| 3424 | if( iError < iMinError ) |
---|
| 3425 | { |
---|
| 3426 | iMinError = iError; |
---|
| 3427 | iBestD = d; |
---|
| 3428 | } |
---|
| 3429 | if( iMinError == 0 ) |
---|
| 3430 | { |
---|
| 3431 | break; |
---|
| 3432 | } |
---|
| 3433 | } |
---|
| 3434 | Int iRoundingDir = 0; |
---|
| 3435 | if( iCodedScale * iBestD > iTargetValue ) |
---|
| 3436 | { |
---|
| 3437 | iRoundingDir = -1; |
---|
| 3438 | } |
---|
| 3439 | else if( iCodedScale * iBestD < iTargetValue ) |
---|
| 3440 | { |
---|
| 3441 | iRoundingDir = 1; |
---|
| 3442 | } |
---|
| 3443 | Int iCamPres = uiCamParsCodedPrecision - 1; |
---|
| 3444 | m_aiDDDInvScale [ iBaseViewIdx ] = ( iBestD << ( iCamPres + g_bitDepthY )) * iSign; |
---|
| 3445 | m_aiDDDInvOffset[ iBaseViewIdx ] = -iSign * iBestD * ( iCodedOffset << g_bitDepthY ); |
---|
| 3446 | m_aiDDDShift [ iBaseViewIdx ] = iBitWidth; |
---|
| 3447 | m_aiDDDInvOffset[ iBaseViewIdx ] += 1 << ( m_aiDDDShift[ iBaseViewIdx ] - 1 ); |
---|
| 3448 | m_aiDDDInvOffset[ iBaseViewIdx ] += ( 1 << ( m_aiDDDShift[ iBaseViewIdx ] - 4 ) ) * iRoundingDir; |
---|
| 3449 | |
---|
| 3450 | return; |
---|
| 3451 | } |
---|
| 3452 | #endif |
---|
| 3453 | |
---|
[56] | 3454 | /** get scaling matrix from RefMatrixID |
---|
| 3455 | * \param sizeId size index |
---|
| 3456 | * \param Index of input matrix |
---|
| 3457 | * \param Index of reference matrix |
---|
| 3458 | */ |
---|
| 3459 | Void TComScalingList::processRefMatrix( UInt sizeId, UInt listId , UInt refListId ) |
---|
| 3460 | { |
---|
[608] | 3461 | ::memcpy(getScalingListAddress(sizeId, listId),((listId == refListId)? getScalingListDefaultAddress(sizeId, refListId): getScalingListAddress(sizeId, refListId)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
[56] | 3462 | } |
---|
[608] | 3463 | |
---|
[56] | 3464 | /** parse syntax infomation |
---|
| 3465 | * \param pchFile syntax infomation |
---|
| 3466 | * \returns false if successful |
---|
| 3467 | */ |
---|
[608] | 3468 | Bool TComScalingList::xParseScalingList(Char* pchFile) |
---|
[56] | 3469 | { |
---|
| 3470 | FILE *fp; |
---|
| 3471 | Char line[1024]; |
---|
| 3472 | UInt sizeIdc,listIdc; |
---|
| 3473 | UInt i,size = 0; |
---|
| 3474 | Int *src=0,data; |
---|
| 3475 | Char *ret; |
---|
| 3476 | UInt retval; |
---|
| 3477 | |
---|
| 3478 | if((fp = fopen(pchFile,"r")) == (FILE*)NULL) |
---|
| 3479 | { |
---|
| 3480 | printf("can't open file %s :: set Default Matrix\n",pchFile); |
---|
| 3481 | return true; |
---|
| 3482 | } |
---|
| 3483 | |
---|
| 3484 | for(sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++) |
---|
| 3485 | { |
---|
| 3486 | size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeIdc]); |
---|
| 3487 | for(listIdc = 0; listIdc < g_scalingListNum[sizeIdc]; listIdc++) |
---|
| 3488 | { |
---|
| 3489 | src = getScalingListAddress(sizeIdc, listIdc); |
---|
| 3490 | |
---|
| 3491 | fseek(fp,0,0); |
---|
| 3492 | do |
---|
| 3493 | { |
---|
| 3494 | ret = fgets(line, 1024, fp); |
---|
| 3495 | if ((ret==NULL)||(strstr(line, MatrixType[sizeIdc][listIdc])==NULL && feof(fp))) |
---|
| 3496 | { |
---|
| 3497 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
| 3498 | return true; |
---|
| 3499 | } |
---|
| 3500 | } |
---|
| 3501 | while (strstr(line, MatrixType[sizeIdc][listIdc]) == NULL); |
---|
| 3502 | for (i=0; i<size; i++) |
---|
| 3503 | { |
---|
| 3504 | retval = fscanf(fp, "%d,", &data); |
---|
| 3505 | if (retval!=1) |
---|
| 3506 | { |
---|
| 3507 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
| 3508 | return true; |
---|
| 3509 | } |
---|
| 3510 | src[i] = data; |
---|
| 3511 | } |
---|
| 3512 | //set DC value for default matrix check |
---|
| 3513 | setScalingListDC(sizeIdc,listIdc,src[0]); |
---|
| 3514 | |
---|
| 3515 | if(sizeIdc > SCALING_LIST_8x8) |
---|
| 3516 | { |
---|
| 3517 | fseek(fp,0,0); |
---|
| 3518 | do |
---|
| 3519 | { |
---|
| 3520 | ret = fgets(line, 1024, fp); |
---|
| 3521 | if ((ret==NULL)||(strstr(line, MatrixType_DC[sizeIdc][listIdc])==NULL && feof(fp))) |
---|
| 3522 | { |
---|
| 3523 | printf("Error: can't read DC :: set Default Matrix\n"); |
---|
| 3524 | return true; |
---|
| 3525 | } |
---|
| 3526 | } |
---|
| 3527 | while (strstr(line, MatrixType_DC[sizeIdc][listIdc]) == NULL); |
---|
[608] | 3528 | retval = fscanf(fp, "%d,", &data); |
---|
| 3529 | if (retval!=1) |
---|
| 3530 | { |
---|
| 3531 | printf("Error: can't read Matrix :: set Default Matrix\n"); |
---|
| 3532 | return true; |
---|
| 3533 | } |
---|
| 3534 | //overwrite DC value when size of matrix is larger than 16x16 |
---|
| 3535 | setScalingListDC(sizeIdc,listIdc,data); |
---|
[56] | 3536 | } |
---|
| 3537 | } |
---|
| 3538 | } |
---|
| 3539 | fclose(fp); |
---|
| 3540 | return false; |
---|
| 3541 | } |
---|
| 3542 | |
---|
[622] | 3543 | #if H_MV |
---|
| 3544 | Void TComScalingList::inferFrom( TComScalingList* srcScLi ) |
---|
| 3545 | { |
---|
| 3546 | for(Int sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 3547 | { |
---|
| 3548 | for(Int listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
| 3549 | { |
---|
| 3550 | setRefMatrixId (sizeId,listId, srcScLi->getRefMatrixId (sizeId,listId)); |
---|
| 3551 | setScalingListDC(sizeId,listId, srcScLi->getScalingListDC(sizeId,listId)); |
---|
| 3552 | ::memcpy(getScalingListAddress(sizeId, listId),srcScLi->getScalingListAddress(sizeId, listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
| 3553 | } |
---|
| 3554 | } |
---|
| 3555 | } |
---|
| 3556 | #endif |
---|
[56] | 3557 | /** initialization process of quantization matrix array |
---|
| 3558 | */ |
---|
| 3559 | Void TComScalingList::init() |
---|
| 3560 | { |
---|
| 3561 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 3562 | { |
---|
| 3563 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
| 3564 | { |
---|
| 3565 | m_scalingListCoef[sizeId][listId] = new Int [min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])]; |
---|
| 3566 | } |
---|
| 3567 | } |
---|
| 3568 | m_scalingListCoef[SCALING_LIST_32x32][3] = m_scalingListCoef[SCALING_LIST_32x32][1]; // copy address for 32x32 |
---|
| 3569 | } |
---|
[608] | 3570 | |
---|
[56] | 3571 | /** destroy quantization matrix array |
---|
| 3572 | */ |
---|
| 3573 | Void TComScalingList::destroy() |
---|
| 3574 | { |
---|
| 3575 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 3576 | { |
---|
| 3577 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
| 3578 | { |
---|
| 3579 | if(m_scalingListCoef[sizeId][listId]) delete [] m_scalingListCoef[sizeId][listId]; |
---|
| 3580 | } |
---|
| 3581 | } |
---|
| 3582 | } |
---|
[608] | 3583 | |
---|
[56] | 3584 | /** get default address of quantization matrix |
---|
| 3585 | * \param sizeId size index |
---|
| 3586 | * \param listId list index |
---|
| 3587 | * \returns pointer of quantization matrix |
---|
| 3588 | */ |
---|
| 3589 | Int* TComScalingList::getScalingListDefaultAddress(UInt sizeId, UInt listId) |
---|
| 3590 | { |
---|
| 3591 | Int *src = 0; |
---|
| 3592 | switch(sizeId) |
---|
| 3593 | { |
---|
| 3594 | case SCALING_LIST_4x4: |
---|
[608] | 3595 | src = g_quantTSDefault4x4; |
---|
[56] | 3596 | break; |
---|
| 3597 | case SCALING_LIST_8x8: |
---|
| 3598 | src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
| 3599 | break; |
---|
| 3600 | case SCALING_LIST_16x16: |
---|
| 3601 | src = (listId<3) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
| 3602 | break; |
---|
| 3603 | case SCALING_LIST_32x32: |
---|
| 3604 | src = (listId<1) ? g_quantIntraDefault8x8 : g_quantInterDefault8x8; |
---|
| 3605 | break; |
---|
| 3606 | default: |
---|
| 3607 | assert(0); |
---|
| 3608 | src = NULL; |
---|
| 3609 | break; |
---|
| 3610 | } |
---|
| 3611 | return src; |
---|
| 3612 | } |
---|
[608] | 3613 | |
---|
[56] | 3614 | /** process of default matrix |
---|
| 3615 | * \param sizeId size index |
---|
| 3616 | * \param Index of input matrix |
---|
| 3617 | */ |
---|
[872] | 3618 | Void TComScalingList::processDefaultMatrix(UInt sizeId, UInt listId) |
---|
[56] | 3619 | { |
---|
| 3620 | ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])); |
---|
| 3621 | setScalingListDC(sizeId,listId,SCALING_LIST_DC); |
---|
| 3622 | } |
---|
[608] | 3623 | |
---|
[56] | 3624 | /** check DC value of matrix for default matrix signaling |
---|
| 3625 | */ |
---|
| 3626 | Void TComScalingList::checkDcOfMatrix() |
---|
| 3627 | { |
---|
| 3628 | for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 3629 | { |
---|
| 3630 | for(UInt listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
| 3631 | { |
---|
| 3632 | //check default matrix? |
---|
| 3633 | if(getScalingListDC(sizeId,listId) == 0) |
---|
| 3634 | { |
---|
[872] | 3635 | processDefaultMatrix(sizeId, listId); |
---|
[56] | 3636 | } |
---|
| 3637 | } |
---|
| 3638 | } |
---|
| 3639 | } |
---|
| 3640 | |
---|
| 3641 | ParameterSetManager::ParameterSetManager() |
---|
[608] | 3642 | : m_vpsMap(MAX_NUM_VPS) |
---|
| 3643 | , m_spsMap(MAX_NUM_SPS) |
---|
[56] | 3644 | , m_ppsMap(MAX_NUM_PPS) |
---|
[608] | 3645 | , m_activeVPSId(-1) |
---|
[622] | 3646 | #if !H_MV |
---|
[608] | 3647 | , m_activeSPSId(-1) |
---|
| 3648 | , m_activePPSId(-1) |
---|
[56] | 3649 | { |
---|
[622] | 3650 | #else |
---|
| 3651 | { |
---|
| 3652 | for (Int i = 0; i < MAX_NUM_LAYERS; i++ ) |
---|
| 3653 | { |
---|
| 3654 | m_activeSPSId[ i ] = -1; |
---|
| 3655 | m_activePPSId[ i ] = -1; |
---|
| 3656 | } |
---|
| 3657 | #endif |
---|
[56] | 3658 | } |
---|
| 3659 | |
---|
| 3660 | |
---|
| 3661 | ParameterSetManager::~ParameterSetManager() |
---|
| 3662 | { |
---|
| 3663 | } |
---|
| 3664 | |
---|
[608] | 3665 | //! activate a SPS from a active parameter sets SEI message |
---|
| 3666 | //! \returns true, if activation is successful |
---|
[622] | 3667 | #if H_MV |
---|
| 3668 | Bool ParameterSetManager::activateSPSWithSEI(Int spsId, Int layerId ) |
---|
| 3669 | #else |
---|
[608] | 3670 | Bool ParameterSetManager::activateSPSWithSEI(Int spsId) |
---|
[622] | 3671 | #endif |
---|
[608] | 3672 | { |
---|
| 3673 | TComSPS *sps = m_spsMap.getPS(spsId); |
---|
| 3674 | if (sps) |
---|
| 3675 | { |
---|
| 3676 | Int vpsId = sps->getVPSId(); |
---|
| 3677 | if (m_vpsMap.getPS(vpsId)) |
---|
| 3678 | { |
---|
| 3679 | m_activeVPSId = vpsId; |
---|
[622] | 3680 | #if H_MV |
---|
| 3681 | m_activeSPSId[ layerId ] = spsId; |
---|
| 3682 | #else |
---|
| 3683 | m_activeSPSId = spsId; |
---|
| 3684 | #endif |
---|
[608] | 3685 | return true; |
---|
| 3686 | } |
---|
| 3687 | else |
---|
| 3688 | { |
---|
| 3689 | printf("Warning: tried to activate SPS using an Active parameter sets SEI message. Referenced VPS does not exist."); |
---|
| 3690 | } |
---|
| 3691 | } |
---|
| 3692 | else |
---|
| 3693 | { |
---|
| 3694 | printf("Warning: tried to activate non-existing SPS using an Active parameter sets SEI message."); |
---|
| 3695 | } |
---|
| 3696 | return false; |
---|
| 3697 | } |
---|
| 3698 | |
---|
| 3699 | //! activate a PPS and depending on isIDR parameter also SPS and VPS |
---|
| 3700 | //! \returns true, if activation is successful |
---|
[622] | 3701 | #if H_MV |
---|
| 3702 | Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP, Int layerId ) |
---|
| 3703 | #else |
---|
[608] | 3704 | Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP) |
---|
[622] | 3705 | #endif |
---|
[608] | 3706 | { |
---|
| 3707 | TComPPS *pps = m_ppsMap.getPS(ppsId); |
---|
| 3708 | if (pps) |
---|
| 3709 | { |
---|
| 3710 | Int spsId = pps->getSPSId(); |
---|
| 3711 | #if H_MV |
---|
[622] | 3712 | if (!isIRAP && (spsId != m_activeSPSId[ layerId ])) |
---|
| 3713 | #else |
---|
| 3714 | if (!isIRAP && (spsId != m_activeSPSId)) |
---|
| 3715 | #endif |
---|
| 3716 | { |
---|
| 3717 | printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP."); |
---|
| 3718 | return false; |
---|
| 3719 | } |
---|
| 3720 | |
---|
| 3721 | TComSPS *sps = m_spsMap.getPS(spsId); |
---|
| 3722 | if (sps) |
---|
| 3723 | { |
---|
| 3724 | Int vpsId = sps->getVPSId(); |
---|
| 3725 | if (!isIRAP && (vpsId != m_activeVPSId)) |
---|
| 3726 | { |
---|
| 3727 | printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP."); |
---|
| 3728 | return false; |
---|
| 3729 | } |
---|
| 3730 | if (m_vpsMap.getPS(vpsId)) |
---|
| 3731 | { |
---|
| 3732 | #if H_MV |
---|
| 3733 | m_activePPSId[ layerId ] = ppsId; |
---|
| 3734 | m_activeVPSId = vpsId; |
---|
| 3735 | m_activeSPSId[ layerId ] = spsId; |
---|
| 3736 | #else |
---|
| 3737 | m_activePPSId = ppsId; |
---|
| 3738 | m_activeVPSId = vpsId; |
---|
| 3739 | m_activeSPSId = spsId; |
---|
| 3740 | #endif |
---|
[608] | 3741 | return true; |
---|
| 3742 | } |
---|
| 3743 | else |
---|
| 3744 | { |
---|
| 3745 | printf("Warning: tried to activate PPS that refers to a non-existing VPS."); |
---|
| 3746 | } |
---|
| 3747 | } |
---|
| 3748 | else |
---|
| 3749 | { |
---|
| 3750 | printf("Warning: tried to activate a PPS that refers to a non-existing SPS."); |
---|
| 3751 | } |
---|
| 3752 | } |
---|
| 3753 | else |
---|
| 3754 | { |
---|
| 3755 | printf("Warning: tried to activate non-existing PPS."); |
---|
| 3756 | } |
---|
| 3757 | return false; |
---|
| 3758 | } |
---|
| 3759 | |
---|
| 3760 | ProfileTierLevel::ProfileTierLevel() |
---|
| 3761 | : m_profileSpace (0) |
---|
| 3762 | , m_tierFlag (false) |
---|
| 3763 | , m_profileIdc (0) |
---|
| 3764 | , m_levelIdc (0) |
---|
| 3765 | , m_progressiveSourceFlag (false) |
---|
| 3766 | , m_interlacedSourceFlag (false) |
---|
| 3767 | , m_nonPackedConstraintFlag(false) |
---|
| 3768 | , m_frameOnlyConstraintFlag(false) |
---|
| 3769 | { |
---|
| 3770 | ::memset(m_profileCompatibilityFlag, 0, sizeof(m_profileCompatibilityFlag)); |
---|
| 3771 | } |
---|
| 3772 | |
---|
| 3773 | TComPTL::TComPTL() |
---|
| 3774 | { |
---|
| 3775 | ::memset(m_subLayerProfilePresentFlag, 0, sizeof(m_subLayerProfilePresentFlag)); |
---|
| 3776 | ::memset(m_subLayerLevelPresentFlag, 0, sizeof(m_subLayerLevelPresentFlag )); |
---|
| 3777 | } |
---|
| 3778 | |
---|
| 3779 | #if H_MV |
---|
| 3780 | Void TComPTL::copyLevelFrom( TComPTL* source ) |
---|
| 3781 | { |
---|
| 3782 | getGeneralPTL()->setLevelIdc( source->getGeneralPTL()->getLevelIdc() ); |
---|
| 3783 | for( Int subLayer = 0; subLayer < 6; subLayer++ ) |
---|
| 3784 | { |
---|
| 3785 | setSubLayerLevelPresentFlag( subLayer, source->getSubLayerLevelPresentFlag( subLayer ) ); |
---|
| 3786 | getSubLayerPTL( subLayer )->setLevelIdc( source->getSubLayerPTL( subLayer )->getLevelIdc() ); |
---|
| 3787 | } |
---|
| 3788 | } |
---|
| 3789 | #endif |
---|
[622] | 3790 | //! \} |
---|
| 3791 | |
---|
| 3792 | #if H_MV |
---|
| 3793 | TComVPSVUI::TComVPSVUI() |
---|
[608] | 3794 | { |
---|
[738] | 3795 | m_crossLayerIrapAlignedFlag = true; |
---|
[872] | 3796 | m_allLayersIdrAlignedFlag = false; |
---|
[622] | 3797 | m_bitRatePresentVpsFlag = false; |
---|
| 3798 | m_picRatePresentVpsFlag = false; |
---|
| 3799 | for ( Int i = 0; i < MAX_VPS_OP_SETS_PLUS1; i++) |
---|
| 3800 | { |
---|
| 3801 | for ( Int j = 0; j < MAX_TLAYER; j++) |
---|
| 3802 | { |
---|
| 3803 | m_bitRatePresentFlag [i][j] = false; |
---|
| 3804 | m_picRatePresentFlag [i][j] = false; |
---|
| 3805 | m_avgBitRate [i][j] = -1; |
---|
| 3806 | m_maxBitRate [i][j] = -1; |
---|
| 3807 | m_constantPicRateIdc [i][j] = -1; |
---|
| 3808 | m_avgPicRate [i][j] = -1; |
---|
| 3809 | } |
---|
| 3810 | } |
---|
| 3811 | |
---|
| 3812 | m_ilpRestrictedRefLayersFlag = false; |
---|
| 3813 | |
---|
| 3814 | for ( Int i = 0; i < MAX_NUM_LAYERS; i++) |
---|
| 3815 | { |
---|
| 3816 | for ( Int j = 0; j < MAX_NUM_LAYERS; j++) |
---|
| 3817 | { |
---|
| 3818 | m_tileBoundariesAlignedFlag [i][j] = false; |
---|
| 3819 | m_minSpatialSegmentOffsetPlus1[i][j] = 0; |
---|
| 3820 | m_ctuBasedOffsetEnabledFlag [i][j] = false; |
---|
| 3821 | m_minHorizontalCtuOffsetPlus1 [i][j] = -1; |
---|
| 3822 | } |
---|
[872] | 3823 | m_baseLayerParameterSetCompatibilityFlag[i] = false; |
---|
[622] | 3824 | } |
---|
[738] | 3825 | for ( Int i = 0; i < MAX_NUM_VIDEO_SIGNAL_INFO; i++ ) |
---|
| 3826 | { |
---|
| 3827 | m_videoSignalInfo [i] = NULL; |
---|
| 3828 | } |
---|
| 3829 | |
---|
| 3830 | m_vpsVuiBspHrdPresentFlag = false; |
---|
| 3831 | m_vpsVuiBspHrdParameters = new TComVpsVuiBspHrdParameters(); |
---|
[608] | 3832 | } |
---|
[738] | 3833 | |
---|
| 3834 | TComVPSVUI::~TComVPSVUI() |
---|
| 3835 | { |
---|
| 3836 | for ( Int i = 0; i < MAX_NUM_VIDEO_SIGNAL_INFO; i++ ) |
---|
| 3837 | { |
---|
| 3838 | if (m_videoSignalInfo[ i ] != NULL ) delete m_videoSignalInfo[ i ]; |
---|
| 3839 | m_videoSignalInfo [ i ] = NULL; |
---|
| 3840 | } |
---|
| 3841 | |
---|
| 3842 | if ( m_vpsVuiBspHrdParameters ) delete m_vpsVuiBspHrdParameters; |
---|
| 3843 | m_vpsVuiBspHrdParameters = NULL; |
---|
| 3844 | } |
---|
| 3845 | |
---|
[884] | 3846 | Void TComVPSVUI::inferVpsVui( Bool encoderFlag ) |
---|
| 3847 | { |
---|
| 3848 | // inference of syntax elements that differ from default inference (as done in constructor), when VPS VUI is not present |
---|
| 3849 | if (!encoderFlag ) |
---|
| 3850 | { |
---|
| 3851 | setCrossLayerIrapAlignedFlag( false ); |
---|
| 3852 | } |
---|
| 3853 | else |
---|
| 3854 | { |
---|
| 3855 | assert( !getCrossLayerIrapAlignedFlag() ); |
---|
| 3856 | } |
---|
| 3857 | } |
---|
| 3858 | |
---|
[738] | 3859 | Void TComRepFormat::inferChromaAndBitDepth( TComRepFormat* prevRepFormat, Bool encoderFlag ) |
---|
| 3860 | { |
---|
| 3861 | if ( !encoderFlag ) |
---|
| 3862 | { |
---|
| 3863 | setChromaAndBitDepthVpsPresentFlag( prevRepFormat->getChromaAndBitDepthVpsPresentFlag() ); |
---|
| 3864 | setSeparateColourPlaneVpsFlag ( prevRepFormat->getSeparateColourPlaneVpsFlag () ); |
---|
| 3865 | setBitDepthVpsLumaMinus8 ( prevRepFormat->getBitDepthVpsLumaMinus8 () ); |
---|
| 3866 | setBitDepthVpsChromaMinus8 ( prevRepFormat->getBitDepthVpsChromaMinus8 () ); |
---|
| 3867 | } |
---|
| 3868 | else |
---|
| 3869 | { |
---|
| 3870 | assert( getChromaAndBitDepthVpsPresentFlag() == prevRepFormat->getChromaAndBitDepthVpsPresentFlag() ); |
---|
| 3871 | assert( getSeparateColourPlaneVpsFlag () == prevRepFormat->getSeparateColourPlaneVpsFlag () ); |
---|
| 3872 | assert( getBitDepthVpsLumaMinus8 () == prevRepFormat->getBitDepthVpsLumaMinus8 () ); |
---|
| 3873 | assert( getBitDepthVpsChromaMinus8 () == prevRepFormat->getBitDepthVpsChromaMinus8 () ); |
---|
| 3874 | } |
---|
| 3875 | } |
---|
| 3876 | |
---|
| 3877 | Void TComVpsVuiBspHrdParameters::checkLayerInBspFlag( TComVPS* vps, Int h ) |
---|
| 3878 | { |
---|
| 3879 | // It is a requirement of bitstream conformance that bitstream partition with index j shall not include |
---|
| 3880 | // direct or indirect reference layers of any layers in bitstream partition i for any values of i and j |
---|
[758] | 3881 | // in the range of 0 to num_bitstream_partitions[ h ] ?1, inclusive, such that i is less than j. |
---|
[738] | 3882 | |
---|
| 3883 | for ( Int partJ = 0; partJ < getNumBitstreamPartitions( h ); partJ++ ) |
---|
| 3884 | { |
---|
| 3885 | for ( Int partI = 0; partI < partJ; partI++ ) |
---|
| 3886 | { |
---|
| 3887 | for ( Int layerJ = 0; layerJ < vps->getMaxLayersMinus1(); layerJ++ ) |
---|
| 3888 | { |
---|
| 3889 | if ( m_layerInBspFlag[ h ][partJ][layerJ ] ) |
---|
| 3890 | { |
---|
| 3891 | for ( Int layerI = 0; layerI < vps->getMaxLayersMinus1(); layerI++ ) |
---|
| 3892 | { |
---|
| 3893 | if ( m_layerInBspFlag[ h ][partI][layerI] ) |
---|
| 3894 | { |
---|
| 3895 | assert( !vps->getInDirectDependencyFlag( layerI, layerJ ) ); |
---|
| 3896 | } |
---|
| 3897 | } |
---|
| 3898 | } |
---|
| 3899 | } |
---|
| 3900 | } |
---|
| 3901 | } |
---|
| 3902 | } |
---|
[773] | 3903 | |
---|
| 3904 | Void TComVUI::inferVideoSignalInfo( TComVPS* vps, Int layerIdCurr ) |
---|
| 3905 | { |
---|
| 3906 | if ( layerIdCurr == 0 || !vps->getVpsVuiPresentFlag() ) |
---|
| 3907 | { |
---|
| 3908 | return; |
---|
| 3909 | } |
---|
| 3910 | |
---|
| 3911 | TComVPSVUI* vpsVUI = vps->getVPSVUI(); |
---|
| 3912 | assert( vpsVUI != NULL ); |
---|
| 3913 | |
---|
| 3914 | TComVideoSignalInfo* videoSignalInfo = vpsVUI->getVideoSignalInfo( vpsVUI->getVpsVideoSignalInfoIdx( vps->getLayerIdInVps( layerIdCurr ) ) ); |
---|
| 3915 | assert( videoSignalInfo != NULL ); |
---|
| 3916 | |
---|
| 3917 | setVideoFormat ( videoSignalInfo->getVideoVpsFormat () ); |
---|
| 3918 | setVideoFullRangeFlag ( videoSignalInfo->getVideoFullRangeVpsFlag () ); |
---|
| 3919 | setColourPrimaries ( videoSignalInfo->getColourPrimariesVps () ); |
---|
| 3920 | setTransferCharacteristics( videoSignalInfo->getTransferCharacteristicsVps() ); |
---|
| 3921 | setMatrixCoefficients ( videoSignalInfo->getMatrixCoeffsVps () ); |
---|
| 3922 | } |
---|
[884] | 3923 | |
---|
| 3924 | TComDpbSize::TComDpbSize() |
---|
| 3925 | { |
---|
| 3926 | for (Int i = 0; i < MAX_VPS_OUTPUTLAYER_SETS; i++ ) |
---|
| 3927 | { |
---|
| 3928 | m_subLayerFlagInfoPresentFlag[i] = false; |
---|
| 3929 | |
---|
| 3930 | for (Int j = 0; j < MAX_TLAYER; j++ ) |
---|
| 3931 | { |
---|
| 3932 | m_subLayerDpbInfoPresentFlag [i][j] = ( j == 0) ; |
---|
| 3933 | m_maxVpsNumReorderPics [i][j] = 0; |
---|
| 3934 | m_maxVpsLatencyIncreasePlus1 [i][j] = 0; |
---|
| 3935 | |
---|
| 3936 | for (Int k = 0; k < MAX_NUM_LAYER_IDS; k++ ) |
---|
| 3937 | { |
---|
| 3938 | m_maxVpsDecPicBufferingMinus1[i][k][j] = 0; |
---|
| 3939 | } |
---|
| 3940 | } |
---|
| 3941 | } |
---|
| 3942 | } |
---|
[738] | 3943 | #endif |
---|