[5] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[56] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[608] | 6 | * Copyright (c) 2010-2013, 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 TDecTop.cpp |
---|
| 35 | \brief decoder class |
---|
| 36 | */ |
---|
| 37 | |
---|
[56] | 38 | #include "NALread.h" |
---|
[2] | 39 | #include "TDecTop.h" |
---|
| 40 | |
---|
[608] | 41 | #if H_MV |
---|
| 42 | ParameterSetManagerDecoder TDecTop::m_parameterSetManagerDecoder; |
---|
| 43 | #endif |
---|
[56] | 44 | //! \ingroup TLibDecoder |
---|
| 45 | //! \{ |
---|
[2] | 46 | |
---|
[608] | 47 | #if H_3D |
---|
[2] | 48 | CamParsCollector::CamParsCollector() |
---|
| 49 | : m_bInitialized( false ) |
---|
| 50 | { |
---|
[608] | 51 | m_aaiCodedOffset = new Int* [ MAX_NUM_LAYERS ]; |
---|
| 52 | m_aaiCodedScale = new Int* [ MAX_NUM_LAYERS ]; |
---|
| 53 | m_aiViewId = new Int [ MAX_NUM_LAYERS ]; |
---|
| 54 | |
---|
| 55 | m_bViewReceived = new Bool [ MAX_NUM_LAYERS ]; |
---|
| 56 | for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ ) |
---|
[2] | 57 | { |
---|
[608] | 58 | m_aaiCodedOffset [ uiId ] = new Int [ MAX_NUM_LAYERS ]; |
---|
| 59 | m_aaiCodedScale [ uiId ] = new Int [ MAX_NUM_LAYERS ]; |
---|
[2] | 60 | } |
---|
[296] | 61 | |
---|
[608] | 62 | xCreateLUTs( (UInt)MAX_NUM_LAYERS, (UInt)MAX_NUM_LAYERS, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); |
---|
[296] | 63 | m_iLog2Precision = LOG2_DISP_PREC_LUT; |
---|
| 64 | m_uiBitDepthForLUT = 8; // fixed |
---|
[2] | 65 | } |
---|
| 66 | |
---|
| 67 | CamParsCollector::~CamParsCollector() |
---|
| 68 | { |
---|
[608] | 69 | for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ ) |
---|
[2] | 70 | { |
---|
| 71 | delete [] m_aaiCodedOffset [ uiId ]; |
---|
| 72 | delete [] m_aaiCodedScale [ uiId ]; |
---|
| 73 | } |
---|
| 74 | delete [] m_aaiCodedOffset; |
---|
| 75 | delete [] m_aaiCodedScale; |
---|
[608] | 76 | delete [] m_aiViewId; |
---|
| 77 | delete [] m_bViewReceived; |
---|
[296] | 78 | |
---|
[608] | 79 | xDeleteArray( m_adBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 ); |
---|
| 80 | xDeleteArray( m_aiBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 ); |
---|
[2] | 81 | } |
---|
| 82 | |
---|
| 83 | Void |
---|
| 84 | CamParsCollector::init( FILE* pCodedScaleOffsetFile ) |
---|
| 85 | { |
---|
| 86 | m_bInitialized = true; |
---|
| 87 | m_pCodedScaleOffsetFile = pCodedScaleOffsetFile; |
---|
| 88 | m_uiCamParsCodedPrecision = 0; |
---|
| 89 | m_bCamParsVaryOverTime = false; |
---|
[608] | 90 | m_iLastViewIndex = -1; |
---|
[2] | 91 | m_iLastPOC = -1; |
---|
[608] | 92 | m_uiMaxViewIndex = 0; |
---|
[2] | 93 | } |
---|
| 94 | |
---|
| 95 | Void |
---|
[296] | 96 | CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT) |
---|
| 97 | { |
---|
| 98 | |
---|
[608] | 99 | uiNumberSourceViews = std::max( (UInt) 1, uiNumberSourceViews ); |
---|
| 100 | uiNumberTargetViews = std::max( (UInt) 1, uiNumberTargetViews ); |
---|
[296] | 101 | |
---|
| 102 | radLUT = new Double***[ uiNumberSourceViews ]; |
---|
| 103 | raiLUT = new Int ***[ uiNumberSourceViews ]; |
---|
| 104 | |
---|
| 105 | for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ ) |
---|
| 106 | { |
---|
| 107 | radLUT [ uiSourceView ] = new Double**[ uiNumberTargetViews ]; |
---|
| 108 | raiLUT [ uiSourceView ] = new Int **[ uiNumberTargetViews ]; |
---|
| 109 | |
---|
| 110 | for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ ) |
---|
| 111 | { |
---|
| 112 | radLUT [ uiSourceView ][ uiTargetView ] = new Double*[ 2 ]; |
---|
| 113 | radLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ]; |
---|
| 114 | radLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ]; |
---|
| 115 | |
---|
| 116 | raiLUT [ uiSourceView ][ uiTargetView ] = new Int* [ 2 ]; |
---|
| 117 | raiLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Int [ 257 ]; |
---|
| 118 | raiLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Int [ 257 ]; |
---|
| 119 | } |
---|
| 120 | } |
---|
| 121 | } |
---|
| 122 | |
---|
| 123 | Void |
---|
| 124 | CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT) |
---|
| 125 | { |
---|
| 126 | Int iLog2DivLuma = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision; AOF( iLog2DivLuma > 0 ); |
---|
| 127 | Int iLog2DivChroma = iLog2DivLuma + 1; |
---|
| 128 | |
---|
| 129 | iOffset <<= m_uiBitDepthForLUT; |
---|
| 130 | |
---|
| 131 | Double dScale = (Double) iScale / (( Double ) ( 1 << iLog2DivLuma )); |
---|
| 132 | Double dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma )); |
---|
| 133 | |
---|
| 134 | // offsets including rounding offsets |
---|
| 135 | Int64 iOffsetLuma = iOffset + ( ( 1 << iLog2DivLuma ) >> 1 ); |
---|
| 136 | Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 ); |
---|
| 137 | |
---|
| 138 | |
---|
| 139 | for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ ) |
---|
| 140 | { |
---|
| 141 | |
---|
| 142 | // real-valued look-up tables |
---|
| 143 | Double dShiftLuma = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision ); |
---|
| 144 | Double dShiftChroma = dShiftLuma / 2; |
---|
| 145 | radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma; |
---|
| 146 | radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma; |
---|
| 147 | |
---|
| 148 | // integer-valued look-up tables |
---|
| 149 | Int64 iTempScale = (Int64)uiDepthValue * iScale; |
---|
| 150 | Int64 iShiftLuma = ( iTempScale + iOffsetLuma ) >> iLog2DivLuma; |
---|
| 151 | Int64 iShiftChroma = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma; |
---|
| 152 | raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma; |
---|
| 153 | raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma; |
---|
| 154 | } |
---|
| 155 | |
---|
| 156 | radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ]; |
---|
| 157 | radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; |
---|
| 158 | raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ]; |
---|
| 159 | raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; |
---|
| 160 | } |
---|
| 161 | |
---|
| 162 | Void |
---|
[2] | 163 | CamParsCollector::uninit() |
---|
| 164 | { |
---|
| 165 | m_bInitialized = false; |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | Void |
---|
| 169 | CamParsCollector::setSlice( TComSlice* pcSlice ) |
---|
| 170 | { |
---|
[608] | 171 | |
---|
[2] | 172 | if( pcSlice == 0 ) |
---|
| 173 | { |
---|
| 174 | AOF( xIsComplete() ); |
---|
| 175 | if( m_bCamParsVaryOverTime || m_iLastPOC == 0 ) |
---|
| 176 | { |
---|
| 177 | xOutput( m_iLastPOC ); |
---|
| 178 | } |
---|
| 179 | return; |
---|
| 180 | } |
---|
[608] | 181 | |
---|
| 182 | if ( pcSlice->getIsDepth()) |
---|
[2] | 183 | { |
---|
| 184 | return; |
---|
| 185 | } |
---|
[608] | 186 | |
---|
| 187 | Bool bFirstAU = ( pcSlice->getPOC() == 0 ); |
---|
| 188 | Bool bFirstSliceInAU = ( pcSlice->getPOC() != Int ( m_iLastPOC ) ); |
---|
| 189 | Bool bFirstSliceInView = ( pcSlice->getViewIndex() != UInt( m_iLastViewIndex ) || bFirstSliceInAU ); |
---|
| 190 | |
---|
| 191 | AOT( bFirstSliceInAU && pcSlice->getViewIndex() != 0 ); |
---|
| 192 | AOT( !bFirstSliceInAU && pcSlice->getViewIndex() < UInt( m_iLastViewIndex ) ); |
---|
| 193 | |
---|
| 194 | AOT( !bFirstSliceInAU && pcSlice->getViewIndex() > UInt( m_iLastViewIndex + 1 ) ); |
---|
| 195 | |
---|
| 196 | AOT( !bFirstAU && pcSlice->getViewIndex() > m_uiMaxViewIndex ); |
---|
| 197 | |
---|
[2] | 198 | if ( !bFirstSliceInView ) |
---|
| 199 | { |
---|
| 200 | if( m_bCamParsVaryOverTime ) // check consistency of slice parameters here |
---|
| 201 | { |
---|
[608] | 202 | UInt uiViewIndex = pcSlice->getViewIndex(); |
---|
| 203 | for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < uiViewIndex; uiBaseViewIndex++ ) |
---|
[2] | 204 | { |
---|
[608] | 205 | AOF( m_aaiCodedScale [ uiBaseViewIndex ][ uiViewIndex ] == pcSlice->getCodedScale () [ uiBaseViewIndex ] ); |
---|
| 206 | AOF( m_aaiCodedOffset[ uiBaseViewIndex ][ uiViewIndex ] == pcSlice->getCodedOffset () [ uiBaseViewIndex ] ); |
---|
| 207 | AOF( m_aaiCodedScale [ uiViewIndex ][ uiBaseViewIndex ] == pcSlice->getInvCodedScale () [ uiBaseViewIndex ] ); |
---|
| 208 | AOF( m_aaiCodedOffset[ uiViewIndex ][ uiBaseViewIndex ] == pcSlice->getInvCodedOffset() [ uiBaseViewIndex ] ); |
---|
[2] | 209 | } |
---|
| 210 | } |
---|
| 211 | return; |
---|
| 212 | } |
---|
| 213 | |
---|
| 214 | if( bFirstSliceInAU ) |
---|
| 215 | { |
---|
| 216 | if( !bFirstAU ) |
---|
| 217 | { |
---|
| 218 | AOF( xIsComplete() ); |
---|
| 219 | xOutput( m_iLastPOC ); |
---|
| 220 | } |
---|
[608] | 221 | ::memset( m_bViewReceived, false, MAX_NUM_LAYERS * sizeof( Bool ) ); |
---|
[2] | 222 | } |
---|
| 223 | |
---|
[608] | 224 | UInt uiViewIndex = pcSlice->getViewIndex(); |
---|
| 225 | m_bViewReceived[ uiViewIndex ] = true; |
---|
[2] | 226 | if( bFirstAU ) |
---|
| 227 | { |
---|
[608] | 228 | m_uiMaxViewIndex = std::max( m_uiMaxViewIndex, uiViewIndex ); |
---|
| 229 | m_aiViewId[ uiViewIndex ] = pcSlice->getViewId(); |
---|
[773] | 230 | |
---|
[608] | 231 | if( uiViewIndex == 1 ) |
---|
[2] | 232 | { |
---|
[758] | 233 | m_uiCamParsCodedPrecision = pcSlice->getVPS()->getCamParPrecision (); |
---|
| 234 | m_bCamParsVaryOverTime = pcSlice->getVPS()->hasCamParInSliceHeader ( uiViewIndex ); |
---|
| 235 | } |
---|
| 236 | else if( uiViewIndex > 1 ) |
---|
| 237 | { |
---|
| 238 | AOF( m_uiCamParsCodedPrecision == pcSlice->getVPS()->getCamParPrecision () ); |
---|
| 239 | AOF( m_bCamParsVaryOverTime == pcSlice->getVPS()->hasCamParInSliceHeader ( uiViewIndex ) ); |
---|
| 240 | } |
---|
[773] | 241 | |
---|
[608] | 242 | for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ ) |
---|
[2] | 243 | { |
---|
| 244 | if( m_bCamParsVaryOverTime ) |
---|
| 245 | { |
---|
[608] | 246 | m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedScale () [ uiBaseIndex ]; |
---|
| 247 | m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedOffset () [ uiBaseIndex ]; |
---|
| 248 | m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedScale () [ uiBaseIndex ]; |
---|
| 249 | m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedOffset() [ uiBaseIndex ]; |
---|
| 250 | xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); |
---|
| 251 | xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT); |
---|
[2] | 252 | } |
---|
| 253 | else |
---|
| 254 | { |
---|
[758] | 255 | m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ] = pcSlice->getVPS()->getCodedScale (uiViewIndex) [ uiBaseIndex ]; |
---|
| 256 | m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ] = pcSlice->getVPS()->getCodedOffset (uiViewIndex) [ uiBaseIndex ]; |
---|
| 257 | m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ] = pcSlice->getVPS()->getInvCodedScale (uiViewIndex) [ uiBaseIndex ]; |
---|
| 258 | m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ] = pcSlice->getVPS()->getInvCodedOffset(uiViewIndex) [ uiBaseIndex ]; |
---|
[608] | 259 | xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); |
---|
| 260 | xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); |
---|
[2] | 261 | } |
---|
| 262 | } |
---|
| 263 | } |
---|
| 264 | else |
---|
| 265 | { |
---|
[608] | 266 | AOF( m_aiViewId[ uiViewIndex ] == pcSlice->getViewId() ); |
---|
[2] | 267 | if( m_bCamParsVaryOverTime ) |
---|
| 268 | { |
---|
[608] | 269 | for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ ) |
---|
[2] | 270 | { |
---|
[608] | 271 | m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedScale () [ uiBaseIndex ]; |
---|
| 272 | m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ] = pcSlice->getCodedOffset () [ uiBaseIndex ]; |
---|
| 273 | m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedScale () [ uiBaseIndex ]; |
---|
| 274 | m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ] = pcSlice->getInvCodedOffset() [ uiBaseIndex ]; |
---|
| 275 | |
---|
| 276 | xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); |
---|
| 277 | xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT ); |
---|
[2] | 278 | } |
---|
| 279 | } |
---|
| 280 | } |
---|
[608] | 281 | |
---|
| 282 | m_iLastViewIndex = (Int)pcSlice->getViewIndex(); |
---|
| 283 | m_iLastPOC = (Int)pcSlice->getPOC(); |
---|
[2] | 284 | } |
---|
| 285 | |
---|
[773] | 286 | #if H_3D_IV_MERGE |
---|
[724] | 287 | Void |
---|
| 288 | CamParsCollector::copyCamParamForSlice( TComSlice* pcSlice ) |
---|
| 289 | { |
---|
| 290 | if( m_bCamParsVaryOverTime ) |
---|
| 291 | { |
---|
| 292 | pcSlice->setCamparaSlice( m_aaiCodedScale, m_aaiCodedOffset ); |
---|
| 293 | } |
---|
| 294 | } |
---|
| 295 | #endif |
---|
| 296 | |
---|
[2] | 297 | Bool |
---|
| 298 | CamParsCollector::xIsComplete() |
---|
| 299 | { |
---|
[608] | 300 | for( UInt uiView = 0; uiView <= m_uiMaxViewIndex; uiView++ ) |
---|
[2] | 301 | { |
---|
[608] | 302 | if( m_bViewReceived[ uiView ] == 0 ) |
---|
[2] | 303 | { |
---|
| 304 | return false; |
---|
| 305 | } |
---|
| 306 | } |
---|
| 307 | return true; |
---|
| 308 | } |
---|
| 309 | |
---|
| 310 | Void |
---|
| 311 | CamParsCollector::xOutput( Int iPOC ) |
---|
| 312 | { |
---|
| 313 | if( m_pCodedScaleOffsetFile ) |
---|
| 314 | { |
---|
| 315 | if( iPOC == 0 ) |
---|
| 316 | { |
---|
[608] | 317 | fprintf( m_pCodedScaleOffsetFile, "# ViewIndex ViewId\n" ); |
---|
[2] | 318 | fprintf( m_pCodedScaleOffsetFile, "#----------- ------------\n" ); |
---|
[608] | 319 | for( UInt uiViewIndex = 0; uiViewIndex <= m_uiMaxViewIndex; uiViewIndex++ ) |
---|
[2] | 320 | { |
---|
[608] | 321 | fprintf( m_pCodedScaleOffsetFile, "%12d %12d\n", uiViewIndex, m_aiViewId[ uiViewIndex ] ); |
---|
[2] | 322 | } |
---|
| 323 | fprintf( m_pCodedScaleOffsetFile, "\n\n"); |
---|
| 324 | fprintf( m_pCodedScaleOffsetFile, "# StartFrame EndFrame TargetView BaseView CodedScale CodedOffset Precision\n" ); |
---|
| 325 | fprintf( m_pCodedScaleOffsetFile, "#----------- ------------ ------------ ------------ ------------ ------------ ------------\n" ); |
---|
| 326 | } |
---|
| 327 | if( iPOC == 0 || m_bCamParsVaryOverTime ) |
---|
| 328 | { |
---|
| 329 | Int iS = iPOC; |
---|
| 330 | Int iE = ( m_bCamParsVaryOverTime ? iPOC : ~( 1 << 31 ) ); |
---|
[608] | 331 | for( UInt uiViewIndex = 0; uiViewIndex <= m_uiMaxViewIndex; uiViewIndex++ ) |
---|
[2] | 332 | { |
---|
[608] | 333 | for( UInt uiBaseIndex = 0; uiBaseIndex <= m_uiMaxViewIndex; uiBaseIndex++ ) |
---|
[2] | 334 | { |
---|
[608] | 335 | if( uiViewIndex != uiBaseIndex ) |
---|
[2] | 336 | { |
---|
| 337 | fprintf( m_pCodedScaleOffsetFile, "%12d %12d %12d %12d %12d %12d %12d\n", |
---|
[608] | 338 | iS, iE, uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_uiCamParsCodedPrecision ); |
---|
[2] | 339 | } |
---|
| 340 | } |
---|
| 341 | } |
---|
| 342 | } |
---|
| 343 | } |
---|
| 344 | } |
---|
[608] | 345 | #endif |
---|
[2] | 346 | TDecTop::TDecTop() |
---|
| 347 | { |
---|
[56] | 348 | m_pcPic = 0; |
---|
[2] | 349 | m_iMaxRefPicNum = 0; |
---|
| 350 | #if ENC_DEC_TRACE |
---|
[608] | 351 | #if H_MV |
---|
| 352 | if ( g_hTrace == NULL ) |
---|
| 353 | { |
---|
| 354 | #endif |
---|
| 355 | g_hTrace = fopen( "TraceDec.txt", "wb" ); |
---|
[2] | 356 | g_bJustDoIt = g_bEncDecTraceDisable; |
---|
| 357 | g_nSymbolCounter = 0; |
---|
[608] | 358 | #if H_MV |
---|
| 359 | } |
---|
[2] | 360 | #endif |
---|
[608] | 361 | #endif |
---|
[655] | 362 | m_associatedIRAPType = NAL_UNIT_INVALID; |
---|
[56] | 363 | m_pocCRA = 0; |
---|
[608] | 364 | m_pocRandomAccess = MAX_INT; |
---|
[56] | 365 | m_prevPOC = MAX_INT; |
---|
[2] | 366 | m_bFirstSliceInPicture = true; |
---|
| 367 | m_bFirstSliceInSequence = true; |
---|
[655] | 368 | m_prevSliceSkipped = false; |
---|
| 369 | m_skippedPOC = 0; |
---|
[608] | 370 | #if H_MV |
---|
| 371 | m_layerId = 0; |
---|
| 372 | m_viewId = 0; |
---|
| 373 | #if H_3D |
---|
| 374 | m_viewIndex = 0; |
---|
| 375 | m_isDepth = false; |
---|
[57] | 376 | m_pcCamParsCollector = 0; |
---|
[210] | 377 | #endif |
---|
[608] | 378 | #endif |
---|
[2] | 379 | } |
---|
| 380 | |
---|
| 381 | TDecTop::~TDecTop() |
---|
| 382 | { |
---|
| 383 | #if ENC_DEC_TRACE |
---|
[608] | 384 | fclose( g_hTrace ); |
---|
[2] | 385 | #endif |
---|
| 386 | } |
---|
| 387 | |
---|
| 388 | Void TDecTop::create() |
---|
| 389 | { |
---|
| 390 | m_cGopDecoder.create(); |
---|
| 391 | m_apcSlicePilot = new TComSlice; |
---|
[608] | 392 | m_uiSliceIdx = 0; |
---|
[2] | 393 | } |
---|
| 394 | |
---|
| 395 | Void TDecTop::destroy() |
---|
| 396 | { |
---|
| 397 | m_cGopDecoder.destroy(); |
---|
[56] | 398 | |
---|
[2] | 399 | delete m_apcSlicePilot; |
---|
| 400 | m_apcSlicePilot = NULL; |
---|
[56] | 401 | |
---|
[2] | 402 | m_cSliceDecoder.destroy(); |
---|
| 403 | } |
---|
| 404 | |
---|
[608] | 405 | Void TDecTop::init() |
---|
[2] | 406 | { |
---|
| 407 | // initialize ROM |
---|
[608] | 408 | #if !H_MV |
---|
[56] | 409 | initROM(); |
---|
[5] | 410 | #endif |
---|
[608] | 411 | m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO ); |
---|
[2] | 412 | m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder ); |
---|
| 413 | m_cEntropyDecoder.init(&m_cPrediction); |
---|
| 414 | } |
---|
| 415 | |
---|
| 416 | Void TDecTop::deletePicBuffer ( ) |
---|
| 417 | { |
---|
| 418 | TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); |
---|
| 419 | Int iSize = Int( m_cListPic.size() ); |
---|
[56] | 420 | |
---|
[2] | 421 | for (Int i = 0; i < iSize; i++ ) |
---|
| 422 | { |
---|
[608] | 423 | TComPic* pcPic = *(iterPic++); |
---|
| 424 | #if H_MV |
---|
| 425 | if( pcPic ) |
---|
[56] | 426 | { |
---|
[608] | 427 | #endif |
---|
| 428 | pcPic->destroy(); |
---|
[56] | 429 | |
---|
[608] | 430 | delete pcPic; |
---|
| 431 | pcPic = NULL; |
---|
| 432 | #if H_MV |
---|
[56] | 433 | } |
---|
[608] | 434 | #endif |
---|
[2] | 435 | } |
---|
[56] | 436 | |
---|
[2] | 437 | m_cSAO.destroy(); |
---|
[56] | 438 | |
---|
[2] | 439 | m_cLoopFilter. destroy(); |
---|
[56] | 440 | |
---|
[608] | 441 | #if !H_MV |
---|
[2] | 442 | // destroy ROM |
---|
[608] | 443 | destroyROM(); |
---|
| 444 | #endif |
---|
[2] | 445 | } |
---|
| 446 | |
---|
[608] | 447 | Void TDecTop::xGetNewPicBuffer ( TComSlice* pcSlice, TComPic*& rpcPic ) |
---|
[56] | 448 | { |
---|
[608] | 449 | Int numReorderPics[MAX_TLAYER]; |
---|
| 450 | Window &conformanceWindow = pcSlice->getSPS()->getConformanceWindow(); |
---|
| 451 | Window defaultDisplayWindow = pcSlice->getSPS()->getVuiParametersPresentFlag() ? pcSlice->getSPS()->getVuiParameters()->getDefaultDisplayWindow() : Window(); |
---|
[56] | 452 | |
---|
[622] | 453 | #if H_MV |
---|
| 454 | assert( conformanceWindow .getScaledFlag() ); |
---|
| 455 | assert( defaultDisplayWindow.getScaledFlag() ); |
---|
| 456 | #endif |
---|
[608] | 457 | for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++) |
---|
[56] | 458 | { |
---|
[608] | 459 | numReorderPics[temporalLayer] = pcSlice->getSPS()->getNumReorderPics(temporalLayer); |
---|
[56] | 460 | } |
---|
| 461 | |
---|
[608] | 462 | m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded |
---|
[2] | 463 | if (m_cListPic.size() < (UInt)m_iMaxRefPicNum) |
---|
| 464 | { |
---|
[56] | 465 | rpcPic = new TComPic(); |
---|
| 466 | |
---|
[608] | 467 | rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
| 468 | conformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
| 469 | rpcPic->getPicSym()->allocSaoParam(&m_cSAO); |
---|
[2] | 470 | m_cListPic.pushBack( rpcPic ); |
---|
[56] | 471 | |
---|
[2] | 472 | return; |
---|
| 473 | } |
---|
[56] | 474 | |
---|
[2] | 475 | Bool bBufferIsAvailable = false; |
---|
| 476 | TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); |
---|
| 477 | while (iterPic != m_cListPic.end()) |
---|
| 478 | { |
---|
| 479 | rpcPic = *(iterPic++); |
---|
[56] | 480 | if ( rpcPic->getReconMark() == false && rpcPic->getOutputMark() == false) |
---|
[2] | 481 | { |
---|
[56] | 482 | rpcPic->setOutputMark(false); |
---|
[2] | 483 | bBufferIsAvailable = true; |
---|
| 484 | break; |
---|
| 485 | } |
---|
[56] | 486 | |
---|
| 487 | if ( rpcPic->getSlice( 0 )->isReferenced() == false && rpcPic->getOutputMark() == false) |
---|
| 488 | { |
---|
| 489 | rpcPic->setOutputMark(false); |
---|
| 490 | rpcPic->setReconMark( false ); |
---|
| 491 | rpcPic->getPicYuvRec()->setBorderExtension( false ); |
---|
| 492 | bBufferIsAvailable = true; |
---|
| 493 | break; |
---|
| 494 | } |
---|
[2] | 495 | } |
---|
[56] | 496 | |
---|
[2] | 497 | if ( !bBufferIsAvailable ) |
---|
| 498 | { |
---|
[56] | 499 | //There is no room for this picture, either because of faulty encoder or dropped NAL. Extend the buffer. |
---|
| 500 | m_iMaxRefPicNum++; |
---|
| 501 | rpcPic = new TComPic(); |
---|
| 502 | m_cListPic.pushBack( rpcPic ); |
---|
[2] | 503 | } |
---|
[608] | 504 | rpcPic->destroy(); |
---|
| 505 | rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
| 506 | conformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
| 507 | rpcPic->getPicSym()->allocSaoParam(&m_cSAO); |
---|
[2] | 508 | } |
---|
| 509 | |
---|
[608] | 510 | #if H_MV |
---|
| 511 | Void TDecTop::endPicDecoding(Int& poc, TComList<TComPic*>*& rpcListPic, std::vector<Int>& targetDecLayerIdSet ) |
---|
| 512 | #else |
---|
| 513 | Void TDecTop::executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic) |
---|
| 514 | #endif |
---|
[56] | 515 | { |
---|
| 516 | if (!m_pcPic) |
---|
| 517 | { |
---|
| 518 | /* nothing to deblock */ |
---|
| 519 | return; |
---|
| 520 | } |
---|
| 521 | |
---|
| 522 | TComPic*& pcPic = m_pcPic; |
---|
[2] | 523 | |
---|
[608] | 524 | // Execute Deblock + Cleanup |
---|
[56] | 525 | |
---|
[608] | 526 | m_cGopDecoder.filterPicture(pcPic); |
---|
[56] | 527 | |
---|
| 528 | TComSlice::sortPicList( m_cListPic ); // sorting for application output |
---|
[608] | 529 | poc = pcPic->getSlice(m_uiSliceIdx-1)->getPOC(); |
---|
[56] | 530 | rpcListPic = &m_cListPic; |
---|
| 531 | m_cCuDecoder.destroy(); |
---|
[608] | 532 | #if H_MV |
---|
[622] | 533 | TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer0, m_refPicSetInterLayer1 ); |
---|
[608] | 534 | TComSlice::markCurrPic( pcPic ); |
---|
| 535 | TComSlice::markIvRefPicsAsUnused ( m_ivPicLists, targetDecLayerIdSet, m_parameterSetManagerDecoder.getActiveVPS(), m_layerId, poc ); |
---|
| 536 | #endif |
---|
[56] | 537 | m_bFirstSliceInPicture = true; |
---|
| 538 | |
---|
| 539 | return; |
---|
| 540 | } |
---|
| 541 | |
---|
| 542 | Void TDecTop::xCreateLostPicture(Int iLostPoc) |
---|
[2] | 543 | { |
---|
[56] | 544 | printf("\ninserting lost poc : %d\n",iLostPoc); |
---|
| 545 | TComSlice cFillSlice; |
---|
| 546 | cFillSlice.setSPS( m_parameterSetManagerDecoder.getFirstSPS() ); |
---|
| 547 | cFillSlice.setPPS( m_parameterSetManagerDecoder.getFirstPPS() ); |
---|
| 548 | cFillSlice.initSlice(); |
---|
| 549 | TComPic *cFillPic; |
---|
| 550 | xGetNewPicBuffer(&cFillSlice,cFillPic); |
---|
| 551 | cFillPic->getSlice(0)->setSPS( m_parameterSetManagerDecoder.getFirstSPS() ); |
---|
| 552 | cFillPic->getSlice(0)->setPPS( m_parameterSetManagerDecoder.getFirstPPS() ); |
---|
| 553 | cFillPic->getSlice(0)->initSlice(); |
---|
| 554 | |
---|
| 555 | TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); |
---|
| 556 | Int closestPoc = 1000000; |
---|
| 557 | while ( iterPic != m_cListPic.end()) |
---|
[2] | 558 | { |
---|
[56] | 559 | TComPic * rpcPic = *(iterPic++); |
---|
| 560 | if(abs(rpcPic->getPicSym()->getSlice(0)->getPOC() -iLostPoc)<closestPoc&&abs(rpcPic->getPicSym()->getSlice(0)->getPOC() -iLostPoc)!=0&&rpcPic->getPicSym()->getSlice(0)->getPOC()!=m_apcSlicePilot->getPOC()) |
---|
[2] | 561 | { |
---|
[56] | 562 | closestPoc=abs(rpcPic->getPicSym()->getSlice(0)->getPOC() -iLostPoc); |
---|
| 563 | } |
---|
| 564 | } |
---|
| 565 | iterPic = m_cListPic.begin(); |
---|
| 566 | while ( iterPic != m_cListPic.end()) |
---|
| 567 | { |
---|
| 568 | TComPic *rpcPic = *(iterPic++); |
---|
| 569 | if(abs(rpcPic->getPicSym()->getSlice(0)->getPOC() -iLostPoc)==closestPoc&&rpcPic->getPicSym()->getSlice(0)->getPOC()!=m_apcSlicePilot->getPOC()) |
---|
| 570 | { |
---|
| 571 | printf("copying picture %d to %d (%d)\n",rpcPic->getPicSym()->getSlice(0)->getPOC() ,iLostPoc,m_apcSlicePilot->getPOC()); |
---|
| 572 | rpcPic->getPicYuvRec()->copyToPic(cFillPic->getPicYuvRec()); |
---|
[2] | 573 | break; |
---|
| 574 | } |
---|
| 575 | } |
---|
[56] | 576 | cFillPic->setCurrSliceIdx(0); |
---|
| 577 | for(Int i=0; i<cFillPic->getNumCUsInFrame(); i++) |
---|
[2] | 578 | { |
---|
[56] | 579 | cFillPic->getCU(i)->initCU(cFillPic,i); |
---|
[2] | 580 | } |
---|
[56] | 581 | cFillPic->getSlice(0)->setReferenced(true); |
---|
| 582 | cFillPic->getSlice(0)->setPOC(iLostPoc); |
---|
| 583 | cFillPic->setReconMark(true); |
---|
| 584 | cFillPic->setOutputMark(true); |
---|
| 585 | if(m_pocRandomAccess == MAX_INT) |
---|
| 586 | { |
---|
| 587 | m_pocRandomAccess = iLostPoc; |
---|
| 588 | } |
---|
[2] | 589 | } |
---|
| 590 | |
---|
[56] | 591 | |
---|
| 592 | Void TDecTop::xActivateParameterSets() |
---|
[2] | 593 | { |
---|
[56] | 594 | m_parameterSetManagerDecoder.applyPrefetchedPS(); |
---|
[608] | 595 | |
---|
[56] | 596 | TComPPS *pps = m_parameterSetManagerDecoder.getPPS(m_apcSlicePilot->getPPSId()); |
---|
| 597 | assert (pps != 0); |
---|
| 598 | |
---|
| 599 | TComSPS *sps = m_parameterSetManagerDecoder.getSPS(pps->getSPSId()); |
---|
| 600 | assert (sps != 0); |
---|
[608] | 601 | |
---|
[622] | 602 | #if H_MV |
---|
| 603 | TComVPS* vps = m_parameterSetManagerDecoder.getVPS(sps->getVPSId()); |
---|
| 604 | assert (vps != 0); |
---|
| 605 | if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP(), m_layerId ) ) |
---|
| 606 | #else |
---|
[608] | 607 | if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP())) |
---|
[622] | 608 | #endif |
---|
[608] | 609 | { |
---|
| 610 | printf ("Parameter set activation failed!"); |
---|
| 611 | assert (0); |
---|
| 612 | } |
---|
| 613 | |
---|
| 614 | if( pps->getDependentSliceSegmentsEnabledFlag() ) |
---|
| 615 | { |
---|
| 616 | Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1; |
---|
| 617 | |
---|
| 618 | if (m_cSliceDecoder.getCtxMemSize() != NumCtx) |
---|
| 619 | { |
---|
| 620 | m_cSliceDecoder.initCtxMem(NumCtx); |
---|
| 621 | for ( UInt st = 0; st < NumCtx; st++ ) |
---|
| 622 | { |
---|
| 623 | TDecSbac* ctx = NULL; |
---|
| 624 | ctx = new TDecSbac; |
---|
| 625 | ctx->init( &m_cBinCABAC ); |
---|
| 626 | m_cSliceDecoder.setCtxMem( ctx, st ); |
---|
| 627 | } |
---|
| 628 | } |
---|
| 629 | } |
---|
| 630 | |
---|
[56] | 631 | m_apcSlicePilot->setPPS(pps); |
---|
| 632 | m_apcSlicePilot->setSPS(sps); |
---|
[608] | 633 | #if H_MV |
---|
[622] | 634 | m_apcSlicePilot->setVPS(vps); |
---|
[738] | 635 | // The nuh_layer_id value of the NAL unit containing the PPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA. |
---|
| 636 | assert( pps->getLayerId() == m_layerId || pps->getLayerId( ) == 0 || vps->getInDirectDependencyFlag( m_layerId, pps->getLayerId() ) ); |
---|
| 637 | // The nuh_layer_id value of the NAL unit containing the SPS that is activated for a layer layerA with nuh_layer_id equal to nuhLayerIdA shall be equal to 0, or nuhLayerIdA, or the nuh_layer_id of a direct or indirect reference layer of layerA. |
---|
| 638 | assert( sps->getLayerId() == m_layerId || sps->getLayerId( ) == 0 || vps->getInDirectDependencyFlag( m_layerId, sps->getLayerId() ) ); |
---|
[622] | 639 | sps->inferRepFormat ( vps , m_layerId ); |
---|
| 640 | sps->inferScalingList( m_parameterSetManagerDecoder.getActiveSPS( sps->getSpsScalingListRefLayerId() ) ); |
---|
[210] | 641 | #endif |
---|
[56] | 642 | pps->setSPS(sps); |
---|
[608] | 643 | pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1); |
---|
[56] | 644 | pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) ); |
---|
| 645 | |
---|
[608] | 646 | g_bitDepthY = sps->getBitDepthY(); |
---|
| 647 | g_bitDepthC = sps->getBitDepthC(); |
---|
| 648 | g_uiMaxCUWidth = sps->getMaxCUWidth(); |
---|
| 649 | g_uiMaxCUHeight = sps->getMaxCUHeight(); |
---|
| 650 | g_uiMaxCUDepth = sps->getMaxCUDepth(); |
---|
| 651 | g_uiAddCUDepth = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() ); |
---|
| 652 | |
---|
| 653 | for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++) |
---|
[2] | 654 | { |
---|
[56] | 655 | sps->setAMPAcc( i, sps->getUseAMP() ); |
---|
[2] | 656 | } |
---|
[56] | 657 | |
---|
[608] | 658 | for (Int i = sps->getLog2DiffMaxMinCodingBlockSize(); i < sps->getMaxCUDepth(); i++) |
---|
[56] | 659 | { |
---|
| 660 | sps->setAMPAcc( i, 0 ); |
---|
| 661 | } |
---|
| 662 | |
---|
[608] | 663 | m_cSAO.destroy(); |
---|
| 664 | m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() ); |
---|
| 665 | m_cLoopFilter.create( sps->getMaxCUDepth() ); |
---|
[2] | 666 | } |
---|
[56] | 667 | |
---|
[608] | 668 | #if H_MV |
---|
[738] | 669 | Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag ) |
---|
[608] | 670 | { |
---|
| 671 | assert( nalu.m_layerId == m_layerId ); |
---|
| 672 | |
---|
| 673 | #else |
---|
[56] | 674 | Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay ) |
---|
[2] | 675 | { |
---|
[608] | 676 | #endif |
---|
[2] | 677 | TComPic*& pcPic = m_pcPic; |
---|
[56] | 678 | m_apcSlicePilot->initSlice(); |
---|
[2] | 679 | |
---|
[56] | 680 | if (m_bFirstSliceInPicture) |
---|
[2] | 681 | { |
---|
[56] | 682 | m_uiSliceIdx = 0; |
---|
[2] | 683 | } |
---|
[56] | 684 | m_apcSlicePilot->setSliceIdx(m_uiSliceIdx); |
---|
| 685 | if (!m_bFirstSliceInPicture) |
---|
| 686 | { |
---|
| 687 | m_apcSlicePilot->copySliceInfo( pcPic->getPicSym()->getSlice(m_uiSliceIdx-1) ); |
---|
| 688 | } |
---|
[2] | 689 | |
---|
[56] | 690 | m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType); |
---|
[608] | 691 | Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || |
---|
| 692 | m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || |
---|
| 693 | m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || |
---|
| 694 | m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
| 695 | m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N); |
---|
| 696 | m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag); |
---|
| 697 | |
---|
| 698 | m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS |
---|
[56] | 699 | m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); |
---|
[42] | 700 | |
---|
[608] | 701 | #if H_MV |
---|
[622] | 702 | m_apcSlicePilot->setRefPicSetInterLayer( & m_refPicSetInterLayer0, &m_refPicSetInterLayer1 ); |
---|
[608] | 703 | m_apcSlicePilot->setLayerId( nalu.m_layerId ); |
---|
[42] | 704 | #endif |
---|
[608] | 705 | m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder); |
---|
| 706 | |
---|
[655] | 707 | // set POC for dependent slices in skipped pictures |
---|
| 708 | if(m_apcSlicePilot->getDependentSliceSegmentFlag() && m_prevSliceSkipped) |
---|
| 709 | { |
---|
| 710 | m_apcSlicePilot->setPOC(m_skippedPOC); |
---|
| 711 | } |
---|
| 712 | |
---|
| 713 | m_apcSlicePilot->setAssociatedIRAPPOC(m_pocCRA); |
---|
| 714 | m_apcSlicePilot->setAssociatedIRAPType(m_associatedIRAPType); |
---|
| 715 | |
---|
[608] | 716 | #if H_MV |
---|
| 717 | TComVPS* vps = m_apcSlicePilot->getVPS(); |
---|
[622] | 718 | Int layerId = nalu.m_layerId; |
---|
| 719 | setViewId ( vps->getViewId ( layerId ) ); |
---|
| 720 | #if H_3D |
---|
| 721 | setViewIndex( vps->getViewIndex( layerId ) ); |
---|
| 722 | setIsDepth ( vps->getDepthId ( layerId ) == 1 ); |
---|
| 723 | m_ivPicLists->setVPS( vps ); |
---|
| 724 | #endif |
---|
[608] | 725 | #endif |
---|
[738] | 726 | |
---|
[773] | 727 | #if H_MV |
---|
[738] | 728 | xCeckNoClrasOutput(); |
---|
| 729 | #endif |
---|
[608] | 730 | // Skip pictures due to random access |
---|
| 731 | if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) |
---|
[56] | 732 | { |
---|
[655] | 733 | m_prevSliceSkipped = true; |
---|
| 734 | m_skippedPOC = m_apcSlicePilot->getPOC(); |
---|
[773] | 735 | #if H_MV |
---|
| 736 | sliceSkippedFlag = true; |
---|
[738] | 737 | #endif |
---|
[608] | 738 | return false; |
---|
[56] | 739 | } |
---|
[608] | 740 | // Skip TFD pictures associated with BLA/BLANT pictures |
---|
| 741 | if (isSkipPictureForBLA(iPOCLastDisplay)) |
---|
| 742 | { |
---|
[655] | 743 | m_prevSliceSkipped = true; |
---|
| 744 | m_skippedPOC = m_apcSlicePilot->getPOC(); |
---|
[773] | 745 | #if H_MV |
---|
| 746 | sliceSkippedFlag = true; |
---|
[738] | 747 | #endif |
---|
[608] | 748 | return false; |
---|
| 749 | } |
---|
| 750 | |
---|
[655] | 751 | // clear previous slice skipped flag |
---|
| 752 | m_prevSliceSkipped = false; |
---|
| 753 | |
---|
[608] | 754 | //we should only get a different poc for a new picture (with CTU address==0) |
---|
| 755 | if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (!m_apcSlicePilot->getSliceCurStartCUAddr()==0)) |
---|
| 756 | { |
---|
| 757 | printf ("Warning, the first slice of a picture might have been lost!\n"); |
---|
[56] | 758 | } |
---|
| 759 | // exit when a new picture is found |
---|
[608] | 760 | if (m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence ) |
---|
[56] | 761 | { |
---|
| 762 | if (m_prevPOC >= m_pocRandomAccess) |
---|
| 763 | { |
---|
| 764 | m_prevPOC = m_apcSlicePilot->getPOC(); |
---|
| 765 | return true; |
---|
| 766 | } |
---|
| 767 | m_prevPOC = m_apcSlicePilot->getPOC(); |
---|
| 768 | } |
---|
[608] | 769 | #if H_MV |
---|
| 770 | if ( newLayerFlag ) |
---|
| 771 | { |
---|
| 772 | return false; |
---|
| 773 | } |
---|
| 774 | #if ENC_DEC_TRACE |
---|
| 775 | #if H_MV_ENC_DEC_TRAC |
---|
| 776 | // parse remainder of SH |
---|
| 777 | g_disableHLSTrace = false; |
---|
| 778 | #endif |
---|
| 779 | #endif |
---|
| 780 | #endif |
---|
[56] | 781 | // actual decoding starts here |
---|
[622] | 782 | #if H_MV |
---|
| 783 | // This part needs further testing ! |
---|
| 784 | if ( m_apcSlicePilot->getPocResetFlag() ) |
---|
| 785 | { |
---|
| 786 | xResetPocInPicBuffer(); |
---|
| 787 | } |
---|
| 788 | #endif |
---|
[56] | 789 | xActivateParameterSets(); |
---|
| 790 | |
---|
| 791 | if (m_apcSlicePilot->isNextSlice()) |
---|
| 792 | { |
---|
| 793 | m_prevPOC = m_apcSlicePilot->getPOC(); |
---|
| 794 | } |
---|
| 795 | m_bFirstSliceInSequence = false; |
---|
| 796 | //detect lost reference picture and insert copy of earlier frame. |
---|
[608] | 797 | Int lostPoc; |
---|
| 798 | while((lostPoc=m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true, m_pocRandomAccess)) > 0) |
---|
[56] | 799 | { |
---|
[608] | 800 | xCreateLostPicture(lostPoc-1); |
---|
[56] | 801 | } |
---|
[2] | 802 | if (m_bFirstSliceInPicture) |
---|
| 803 | { |
---|
[56] | 804 | // Buffer initialize for prediction. |
---|
| 805 | m_cPrediction.initTempBuff(); |
---|
| 806 | m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); |
---|
[608] | 807 | #if H_MV |
---|
[622] | 808 | m_apcSlicePilot->createInterLayerReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer0, m_refPicSetInterLayer1 ); |
---|
[608] | 809 | #endif |
---|
[56] | 810 | // Get a new picture buffer |
---|
| 811 | xGetNewPicBuffer (m_apcSlicePilot, pcPic); |
---|
[2] | 812 | |
---|
[655] | 813 | Bool isField = false; |
---|
| 814 | Bool isTff = false; |
---|
| 815 | |
---|
| 816 | if(!m_SEIs.empty()) |
---|
| 817 | { |
---|
| 818 | // Check if any new Picture Timing SEI has arrived |
---|
| 819 | SEIMessages pictureTimingSEIs = extractSeisByType (m_SEIs, SEI::PICTURE_TIMING); |
---|
| 820 | if (pictureTimingSEIs.size()>0) |
---|
| 821 | { |
---|
| 822 | SEIPictureTiming* pictureTiming = (SEIPictureTiming*) *(pictureTimingSEIs.begin()); |
---|
| 823 | isField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 2); |
---|
| 824 | isTff = (pictureTiming->m_picStruct == 1); |
---|
| 825 | } |
---|
| 826 | } |
---|
| 827 | |
---|
| 828 | //Set Field/Frame coding mode |
---|
| 829 | m_pcPic->setField(isField); |
---|
| 830 | m_pcPic->setTopField(isTff); |
---|
| 831 | |
---|
[608] | 832 | // transfer any SEI messages that have been received to the picture |
---|
[56] | 833 | pcPic->setSEIs(m_SEIs); |
---|
[608] | 834 | m_SEIs.clear(); |
---|
[42] | 835 | |
---|
[56] | 836 | // Recursive structure |
---|
| 837 | m_cCuDecoder.create ( g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight ); |
---|
| 838 | m_cCuDecoder.init ( &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction ); |
---|
| 839 | m_cTrQuant.init ( g_uiMaxCUWidth, g_uiMaxCUHeight, m_apcSlicePilot->getSPS()->getMaxTrSize()); |
---|
[42] | 840 | |
---|
[608] | 841 | m_cSliceDecoder.create(); |
---|
| 842 | } |
---|
| 843 | else |
---|
| 844 | { |
---|
| 845 | // Check if any new SEI has arrived |
---|
| 846 | if(!m_SEIs.empty()) |
---|
[56] | 847 | { |
---|
[608] | 848 | // Currently only decoding Unit SEI message occurring between VCL NALUs copied |
---|
| 849 | SEIMessages &picSEI = pcPic->getSEIs(); |
---|
| 850 | SEIMessages decodingUnitInfos = extractSeisByType (m_SEIs, SEI::DECODING_UNIT_INFO); |
---|
| 851 | picSEI.insert(picSEI.end(), decodingUnitInfos.begin(), decodingUnitInfos.end()); |
---|
| 852 | deleteSEIs(m_SEIs); |
---|
[56] | 853 | } |
---|
| 854 | } |
---|
[608] | 855 | |
---|
[56] | 856 | // Set picture slice pointer |
---|
| 857 | TComSlice* pcSlice = m_apcSlicePilot; |
---|
| 858 | Bool bNextSlice = pcSlice->isNextSlice(); |
---|
[2] | 859 | |
---|
[56] | 860 | UInt uiCummulativeTileWidth; |
---|
| 861 | UInt uiCummulativeTileHeight; |
---|
| 862 | UInt i, j, p; |
---|
| 863 | |
---|
[608] | 864 | //set NumColumnsMins1 and NumRowsMinus1 |
---|
| 865 | pcPic->getPicSym()->setNumColumnsMinus1( pcSlice->getPPS()->getNumColumnsMinus1() ); |
---|
| 866 | pcPic->getPicSym()->setNumRowsMinus1( pcSlice->getPPS()->getNumRowsMinus1() ); |
---|
[2] | 867 | |
---|
[608] | 868 | //create the TComTileArray |
---|
| 869 | pcPic->getPicSym()->xCreateTComTileArray(); |
---|
| 870 | |
---|
| 871 | if( pcSlice->getPPS()->getUniformSpacingFlag() ) |
---|
[56] | 872 | { |
---|
[608] | 873 | //set the width for each tile |
---|
| 874 | for(j=0; j < pcPic->getPicSym()->getNumRowsMinus1()+1; j++) |
---|
[56] | 875 | { |
---|
[608] | 876 | for(p=0; p < pcPic->getPicSym()->getNumColumnsMinus1()+1; p++) |
---|
[2] | 877 | { |
---|
[608] | 878 | pcPic->getPicSym()->getTComTile( j * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + p )-> |
---|
| 879 | setTileWidth( (p+1)*pcPic->getPicSym()->getFrameWidthInCU()/(pcPic->getPicSym()->getNumColumnsMinus1()+1) |
---|
| 880 | - (p*pcPic->getPicSym()->getFrameWidthInCU())/(pcPic->getPicSym()->getNumColumnsMinus1()+1) ); |
---|
[2] | 881 | } |
---|
[608] | 882 | } |
---|
[2] | 883 | |
---|
[608] | 884 | //set the height for each tile |
---|
| 885 | for(j=0; j < pcPic->getPicSym()->getNumColumnsMinus1()+1; j++) |
---|
[2] | 886 | { |
---|
[608] | 887 | for(p=0; p < pcPic->getPicSym()->getNumRowsMinus1()+1; p++) |
---|
[2] | 888 | { |
---|
[608] | 889 | pcPic->getPicSym()->getTComTile( p * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + j )-> |
---|
| 890 | setTileHeight( (p+1)*pcPic->getPicSym()->getFrameHeightInCU()/(pcPic->getPicSym()->getNumRowsMinus1()+1) |
---|
| 891 | - (p*pcPic->getPicSym()->getFrameHeightInCU())/(pcPic->getPicSym()->getNumRowsMinus1()+1) ); |
---|
[2] | 892 | } |
---|
[56] | 893 | } |
---|
| 894 | } |
---|
| 895 | else |
---|
| 896 | { |
---|
[608] | 897 | //set the width for each tile |
---|
| 898 | for(j=0; j < pcSlice->getPPS()->getNumRowsMinus1()+1; j++) |
---|
[56] | 899 | { |
---|
[608] | 900 | uiCummulativeTileWidth = 0; |
---|
| 901 | for(i=0; i < pcSlice->getPPS()->getNumColumnsMinus1(); i++) |
---|
[2] | 902 | { |
---|
[608] | 903 | pcPic->getPicSym()->getTComTile(j * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + i)->setTileWidth( pcSlice->getPPS()->getColumnWidth(i) ); |
---|
| 904 | uiCummulativeTileWidth += pcSlice->getPPS()->getColumnWidth(i); |
---|
[2] | 905 | } |
---|
[608] | 906 | pcPic->getPicSym()->getTComTile(j * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + i)->setTileWidth( pcPic->getPicSym()->getFrameWidthInCU()-uiCummulativeTileWidth ); |
---|
| 907 | } |
---|
[56] | 908 | |
---|
[608] | 909 | //set the height for each tile |
---|
| 910 | for(j=0; j < pcSlice->getPPS()->getNumColumnsMinus1()+1; j++) |
---|
[56] | 911 | { |
---|
[608] | 912 | uiCummulativeTileHeight = 0; |
---|
| 913 | for(i=0; i < pcSlice->getPPS()->getNumRowsMinus1(); i++) |
---|
| 914 | { |
---|
| 915 | pcPic->getPicSym()->getTComTile(i * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + j)->setTileHeight( pcSlice->getPPS()->getRowHeight(i) ); |
---|
| 916 | uiCummulativeTileHeight += pcSlice->getPPS()->getRowHeight(i); |
---|
[56] | 917 | } |
---|
[608] | 918 | pcPic->getPicSym()->getTComTile(i * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + j)->setTileHeight( pcPic->getPicSym()->getFrameHeightInCU()-uiCummulativeTileHeight ); |
---|
[56] | 919 | } |
---|
| 920 | } |
---|
[2] | 921 | |
---|
[56] | 922 | pcPic->getPicSym()->xInitTiles(); |
---|
[2] | 923 | |
---|
[56] | 924 | //generate the Coding Order Map and Inverse Coding Order Map |
---|
| 925 | UInt uiEncCUAddr; |
---|
| 926 | for(i=0, uiEncCUAddr=0; i<pcPic->getPicSym()->getNumberOfCUsInFrame(); i++, uiEncCUAddr = pcPic->getPicSym()->xCalculateNxtCUAddr(uiEncCUAddr)) |
---|
| 927 | { |
---|
| 928 | pcPic->getPicSym()->setCUOrderMap(i, uiEncCUAddr); |
---|
| 929 | pcPic->getPicSym()->setInverseCUOrderMap(uiEncCUAddr, i); |
---|
| 930 | } |
---|
| 931 | pcPic->getPicSym()->setCUOrderMap(pcPic->getPicSym()->getNumberOfCUsInFrame(), pcPic->getPicSym()->getNumberOfCUsInFrame()); |
---|
| 932 | pcPic->getPicSym()->setInverseCUOrderMap(pcPic->getPicSym()->getNumberOfCUsInFrame(), pcPic->getPicSym()->getNumberOfCUsInFrame()); |
---|
| 933 | |
---|
[608] | 934 | //convert the start and end CU addresses of the slice and dependent slice into encoding order |
---|
| 935 | pcSlice->setSliceSegmentCurStartCUAddr( pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceSegmentCurStartCUAddr()) ); |
---|
| 936 | pcSlice->setSliceSegmentCurEndCUAddr( pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceSegmentCurEndCUAddr()) ); |
---|
[56] | 937 | if(pcSlice->isNextSlice()) |
---|
| 938 | { |
---|
| 939 | pcSlice->setSliceCurStartCUAddr(pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceCurStartCUAddr())); |
---|
| 940 | pcSlice->setSliceCurEndCUAddr(pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceCurEndCUAddr())); |
---|
| 941 | } |
---|
| 942 | |
---|
| 943 | if (m_bFirstSliceInPicture) |
---|
| 944 | { |
---|
| 945 | if(pcPic->getNumAllocatedSlice() != 1) |
---|
| 946 | { |
---|
| 947 | pcPic->clearSliceBuffer(); |
---|
| 948 | } |
---|
| 949 | } |
---|
| 950 | else |
---|
| 951 | { |
---|
| 952 | pcPic->allocateNewSlice(); |
---|
| 953 | } |
---|
| 954 | assert(pcPic->getNumAllocatedSlice() == (m_uiSliceIdx + 1)); |
---|
| 955 | m_apcSlicePilot = pcPic->getPicSym()->getSlice(m_uiSliceIdx); |
---|
| 956 | pcPic->getPicSym()->setSlice(pcSlice, m_uiSliceIdx); |
---|
| 957 | |
---|
| 958 | pcPic->setTLayer(nalu.m_temporalId); |
---|
| 959 | |
---|
[608] | 960 | #if H_MV |
---|
| 961 | pcPic->setLayerId( nalu.m_layerId ); |
---|
| 962 | pcPic->setViewId ( getViewId() ); |
---|
| 963 | #if H_3D |
---|
| 964 | pcPic->setViewIndex( getViewIndex() ); |
---|
| 965 | pcPic->setIsDepth ( getIsDepth () ); |
---|
| 966 | #endif |
---|
| 967 | #endif |
---|
[56] | 968 | if (bNextSlice) |
---|
| 969 | { |
---|
[655] | 970 | pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_associatedIRAPType, m_cListPic ); |
---|
[608] | 971 | // Set reference list |
---|
| 972 | #if H_MV |
---|
[622] | 973 | std::vector< TComPic* > tempRefPicLists[2]; |
---|
| 974 | std::vector< Bool > usedAsLongTerm [2]; |
---|
| 975 | Int numPocTotalCurr; |
---|
| 976 | |
---|
| 977 | pcSlice->getTempRefPicLists( m_cListPic, m_refPicSetInterLayer0, m_refPicSetInterLayer1, tempRefPicLists, usedAsLongTerm, numPocTotalCurr); |
---|
| 978 | pcSlice->setRefPicList ( tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true ); |
---|
[608] | 979 | #if H_3D_ARP |
---|
[724] | 980 | pcSlice->setARPStepNum(m_ivPicLists); |
---|
[608] | 981 | if( pcSlice->getARPStepNum() > 1 ) |
---|
[56] | 982 | { |
---|
[622] | 983 | // GT: This seems to be broken, not all nuh_layer_ids are necessarily present |
---|
[608] | 984 | for(Int iLayerId = 0; iLayerId < nalu.m_layerId; iLayerId ++ ) |
---|
| 985 | { |
---|
| 986 | Int iViewIdx = pcSlice->getVPS()->getViewIndex(iLayerId); |
---|
| 987 | Bool bIsDepth = ( pcSlice->getVPS()->getDepthId ( iLayerId ) == 1 ); |
---|
| 988 | if( iViewIdx<getViewIndex() && !bIsDepth ) |
---|
| 989 | { |
---|
| 990 | pcSlice->setBaseViewRefPicList( m_ivPicLists->getPicList( iLayerId ), iViewIdx ); |
---|
| 991 | } |
---|
| 992 | } |
---|
[56] | 993 | } |
---|
[77] | 994 | #endif |
---|
| 995 | #else |
---|
[608] | 996 | #if FIX1071 |
---|
| 997 | pcSlice->setRefPicList( m_cListPic, true ); |
---|
| 998 | #else |
---|
| 999 | pcSlice->setRefPicList( m_cListPic ); |
---|
[21] | 1000 | #endif |
---|
| 1001 | |
---|
[296] | 1002 | #endif |
---|
| 1003 | |
---|
[608] | 1004 | #if H_3D |
---|
| 1005 | pcSlice->setIvPicLists( m_ivPicLists ); |
---|
[655] | 1006 | #if H_3D_IV_MERGE |
---|
| 1007 | #if H_3D_FCO |
---|
| 1008 | //assert( !getIsDepth() ); |
---|
| 1009 | #else |
---|
[608] | 1010 | assert( !getIsDepth() || ( pcSlice->getTexturePic() != 0 ) ); |
---|
[655] | 1011 | #endif |
---|
[608] | 1012 | #endif |
---|
[210] | 1013 | #endif |
---|
[56] | 1014 | // For generalized B |
---|
| 1015 | // note: maybe not existed case (always L0 is copied to L1 if L1 is empty) |
---|
| 1016 | if (pcSlice->isInterB() && pcSlice->getNumRefIdx(REF_PIC_LIST_1) == 0) |
---|
| 1017 | { |
---|
| 1018 | Int iNumRefIdx = pcSlice->getNumRefIdx(REF_PIC_LIST_0); |
---|
| 1019 | pcSlice->setNumRefIdx ( REF_PIC_LIST_1, iNumRefIdx ); |
---|
[2] | 1020 | |
---|
[56] | 1021 | for (Int iRefIdx = 0; iRefIdx < iNumRefIdx; iRefIdx++) |
---|
| 1022 | { |
---|
| 1023 | pcSlice->setRefPic(pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx), REF_PIC_LIST_1, iRefIdx); |
---|
| 1024 | } |
---|
| 1025 | } |
---|
[608] | 1026 | if (!pcSlice->isIntra()) |
---|
[56] | 1027 | { |
---|
| 1028 | Bool bLowDelay = true; |
---|
| 1029 | Int iCurrPOC = pcSlice->getPOC(); |
---|
| 1030 | Int iRefIdx = 0; |
---|
| 1031 | |
---|
| 1032 | for (iRefIdx = 0; iRefIdx < pcSlice->getNumRefIdx(REF_PIC_LIST_0) && bLowDelay; iRefIdx++) |
---|
| 1033 | { |
---|
| 1034 | if ( pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx)->getPOC() > iCurrPOC ) |
---|
[21] | 1035 | { |
---|
[56] | 1036 | bLowDelay = false; |
---|
[21] | 1037 | } |
---|
[2] | 1038 | } |
---|
[608] | 1039 | if (pcSlice->isInterB()) |
---|
[56] | 1040 | { |
---|
[608] | 1041 | for (iRefIdx = 0; iRefIdx < pcSlice->getNumRefIdx(REF_PIC_LIST_1) && bLowDelay; iRefIdx++) |
---|
[56] | 1042 | { |
---|
[608] | 1043 | if ( pcSlice->getRefPic(REF_PIC_LIST_1, iRefIdx)->getPOC() > iCurrPOC ) |
---|
| 1044 | { |
---|
| 1045 | bLowDelay = false; |
---|
| 1046 | } |
---|
| 1047 | } |
---|
[56] | 1048 | } |
---|
[2] | 1049 | |
---|
[56] | 1050 | pcSlice->setCheckLDC(bLowDelay); |
---|
| 1051 | } |
---|
| 1052 | |
---|
| 1053 | //--------------- |
---|
[608] | 1054 | pcSlice->setRefPOCList(); |
---|
| 1055 | #if H_3D_TMVP |
---|
| 1056 | if(pcSlice->getLayerId()) |
---|
| 1057 | pcSlice->generateAlterRefforTMVP(); |
---|
[313] | 1058 | #endif |
---|
[56] | 1059 | } |
---|
| 1060 | |
---|
| 1061 | pcPic->setCurrSliceIdx(m_uiSliceIdx); |
---|
| 1062 | if(pcSlice->getSPS()->getScalingListFlag()) |
---|
| 1063 | { |
---|
[608] | 1064 | pcSlice->setScalingList ( pcSlice->getSPS()->getScalingList() ); |
---|
| 1065 | if(pcSlice->getPPS()->getScalingListPresentFlag()) |
---|
[56] | 1066 | { |
---|
[608] | 1067 | pcSlice->setScalingList ( pcSlice->getPPS()->getScalingList() ); |
---|
[56] | 1068 | } |
---|
[608] | 1069 | if(!pcSlice->getPPS()->getScalingListPresentFlag() && !pcSlice->getSPS()->getScalingListPresentFlag()) |
---|
| 1070 | { |
---|
| 1071 | pcSlice->setDefaultScalingList(); |
---|
| 1072 | } |
---|
| 1073 | m_cTrQuant.setScalingListDec(pcSlice->getScalingList()); |
---|
[56] | 1074 | m_cTrQuant.setUseScalingList(true); |
---|
| 1075 | } |
---|
| 1076 | else |
---|
| 1077 | { |
---|
| 1078 | m_cTrQuant.setFlatScalingList(); |
---|
| 1079 | m_cTrQuant.setUseScalingList(false); |
---|
| 1080 | } |
---|
[2] | 1081 | |
---|
[773] | 1082 | #if H_3D_IV_MERGE |
---|
[724] | 1083 | if( pcSlice->getIsDepth() && m_pcCamParsCollector ) |
---|
| 1084 | { |
---|
| 1085 | m_pcCamParsCollector->copyCamParamForSlice( pcSlice ); |
---|
| 1086 | } |
---|
| 1087 | #endif |
---|
| 1088 | |
---|
[56] | 1089 | // Decode a picture |
---|
[608] | 1090 | m_cGopDecoder.decompressSlice(nalu.m_Bitstream, pcPic); |
---|
| 1091 | #if H_3D |
---|
[57] | 1092 | if( m_pcCamParsCollector ) |
---|
| 1093 | { |
---|
| 1094 | m_pcCamParsCollector->setSlice( pcSlice ); |
---|
| 1095 | } |
---|
[758] | 1096 | #endif |
---|
[56] | 1097 | m_bFirstSliceInPicture = false; |
---|
| 1098 | m_uiSliceIdx++; |
---|
| 1099 | |
---|
| 1100 | return false; |
---|
| 1101 | } |
---|
| 1102 | |
---|
[77] | 1103 | Void TDecTop::xDecodeVPS() |
---|
| 1104 | { |
---|
| 1105 | TComVPS* vps = new TComVPS(); |
---|
| 1106 | |
---|
| 1107 | m_cEntropyDecoder.decodeVPS( vps ); |
---|
| 1108 | m_parameterSetManagerDecoder.storePrefetchedVPS(vps); |
---|
| 1109 | } |
---|
[56] | 1110 | |
---|
| 1111 | Void TDecTop::xDecodeSPS() |
---|
| 1112 | { |
---|
| 1113 | TComSPS* sps = new TComSPS(); |
---|
[608] | 1114 | #if H_MV |
---|
| 1115 | sps->setLayerId( getLayerId() ); |
---|
| 1116 | #endif |
---|
| 1117 | #if H_3D |
---|
| 1118 | // Preliminary fix. assuming that all sps refer to the same SPS. |
---|
| 1119 | // Parsing dependency should be resolved! |
---|
| 1120 | TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 ); |
---|
| 1121 | assert( vps != 0 ); |
---|
[622] | 1122 | m_cEntropyDecoder.decodeSPS( sps, vps->getViewIndex( m_layerId ), ( vps->getDepthId( m_layerId ) == 1 ) ); |
---|
| 1123 | #else |
---|
[56] | 1124 | m_cEntropyDecoder.decodeSPS( sps ); |
---|
[42] | 1125 | #endif |
---|
[56] | 1126 | m_parameterSetManagerDecoder.storePrefetchedSPS(sps); |
---|
| 1127 | } |
---|
[2] | 1128 | |
---|
[56] | 1129 | Void TDecTop::xDecodePPS() |
---|
| 1130 | { |
---|
| 1131 | TComPPS* pps = new TComPPS(); |
---|
[622] | 1132 | #if H_MV |
---|
| 1133 | pps->setLayerId( getLayerId() ); |
---|
| 1134 | #endif |
---|
[773] | 1135 | #if H_3D |
---|
[758] | 1136 | // Assuming that all PPS indirectly refer to the same VPS via different SPS |
---|
| 1137 | // There is no parsing dependency in decoding DLT in PPS. |
---|
| 1138 | // The VPS information passed to decodePPS() is used to arrange the decoded DLT tables to their corresponding layers. |
---|
| 1139 | // This is equivalent to the process of |
---|
| 1140 | // Step 1) decoding DLT tables based on the number of depth layers, and |
---|
| 1141 | // Step 2) mapping DLT tables to the depth layers |
---|
[773] | 1142 | // as described in the 3D-HEVC WD. |
---|
[758] | 1143 | TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 ); |
---|
| 1144 | m_cEntropyDecoder.decodePPS( pps, vps ); |
---|
| 1145 | #else |
---|
[608] | 1146 | m_cEntropyDecoder.decodePPS( pps ); |
---|
[758] | 1147 | #endif |
---|
[56] | 1148 | m_parameterSetManagerDecoder.storePrefetchedPPS( pps ); |
---|
| 1149 | } |
---|
[2] | 1150 | |
---|
[608] | 1151 | Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ) |
---|
[56] | 1152 | { |
---|
[608] | 1153 | if(nalUnitType == NAL_UNIT_SUFFIX_SEI) |
---|
| 1154 | { |
---|
[622] | 1155 | #if H_MV |
---|
| 1156 | m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS( m_layerId ) ); |
---|
| 1157 | #else |
---|
[608] | 1158 | m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); |
---|
[622] | 1159 | #endif |
---|
[608] | 1160 | } |
---|
| 1161 | else |
---|
| 1162 | { |
---|
[622] | 1163 | #if H_MV |
---|
| 1164 | m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS( m_layerId ) ); |
---|
| 1165 | #else |
---|
[608] | 1166 | m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); |
---|
[622] | 1167 | #endif |
---|
[608] | 1168 | SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS); |
---|
| 1169 | if (activeParamSets.size()>0) |
---|
| 1170 | { |
---|
| 1171 | SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin()); |
---|
| 1172 | m_parameterSetManagerDecoder.applyPrefetchedPS(); |
---|
| 1173 | assert(seiAps->activeSeqParamSetId.size()>0); |
---|
[622] | 1174 | #if H_MV |
---|
| 1175 | if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParamSetId[0], m_layerId )) |
---|
| 1176 | #else |
---|
[608] | 1177 | if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParamSetId[0] )) |
---|
[622] | 1178 | #endif |
---|
[608] | 1179 | { |
---|
| 1180 | printf ("Warning SPS activation with Active parameter set SEI failed"); |
---|
| 1181 | } |
---|
| 1182 | } |
---|
| 1183 | } |
---|
[56] | 1184 | } |
---|
[2] | 1185 | |
---|
[608] | 1186 | #if H_MV |
---|
[738] | 1187 | Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayerFlag, Bool& sliceSkippedFlag ) |
---|
| 1188 | #else |
---|
[56] | 1189 | Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay) |
---|
[608] | 1190 | #endif |
---|
[56] | 1191 | { |
---|
| 1192 | // Initialize entropy decoder |
---|
| 1193 | m_cEntropyDecoder.setEntropyDecoder (&m_cCavlcDecoder); |
---|
| 1194 | m_cEntropyDecoder.setBitstream (nalu.m_Bitstream); |
---|
[2] | 1195 | |
---|
[56] | 1196 | switch (nalu.m_nalUnitType) |
---|
| 1197 | { |
---|
[77] | 1198 | case NAL_UNIT_VPS: |
---|
| 1199 | xDecodeVPS(); |
---|
| 1200 | return false; |
---|
[608] | 1201 | |
---|
[56] | 1202 | case NAL_UNIT_SPS: |
---|
| 1203 | xDecodeSPS(); |
---|
| 1204 | return false; |
---|
| 1205 | |
---|
| 1206 | case NAL_UNIT_PPS: |
---|
| 1207 | xDecodePPS(); |
---|
| 1208 | return false; |
---|
[608] | 1209 | |
---|
| 1210 | case NAL_UNIT_PREFIX_SEI: |
---|
| 1211 | case NAL_UNIT_SUFFIX_SEI: |
---|
| 1212 | xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType ); |
---|
[56] | 1213 | return false; |
---|
| 1214 | |
---|
[608] | 1215 | case NAL_UNIT_CODED_SLICE_TRAIL_R: |
---|
| 1216 | case NAL_UNIT_CODED_SLICE_TRAIL_N: |
---|
| 1217 | case NAL_UNIT_CODED_SLICE_TLA_R: |
---|
| 1218 | case NAL_UNIT_CODED_SLICE_TSA_N: |
---|
| 1219 | case NAL_UNIT_CODED_SLICE_STSA_R: |
---|
| 1220 | case NAL_UNIT_CODED_SLICE_STSA_N: |
---|
| 1221 | case NAL_UNIT_CODED_SLICE_BLA_W_LP: |
---|
| 1222 | case NAL_UNIT_CODED_SLICE_BLA_W_RADL: |
---|
| 1223 | case NAL_UNIT_CODED_SLICE_BLA_N_LP: |
---|
| 1224 | case NAL_UNIT_CODED_SLICE_IDR_W_RADL: |
---|
| 1225 | case NAL_UNIT_CODED_SLICE_IDR_N_LP: |
---|
[56] | 1226 | case NAL_UNIT_CODED_SLICE_CRA: |
---|
[608] | 1227 | case NAL_UNIT_CODED_SLICE_RADL_N: |
---|
| 1228 | case NAL_UNIT_CODED_SLICE_RADL_R: |
---|
| 1229 | case NAL_UNIT_CODED_SLICE_RASL_N: |
---|
| 1230 | case NAL_UNIT_CODED_SLICE_RASL_R: |
---|
| 1231 | #if H_MV |
---|
[738] | 1232 | return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag, sliceSkippedFlag ); |
---|
| 1233 | #else |
---|
[56] | 1234 | return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay); |
---|
[608] | 1235 | #endif |
---|
[2] | 1236 | break; |
---|
| 1237 | default: |
---|
| 1238 | assert (1); |
---|
| 1239 | } |
---|
| 1240 | |
---|
| 1241 | return false; |
---|
| 1242 | } |
---|
| 1243 | |
---|
[608] | 1244 | /** Function for checking if picture should be skipped because of association with a previous BLA picture |
---|
| 1245 | * \param iPOCLastDisplay POC of last picture displayed |
---|
| 1246 | * \returns true if the picture should be skipped |
---|
| 1247 | * This function skips all TFD pictures that follow a BLA picture |
---|
| 1248 | * in decoding order and precede it in output order. |
---|
| 1249 | */ |
---|
| 1250 | Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay) |
---|
[210] | 1251 | { |
---|
[655] | 1252 | if ((m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_N_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_LP || m_associatedIRAPType == NAL_UNIT_CODED_SLICE_BLA_W_RADL) && |
---|
| 1253 | m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) |
---|
[608] | 1254 | { |
---|
| 1255 | iPOCLastDisplay++; |
---|
| 1256 | return true; |
---|
| 1257 | } |
---|
| 1258 | return false; |
---|
[210] | 1259 | } |
---|
| 1260 | |
---|
[2] | 1261 | /** Function for checking if picture should be skipped because of random access |
---|
| 1262 | * \param iSkipFrame skip frame counter |
---|
| 1263 | * \param iPOCLastDisplay POC of last picture displayed |
---|
| 1264 | * \returns true if the picture shold be skipped in the random access. |
---|
| 1265 | * This function checks the skipping of pictures in the case of -s option random access. |
---|
| 1266 | * All pictures prior to the random access point indicated by the counter iSkipFrame are skipped. |
---|
| 1267 | * It also checks the type of Nal unit type at the random access point. |
---|
[608] | 1268 | * If the random access point is CRA/CRANT/BLA/BLANT, TFD pictures with POC less than the POC of the random access point are skipped. |
---|
[2] | 1269 | * If the random access point is IDR all pictures after the random access point are decoded. |
---|
[608] | 1270 | * If the random access point is none of the above, a warning is issues, and decoding of pictures with POC |
---|
| 1271 | * equal to or greater than the random access point POC is attempted. For non IDR/CRA/BLA random |
---|
[2] | 1272 | * access point there is no guarantee that the decoder will not crash. |
---|
| 1273 | */ |
---|
| 1274 | Bool TDecTop::isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay) |
---|
| 1275 | { |
---|
[56] | 1276 | if (iSkipFrame) |
---|
[2] | 1277 | { |
---|
| 1278 | iSkipFrame--; // decrement the counter |
---|
| 1279 | return true; |
---|
| 1280 | } |
---|
[773] | 1281 | #if H_MV |
---|
[738] | 1282 | else if ( !m_layerInitilizedFlag[ m_layerId ] ) // start of random access point, m_pocRandomAccess has not been set yet. |
---|
| 1283 | #else |
---|
[56] | 1284 | else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet. |
---|
[738] | 1285 | #endif |
---|
[2] | 1286 | { |
---|
[608] | 1287 | if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA |
---|
| 1288 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 1289 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP |
---|
| 1290 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ) |
---|
[2] | 1291 | { |
---|
[738] | 1292 | |
---|
[773] | 1293 | #if H_MV |
---|
[738] | 1294 | if ( xAllRefLayersInitilized() ) |
---|
| 1295 | { |
---|
| 1296 | m_layerInitilizedFlag[ m_layerId ] = true; |
---|
| 1297 | m_pocRandomAccess = m_apcSlicePilot->getPOC(); |
---|
| 1298 | } |
---|
| 1299 | else |
---|
| 1300 | { |
---|
| 1301 | return true; |
---|
| 1302 | } |
---|
| 1303 | #else |
---|
[608] | 1304 | // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT. |
---|
| 1305 | m_pocRandomAccess = m_apcSlicePilot->getPOC(); |
---|
[738] | 1306 | #endif |
---|
[2] | 1307 | } |
---|
[608] | 1308 | else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) |
---|
[2] | 1309 | { |
---|
[773] | 1310 | #if H_MV |
---|
[738] | 1311 | if ( xAllRefLayersInitilized() ) |
---|
| 1312 | { |
---|
| 1313 | m_layerInitilizedFlag[ m_layerId ] = true; |
---|
[773] | 1314 | m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable. |
---|
| 1315 | } |
---|
| 1316 | else |
---|
| 1317 | { |
---|
[738] | 1318 | return true; |
---|
| 1319 | } |
---|
| 1320 | #else |
---|
| 1321 | m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable. |
---|
| 1322 | #endif |
---|
| 1323 | } |
---|
| 1324 | else |
---|
| 1325 | { |
---|
[773] | 1326 | #if H_MV |
---|
[738] | 1327 | static Bool warningMessage[MAX_NUM_LAYERS]; |
---|
| 1328 | static Bool warningInitFlag = false; |
---|
| 1329 | |
---|
| 1330 | if (!warningInitFlag) |
---|
| 1331 | { |
---|
| 1332 | for ( Int i = 0; i < MAX_NUM_LAYERS; i++) |
---|
| 1333 | { |
---|
| 1334 | warningMessage[i] = true; |
---|
| 1335 | } |
---|
| 1336 | warningInitFlag = true; |
---|
| 1337 | } |
---|
| 1338 | |
---|
| 1339 | if ( warningMessage[getLayerId()] ) |
---|
| 1340 | { |
---|
| 1341 | printf("\nLayer%3d No valid random access point. VCL NAL units of this layer are discarded until next layer initialization picture. ", getLayerId() ); |
---|
| 1342 | warningMessage[m_layerId] = false; |
---|
| 1343 | } |
---|
| 1344 | #else |
---|
[608] | 1345 | static Bool warningMessage = false; |
---|
[56] | 1346 | if(!warningMessage) |
---|
| 1347 | { |
---|
| 1348 | printf("\nWarning: this is not a valid random access point and the data is discarded until the first CRA picture"); |
---|
| 1349 | warningMessage = true; |
---|
| 1350 | } |
---|
[738] | 1351 | #endif |
---|
[56] | 1352 | return true; |
---|
[2] | 1353 | } |
---|
| 1354 | } |
---|
[608] | 1355 | // skip the reordered pictures, if necessary |
---|
| 1356 | else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) |
---|
[2] | 1357 | { |
---|
| 1358 | iPOCLastDisplay++; |
---|
| 1359 | return true; |
---|
| 1360 | } |
---|
[773] | 1361 | #if H_MV |
---|
[738] | 1362 | return !m_layerInitilizedFlag[ getLayerId() ]; |
---|
| 1363 | #else |
---|
[2] | 1364 | // if we reach here, then the picture is not skipped. |
---|
[56] | 1365 | return false; |
---|
[738] | 1366 | #endif |
---|
[2] | 1367 | } |
---|
[56] | 1368 | |
---|
[608] | 1369 | #if H_MV |
---|
| 1370 | TComPic* TDecTop::getPic( Int poc ) |
---|
[56] | 1371 | { |
---|
[608] | 1372 | xGetPic( m_layerId, poc ); |
---|
| 1373 | TComList<TComPic*>* listPic = getListPic(); |
---|
| 1374 | TComPic* pcPic = NULL; |
---|
| 1375 | for(TComList<TComPic*>::iterator it=listPic->begin(); it!=listPic->end(); it++) |
---|
| 1376 | { |
---|
| 1377 | if( (*it)->getPOC() == poc ) |
---|
| 1378 | { |
---|
| 1379 | pcPic = *it ; |
---|
| 1380 | break ; |
---|
| 1381 | } |
---|
| 1382 | } |
---|
| 1383 | return pcPic; |
---|
[56] | 1384 | } |
---|
[2] | 1385 | |
---|
[608] | 1386 | TComPic* TDecTop::xGetPic( Int layerId, Int poc ) |
---|
| 1387 | { |
---|
| 1388 | return m_ivPicLists->getPic( layerId, poc ) ; |
---|
| 1389 | } |
---|
| 1390 | |
---|
[622] | 1391 | Void TDecTop::xResetPocInPicBuffer() |
---|
| 1392 | { |
---|
| 1393 | TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); |
---|
| 1394 | while (iterPic != m_cListPic.end()) |
---|
| 1395 | { |
---|
| 1396 | TComPic* pic = *(iterPic++); |
---|
| 1397 | if ( pic->getReconMark() ) |
---|
| 1398 | { |
---|
| 1399 | for( Int i = 0; i < pic->getNumAllocatedSlice(); i++) |
---|
| 1400 | { |
---|
| 1401 | TComSlice* slice = pic->getSlice( i ); |
---|
| 1402 | slice->setPOC ( slice->getPOC() - m_apcSlicePilot->getPocBeforeReset() ); |
---|
| 1403 | } |
---|
| 1404 | } |
---|
| 1405 | } |
---|
| 1406 | } |
---|
[738] | 1407 | |
---|
[773] | 1408 | #if H_MV |
---|
[738] | 1409 | Void TDecTop::xCeckNoClrasOutput() |
---|
| 1410 | { |
---|
| 1411 | // This part needs further testing! |
---|
| 1412 | if ( getLayerId() == 0 ) |
---|
| 1413 | { |
---|
| 1414 | NalUnitType nut = m_apcSlicePilot->getNalUnitType(); |
---|
| 1415 | |
---|
| 1416 | Bool isBLA = ( nut == NAL_UNIT_CODED_SLICE_BLA_W_LP ) || ( nut == NAL_UNIT_CODED_SLICE_BLA_N_LP ) || ( nut == NAL_UNIT_CODED_SLICE_BLA_W_RADL ); |
---|
| 1417 | Bool isIDR = ( nut == NAL_UNIT_CODED_SLICE_IDR_W_RADL ) || ( nut == NAL_UNIT_CODED_SLICE_IDR_N_LP ); |
---|
| 1418 | Bool noClrasOutputFlag = isBLA || ( isIDR && m_apcSlicePilot->getCrossLayerBlaFlag() ); |
---|
| 1419 | |
---|
| 1420 | if ( noClrasOutputFlag ) |
---|
| 1421 | { |
---|
| 1422 | for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) |
---|
| 1423 | { |
---|
| 1424 | m_layerInitilizedFlag[i] = false; |
---|
| 1425 | } |
---|
| 1426 | } |
---|
| 1427 | } |
---|
| 1428 | } |
---|
| 1429 | |
---|
| 1430 | Bool TDecTop::xAllRefLayersInitilized() |
---|
| 1431 | { |
---|
| 1432 | Bool allRefLayersInitilizedFlag = true; |
---|
| 1433 | TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 ); |
---|
| 1434 | for (Int i = 0; i < vps->getNumDirectRefLayers( getLayerId() ); i++ ) |
---|
| 1435 | { |
---|
| 1436 | Int refLayerId = vps->getRefLayerId( m_layerId, i ); |
---|
| 1437 | allRefLayersInitilizedFlag = allRefLayersInitilizedFlag && m_layerInitilizedFlag[ refLayerId ]; |
---|
| 1438 | } |
---|
| 1439 | |
---|
| 1440 | return allRefLayersInitilizedFlag; |
---|
| 1441 | } |
---|
[608] | 1442 | #endif |
---|
[738] | 1443 | #endif |
---|
[56] | 1444 | //! \} |
---|