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