1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2014, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** \file TDecTop.cpp |
---|
35 | \brief decoder class |
---|
36 | */ |
---|
37 | |
---|
38 | #include "NALread.h" |
---|
39 | #include "TDecTop.h" |
---|
40 | |
---|
41 | #if SVC_EXTENSION |
---|
42 | UInt TDecTop::m_prevPOC = MAX_UINT; |
---|
43 | UInt TDecTop::m_uiPrevLayerId = MAX_UINT; |
---|
44 | Bool TDecTop::m_bFirstSliceInSequence = true; |
---|
45 | #endif |
---|
46 | |
---|
47 | //! \ingroup TLibDecoder |
---|
48 | //! \{ |
---|
49 | |
---|
50 | TDecTop::TDecTop() |
---|
51 | { |
---|
52 | m_pcPic = 0; |
---|
53 | m_iMaxRefPicNum = 0; |
---|
54 | #if ENC_DEC_TRACE |
---|
55 | g_hTrace = fopen( "TraceDec.txt", "wb" ); |
---|
56 | g_bJustDoIt = g_bEncDecTraceDisable; |
---|
57 | g_nSymbolCounter = 0; |
---|
58 | #endif |
---|
59 | m_associatedIRAPType = NAL_UNIT_INVALID; |
---|
60 | m_pocCRA = 0; |
---|
61 | m_pocRandomAccess = MAX_INT; |
---|
62 | #if !SVC_EXTENSION |
---|
63 | m_prevPOC = MAX_INT; |
---|
64 | #endif |
---|
65 | m_bFirstSliceInPicture = true; |
---|
66 | #if !SVC_EXTENSION |
---|
67 | m_bFirstSliceInSequence = true; |
---|
68 | #endif |
---|
69 | #if SVC_EXTENSION |
---|
70 | m_layerId = 0; |
---|
71 | #if AVC_BASE |
---|
72 | m_pBLReconFile = NULL; |
---|
73 | #endif |
---|
74 | memset(m_cIlpPic, 0, sizeof(m_cIlpPic)); |
---|
75 | #endif |
---|
76 | #if AVC_SYNTAX || SYNTAX_OUTPUT |
---|
77 | m_pBLSyntaxFile = NULL; |
---|
78 | #endif |
---|
79 | m_prevSliceSkipped = false; |
---|
80 | m_skippedPOC = 0; |
---|
81 | #if NO_CLRAS_OUTPUT_FLAG |
---|
82 | m_noClrasOutputFlag = false; |
---|
83 | m_layerInitializedFlag = false; |
---|
84 | m_firstPicInLayerDecodedFlag = false; |
---|
85 | m_noOutputOfPriorPicsFlags = false; |
---|
86 | m_bRefreshPending = false; |
---|
87 | #endif |
---|
88 | #if RESOLUTION_BASED_DPB |
---|
89 | m_subDpbIdx = -1; |
---|
90 | #endif |
---|
91 | } |
---|
92 | |
---|
93 | TDecTop::~TDecTop() |
---|
94 | { |
---|
95 | #if ENC_DEC_TRACE |
---|
96 | fclose( g_hTrace ); |
---|
97 | #endif |
---|
98 | } |
---|
99 | |
---|
100 | Void TDecTop::create() |
---|
101 | { |
---|
102 | #if SVC_EXTENSION |
---|
103 | m_cGopDecoder.create( m_layerId ); |
---|
104 | #else |
---|
105 | m_cGopDecoder.create(); |
---|
106 | #endif |
---|
107 | m_apcSlicePilot = new TComSlice; |
---|
108 | m_uiSliceIdx = 0; |
---|
109 | } |
---|
110 | |
---|
111 | Void TDecTop::destroy() |
---|
112 | { |
---|
113 | m_cGopDecoder.destroy(); |
---|
114 | |
---|
115 | delete m_apcSlicePilot; |
---|
116 | m_apcSlicePilot = NULL; |
---|
117 | |
---|
118 | m_cSliceDecoder.destroy(); |
---|
119 | #if SVC_EXTENSION |
---|
120 | for(Int i=0; i<MAX_NUM_REF; i++) |
---|
121 | { |
---|
122 | if(m_cIlpPic[i]) |
---|
123 | { |
---|
124 | m_cIlpPic[i]->destroy(); |
---|
125 | delete m_cIlpPic[i]; |
---|
126 | m_cIlpPic[i] = NULL; |
---|
127 | } |
---|
128 | } |
---|
129 | #endif |
---|
130 | } |
---|
131 | |
---|
132 | Void TDecTop::init() |
---|
133 | { |
---|
134 | #if !SVC_EXTENSION |
---|
135 | // initialize ROM |
---|
136 | initROM(); |
---|
137 | #endif |
---|
138 | #if SVC_EXTENSION |
---|
139 | m_cGopDecoder.init( m_ppcTDecTop, &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO); |
---|
140 | m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder, m_cSAO.getSaoMaxOffsetQVal() ); |
---|
141 | #else |
---|
142 | m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO); |
---|
143 | m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder ); |
---|
144 | #endif |
---|
145 | m_cEntropyDecoder.init(&m_cPrediction); |
---|
146 | } |
---|
147 | |
---|
148 | #if SVC_EXTENSION |
---|
149 | #if !REPN_FORMAT_IN_VPS |
---|
150 | Void TDecTop::xInitILRP(TComSPS *pcSPS) |
---|
151 | #else |
---|
152 | Void TDecTop::xInitILRP(TComSlice *slice) |
---|
153 | #endif |
---|
154 | { |
---|
155 | #if REPN_FORMAT_IN_VPS |
---|
156 | TComSPS* pcSPS = slice->getSPS(); |
---|
157 | Int bitDepthY = slice->getBitDepthY(); |
---|
158 | Int bitDepthC = slice->getBitDepthC(); |
---|
159 | Int picWidth = slice->getPicWidthInLumaSamples(); |
---|
160 | Int picHeight = slice->getPicHeightInLumaSamples(); |
---|
161 | #endif |
---|
162 | if(m_layerId>0) |
---|
163 | { |
---|
164 | #if REPN_FORMAT_IN_VPS |
---|
165 | g_bitDepthY = bitDepthY; |
---|
166 | g_bitDepthC = bitDepthC; |
---|
167 | #else |
---|
168 | g_bitDepthY = pcSPS->getBitDepthY(); |
---|
169 | g_bitDepthC = pcSPS->getBitDepthC(); |
---|
170 | #endif |
---|
171 | g_uiMaxCUWidth = pcSPS->getMaxCUWidth(); |
---|
172 | g_uiMaxCUHeight = pcSPS->getMaxCUHeight(); |
---|
173 | g_uiMaxCUDepth = pcSPS->getMaxCUDepth(); |
---|
174 | g_uiAddCUDepth = max (0, pcSPS->getLog2MinCodingBlockSize() - (Int)pcSPS->getQuadtreeTULog2MinSize() ); |
---|
175 | |
---|
176 | Int numReorderPics[MAX_TLAYER]; |
---|
177 | Window &conformanceWindow = pcSPS->getConformanceWindow(); |
---|
178 | Window defaultDisplayWindow = pcSPS->getVuiParametersPresentFlag() ? pcSPS->getVuiParameters()->getDefaultDisplayWindow() : Window(); |
---|
179 | |
---|
180 | for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++) |
---|
181 | { |
---|
182 | #if USE_DPB_SIZE_TABLE |
---|
183 | if( getCommonDecoderParams()->getTargetOutputLayerSetIdx() == 0 ) |
---|
184 | { |
---|
185 | assert( this->getLayerId() == 0 ); |
---|
186 | numReorderPics[temporalLayer] = pcSPS->getNumReorderPics(temporalLayer); |
---|
187 | } |
---|
188 | else |
---|
189 | { |
---|
190 | TComVPS *vps = slice->getVPS(); |
---|
191 | // SHM decoders will use DPB size table in the VPS to determine the number of reorder pictures. |
---|
192 | numReorderPics[temporalLayer] = vps->getMaxVpsNumReorderPics( getCommonDecoderParams()->getTargetOutputLayerSetIdx() , temporalLayer); |
---|
193 | } |
---|
194 | #else |
---|
195 | numReorderPics[temporalLayer] = pcSPS->getNumReorderPics(temporalLayer); |
---|
196 | #endif |
---|
197 | } |
---|
198 | |
---|
199 | if (m_cIlpPic[0] == NULL) |
---|
200 | { |
---|
201 | for (Int j=0; j < m_numDirectRefLayers; j++) |
---|
202 | { |
---|
203 | |
---|
204 | m_cIlpPic[j] = new TComPic; |
---|
205 | #if AUXILIARY_PICTURES |
---|
206 | #if REPN_FORMAT_IN_VPS |
---|
207 | #if SVC_UPSAMPLING |
---|
208 | m_cIlpPic[j]->create(picWidth, picHeight, slice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true); |
---|
209 | #else |
---|
210 | m_cIlpPic[j]->create(picWidth, picHeight, slice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
211 | #endif |
---|
212 | #else |
---|
213 | #if SVC_UPSAMPLING |
---|
214 | m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), pcSPS->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true); |
---|
215 | #else |
---|
216 | m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), pcSPS->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
217 | #endif |
---|
218 | #endif |
---|
219 | #else |
---|
220 | #if REPN_FORMAT_IN_VPS |
---|
221 | #if SVC_UPSAMPLING |
---|
222 | m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true); |
---|
223 | #else |
---|
224 | m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
225 | #endif |
---|
226 | #else |
---|
227 | #if SVC_UPSAMPLING |
---|
228 | m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true); |
---|
229 | #else |
---|
230 | m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
231 | #endif |
---|
232 | #endif |
---|
233 | #endif |
---|
234 | for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCUsInFrame(); i++) |
---|
235 | { |
---|
236 | m_cIlpPic[j]->getPicSym()->getCU(i)->initCU(m_cIlpPic[j], i); |
---|
237 | } |
---|
238 | } |
---|
239 | } |
---|
240 | } |
---|
241 | } |
---|
242 | #endif |
---|
243 | |
---|
244 | Void TDecTop::deletePicBuffer ( ) |
---|
245 | { |
---|
246 | TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); |
---|
247 | Int iSize = Int( m_cListPic.size() ); |
---|
248 | |
---|
249 | for (Int i = 0; i < iSize; i++ ) |
---|
250 | { |
---|
251 | TComPic* pcPic = *(iterPic++); |
---|
252 | #if SVC_EXTENSION |
---|
253 | if( pcPic ) |
---|
254 | { |
---|
255 | pcPic->destroy(); |
---|
256 | |
---|
257 | delete pcPic; |
---|
258 | pcPic = NULL; |
---|
259 | } |
---|
260 | #else |
---|
261 | pcPic->destroy(); |
---|
262 | |
---|
263 | delete pcPic; |
---|
264 | pcPic = NULL; |
---|
265 | #endif |
---|
266 | } |
---|
267 | |
---|
268 | m_cSAO.destroy(); |
---|
269 | |
---|
270 | m_cLoopFilter. destroy(); |
---|
271 | |
---|
272 | #if !SVC_EXTENSION |
---|
273 | // destroy ROM |
---|
274 | destroyROM(); |
---|
275 | #endif |
---|
276 | } |
---|
277 | |
---|
278 | Void TDecTop::xGetNewPicBuffer ( TComSlice* pcSlice, TComPic*& rpcPic ) |
---|
279 | { |
---|
280 | Int numReorderPics[MAX_TLAYER]; |
---|
281 | Window &conformanceWindow = pcSlice->getSPS()->getConformanceWindow(); |
---|
282 | Window defaultDisplayWindow = pcSlice->getSPS()->getVuiParametersPresentFlag() ? pcSlice->getSPS()->getVuiParameters()->getDefaultDisplayWindow() : Window(); |
---|
283 | |
---|
284 | for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++) |
---|
285 | { |
---|
286 | #if USE_DPB_SIZE_TABLE |
---|
287 | if( getCommonDecoderParams()->getTargetOutputLayerSetIdx() == 0 ) |
---|
288 | { |
---|
289 | assert( this->getLayerId() == 0 ); |
---|
290 | numReorderPics[temporalLayer] = pcSlice->getSPS()->getNumReorderPics(temporalLayer); |
---|
291 | } |
---|
292 | else |
---|
293 | { |
---|
294 | TComVPS *vps = pcSlice->getVPS(); |
---|
295 | // SHM decoders will use DPB size table in the VPS to determine the number of reorder pictures. |
---|
296 | numReorderPics[temporalLayer] = vps->getMaxVpsNumReorderPics( getCommonDecoderParams()->getTargetOutputLayerSetIdx() , temporalLayer); |
---|
297 | } |
---|
298 | #else |
---|
299 | numReorderPics[temporalLayer] = pcSlice->getSPS()->getNumReorderPics(temporalLayer); |
---|
300 | #endif |
---|
301 | } |
---|
302 | |
---|
303 | #if USE_DPB_SIZE_TABLE |
---|
304 | if( getCommonDecoderParams()->getTargetOutputLayerSetIdx() == 0 ) |
---|
305 | { |
---|
306 | assert( this->getLayerId() == 0 ); |
---|
307 | m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded |
---|
308 | } |
---|
309 | else |
---|
310 | { |
---|
311 | #if RESOLUTION_BASED_DPB |
---|
312 | Int layerSetIdxForOutputLayerSet = pcSlice->getVPS()->getOutputLayerSetIdx( getCommonDecoderParams()->getTargetOutputLayerSetIdx() ); |
---|
313 | Int layerIdx = pcSlice->getVPS()->findLayerIdxInLayerSet( layerSetIdxForOutputLayerSet, pcSlice->getLayerId() ); assert( layerIdx != -1 ); |
---|
314 | m_iMaxRefPicNum = pcSlice->getVPS()->getMaxVpsLayerDecPicBuffMinus1( getCommonDecoderParams()->getTargetOutputLayerSetIdx(), layerIdx, pcSlice->getTLayer() ) + 1; // m_uiMaxDecPicBuffering has the space for the picture currently being decoded |
---|
315 | #else |
---|
316 | m_iMaxRefPicNum = pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1( getCommonDecoderParams()->getTargetOutputLayerSetIdx(), pcSlice->getLayerId(), pcSlice->getTLayer() ) + 1; // m_uiMaxDecPicBuffering has the space for the picture currently being decoded |
---|
317 | #endif |
---|
318 | #if SPS_DPB_PARAMS |
---|
319 | pcSlice->getVPS()->setTolsIdx(getCommonDecoderParams()->getTargetOutputLayerSetIdx()); |
---|
320 | #endif |
---|
321 | } |
---|
322 | #else |
---|
323 | m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded |
---|
324 | #endif |
---|
325 | |
---|
326 | #if SVC_EXTENSION |
---|
327 | m_iMaxRefPicNum += 1; // it should be updated if more than 1 resampling picture is used |
---|
328 | #endif |
---|
329 | |
---|
330 | if (m_cListPic.size() < (UInt)m_iMaxRefPicNum) |
---|
331 | { |
---|
332 | rpcPic = new TComPic(); |
---|
333 | |
---|
334 | #if SVC_EXTENSION //Temporal solution, should be modified |
---|
335 | if(m_layerId > 0) |
---|
336 | { |
---|
337 | for(UInt i = 0; i < pcSlice->getVPS()->getNumDirectRefLayers( m_layerId ); i++ ) |
---|
338 | { |
---|
339 | #if O0098_SCALED_REF_LAYER_ID |
---|
340 | const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i)); |
---|
341 | #else |
---|
342 | const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(i); |
---|
343 | #endif |
---|
344 | Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 ); |
---|
345 | |
---|
346 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
347 | TDecTop *pcTDecTopBase = (TDecTop *)getRefLayerDec( i ); |
---|
348 | #else |
---|
349 | TDecTop *pcTDecTopBase = (TDecTop *)getLayerDec( m_layerId-1 ); |
---|
350 | #endif |
---|
351 | //TComPic* pcPic = *(pcTDecTopBase->getListPic()->begin()); |
---|
352 | TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec(); |
---|
353 | #if REPN_FORMAT_IN_VPS |
---|
354 | if(pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets ) |
---|
355 | #else |
---|
356 | if(pcPicYuvRecBase->getWidth() != pcSlice->getSPS()->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getSPS()->getPicHeightInLumaSamples() || !zeroOffsets ) |
---|
357 | #endif |
---|
358 | { |
---|
359 | rpcPic->setSpatialEnhLayerFlag( i, true ); |
---|
360 | |
---|
361 | //only for scalable extension |
---|
362 | #if SCALABILITY_MASK_E0104 |
---|
363 | assert( pcSlice->getVPS()->getScalabilityMask(2) == true ); |
---|
364 | #else |
---|
365 | assert( pcSlice->getVPS()->getScalabilityMask(1) == true ); |
---|
366 | #endif |
---|
367 | } |
---|
368 | } |
---|
369 | } |
---|
370 | #endif |
---|
371 | |
---|
372 | #if AUXILIARY_PICTURES |
---|
373 | #if REPN_FORMAT_IN_VPS |
---|
374 | #if SVC_UPSAMPLING |
---|
375 | rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
376 | conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true); |
---|
377 | #else |
---|
378 | rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
379 | conformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
380 | #endif |
---|
381 | #else |
---|
382 | #if SVC_UPSAMPLING |
---|
383 | rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
384 | conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true); |
---|
385 | #else |
---|
386 | rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
387 | conformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
388 | #endif |
---|
389 | #endif |
---|
390 | #else |
---|
391 | #if REPN_FORMAT_IN_VPS |
---|
392 | #if SVC_UPSAMPLING |
---|
393 | rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
394 | conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true); |
---|
395 | #else |
---|
396 | rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
397 | conformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
398 | #endif |
---|
399 | #else |
---|
400 | #if SVC_UPSAMPLING |
---|
401 | rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
402 | conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true); |
---|
403 | #else |
---|
404 | rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
405 | conformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
406 | #endif |
---|
407 | #endif |
---|
408 | #endif |
---|
409 | m_cListPic.pushBack( rpcPic ); |
---|
410 | |
---|
411 | return; |
---|
412 | } |
---|
413 | |
---|
414 | Bool bBufferIsAvailable = false; |
---|
415 | TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); |
---|
416 | while (iterPic != m_cListPic.end()) |
---|
417 | { |
---|
418 | rpcPic = *(iterPic++); |
---|
419 | if ( rpcPic->getReconMark() == false && rpcPic->getOutputMark() == false) |
---|
420 | { |
---|
421 | rpcPic->setOutputMark(false); |
---|
422 | bBufferIsAvailable = true; |
---|
423 | break; |
---|
424 | } |
---|
425 | |
---|
426 | if ( rpcPic->getSlice( 0 )->isReferenced() == false && rpcPic->getOutputMark() == false) |
---|
427 | { |
---|
428 | #if !SVC_EXTENSION |
---|
429 | rpcPic->setOutputMark(false); |
---|
430 | #endif |
---|
431 | rpcPic->setReconMark( false ); |
---|
432 | rpcPic->getPicYuvRec()->setBorderExtension( false ); |
---|
433 | bBufferIsAvailable = true; |
---|
434 | break; |
---|
435 | } |
---|
436 | } |
---|
437 | |
---|
438 | if ( !bBufferIsAvailable ) |
---|
439 | { |
---|
440 | //There is no room for this picture, either because of faulty encoder or dropped NAL. Extend the buffer. |
---|
441 | m_iMaxRefPicNum++; |
---|
442 | rpcPic = new TComPic(); |
---|
443 | m_cListPic.pushBack( rpcPic ); |
---|
444 | } |
---|
445 | rpcPic->destroy(); |
---|
446 | |
---|
447 | #if AUXILIARY_PICTURES |
---|
448 | #if REPN_FORMAT_IN_VPS |
---|
449 | #if SVC_UPSAMPLING |
---|
450 | rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
451 | conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true); |
---|
452 | |
---|
453 | #else |
---|
454 | rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
455 | conformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
456 | #endif |
---|
457 | #else |
---|
458 | #if SVC_UPSAMPLING |
---|
459 | rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
460 | conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true); |
---|
461 | |
---|
462 | #else |
---|
463 | rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
464 | conformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
465 | #endif |
---|
466 | #endif |
---|
467 | #else |
---|
468 | #if REPN_FORMAT_IN_VPS |
---|
469 | #if SVC_UPSAMPLING |
---|
470 | rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
471 | conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true); |
---|
472 | |
---|
473 | #else |
---|
474 | rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
475 | conformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
476 | #endif |
---|
477 | #else |
---|
478 | #if SVC_UPSAMPLING |
---|
479 | rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
480 | conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true); |
---|
481 | |
---|
482 | #else |
---|
483 | rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, |
---|
484 | conformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
485 | #endif |
---|
486 | #endif |
---|
487 | #endif |
---|
488 | } |
---|
489 | |
---|
490 | Void TDecTop::executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic) |
---|
491 | { |
---|
492 | if (!m_pcPic) |
---|
493 | { |
---|
494 | /* nothing to deblock */ |
---|
495 | return; |
---|
496 | } |
---|
497 | |
---|
498 | TComPic*& pcPic = m_pcPic; |
---|
499 | |
---|
500 | // Execute Deblock + Cleanup |
---|
501 | |
---|
502 | m_cGopDecoder.filterPicture(pcPic); |
---|
503 | |
---|
504 | #if SYNTAX_OUTPUT |
---|
505 | pcPic->wrireBLSyntax( getBLSyntaxFile(), SYNTAX_BYTES ); |
---|
506 | #endif |
---|
507 | TComSlice::sortPicList( m_cListPic ); // sorting for application output |
---|
508 | poc = pcPic->getSlice(m_uiSliceIdx-1)->getPOC(); |
---|
509 | rpcListPic = &m_cListPic; |
---|
510 | m_cCuDecoder.destroy(); |
---|
511 | m_bFirstSliceInPicture = true; |
---|
512 | |
---|
513 | return; |
---|
514 | } |
---|
515 | |
---|
516 | #if EARLY_REF_PIC_MARKING |
---|
517 | Void TDecTop::earlyPicMarking(Int maxTemporalLayer, std::vector<Int>& targetDecLayerIdSet) |
---|
518 | { |
---|
519 | UInt currTid = m_pcPic->getTLayer(); |
---|
520 | UInt highestTid = (maxTemporalLayer >= 0) ? maxTemporalLayer : (m_pcPic->getSlice(0)->getSPS()->getMaxTLayers() - 1); |
---|
521 | UInt latestDecLayerId = m_layerId; |
---|
522 | UInt numTargetDecLayers = 0; |
---|
523 | Int targetDecLayerIdList[MAX_LAYERS]; |
---|
524 | UInt latestDecIdx = 0; |
---|
525 | TComSlice* pcSlice = m_pcPic->getSlice(0); |
---|
526 | |
---|
527 | if ( currTid != highestTid ) // Marking process is only applicaple for highest decoded TLayer |
---|
528 | { |
---|
529 | return; |
---|
530 | } |
---|
531 | |
---|
532 | // currPic must be marked as "used for reference" and must be a sub-layer non-reference picture |
---|
533 | if ( !((pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || |
---|
534 | pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || |
---|
535 | pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || |
---|
536 | pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
537 | pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N || |
---|
538 | pcSlice->getNalUnitType() == NAL_UNIT_RESERVED_VCL_N10 || |
---|
539 | pcSlice->getNalUnitType() == NAL_UNIT_RESERVED_VCL_N12 || |
---|
540 | pcSlice->getNalUnitType() == NAL_UNIT_RESERVED_VCL_N14) && pcSlice->isReferenced())) |
---|
541 | { |
---|
542 | return; |
---|
543 | } |
---|
544 | |
---|
545 | if ( targetDecLayerIdSet.size() == 0 ) // Cannot mark if we don't know the number of scalable layers |
---|
546 | { |
---|
547 | return; |
---|
548 | } |
---|
549 | |
---|
550 | for (std::vector<Int>::iterator it = targetDecLayerIdSet.begin(); it != targetDecLayerIdSet.end(); it++) |
---|
551 | { |
---|
552 | if ( latestDecLayerId == (*it) ) |
---|
553 | { |
---|
554 | latestDecIdx = numTargetDecLayers; |
---|
555 | } |
---|
556 | targetDecLayerIdList[numTargetDecLayers++] = (*it); |
---|
557 | } |
---|
558 | |
---|
559 | Int remainingInterLayerReferencesFlag = 0; |
---|
560 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
561 | for ( Int j = latestDecIdx + 1; j < numTargetDecLayers; j++ ) |
---|
562 | { |
---|
563 | Int jLidx = pcSlice->getVPS()->getLayerIdInVps(targetDecLayerIdList[j]); |
---|
564 | if ( currTid <= pcSlice->getVPS()->getMaxTidIlRefPicsPlus1(latestDecLayerId,jLidx) - 1 ) |
---|
565 | { |
---|
566 | #else |
---|
567 | if ( currTid <= pcSlice->getVPS()->getMaxTidIlRefPicsPlus1(latestDecLayerId) - 1 ) |
---|
568 | { |
---|
569 | for ( Int j = latestDecIdx + 1; j < numTargetDecLayers; j++ ) |
---|
570 | { |
---|
571 | #endif |
---|
572 | for ( Int k = 0; k < m_ppcTDecTop[targetDecLayerIdList[j]]->getNumDirectRefLayers(); k++ ) |
---|
573 | { |
---|
574 | if ( latestDecIdx == m_ppcTDecTop[targetDecLayerIdList[j]]->getRefLayerId(k) ) |
---|
575 | { |
---|
576 | remainingInterLayerReferencesFlag = 1; |
---|
577 | } |
---|
578 | } |
---|
579 | } |
---|
580 | } |
---|
581 | |
---|
582 | if ( remainingInterLayerReferencesFlag == 0 ) |
---|
583 | { |
---|
584 | pcSlice->setReferenced(false); |
---|
585 | } |
---|
586 | } |
---|
587 | #endif |
---|
588 | |
---|
589 | Void TDecTop::xCreateLostPicture(Int iLostPoc) |
---|
590 | { |
---|
591 | printf("\ninserting lost poc : %d\n",iLostPoc); |
---|
592 | TComSlice cFillSlice; |
---|
593 | cFillSlice.setSPS( m_parameterSetManagerDecoder.getFirstSPS() ); |
---|
594 | cFillSlice.setPPS( m_parameterSetManagerDecoder.getFirstPPS() ); |
---|
595 | #if SVC_EXTENSION |
---|
596 | cFillSlice.setVPS( m_parameterSetManagerDecoder.getFirstVPS() ); |
---|
597 | cFillSlice.initSlice( m_layerId ); |
---|
598 | #else |
---|
599 | cFillSlice.initSlice(); |
---|
600 | #endif |
---|
601 | TComPic *cFillPic; |
---|
602 | xGetNewPicBuffer(&cFillSlice,cFillPic); |
---|
603 | cFillPic->getSlice(0)->setSPS( m_parameterSetManagerDecoder.getFirstSPS() ); |
---|
604 | cFillPic->getSlice(0)->setPPS( m_parameterSetManagerDecoder.getFirstPPS() ); |
---|
605 | #if SVC_EXTENSION |
---|
606 | cFillPic->getSlice(0)->setVPS( m_parameterSetManagerDecoder.getFirstVPS() ); |
---|
607 | cFillPic->getSlice(0)->initSlice( m_layerId ); |
---|
608 | #else |
---|
609 | cFillPic->getSlice(0)->initSlice(); |
---|
610 | #endif |
---|
611 | |
---|
612 | TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); |
---|
613 | Int closestPoc = 1000000; |
---|
614 | while ( iterPic != m_cListPic.end()) |
---|
615 | { |
---|
616 | TComPic * rpcPic = *(iterPic++); |
---|
617 | 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()) |
---|
618 | { |
---|
619 | closestPoc=abs(rpcPic->getPicSym()->getSlice(0)->getPOC() -iLostPoc); |
---|
620 | } |
---|
621 | } |
---|
622 | iterPic = m_cListPic.begin(); |
---|
623 | while ( iterPic != m_cListPic.end()) |
---|
624 | { |
---|
625 | TComPic *rpcPic = *(iterPic++); |
---|
626 | if(abs(rpcPic->getPicSym()->getSlice(0)->getPOC() -iLostPoc)==closestPoc&&rpcPic->getPicSym()->getSlice(0)->getPOC()!=m_apcSlicePilot->getPOC()) |
---|
627 | { |
---|
628 | printf("copying picture %d to %d (%d)\n",rpcPic->getPicSym()->getSlice(0)->getPOC() ,iLostPoc,m_apcSlicePilot->getPOC()); |
---|
629 | rpcPic->getPicYuvRec()->copyToPic(cFillPic->getPicYuvRec()); |
---|
630 | break; |
---|
631 | } |
---|
632 | } |
---|
633 | cFillPic->setCurrSliceIdx(0); |
---|
634 | for(Int i=0; i<cFillPic->getNumCUsInFrame(); i++) |
---|
635 | { |
---|
636 | cFillPic->getCU(i)->initCU(cFillPic,i); |
---|
637 | } |
---|
638 | cFillPic->getSlice(0)->setReferenced(true); |
---|
639 | cFillPic->getSlice(0)->setPOC(iLostPoc); |
---|
640 | cFillPic->setReconMark(true); |
---|
641 | cFillPic->setOutputMark(true); |
---|
642 | if(m_pocRandomAccess == MAX_INT) |
---|
643 | { |
---|
644 | m_pocRandomAccess = iLostPoc; |
---|
645 | } |
---|
646 | } |
---|
647 | |
---|
648 | |
---|
649 | Void TDecTop::xActivateParameterSets() |
---|
650 | { |
---|
651 | m_parameterSetManagerDecoder.applyPrefetchedPS(); |
---|
652 | |
---|
653 | TComPPS *pps = m_parameterSetManagerDecoder.getPPS(m_apcSlicePilot->getPPSId()); |
---|
654 | assert (pps != 0); |
---|
655 | |
---|
656 | TComSPS *sps = m_parameterSetManagerDecoder.getSPS(pps->getSPSId()); |
---|
657 | assert (sps != 0); |
---|
658 | |
---|
659 | if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP())) |
---|
660 | { |
---|
661 | printf ("Parameter set activation failed!"); |
---|
662 | assert (0); |
---|
663 | } |
---|
664 | |
---|
665 | #if SCALINGLIST_INFERRING |
---|
666 | // scaling list settings and checks |
---|
667 | TComVPS *activeVPS = m_parameterSetManagerDecoder.getActiveVPS(); |
---|
668 | TComSPS *activeSPS = m_parameterSetManagerDecoder.getActiveSPS(); |
---|
669 | TComPPS *activePPS = m_parameterSetManagerDecoder.getActivePPS(); |
---|
670 | |
---|
671 | if( activeSPS->getInferScalingListFlag() ) |
---|
672 | { |
---|
673 | UInt refLayerId = activeSPS->getScalingListRefLayerId(); |
---|
674 | TComSPS *refSps = m_ppcTDecTop[refLayerId]->getParameterSetManager()->getActiveSPS(); assert( refSps != NULL ); |
---|
675 | |
---|
676 | // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of sps_scaling_list_ref_layer_id shall be greater than 0 |
---|
677 | if( activeVPS->getAvcBaseLayerFlag() ) |
---|
678 | { |
---|
679 | assert( refLayerId > 0 ); |
---|
680 | } |
---|
681 | |
---|
682 | // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and |
---|
683 | // sps_infer_scaling_list_flag in the SPS is equal to 1, sps_infer_scaling_list_flag shall be equal to 0 for the SPS that is active for the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id |
---|
684 | assert( refSps->getInferScalingListFlag() == false ); |
---|
685 | |
---|
686 | // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB, |
---|
687 | // the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB |
---|
688 | assert( activeVPS->getRecursiveRefLayerFlag( activeSPS->getLayerId(), refLayerId ) == true ); |
---|
689 | |
---|
690 | if( activeSPS->getScalingList() != refSps->getScalingList() ) |
---|
691 | { |
---|
692 | // delete created instance of scaling list since it will be inferred |
---|
693 | delete activeSPS->getScalingList(); |
---|
694 | |
---|
695 | // infer scaling list |
---|
696 | activeSPS->setScalingList( refSps->getScalingList() ); |
---|
697 | } |
---|
698 | } |
---|
699 | |
---|
700 | if( activePPS->getInferScalingListFlag() ) |
---|
701 | { |
---|
702 | UInt refLayerId = activePPS->getScalingListRefLayerId(); |
---|
703 | TComPPS *refPps = m_ppcTDecTop[refLayerId]->getParameterSetManager()->getActivePPS(); assert( refPps != NULL ); |
---|
704 | |
---|
705 | // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of sps_scaling_list_ref_layer_id shall be greater than 0 |
---|
706 | if( activeVPS->getAvcBaseLayerFlag() ) |
---|
707 | { |
---|
708 | assert( refLayerId > 0 ); |
---|
709 | } |
---|
710 | |
---|
711 | // It is a requirement of bitstream conformance that, when an PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and |
---|
712 | // pps_infer_scaling_list_flag in the PPS is equal to 1, pps_infer_scaling_list_flag shall be equal to 0 for the PPS that is active for the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id |
---|
713 | assert( refPps->getInferScalingListFlag() == false ); |
---|
714 | |
---|
715 | // It is a requirement of bitstream conformance that, when an PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB, |
---|
716 | // the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB |
---|
717 | assert( activeVPS->getRecursiveRefLayerFlag( activePPS->getLayerId(), refLayerId ) == true ); |
---|
718 | |
---|
719 | if( activePPS->getScalingList() != refPps->getScalingList() ) |
---|
720 | { |
---|
721 | // delete created instance of scaling list since it will be inferred |
---|
722 | delete activePPS->getScalingList(); |
---|
723 | |
---|
724 | // infer scaling list |
---|
725 | activePPS->setScalingList( refPps->getScalingList() ); |
---|
726 | } |
---|
727 | |
---|
728 | } |
---|
729 | #endif |
---|
730 | |
---|
731 | if( pps->getDependentSliceSegmentsEnabledFlag() ) |
---|
732 | { |
---|
733 | Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1; |
---|
734 | |
---|
735 | if (m_cSliceDecoder.getCtxMemSize() != NumCtx) |
---|
736 | { |
---|
737 | m_cSliceDecoder.initCtxMem(NumCtx); |
---|
738 | for ( UInt st = 0; st < NumCtx; st++ ) |
---|
739 | { |
---|
740 | TDecSbac* ctx = NULL; |
---|
741 | ctx = new TDecSbac; |
---|
742 | ctx->init( &m_cBinCABAC ); |
---|
743 | m_cSliceDecoder.setCtxMem( ctx, st ); |
---|
744 | } |
---|
745 | } |
---|
746 | } |
---|
747 | |
---|
748 | m_apcSlicePilot->setPPS(pps); |
---|
749 | m_apcSlicePilot->setSPS(sps); |
---|
750 | pps->setSPS(sps); |
---|
751 | #if REPN_FORMAT_IN_VPS |
---|
752 | pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1); |
---|
753 | #else |
---|
754 | pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1); |
---|
755 | #endif |
---|
756 | pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) ); |
---|
757 | |
---|
758 | #if REPN_FORMAT_IN_VPS |
---|
759 | g_bitDepthY = m_apcSlicePilot->getBitDepthY(); |
---|
760 | g_bitDepthC = m_apcSlicePilot->getBitDepthC(); |
---|
761 | #else |
---|
762 | g_bitDepthY = sps->getBitDepthY(); |
---|
763 | g_bitDepthC = sps->getBitDepthC(); |
---|
764 | #endif |
---|
765 | g_uiMaxCUWidth = sps->getMaxCUWidth(); |
---|
766 | g_uiMaxCUHeight = sps->getMaxCUHeight(); |
---|
767 | g_uiMaxCUDepth = sps->getMaxCUDepth(); |
---|
768 | g_uiAddCUDepth = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() ); |
---|
769 | |
---|
770 | for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++) |
---|
771 | { |
---|
772 | sps->setAMPAcc( i, sps->getUseAMP() ); |
---|
773 | } |
---|
774 | |
---|
775 | for (Int i = sps->getLog2DiffMaxMinCodingBlockSize(); i < sps->getMaxCUDepth(); i++) |
---|
776 | { |
---|
777 | sps->setAMPAcc( i, 0 ); |
---|
778 | } |
---|
779 | |
---|
780 | m_cSAO.destroy(); |
---|
781 | #if REPN_FORMAT_IN_VPS |
---|
782 | #if AUXILIARY_PICTURES |
---|
783 | m_cSAO.create( m_apcSlicePilot->getPicWidthInLumaSamples(), m_apcSlicePilot->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth() ); |
---|
784 | #else |
---|
785 | m_cSAO.create( m_apcSlicePilot->getPicWidthInLumaSamples(), m_apcSlicePilot->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth() ); |
---|
786 | #endif |
---|
787 | #else |
---|
788 | m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth() ); |
---|
789 | #endif |
---|
790 | m_cLoopFilter.create( sps->getMaxCUDepth() ); |
---|
791 | } |
---|
792 | |
---|
793 | #if SVC_EXTENSION |
---|
794 | #if POC_RESET_FLAG |
---|
795 | Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int &iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC ) |
---|
796 | #else |
---|
797 | Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC ) |
---|
798 | #endif |
---|
799 | #else |
---|
800 | Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay ) |
---|
801 | #endif |
---|
802 | { |
---|
803 | TComPic*& pcPic = m_pcPic; |
---|
804 | #if SVC_EXTENSION |
---|
805 | #if !NO_OUTPUT_OF_PRIOR_PICS |
---|
806 | #if NO_CLRAS_OUTPUT_FLAG |
---|
807 | Bool bFirstSliceInSeq; |
---|
808 | #endif |
---|
809 | #endif |
---|
810 | m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getPrefetchedVPS(0) ); |
---|
811 | #if OUTPUT_LAYER_SET_INDEX |
---|
812 | // Following check should go wherever the VPS is activated |
---|
813 | checkValueOfTargetOutputLayerSetIdx( m_apcSlicePilot->getVPS()); |
---|
814 | #endif |
---|
815 | #if RESOLUTION_BASED_DPB |
---|
816 | // Following assignment should go wherever a new VPS is activated |
---|
817 | assignSubDpbs(m_apcSlicePilot->getVPS()); |
---|
818 | #endif |
---|
819 | m_apcSlicePilot->initSlice( nalu.m_layerId ); |
---|
820 | #else //SVC_EXTENSION |
---|
821 | m_apcSlicePilot->initSlice(); |
---|
822 | #endif |
---|
823 | |
---|
824 | if (m_bFirstSliceInPicture) |
---|
825 | { |
---|
826 | m_uiSliceIdx = 0; |
---|
827 | } |
---|
828 | else |
---|
829 | { |
---|
830 | m_apcSlicePilot->copySliceInfo( pcPic->getPicSym()->getSlice(m_uiSliceIdx-1) ); |
---|
831 | } |
---|
832 | m_apcSlicePilot->setSliceIdx(m_uiSliceIdx); |
---|
833 | |
---|
834 | m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType); |
---|
835 | Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || |
---|
836 | m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || |
---|
837 | m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || |
---|
838 | m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N || |
---|
839 | m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N); |
---|
840 | m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag); |
---|
841 | |
---|
842 | m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS |
---|
843 | m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); |
---|
844 | |
---|
845 | #if SVC_EXTENSION |
---|
846 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
847 | setRefLayerParams(m_apcSlicePilot->getVPS()); |
---|
848 | #endif |
---|
849 | m_apcSlicePilot->setNumMotionPredRefLayers(m_numMotionPredRefLayers); |
---|
850 | #endif |
---|
851 | m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder); |
---|
852 | |
---|
853 | // set POC for dependent slices in skipped pictures |
---|
854 | if(m_apcSlicePilot->getDependentSliceSegmentFlag() && m_prevSliceSkipped) |
---|
855 | { |
---|
856 | m_apcSlicePilot->setPOC(m_skippedPOC); |
---|
857 | } |
---|
858 | |
---|
859 | m_apcSlicePilot->setAssociatedIRAPPOC(m_pocCRA); |
---|
860 | m_apcSlicePilot->setAssociatedIRAPType(m_associatedIRAPType); |
---|
861 | |
---|
862 | #if NO_OUTPUT_OF_PRIOR_PICS |
---|
863 | // Infer the value of NoOutputOfPriorPicsFlag |
---|
864 | if( m_apcSlicePilot->getRapPicFlag() ) |
---|
865 | { |
---|
866 | if ( m_apcSlicePilot->getBlaPicFlag() || m_apcSlicePilot->getIdrPicFlag() || |
---|
867 | (m_apcSlicePilot->getCraPicFlag() && m_bFirstSliceInSequence) || |
---|
868 | (m_apcSlicePilot->getCraPicFlag() && m_apcSlicePilot->getHandleCraAsBlaFlag())) |
---|
869 | { |
---|
870 | m_apcSlicePilot->setNoRaslOutputFlag( true ); |
---|
871 | } |
---|
872 | else |
---|
873 | { |
---|
874 | m_apcSlicePilot->setNoRaslOutputFlag( false ); |
---|
875 | } |
---|
876 | } |
---|
877 | #endif |
---|
878 | |
---|
879 | // Skip pictures due to random access |
---|
880 | if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay)) |
---|
881 | { |
---|
882 | m_prevSliceSkipped = true; |
---|
883 | m_skippedPOC = m_apcSlicePilot->getPOC(); |
---|
884 | return false; |
---|
885 | } |
---|
886 | // Skip TFD pictures associated with BLA/BLANT pictures |
---|
887 | if (isSkipPictureForBLA(iPOCLastDisplay)) |
---|
888 | { |
---|
889 | m_prevSliceSkipped = true; |
---|
890 | m_skippedPOC = m_apcSlicePilot->getPOC(); |
---|
891 | return false; |
---|
892 | } |
---|
893 | |
---|
894 | // clear previous slice skipped flag |
---|
895 | m_prevSliceSkipped = false; |
---|
896 | |
---|
897 | // exit when a new picture is found |
---|
898 | #if SVC_EXTENSION |
---|
899 | bNewPOC = (m_apcSlicePilot->getPOC()!= m_prevPOC); |
---|
900 | |
---|
901 | #if NO_OUTPUT_OF_PRIOR_PICS |
---|
902 | #if NO_CLRAS_OUTPUT_FLAG |
---|
903 | if (m_layerId == 0 && m_apcSlicePilot->getRapPicFlag() ) |
---|
904 | { |
---|
905 | if (m_bFirstSliceInSequence) |
---|
906 | { |
---|
907 | setNoClrasOutputFlag(true); |
---|
908 | } |
---|
909 | else if ( m_apcSlicePilot->getBlaPicFlag() ) |
---|
910 | { |
---|
911 | setNoClrasOutputFlag(true); |
---|
912 | } |
---|
913 | #if O0149_CROSS_LAYER_BLA_FLAG |
---|
914 | else if (m_apcSlicePilot->getIdrPicFlag() && m_apcSlicePilot->getCrossLayerBLAFlag()) |
---|
915 | { |
---|
916 | setNoClrasOutputFlag(true); |
---|
917 | } |
---|
918 | #endif |
---|
919 | else |
---|
920 | { |
---|
921 | setNoClrasOutputFlag(false); |
---|
922 | } |
---|
923 | } |
---|
924 | else |
---|
925 | { |
---|
926 | setNoClrasOutputFlag(false); |
---|
927 | } |
---|
928 | |
---|
929 | m_apcSlicePilot->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, m_cListPic, getNoClrasOutputFlag()); |
---|
930 | #endif |
---|
931 | |
---|
932 | // Derive the value of NoOutputOfPriorPicsFlag |
---|
933 | if( bNewPOC || m_layerId!=m_uiPrevLayerId ) // i.e. new coded picture |
---|
934 | { |
---|
935 | if( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_apcSlicePilot->getNoRaslOutputFlag() ) |
---|
936 | { |
---|
937 | this->setNoOutputOfPriorPicsFlags( true ); |
---|
938 | } |
---|
939 | else if( m_apcSlicePilot->getRapPicFlag() && m_apcSlicePilot->getNoRaslOutputFlag() ) |
---|
940 | { |
---|
941 | this->setNoOutputOfPriorPicsFlags( m_apcSlicePilot->getNoOutputOfPriorPicsFlag() ); |
---|
942 | } |
---|
943 | else |
---|
944 | { |
---|
945 | if( this->m_ppcTDecTop[0]->getNoClrasOutputFlag() ) |
---|
946 | { |
---|
947 | this->setNoOutputOfPriorPicsFlags( true ); |
---|
948 | } |
---|
949 | } |
---|
950 | } |
---|
951 | #endif |
---|
952 | |
---|
953 | #if ALIGNED_BUMPING |
---|
954 | if (bNewPOC || m_layerId!=m_uiPrevLayerId) |
---|
955 | { |
---|
956 | m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); |
---|
957 | } |
---|
958 | #endif |
---|
959 | if (m_apcSlicePilot->isNextSlice() && (bNewPOC || m_layerId!=m_uiPrevLayerId) && !m_bFirstSliceInSequence ) |
---|
960 | { |
---|
961 | m_prevPOC = m_apcSlicePilot->getPOC(); |
---|
962 | curLayerId = m_uiPrevLayerId; |
---|
963 | m_uiPrevLayerId = m_layerId; |
---|
964 | return true; |
---|
965 | } |
---|
966 | #else |
---|
967 | //we should only get a different poc for a new picture (with CTU address==0) |
---|
968 | if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (!m_apcSlicePilot->getSliceCurStartCUAddr()==0)) |
---|
969 | { |
---|
970 | printf ("Warning, the first slice of a picture might have been lost!\n"); |
---|
971 | } |
---|
972 | // exit when a new picture is found |
---|
973 | if (m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence ) |
---|
974 | { |
---|
975 | if (m_prevPOC >= m_pocRandomAccess) |
---|
976 | { |
---|
977 | m_prevPOC = m_apcSlicePilot->getPOC(); |
---|
978 | return true; |
---|
979 | } |
---|
980 | m_prevPOC = m_apcSlicePilot->getPOC(); |
---|
981 | } |
---|
982 | #endif |
---|
983 | // actual decoding starts here |
---|
984 | xActivateParameterSets(); |
---|
985 | #if !O0223_O0139_IRAP_ALIGN_NO_CONTRAINTS && N0147_IRAP_ALIGN_FLAG |
---|
986 | //Note setting O0223_O0139_IRAP_ALIGN_NO_CONTRAINTS to 0 may cause decoder to crash. |
---|
987 | //When cross_layer_irap_aligned_flag is equal to 0, num_extra_slice_header_bits >=1 |
---|
988 | if(!m_apcSlicePilot->getVPS()->getCrossLayerIrapAlignFlag() ) |
---|
989 | { |
---|
990 | assert( m_apcSlicePilot->getPPS()->getNumExtraSliceHeaderBits() > 0); |
---|
991 | } |
---|
992 | //When cross_layer_irap_aligned_flag is equal to 1, the value of poc_reset_flag shall be equal to 0 |
---|
993 | if( m_apcSlicePilot->getVPS()->getCrossLayerIrapAlignFlag() ) |
---|
994 | { |
---|
995 | assert( m_apcSlicePilot->getPocResetFlag() == 0); |
---|
996 | } |
---|
997 | #endif |
---|
998 | #if REPN_FORMAT_IN_VPS |
---|
999 | // Initialize ILRP if needed, only for the current layer |
---|
1000 | // ILRP intialization should go along with activation of parameters sets, |
---|
1001 | // although activation of parameter sets itself need not be done for each and every slice!!! |
---|
1002 | xInitILRP(m_apcSlicePilot); |
---|
1003 | #endif |
---|
1004 | if (m_apcSlicePilot->isNextSlice()) |
---|
1005 | { |
---|
1006 | m_prevPOC = m_apcSlicePilot->getPOC(); |
---|
1007 | #if SVC_EXTENSION |
---|
1008 | curLayerId = m_layerId; |
---|
1009 | m_uiPrevLayerId = m_layerId; |
---|
1010 | #endif |
---|
1011 | } |
---|
1012 | #if !NO_OUTPUT_OF_PRIOR_PICS |
---|
1013 | #if NO_CLRAS_OUTPUT_FLAG |
---|
1014 | bFirstSliceInSeq = m_bFirstSliceInSequence; |
---|
1015 | #endif |
---|
1016 | #endif |
---|
1017 | m_bFirstSliceInSequence = false; |
---|
1018 | #if POC_RESET_FLAG |
---|
1019 | // This operation would do the following: |
---|
1020 | // 1. Update the other picture in the DPB. This should be done only for the first slice of the picture. |
---|
1021 | // 2. Update the value of m_pocCRA. |
---|
1022 | // 3. Reset the POC values at the decoder for the current picture to be zero. |
---|
1023 | // 4. update value of POCLastDisplay |
---|
1024 | if( m_apcSlicePilot->getPocResetFlag() ) |
---|
1025 | { |
---|
1026 | if( m_apcSlicePilot->getSliceIdx() == 0 ) |
---|
1027 | { |
---|
1028 | Int pocAdjustValue = m_apcSlicePilot->getPOC(); |
---|
1029 | |
---|
1030 | #if PREVTID0_POC_RESET |
---|
1031 | m_apcSlicePilot->adjustPrevTid0POC(pocAdjustValue); |
---|
1032 | #endif |
---|
1033 | // If poc reset flag is set to 1, reset all POC for DPB -> basically do it for each slice in the picutre |
---|
1034 | TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); |
---|
1035 | |
---|
1036 | // Iterate through all picture in DPB |
---|
1037 | while( iterPic != m_cListPic.end() ) |
---|
1038 | { |
---|
1039 | TComPic *dpbPic = *iterPic; |
---|
1040 | // Check if the picture pointed to by iterPic is either used for reference or |
---|
1041 | // needed for output, are in the same layer, and not the current picture. |
---|
1042 | if( /* ( ( dpbPic->getSlice(0)->isReferenced() ) || ( dpbPic->getOutputMark() ) ) |
---|
1043 | &&*/ ( dpbPic->getLayerId() == m_apcSlicePilot->getLayerId() ) |
---|
1044 | && ( dpbPic->getReconMark() ) |
---|
1045 | ) |
---|
1046 | { |
---|
1047 | for(Int i = dpbPic->getNumAllocatedSlice()-1; i >= 0; i--) |
---|
1048 | { |
---|
1049 | |
---|
1050 | TComSlice *slice = dpbPic->getSlice(i); |
---|
1051 | TComReferencePictureSet *rps = slice->getRPS(); |
---|
1052 | slice->setPOC( slice->getPOC() - pocAdjustValue ); |
---|
1053 | |
---|
1054 | // Also adjust the POC value stored in the RPS of each such slice |
---|
1055 | for(Int j = rps->getNumberOfPictures(); j >= 0; j--) |
---|
1056 | { |
---|
1057 | rps->setPOC( j, rps->getPOC(j) - pocAdjustValue ); |
---|
1058 | } |
---|
1059 | // Also adjust the value of refPOC |
---|
1060 | for(Int k = 0; k < 2; k++) // For List 0 and List 1 |
---|
1061 | { |
---|
1062 | RefPicList list = (k == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0; |
---|
1063 | for(Int j = 0; j < slice->getNumRefIdx(list); j++) |
---|
1064 | { |
---|
1065 | slice->setRefPOC( slice->getRefPOC(list, j) - pocAdjustValue, list, j); |
---|
1066 | } |
---|
1067 | } |
---|
1068 | } |
---|
1069 | } |
---|
1070 | iterPic++; |
---|
1071 | } |
---|
1072 | // Update the value of pocCRA |
---|
1073 | m_pocCRA -= pocAdjustValue; |
---|
1074 | // Update value of POCLastDisplay |
---|
1075 | iPOCLastDisplay -= pocAdjustValue; |
---|
1076 | } |
---|
1077 | // Reset current poc for current slice and RPS |
---|
1078 | m_apcSlicePilot->setPOC( 0 ); |
---|
1079 | } |
---|
1080 | #endif |
---|
1081 | #if ALIGN_TSA_STSA_PICS |
---|
1082 | if( m_apcSlicePilot->getLayerId() > 0 ) |
---|
1083 | { |
---|
1084 | // Check for TSA alignment |
---|
1085 | if( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || |
---|
1086 | m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_R |
---|
1087 | ) |
---|
1088 | { |
---|
1089 | for(Int dependentLayerIdx = 0; dependentLayerIdx < m_apcSlicePilot->getVPS()->getNumDirectRefLayers(m_layerId); dependentLayerIdx++) |
---|
1090 | { |
---|
1091 | TComList<TComPic*> *cListPic = getRefLayerDec( dependentLayerIdx )->getListPic(); |
---|
1092 | TComPic* refpicLayer = m_apcSlicePilot->getRefPic(*cListPic, m_apcSlicePilot->getPOC() ); |
---|
1093 | if( refpicLayer ) |
---|
1094 | { |
---|
1095 | assert( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || |
---|
1096 | m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_R ); // TSA pictures should be aligned among depenedent layers |
---|
1097 | } |
---|
1098 | } |
---|
1099 | } |
---|
1100 | // Check for STSA alignment |
---|
1101 | if( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || |
---|
1102 | m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R |
---|
1103 | ) |
---|
1104 | { |
---|
1105 | for(Int dependentLayerIdx = 0; dependentLayerIdx < m_apcSlicePilot->getVPS()->getNumDirectRefLayers(m_layerId); dependentLayerIdx++) |
---|
1106 | { |
---|
1107 | TComList<TComPic*> *cListPic = getRefLayerDec( dependentLayerIdx )->getListPic(); |
---|
1108 | TComPic* refpicLayer = m_apcSlicePilot->getRefPic(*cListPic, m_apcSlicePilot->getPOC() ); // STSA pictures should be aligned among dependent layers |
---|
1109 | if( refpicLayer ) |
---|
1110 | |
---|
1111 | { |
---|
1112 | assert( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N || |
---|
1113 | m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R ); |
---|
1114 | } |
---|
1115 | } |
---|
1116 | } |
---|
1117 | } |
---|
1118 | #endif |
---|
1119 | //detect lost reference picture and insert copy of earlier frame. |
---|
1120 | Int lostPoc; |
---|
1121 | while((lostPoc=m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true, m_pocRandomAccess)) > 0) |
---|
1122 | { |
---|
1123 | xCreateLostPicture(lostPoc-1); |
---|
1124 | } |
---|
1125 | if (m_bFirstSliceInPicture) |
---|
1126 | { |
---|
1127 | #if AVC_BASE |
---|
1128 | if( m_layerId == 1 && m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getAvcBaseLayerFlag() ) |
---|
1129 | { |
---|
1130 | TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin()); |
---|
1131 | pBLPic->getSlice(0)->setReferenced(true); |
---|
1132 | fstream* pFile = m_ppcTDecTop[0]->getBLReconFile(); |
---|
1133 | UInt uiWidth = pBLPic->getPicYuvRec()->getWidth(); |
---|
1134 | UInt uiHeight = pBLPic->getPicYuvRec()->getHeight(); |
---|
1135 | |
---|
1136 | if( pFile->good() ) |
---|
1137 | { |
---|
1138 | UInt64 uiPos = (UInt64) m_apcSlicePilot->getPOC() * uiWidth * uiHeight * 3 / 2; |
---|
1139 | |
---|
1140 | pFile->seekg((UInt)uiPos, ios::beg ); |
---|
1141 | |
---|
1142 | Pel* pPel = pBLPic->getPicYuvRec()->getLumaAddr(); |
---|
1143 | UInt uiStride = pBLPic->getPicYuvRec()->getStride(); |
---|
1144 | for( Int i = 0; i < uiHeight; i++ ) |
---|
1145 | { |
---|
1146 | for( Int j = 0; j < uiWidth; j++ ) |
---|
1147 | { |
---|
1148 | pPel[j] = pFile->get(); |
---|
1149 | } |
---|
1150 | pPel += uiStride; |
---|
1151 | } |
---|
1152 | |
---|
1153 | pPel = pBLPic->getPicYuvRec()->getCbAddr(); |
---|
1154 | uiStride = pBLPic->getPicYuvRec()->getCStride(); |
---|
1155 | for( Int i = 0; i < uiHeight/2; i++ ) |
---|
1156 | { |
---|
1157 | for( Int j = 0; j < uiWidth/2; j++ ) |
---|
1158 | { |
---|
1159 | pPel[j] = pFile->get(); |
---|
1160 | } |
---|
1161 | pPel += uiStride; |
---|
1162 | } |
---|
1163 | |
---|
1164 | pPel = pBLPic->getPicYuvRec()->getCrAddr(); |
---|
1165 | uiStride = pBLPic->getPicYuvRec()->getCStride(); |
---|
1166 | for( Int i = 0; i < uiHeight/2; i++ ) |
---|
1167 | { |
---|
1168 | for( Int j = 0; j < uiWidth/2; j++ ) |
---|
1169 | { |
---|
1170 | pPel[j] = pFile->get(); |
---|
1171 | } |
---|
1172 | pPel += uiStride; |
---|
1173 | } |
---|
1174 | } |
---|
1175 | } |
---|
1176 | #endif |
---|
1177 | |
---|
1178 | #if !NO_OUTPUT_OF_PRIOR_PICS |
---|
1179 | #if NO_CLRAS_OUTPUT_FLAG |
---|
1180 | if (m_layerId == 0 && |
---|
1181 | (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
1182 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
1183 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP |
---|
1184 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL |
---|
1185 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP |
---|
1186 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)) |
---|
1187 | { |
---|
1188 | if (bFirstSliceInSeq) |
---|
1189 | { |
---|
1190 | setNoClrasOutputFlag(true); |
---|
1191 | } |
---|
1192 | else if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
1193 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
1194 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP) |
---|
1195 | { |
---|
1196 | setNoClrasOutputFlag(true); |
---|
1197 | } |
---|
1198 | #if O0149_CROSS_LAYER_BLA_FLAG |
---|
1199 | else if ((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP) && |
---|
1200 | m_apcSlicePilot->getCrossLayerBLAFlag()) |
---|
1201 | { |
---|
1202 | setNoClrasOutputFlag(true); |
---|
1203 | } |
---|
1204 | #endif |
---|
1205 | else |
---|
1206 | { |
---|
1207 | setNoClrasOutputFlag(false); |
---|
1208 | } |
---|
1209 | if (getNoClrasOutputFlag()) |
---|
1210 | { |
---|
1211 | for (UInt i = 0; i < m_apcSlicePilot->getVPS()->getMaxLayers(); i++) |
---|
1212 | { |
---|
1213 | m_ppcTDecTop[i]->setLayerInitializedFlag(false); |
---|
1214 | m_ppcTDecTop[i]->setFirstPicInLayerDecodedFlag(false); |
---|
1215 | } |
---|
1216 | } |
---|
1217 | } |
---|
1218 | #endif |
---|
1219 | |
---|
1220 | #if NO_CLRAS_OUTPUT_FLAG |
---|
1221 | m_apcSlicePilot->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, m_cListPic, getNoClrasOutputFlag()); |
---|
1222 | #endif |
---|
1223 | #else |
---|
1224 | if ( m_layerId == 0 && m_apcSlicePilot->getRapPicFlag() && getNoClrasOutputFlag() ) |
---|
1225 | { |
---|
1226 | for (UInt i = 0; i < m_apcSlicePilot->getVPS()->getMaxLayers(); i++) |
---|
1227 | { |
---|
1228 | m_ppcTDecTop[i]->setLayerInitializedFlag(false); |
---|
1229 | m_ppcTDecTop[i]->setFirstPicInLayerDecodedFlag(false); |
---|
1230 | } |
---|
1231 | } |
---|
1232 | #endif |
---|
1233 | // Buffer initialize for prediction. |
---|
1234 | m_cPrediction.initTempBuff(); |
---|
1235 | #if !ALIGNED_BUMPING |
---|
1236 | m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS()); |
---|
1237 | #else |
---|
1238 | m_apcSlicePilot->checkLeadingPictureRestrictions(m_cListPic); |
---|
1239 | #endif |
---|
1240 | // Get a new picture buffer |
---|
1241 | xGetNewPicBuffer (m_apcSlicePilot, pcPic); |
---|
1242 | |
---|
1243 | Bool isField = false; |
---|
1244 | Bool isTff = false; |
---|
1245 | |
---|
1246 | if(!m_SEIs.empty()) |
---|
1247 | { |
---|
1248 | // Check if any new Picture Timing SEI has arrived |
---|
1249 | SEIMessages pictureTimingSEIs = extractSeisByType (m_SEIs, SEI::PICTURE_TIMING); |
---|
1250 | if (pictureTimingSEIs.size()>0) |
---|
1251 | { |
---|
1252 | SEIPictureTiming* pictureTiming = (SEIPictureTiming*) *(pictureTimingSEIs.begin()); |
---|
1253 | isField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 2); |
---|
1254 | isTff = (pictureTiming->m_picStruct == 1); |
---|
1255 | } |
---|
1256 | } |
---|
1257 | |
---|
1258 | //Set Field/Frame coding mode |
---|
1259 | m_pcPic->setField(isField); |
---|
1260 | m_pcPic->setTopField(isTff); |
---|
1261 | |
---|
1262 | // transfer any SEI messages that have been received to the picture |
---|
1263 | pcPic->setSEIs(m_SEIs); |
---|
1264 | m_SEIs.clear(); |
---|
1265 | |
---|
1266 | // Recursive structure |
---|
1267 | m_cCuDecoder.create ( g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight ); |
---|
1268 | #if SVC_EXTENSION |
---|
1269 | m_cCuDecoder.init ( m_ppcTDecTop,&m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction, curLayerId ); |
---|
1270 | #else |
---|
1271 | m_cCuDecoder.init ( &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction ); |
---|
1272 | #endif |
---|
1273 | m_cTrQuant.init ( g_uiMaxCUWidth, g_uiMaxCUHeight, m_apcSlicePilot->getSPS()->getMaxTrSize()); |
---|
1274 | |
---|
1275 | m_cSliceDecoder.create(); |
---|
1276 | } |
---|
1277 | else |
---|
1278 | { |
---|
1279 | // Check if any new SEI has arrived |
---|
1280 | if(!m_SEIs.empty()) |
---|
1281 | { |
---|
1282 | // Currently only decoding Unit SEI message occurring between VCL NALUs copied |
---|
1283 | SEIMessages &picSEI = pcPic->getSEIs(); |
---|
1284 | SEIMessages decodingUnitInfos = extractSeisByType (m_SEIs, SEI::DECODING_UNIT_INFO); |
---|
1285 | picSEI.insert(picSEI.end(), decodingUnitInfos.begin(), decodingUnitInfos.end()); |
---|
1286 | deleteSEIs(m_SEIs); |
---|
1287 | } |
---|
1288 | } |
---|
1289 | |
---|
1290 | // Set picture slice pointer |
---|
1291 | TComSlice* pcSlice = m_apcSlicePilot; |
---|
1292 | Bool bNextSlice = pcSlice->isNextSlice(); |
---|
1293 | |
---|
1294 | UInt uiCummulativeTileWidth; |
---|
1295 | UInt uiCummulativeTileHeight; |
---|
1296 | UInt i, j, p; |
---|
1297 | |
---|
1298 | //set NumColumnsMins1 and NumRowsMinus1 |
---|
1299 | pcPic->getPicSym()->setNumColumnsMinus1( pcSlice->getPPS()->getNumColumnsMinus1() ); |
---|
1300 | pcPic->getPicSym()->setNumRowsMinus1( pcSlice->getPPS()->getNumRowsMinus1() ); |
---|
1301 | |
---|
1302 | //create the TComTileArray |
---|
1303 | pcPic->getPicSym()->xCreateTComTileArray(); |
---|
1304 | |
---|
1305 | if( pcSlice->getPPS()->getUniformSpacingFlag() ) |
---|
1306 | { |
---|
1307 | //set the width for each tile |
---|
1308 | for(j=0; j < pcPic->getPicSym()->getNumRowsMinus1()+1; j++) |
---|
1309 | { |
---|
1310 | for(p=0; p < pcPic->getPicSym()->getNumColumnsMinus1()+1; p++) |
---|
1311 | { |
---|
1312 | pcPic->getPicSym()->getTComTile( j * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + p )-> |
---|
1313 | setTileWidth( (p+1)*pcPic->getPicSym()->getFrameWidthInCU()/(pcPic->getPicSym()->getNumColumnsMinus1()+1) |
---|
1314 | - (p*pcPic->getPicSym()->getFrameWidthInCU())/(pcPic->getPicSym()->getNumColumnsMinus1()+1) ); |
---|
1315 | } |
---|
1316 | } |
---|
1317 | |
---|
1318 | //set the height for each tile |
---|
1319 | for(j=0; j < pcPic->getPicSym()->getNumColumnsMinus1()+1; j++) |
---|
1320 | { |
---|
1321 | for(p=0; p < pcPic->getPicSym()->getNumRowsMinus1()+1; p++) |
---|
1322 | { |
---|
1323 | pcPic->getPicSym()->getTComTile( p * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + j )-> |
---|
1324 | setTileHeight( (p+1)*pcPic->getPicSym()->getFrameHeightInCU()/(pcPic->getPicSym()->getNumRowsMinus1()+1) |
---|
1325 | - (p*pcPic->getPicSym()->getFrameHeightInCU())/(pcPic->getPicSym()->getNumRowsMinus1()+1) ); |
---|
1326 | } |
---|
1327 | } |
---|
1328 | } |
---|
1329 | else |
---|
1330 | { |
---|
1331 | //set the width for each tile |
---|
1332 | for(j=0; j < pcSlice->getPPS()->getNumRowsMinus1()+1; j++) |
---|
1333 | { |
---|
1334 | uiCummulativeTileWidth = 0; |
---|
1335 | for(i=0; i < pcSlice->getPPS()->getNumColumnsMinus1(); i++) |
---|
1336 | { |
---|
1337 | pcPic->getPicSym()->getTComTile(j * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + i)->setTileWidth( pcSlice->getPPS()->getColumnWidth(i) ); |
---|
1338 | uiCummulativeTileWidth += pcSlice->getPPS()->getColumnWidth(i); |
---|
1339 | } |
---|
1340 | pcPic->getPicSym()->getTComTile(j * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + i)->setTileWidth( pcPic->getPicSym()->getFrameWidthInCU()-uiCummulativeTileWidth ); |
---|
1341 | } |
---|
1342 | |
---|
1343 | //set the height for each tile |
---|
1344 | for(j=0; j < pcSlice->getPPS()->getNumColumnsMinus1()+1; j++) |
---|
1345 | { |
---|
1346 | uiCummulativeTileHeight = 0; |
---|
1347 | for(i=0; i < pcSlice->getPPS()->getNumRowsMinus1(); i++) |
---|
1348 | { |
---|
1349 | pcPic->getPicSym()->getTComTile(i * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + j)->setTileHeight( pcSlice->getPPS()->getRowHeight(i) ); |
---|
1350 | uiCummulativeTileHeight += pcSlice->getPPS()->getRowHeight(i); |
---|
1351 | } |
---|
1352 | pcPic->getPicSym()->getTComTile(i * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + j)->setTileHeight( pcPic->getPicSym()->getFrameHeightInCU()-uiCummulativeTileHeight ); |
---|
1353 | } |
---|
1354 | } |
---|
1355 | |
---|
1356 | pcPic->getPicSym()->xInitTiles(); |
---|
1357 | |
---|
1358 | //generate the Coding Order Map and Inverse Coding Order Map |
---|
1359 | UInt uiEncCUAddr; |
---|
1360 | for(i=0, uiEncCUAddr=0; i<pcPic->getPicSym()->getNumberOfCUsInFrame(); i++, uiEncCUAddr = pcPic->getPicSym()->xCalculateNxtCUAddr(uiEncCUAddr)) |
---|
1361 | { |
---|
1362 | pcPic->getPicSym()->setCUOrderMap(i, uiEncCUAddr); |
---|
1363 | pcPic->getPicSym()->setInverseCUOrderMap(uiEncCUAddr, i); |
---|
1364 | } |
---|
1365 | pcPic->getPicSym()->setCUOrderMap(pcPic->getPicSym()->getNumberOfCUsInFrame(), pcPic->getPicSym()->getNumberOfCUsInFrame()); |
---|
1366 | pcPic->getPicSym()->setInverseCUOrderMap(pcPic->getPicSym()->getNumberOfCUsInFrame(), pcPic->getPicSym()->getNumberOfCUsInFrame()); |
---|
1367 | |
---|
1368 | //convert the start and end CU addresses of the slice and dependent slice into encoding order |
---|
1369 | pcSlice->setSliceSegmentCurStartCUAddr( pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceSegmentCurStartCUAddr()) ); |
---|
1370 | pcSlice->setSliceSegmentCurEndCUAddr( pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceSegmentCurEndCUAddr()) ); |
---|
1371 | if(pcSlice->isNextSlice()) |
---|
1372 | { |
---|
1373 | pcSlice->setSliceCurStartCUAddr(pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceCurStartCUAddr())); |
---|
1374 | pcSlice->setSliceCurEndCUAddr(pcPic->getPicSym()->getPicSCUEncOrder(pcSlice->getSliceCurEndCUAddr())); |
---|
1375 | } |
---|
1376 | |
---|
1377 | if (m_bFirstSliceInPicture) |
---|
1378 | { |
---|
1379 | if(pcPic->getNumAllocatedSlice() != 1) |
---|
1380 | { |
---|
1381 | pcPic->clearSliceBuffer(); |
---|
1382 | } |
---|
1383 | } |
---|
1384 | else |
---|
1385 | { |
---|
1386 | pcPic->allocateNewSlice(); |
---|
1387 | } |
---|
1388 | assert(pcPic->getNumAllocatedSlice() == (m_uiSliceIdx + 1)); |
---|
1389 | m_apcSlicePilot = pcPic->getPicSym()->getSlice(m_uiSliceIdx); |
---|
1390 | pcPic->getPicSym()->setSlice(pcSlice, m_uiSliceIdx); |
---|
1391 | |
---|
1392 | pcPic->setTLayer(nalu.m_temporalId); |
---|
1393 | |
---|
1394 | #if SVC_EXTENSION |
---|
1395 | pcPic->setLayerId(nalu.m_layerId); |
---|
1396 | pcSlice->setLayerId(nalu.m_layerId); |
---|
1397 | pcSlice->setPic(pcPic); |
---|
1398 | #endif |
---|
1399 | |
---|
1400 | if (bNextSlice) |
---|
1401 | { |
---|
1402 | pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_associatedIRAPType, m_cListPic ); |
---|
1403 | // Set reference list |
---|
1404 | #if SVC_EXTENSION |
---|
1405 | if (m_layerId == 0) |
---|
1406 | #endif |
---|
1407 | pcSlice->setRefPicList( m_cListPic, true ); |
---|
1408 | |
---|
1409 | #if SVC_EXTENSION |
---|
1410 | // Create upsampling reference layer pictures for all possible dependent layers and do it only once for the first slice. |
---|
1411 | // Other slices might choose which reference pictures to be used for inter-layer prediction |
---|
1412 | if( m_layerId > 0 && m_uiSliceIdx == 0 ) |
---|
1413 | { |
---|
1414 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
1415 | if( !pcSlice->getVPS()->getSingleLayerForNonIrapFlag() || ( pcSlice->getVPS()->getSingleLayerForNonIrapFlag() && pcSlice->isIRAP() ) ) |
---|
1416 | #endif |
---|
1417 | for( i = 0; i < pcSlice->getNumILRRefIdx(); i++ ) |
---|
1418 | { |
---|
1419 | UInt refLayerIdc = i; |
---|
1420 | #if AVC_BASE |
---|
1421 | if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder.getActiveVPS()->getAvcBaseLayerFlag() ) |
---|
1422 | { |
---|
1423 | TComPic* pic = *m_ppcTDecTop[0]->getListPic()->begin(); |
---|
1424 | |
---|
1425 | if( pic ) |
---|
1426 | { |
---|
1427 | pcSlice->setBaseColPic ( refLayerIdc, pic ); |
---|
1428 | } |
---|
1429 | else |
---|
1430 | { |
---|
1431 | continue; |
---|
1432 | } |
---|
1433 | #if AVC_SYNTAX |
---|
1434 | TComPic* pBLPic = pcSlice->getBaseColPic(refLayerIdc); |
---|
1435 | if( pcSlice->getPOC() == 0 ) |
---|
1436 | { |
---|
1437 | // initialize partition order. |
---|
1438 | UInt* piTmp = &g_auiZscanToRaster[0]; |
---|
1439 | initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp ); |
---|
1440 | initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 ); |
---|
1441 | } |
---|
1442 | pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice ); |
---|
1443 | pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES ); |
---|
1444 | #endif |
---|
1445 | } |
---|
1446 | else |
---|
1447 | { |
---|
1448 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
1449 | TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( refLayerIdc ); |
---|
1450 | #else |
---|
1451 | TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 ); |
---|
1452 | #endif |
---|
1453 | TComList<TComPic*> *cListPic = pcTDecTop->getListPic(); |
---|
1454 | if( !pcSlice->setBaseColPic ( *cListPic, refLayerIdc ) ) |
---|
1455 | { |
---|
1456 | continue; |
---|
1457 | } |
---|
1458 | } |
---|
1459 | #else |
---|
1460 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
1461 | TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( refLayerIdc ); |
---|
1462 | #else |
---|
1463 | TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 ); |
---|
1464 | #endif |
---|
1465 | TComList<TComPic*> *cListPic = pcTDecTop->getListPic(); |
---|
1466 | pcSlice->setBaseColPic ( *cListPic, refLayerIdc ); |
---|
1467 | #endif |
---|
1468 | |
---|
1469 | #if O0098_SCALED_REF_LAYER_ID |
---|
1470 | const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc)); |
---|
1471 | #else |
---|
1472 | const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc); |
---|
1473 | #endif |
---|
1474 | |
---|
1475 | Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth(); |
---|
1476 | Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight(); |
---|
1477 | |
---|
1478 | Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); |
---|
1479 | Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); |
---|
1480 | |
---|
1481 | g_mvScalingFactor[refLayerIdc][0] = widthEL == widthBL ? 4096 : Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL); |
---|
1482 | g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL); |
---|
1483 | |
---|
1484 | g_posScalingFactor[refLayerIdc][0] = ((widthBL << 16) + (widthEL >> 1)) / widthEL; |
---|
1485 | g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL; |
---|
1486 | |
---|
1487 | #if SVC_UPSAMPLING |
---|
1488 | if( pcPic->isSpatialEnhLayer(refLayerIdc) ) |
---|
1489 | { |
---|
1490 | /*#if O0098_SCALED_REF_LAYER_ID |
---|
1491 | Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc)); |
---|
1492 | #else |
---|
1493 | Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc); |
---|
1494 | #endif*/ |
---|
1495 | #if O0215_PHASE_ALIGNMENT |
---|
1496 | #if O0194_JOINT_US_BITSHIFT |
---|
1497 | m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); |
---|
1498 | #else |
---|
1499 | m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); |
---|
1500 | #endif |
---|
1501 | #else |
---|
1502 | #if O0194_JOINT_US_BITSHIFT |
---|
1503 | m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL ); |
---|
1504 | #else |
---|
1505 | m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL ); |
---|
1506 | #endif |
---|
1507 | #endif |
---|
1508 | } |
---|
1509 | else |
---|
1510 | { |
---|
1511 | pcPic->setFullPelBaseRec( refLayerIdc, pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec() ); |
---|
1512 | } |
---|
1513 | pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) ); |
---|
1514 | #endif |
---|
1515 | } |
---|
1516 | } |
---|
1517 | |
---|
1518 | if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() ) |
---|
1519 | { |
---|
1520 | for( i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) |
---|
1521 | { |
---|
1522 | UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i); |
---|
1523 | #if AVC_BASE |
---|
1524 | if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder.getActiveVPS()->getAvcBaseLayerFlag() ) |
---|
1525 | { |
---|
1526 | pcSlice->setBaseColPic ( refLayerIdc, *m_ppcTDecTop[0]->getListPic()->begin() ); |
---|
1527 | #if AVC_SYNTAX |
---|
1528 | TComPic* pBLPic = pcSlice->getBaseColPic(refLayerIdc); |
---|
1529 | if( pcSlice->getPOC() == 0 ) |
---|
1530 | { |
---|
1531 | // initialize partition order. |
---|
1532 | UInt* piTmp = &g_auiZscanToRaster[0]; |
---|
1533 | initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp ); |
---|
1534 | initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 ); |
---|
1535 | } |
---|
1536 | pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice ); |
---|
1537 | pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES ); |
---|
1538 | #endif |
---|
1539 | } |
---|
1540 | else |
---|
1541 | { |
---|
1542 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
1543 | TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( refLayerIdc ); |
---|
1544 | #else |
---|
1545 | TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 ); |
---|
1546 | #endif |
---|
1547 | TComList<TComPic*> *cListPic = pcTDecTop->getListPic(); |
---|
1548 | pcSlice->setBaseColPic ( *cListPic, refLayerIdc ); |
---|
1549 | } |
---|
1550 | #else |
---|
1551 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
1552 | TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( refLayerIdc ); |
---|
1553 | #else |
---|
1554 | TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 ); |
---|
1555 | #endif |
---|
1556 | TComList<TComPic*> *cListPic = pcTDecTop->getListPic(); |
---|
1557 | pcSlice->setBaseColPic ( *cListPic, refLayerIdc ); |
---|
1558 | #endif |
---|
1559 | |
---|
1560 | pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) ); |
---|
1561 | } |
---|
1562 | |
---|
1563 | pcSlice->setILRPic( m_cIlpPic ); |
---|
1564 | |
---|
1565 | #if REF_IDX_MFM |
---|
1566 | if( pcSlice->getMFMEnabledFlag() ) |
---|
1567 | { |
---|
1568 | pcSlice->setRefPOCListILP(m_ppcTDecTop[m_layerId]->m_cIlpPic, pcSlice->getBaseColPic()); |
---|
1569 | } |
---|
1570 | pcSlice->setRefPicList( m_cListPic, false, m_cIlpPic); |
---|
1571 | } |
---|
1572 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
1573 | else if ( m_layerId > 0 ) |
---|
1574 | { |
---|
1575 | pcSlice->setRefPicList( m_cListPic, false, NULL); |
---|
1576 | } |
---|
1577 | #endif |
---|
1578 | #if MFM_ENCCONSTRAINT |
---|
1579 | if( pcSlice->getMFMEnabledFlag() ) |
---|
1580 | { |
---|
1581 | Int refLayerId = pcSlice->getRefPic( pcSlice->getSliceType() == B_SLICE ? ( RefPicList )( 1 - pcSlice->getColFromL0Flag() ) : REF_PIC_LIST_0 , pcSlice->getColRefIdx() )->getLayerId(); |
---|
1582 | if( refLayerId != pcSlice->getLayerId() ) |
---|
1583 | { |
---|
1584 | TComPic* pColBasePic = pcSlice->getBaseColPic( *m_ppcTDecTop[refLayerId]->getListPic() ); |
---|
1585 | assert( pColBasePic->checkSameRefInfo() == true ); |
---|
1586 | } |
---|
1587 | } |
---|
1588 | #endif |
---|
1589 | #endif |
---|
1590 | |
---|
1591 | #if N0147_IRAP_ALIGN_FLAG |
---|
1592 | if( m_layerId > 0 && pcSlice->getVPS()->getCrossLayerIrapAlignFlag() ) |
---|
1593 | { |
---|
1594 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
1595 | if( !pcSlice->getVPS()->getSingleLayerForNonIrapFlag() || ( pcSlice->getVPS()->getSingleLayerForNonIrapFlag() && pcSlice->isIRAP() ) ) |
---|
1596 | #endif |
---|
1597 | for(Int dependentLayerIdx = 0; dependentLayerIdx < pcSlice->getVPS()->getNumDirectRefLayers(m_layerId); dependentLayerIdx++) |
---|
1598 | { |
---|
1599 | TComList<TComPic*> *cListPic = getRefLayerDec( dependentLayerIdx )->getListPic(); |
---|
1600 | TComPic* refpicLayer = pcSlice->getRefPic(*cListPic, pcSlice->getPOC() ); |
---|
1601 | if(refpicLayer && pcSlice->isIRAP()) |
---|
1602 | { |
---|
1603 | assert(pcSlice->getNalUnitType() == refpicLayer->getSlice(0)->getNalUnitType()); |
---|
1604 | } |
---|
1605 | } |
---|
1606 | } |
---|
1607 | #endif |
---|
1608 | #endif //SVC_EXTENSION |
---|
1609 | |
---|
1610 | // For generalized B |
---|
1611 | // note: maybe not existed case (always L0 is copied to L1 if L1 is empty) |
---|
1612 | if (pcSlice->isInterB() && pcSlice->getNumRefIdx(REF_PIC_LIST_1) == 0) |
---|
1613 | { |
---|
1614 | Int iNumRefIdx = pcSlice->getNumRefIdx(REF_PIC_LIST_0); |
---|
1615 | pcSlice->setNumRefIdx ( REF_PIC_LIST_1, iNumRefIdx ); |
---|
1616 | |
---|
1617 | for (Int iRefIdx = 0; iRefIdx < iNumRefIdx; iRefIdx++) |
---|
1618 | { |
---|
1619 | pcSlice->setRefPic(pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx), REF_PIC_LIST_1, iRefIdx); |
---|
1620 | } |
---|
1621 | } |
---|
1622 | if (!pcSlice->isIntra()) |
---|
1623 | { |
---|
1624 | Bool bLowDelay = true; |
---|
1625 | Int iCurrPOC = pcSlice->getPOC(); |
---|
1626 | Int iRefIdx = 0; |
---|
1627 | |
---|
1628 | for (iRefIdx = 0; iRefIdx < pcSlice->getNumRefIdx(REF_PIC_LIST_0) && bLowDelay; iRefIdx++) |
---|
1629 | { |
---|
1630 | if ( pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx)->getPOC() > iCurrPOC ) |
---|
1631 | { |
---|
1632 | bLowDelay = false; |
---|
1633 | } |
---|
1634 | } |
---|
1635 | if (pcSlice->isInterB()) |
---|
1636 | { |
---|
1637 | for (iRefIdx = 0; iRefIdx < pcSlice->getNumRefIdx(REF_PIC_LIST_1) && bLowDelay; iRefIdx++) |
---|
1638 | { |
---|
1639 | if ( pcSlice->getRefPic(REF_PIC_LIST_1, iRefIdx)->getPOC() > iCurrPOC ) |
---|
1640 | { |
---|
1641 | bLowDelay = false; |
---|
1642 | } |
---|
1643 | } |
---|
1644 | } |
---|
1645 | |
---|
1646 | pcSlice->setCheckLDC(bLowDelay); |
---|
1647 | } |
---|
1648 | |
---|
1649 | //--------------- |
---|
1650 | pcSlice->setRefPOCList(); |
---|
1651 | } |
---|
1652 | |
---|
1653 | pcPic->setCurrSliceIdx(m_uiSliceIdx); |
---|
1654 | if(pcSlice->getSPS()->getScalingListFlag()) |
---|
1655 | { |
---|
1656 | pcSlice->setScalingList ( pcSlice->getSPS()->getScalingList() ); |
---|
1657 | if(pcSlice->getPPS()->getScalingListPresentFlag()) |
---|
1658 | { |
---|
1659 | pcSlice->setScalingList ( pcSlice->getPPS()->getScalingList() ); |
---|
1660 | } |
---|
1661 | #if SCALINGLIST_INFERRING |
---|
1662 | if( m_layerId == 0 || ( m_layerId > 0 && !pcSlice->getPPS()->getInferScalingListFlag() && !pcSlice->getSPS()->getInferScalingListFlag() ) ) |
---|
1663 | #endif |
---|
1664 | if(!pcSlice->getPPS()->getScalingListPresentFlag() && !pcSlice->getSPS()->getScalingListPresentFlag()) |
---|
1665 | { |
---|
1666 | pcSlice->setDefaultScalingList(); |
---|
1667 | } |
---|
1668 | m_cTrQuant.setScalingListDec(pcSlice->getScalingList()); |
---|
1669 | m_cTrQuant.setUseScalingList(true); |
---|
1670 | } |
---|
1671 | else |
---|
1672 | { |
---|
1673 | m_cTrQuant.setFlatScalingList(); |
---|
1674 | m_cTrQuant.setUseScalingList(false); |
---|
1675 | } |
---|
1676 | |
---|
1677 | // Decode a picture |
---|
1678 | m_cGopDecoder.decompressSlice(nalu.m_Bitstream, pcPic); |
---|
1679 | |
---|
1680 | m_bFirstSliceInPicture = false; |
---|
1681 | m_uiSliceIdx++; |
---|
1682 | |
---|
1683 | return false; |
---|
1684 | } |
---|
1685 | |
---|
1686 | Void TDecTop::xDecodeVPS() |
---|
1687 | { |
---|
1688 | TComVPS* vps = new TComVPS(); |
---|
1689 | |
---|
1690 | m_cEntropyDecoder.decodeVPS( vps ); |
---|
1691 | m_parameterSetManagerDecoder.storePrefetchedVPS(vps); |
---|
1692 | } |
---|
1693 | |
---|
1694 | Void TDecTop::xDecodeSPS() |
---|
1695 | { |
---|
1696 | TComSPS* sps = new TComSPS(); |
---|
1697 | #if SVC_EXTENSION |
---|
1698 | sps->setLayerId(m_layerId); |
---|
1699 | m_cEntropyDecoder.decodeSPS( sps, &m_parameterSetManagerDecoder ); |
---|
1700 | m_parameterSetManagerDecoder.storePrefetchedSPS(sps); |
---|
1701 | #if !REPN_FORMAT_IN_VPS // ILRP can only be initialized at activation |
---|
1702 | if(m_numLayer>0) |
---|
1703 | { |
---|
1704 | xInitILRP(sps); |
---|
1705 | } |
---|
1706 | #endif |
---|
1707 | #else //SVC_EXTENSION |
---|
1708 | m_cEntropyDecoder.decodeSPS( sps ); |
---|
1709 | m_parameterSetManagerDecoder.storePrefetchedSPS(sps); |
---|
1710 | #endif //SVC_EXTENSION |
---|
1711 | } |
---|
1712 | |
---|
1713 | Void TDecTop::xDecodePPS() |
---|
1714 | { |
---|
1715 | TComPPS* pps = new TComPPS(); |
---|
1716 | |
---|
1717 | #if SCALINGLIST_INFERRING |
---|
1718 | pps->setLayerId( m_layerId ); |
---|
1719 | #endif |
---|
1720 | |
---|
1721 | m_cEntropyDecoder.decodePPS( pps ); |
---|
1722 | m_parameterSetManagerDecoder.storePrefetchedPPS( pps ); |
---|
1723 | |
---|
1724 | if( pps->getDependentSliceSegmentsEnabledFlag() ) |
---|
1725 | { |
---|
1726 | Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1; |
---|
1727 | m_cSliceDecoder.initCtxMem(NumCtx); |
---|
1728 | for ( UInt st = 0; st < NumCtx; st++ ) |
---|
1729 | { |
---|
1730 | TDecSbac* ctx = NULL; |
---|
1731 | ctx = new TDecSbac; |
---|
1732 | ctx->init( &m_cBinCABAC ); |
---|
1733 | m_cSliceDecoder.setCtxMem( ctx, st ); |
---|
1734 | } |
---|
1735 | } |
---|
1736 | } |
---|
1737 | |
---|
1738 | Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ) |
---|
1739 | { |
---|
1740 | #if SVC_EXTENSION |
---|
1741 | if(nalUnitType == NAL_UNIT_SUFFIX_SEI) |
---|
1742 | { |
---|
1743 | #if RANDOM_ACCESS_SEI_FIX |
---|
1744 | if (m_prevSliceSkipped) // No need to decode SEI messages of a skipped access unit |
---|
1745 | { |
---|
1746 | return; |
---|
1747 | } |
---|
1748 | #endif |
---|
1749 | #if LAYERS_NOT_PRESENT_SEI |
---|
1750 | m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() ); |
---|
1751 | #else |
---|
1752 | m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); |
---|
1753 | #endif |
---|
1754 | } |
---|
1755 | else |
---|
1756 | { |
---|
1757 | #if LAYERS_NOT_PRESENT_SEI |
---|
1758 | m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() ); |
---|
1759 | #else |
---|
1760 | m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); |
---|
1761 | #endif |
---|
1762 | SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS); |
---|
1763 | if (activeParamSets.size()>0) |
---|
1764 | { |
---|
1765 | SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin()); |
---|
1766 | m_parameterSetManagerDecoder.applyPrefetchedPS(); |
---|
1767 | assert(seiAps->activeSeqParamSetId.size()>0); |
---|
1768 | if( !m_parameterSetManagerDecoder.activateSPSWithSEI( seiAps->activeSeqParamSetId[0] ) ) |
---|
1769 | { |
---|
1770 | printf ("Warning SPS activation with Active parameter set SEI failed"); |
---|
1771 | } |
---|
1772 | } |
---|
1773 | } |
---|
1774 | #else |
---|
1775 | if(nalUnitType == NAL_UNIT_SUFFIX_SEI) |
---|
1776 | { |
---|
1777 | #if LAYERS_NOT_PRESENT_SEI |
---|
1778 | m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() ); |
---|
1779 | #else |
---|
1780 | m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); |
---|
1781 | #endif |
---|
1782 | } |
---|
1783 | else |
---|
1784 | { |
---|
1785 | #if LAYERS_NOT_PRESENT_SEI |
---|
1786 | m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() ); |
---|
1787 | #else |
---|
1788 | m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); |
---|
1789 | #endif |
---|
1790 | SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS); |
---|
1791 | if (activeParamSets.size()>0) |
---|
1792 | { |
---|
1793 | SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin()); |
---|
1794 | m_parameterSetManagerDecoder.applyPrefetchedPS(); |
---|
1795 | assert(seiAps->activeSeqParamSetId.size()>0); |
---|
1796 | if (! m_parameterSetManagerDecoder.activateSPSWithSEI(seiAps->activeSeqParamSetId[0] )) |
---|
1797 | { |
---|
1798 | printf ("Warning SPS activation with Active parameter set SEI failed"); |
---|
1799 | } |
---|
1800 | } |
---|
1801 | } |
---|
1802 | #endif |
---|
1803 | } |
---|
1804 | |
---|
1805 | #if SVC_EXTENSION |
---|
1806 | Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC) |
---|
1807 | #else |
---|
1808 | Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay) |
---|
1809 | #endif |
---|
1810 | { |
---|
1811 | // Initialize entropy decoder |
---|
1812 | m_cEntropyDecoder.setEntropyDecoder (&m_cCavlcDecoder); |
---|
1813 | m_cEntropyDecoder.setBitstream (nalu.m_Bitstream); |
---|
1814 | |
---|
1815 | #if O0137_MAX_LAYERID |
---|
1816 | // ignore any NAL units with nuh_layer_id == 63 |
---|
1817 | if (nalu.m_layerId == 63 ) |
---|
1818 | { |
---|
1819 | return false; |
---|
1820 | } |
---|
1821 | #endif |
---|
1822 | switch (nalu.m_nalUnitType) |
---|
1823 | { |
---|
1824 | case NAL_UNIT_VPS: |
---|
1825 | #if VPS_NUH_LAYER_ID |
---|
1826 | assert( nalu.m_layerId == 0 ); // Non-conforming bitstream. The value of nuh_layer_id of VPS NAL unit shall be equal to 0. |
---|
1827 | #endif |
---|
1828 | xDecodeVPS(); |
---|
1829 | #if AVC_BASE |
---|
1830 | if( m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getAvcBaseLayerFlag() ) |
---|
1831 | { |
---|
1832 | if( !m_ppcTDecTop[0]->getBLReconFile()->good() ) |
---|
1833 | { |
---|
1834 | printf( "Base layer YUV input reading error\n" ); |
---|
1835 | exit(EXIT_FAILURE); |
---|
1836 | } |
---|
1837 | #if AVC_SYNTAX |
---|
1838 | if( !m_ppcTDecTop[0]->getBLSyntaxFile()->good() ) |
---|
1839 | { |
---|
1840 | printf( "Base layer syntax input reading error\n" ); |
---|
1841 | exit(EXIT_FAILURE); |
---|
1842 | } |
---|
1843 | #endif |
---|
1844 | } |
---|
1845 | else |
---|
1846 | { |
---|
1847 | TComList<TComPic*> *cListPic = m_ppcTDecTop[0]->getListPic(); |
---|
1848 | cListPic->clear(); |
---|
1849 | } |
---|
1850 | #endif |
---|
1851 | return false; |
---|
1852 | |
---|
1853 | case NAL_UNIT_SPS: |
---|
1854 | xDecodeSPS(); |
---|
1855 | #if AVC_BASE |
---|
1856 | if( m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getAvcBaseLayerFlag() ) |
---|
1857 | { |
---|
1858 | TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin()); |
---|
1859 | if( nalu.m_layerId == 1 && pBLPic->getPicYuvRec() == NULL ) |
---|
1860 | { |
---|
1861 | // using EL SPS with spsId = 1 |
---|
1862 | TComSPS* sps = m_parameterSetManagerDecoder.getPrefetchedSPS(1); |
---|
1863 | Int numReorderPics[MAX_TLAYER]; |
---|
1864 | Window &conformanceWindow = sps->getConformanceWindow(); |
---|
1865 | Window defaultDisplayWindow = sps->getVuiParametersPresentFlag() ? sps->getVuiParameters()->getDefaultDisplayWindow() : Window(); |
---|
1866 | #if AUXILIARY_PICTURES |
---|
1867 | #if SVC_UPSAMPLING |
---|
1868 | #if AVC_SYNTAX |
---|
1869 | pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, sps, true); |
---|
1870 | #else |
---|
1871 | pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true); |
---|
1872 | #endif |
---|
1873 | #else |
---|
1874 | pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), onformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
1875 | #endif |
---|
1876 | #else |
---|
1877 | #if SVC_UPSAMPLING |
---|
1878 | #if AVC_SYNTAX |
---|
1879 | pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, sps, true); |
---|
1880 | #else |
---|
1881 | pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true); |
---|
1882 | #endif |
---|
1883 | #else |
---|
1884 | pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), onformanceWindow, defaultDisplayWindow, numReorderPics, true); |
---|
1885 | #endif |
---|
1886 | #endif |
---|
1887 | |
---|
1888 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
1889 | // set AVC BL bit depth, can be an input parameter from the command line |
---|
1890 | g_bitDepthYLayer[0] = 8; |
---|
1891 | g_bitDepthCLayer[0] = 8; |
---|
1892 | #endif |
---|
1893 | } |
---|
1894 | } |
---|
1895 | #endif |
---|
1896 | return false; |
---|
1897 | |
---|
1898 | case NAL_UNIT_PPS: |
---|
1899 | xDecodePPS(); |
---|
1900 | return false; |
---|
1901 | |
---|
1902 | case NAL_UNIT_PREFIX_SEI: |
---|
1903 | case NAL_UNIT_SUFFIX_SEI: |
---|
1904 | xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType ); |
---|
1905 | return false; |
---|
1906 | |
---|
1907 | case NAL_UNIT_CODED_SLICE_TRAIL_R: |
---|
1908 | case NAL_UNIT_CODED_SLICE_TRAIL_N: |
---|
1909 | case NAL_UNIT_CODED_SLICE_TSA_R: |
---|
1910 | case NAL_UNIT_CODED_SLICE_TSA_N: |
---|
1911 | case NAL_UNIT_CODED_SLICE_STSA_R: |
---|
1912 | case NAL_UNIT_CODED_SLICE_STSA_N: |
---|
1913 | case NAL_UNIT_CODED_SLICE_BLA_W_LP: |
---|
1914 | case NAL_UNIT_CODED_SLICE_BLA_W_RADL: |
---|
1915 | case NAL_UNIT_CODED_SLICE_BLA_N_LP: |
---|
1916 | case NAL_UNIT_CODED_SLICE_IDR_W_RADL: |
---|
1917 | case NAL_UNIT_CODED_SLICE_IDR_N_LP: |
---|
1918 | case NAL_UNIT_CODED_SLICE_CRA: |
---|
1919 | case NAL_UNIT_CODED_SLICE_RADL_N: |
---|
1920 | case NAL_UNIT_CODED_SLICE_RADL_R: |
---|
1921 | case NAL_UNIT_CODED_SLICE_RASL_N: |
---|
1922 | case NAL_UNIT_CODED_SLICE_RASL_R: |
---|
1923 | #if SVC_EXTENSION |
---|
1924 | return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, curLayerId, bNewPOC); |
---|
1925 | #else |
---|
1926 | return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay); |
---|
1927 | #endif |
---|
1928 | break; |
---|
1929 | |
---|
1930 | case NAL_UNIT_EOS: |
---|
1931 | m_associatedIRAPType = NAL_UNIT_INVALID; |
---|
1932 | m_pocCRA = 0; |
---|
1933 | m_pocRandomAccess = MAX_INT; |
---|
1934 | m_prevPOC = MAX_INT; |
---|
1935 | m_bFirstSliceInPicture = true; |
---|
1936 | m_bFirstSliceInSequence = true; |
---|
1937 | m_prevSliceSkipped = false; |
---|
1938 | m_skippedPOC = 0; |
---|
1939 | return false; |
---|
1940 | |
---|
1941 | case NAL_UNIT_ACCESS_UNIT_DELIMITER: |
---|
1942 | // TODO: process AU delimiter |
---|
1943 | return false; |
---|
1944 | |
---|
1945 | case NAL_UNIT_EOB: |
---|
1946 | #if P0130_EOB |
---|
1947 | //Check layer id of the nalu. if it is not 0, give a warning message. |
---|
1948 | if (nalu.m_layerId > 0) |
---|
1949 | { |
---|
1950 | printf( "\n\nThis bitstream is ended with EOB NALU that has layer id greater than 0\n" ); |
---|
1951 | } |
---|
1952 | #endif |
---|
1953 | return false; |
---|
1954 | |
---|
1955 | |
---|
1956 | case NAL_UNIT_RESERVED_VCL_N10: |
---|
1957 | case NAL_UNIT_RESERVED_VCL_R11: |
---|
1958 | case NAL_UNIT_RESERVED_VCL_N12: |
---|
1959 | case NAL_UNIT_RESERVED_VCL_R13: |
---|
1960 | case NAL_UNIT_RESERVED_VCL_N14: |
---|
1961 | case NAL_UNIT_RESERVED_VCL_R15: |
---|
1962 | |
---|
1963 | case NAL_UNIT_RESERVED_IRAP_VCL22: |
---|
1964 | case NAL_UNIT_RESERVED_IRAP_VCL23: |
---|
1965 | |
---|
1966 | case NAL_UNIT_RESERVED_VCL24: |
---|
1967 | case NAL_UNIT_RESERVED_VCL25: |
---|
1968 | case NAL_UNIT_RESERVED_VCL26: |
---|
1969 | case NAL_UNIT_RESERVED_VCL27: |
---|
1970 | case NAL_UNIT_RESERVED_VCL28: |
---|
1971 | case NAL_UNIT_RESERVED_VCL29: |
---|
1972 | case NAL_UNIT_RESERVED_VCL30: |
---|
1973 | case NAL_UNIT_RESERVED_VCL31: |
---|
1974 | |
---|
1975 | case NAL_UNIT_FILLER_DATA: |
---|
1976 | case NAL_UNIT_RESERVED_NVCL41: |
---|
1977 | case NAL_UNIT_RESERVED_NVCL42: |
---|
1978 | case NAL_UNIT_RESERVED_NVCL43: |
---|
1979 | case NAL_UNIT_RESERVED_NVCL44: |
---|
1980 | case NAL_UNIT_RESERVED_NVCL45: |
---|
1981 | case NAL_UNIT_RESERVED_NVCL46: |
---|
1982 | case NAL_UNIT_RESERVED_NVCL47: |
---|
1983 | case NAL_UNIT_UNSPECIFIED_48: |
---|
1984 | case NAL_UNIT_UNSPECIFIED_49: |
---|
1985 | case NAL_UNIT_UNSPECIFIED_50: |
---|
1986 | case NAL_UNIT_UNSPECIFIED_51: |
---|
1987 | case NAL_UNIT_UNSPECIFIED_52: |
---|
1988 | case NAL_UNIT_UNSPECIFIED_53: |
---|
1989 | case NAL_UNIT_UNSPECIFIED_54: |
---|
1990 | case NAL_UNIT_UNSPECIFIED_55: |
---|
1991 | case NAL_UNIT_UNSPECIFIED_56: |
---|
1992 | case NAL_UNIT_UNSPECIFIED_57: |
---|
1993 | case NAL_UNIT_UNSPECIFIED_58: |
---|
1994 | case NAL_UNIT_UNSPECIFIED_59: |
---|
1995 | case NAL_UNIT_UNSPECIFIED_60: |
---|
1996 | case NAL_UNIT_UNSPECIFIED_61: |
---|
1997 | case NAL_UNIT_UNSPECIFIED_62: |
---|
1998 | case NAL_UNIT_UNSPECIFIED_63: |
---|
1999 | |
---|
2000 | default: |
---|
2001 | assert (0); |
---|
2002 | } |
---|
2003 | |
---|
2004 | return false; |
---|
2005 | } |
---|
2006 | |
---|
2007 | /** Function for checking if picture should be skipped because of association with a previous BLA picture |
---|
2008 | * \param iPOCLastDisplay POC of last picture displayed |
---|
2009 | * \returns true if the picture should be skipped |
---|
2010 | * This function skips all TFD pictures that follow a BLA picture |
---|
2011 | * in decoding order and precede it in output order. |
---|
2012 | */ |
---|
2013 | Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay) |
---|
2014 | { |
---|
2015 | 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) && |
---|
2016 | m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N)) |
---|
2017 | { |
---|
2018 | iPOCLastDisplay++; |
---|
2019 | return true; |
---|
2020 | } |
---|
2021 | return false; |
---|
2022 | } |
---|
2023 | |
---|
2024 | /** Function for checking if picture should be skipped because of random access |
---|
2025 | * \param iSkipFrame skip frame counter |
---|
2026 | * \param iPOCLastDisplay POC of last picture displayed |
---|
2027 | * \returns true if the picture shold be skipped in the random access. |
---|
2028 | * This function checks the skipping of pictures in the case of -s option random access. |
---|
2029 | * All pictures prior to the random access point indicated by the counter iSkipFrame are skipped. |
---|
2030 | * It also checks the type of Nal unit type at the random access point. |
---|
2031 | * 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. |
---|
2032 | * If the random access point is IDR all pictures after the random access point are decoded. |
---|
2033 | * If the random access point is none of the above, a warning is issues, and decoding of pictures with POC |
---|
2034 | * equal to or greater than the random access point POC is attempted. For non IDR/CRA/BLA random |
---|
2035 | * access point there is no guarantee that the decoder will not crash. |
---|
2036 | */ |
---|
2037 | Bool TDecTop::isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay) |
---|
2038 | { |
---|
2039 | if (iSkipFrame) |
---|
2040 | { |
---|
2041 | iSkipFrame--; // decrement the counter |
---|
2042 | return true; |
---|
2043 | } |
---|
2044 | else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet. |
---|
2045 | { |
---|
2046 | if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA |
---|
2047 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
2048 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP |
---|
2049 | || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ) |
---|
2050 | { |
---|
2051 | // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT. |
---|
2052 | m_pocRandomAccess = m_apcSlicePilot->getPOC(); |
---|
2053 | } |
---|
2054 | else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) |
---|
2055 | { |
---|
2056 | m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable. |
---|
2057 | } |
---|
2058 | else |
---|
2059 | { |
---|
2060 | static Bool warningMessage = false; |
---|
2061 | if(!warningMessage) |
---|
2062 | { |
---|
2063 | printf("\nWarning: this is not a valid random access point and the data is discarded until the first CRA picture"); |
---|
2064 | warningMessage = true; |
---|
2065 | } |
---|
2066 | return true; |
---|
2067 | } |
---|
2068 | } |
---|
2069 | // skip the reordered pictures, if necessary |
---|
2070 | 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)) |
---|
2071 | { |
---|
2072 | iPOCLastDisplay++; |
---|
2073 | return true; |
---|
2074 | } |
---|
2075 | // if we reach here, then the picture is not skipped. |
---|
2076 | return false; |
---|
2077 | } |
---|
2078 | |
---|
2079 | #if SVC_EXTENSION |
---|
2080 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
2081 | TDecTop* TDecTop::getRefLayerDec( UInt refLayerIdc ) |
---|
2082 | { |
---|
2083 | TComVPS* vps = m_parameterSetManagerDecoder.getActiveVPS(); |
---|
2084 | if( vps->getNumDirectRefLayers( m_layerId ) <= 0 ) |
---|
2085 | { |
---|
2086 | return (TDecTop *)getLayerDec( 0 ); |
---|
2087 | } |
---|
2088 | |
---|
2089 | return (TDecTop *)getLayerDec( vps->getRefLayerId( m_layerId, refLayerIdc ) ); |
---|
2090 | } |
---|
2091 | #endif |
---|
2092 | |
---|
2093 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
2094 | Void TDecTop::setRefLayerParams( TComVPS* vps ) |
---|
2095 | { |
---|
2096 | for(UInt layer = 0; layer < m_numLayer; layer++) |
---|
2097 | { |
---|
2098 | TDecTop *decTop = (TDecTop *)getLayerDec(layer); |
---|
2099 | decTop->setNumSamplePredRefLayers(0); |
---|
2100 | decTop->setNumMotionPredRefLayers(0); |
---|
2101 | decTop->setNumDirectRefLayers(0); |
---|
2102 | for(Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1; i++) |
---|
2103 | { |
---|
2104 | decTop->setSamplePredEnabledFlag(i, false); |
---|
2105 | decTop->setMotionPredEnabledFlag(i, false); |
---|
2106 | decTop->setSamplePredRefLayerId(i, 0); |
---|
2107 | decTop->setMotionPredRefLayerId(i, 0); |
---|
2108 | } |
---|
2109 | for(Int j = 0; j < layer; j++) |
---|
2110 | { |
---|
2111 | if (vps->getDirectDependencyFlag(layer, j)) |
---|
2112 | { |
---|
2113 | decTop->setRefLayerId(decTop->getNumDirectRefLayers(), vps->getLayerIdInNuh(layer)); |
---|
2114 | decTop->setNumDirectRefLayers(decTop->getNumDirectRefLayers() + 1); |
---|
2115 | |
---|
2116 | Int samplePredEnabledFlag = (vps->getDirectDependencyType(layer, j) + 1) & 1; |
---|
2117 | decTop->setSamplePredEnabledFlag(j, samplePredEnabledFlag == 1 ? true : false); |
---|
2118 | decTop->setNumSamplePredRefLayers(decTop->getNumSamplePredRefLayers() + samplePredEnabledFlag); |
---|
2119 | |
---|
2120 | Int motionPredEnabledFlag = ((vps->getDirectDependencyType(layer, j) + 1) & 2) >> 1; |
---|
2121 | decTop->setMotionPredEnabledFlag(j, motionPredEnabledFlag == 1 ? true : false); |
---|
2122 | decTop->setNumMotionPredRefLayers(decTop->getNumMotionPredRefLayers() + motionPredEnabledFlag); |
---|
2123 | } |
---|
2124 | } |
---|
2125 | } |
---|
2126 | for ( Int i = 1, mIdx = 0, sIdx = 0; i < m_numLayer; i++ ) |
---|
2127 | { |
---|
2128 | Int iNuhLId = vps->getLayerIdInNuh(i); |
---|
2129 | TDecTop *decTop = (TDecTop *)getLayerDec(iNuhLId); |
---|
2130 | for ( Int j = 0; j < i; j++ ) |
---|
2131 | { |
---|
2132 | if (decTop->getMotionPredEnabledFlag(j)) |
---|
2133 | { |
---|
2134 | decTop->setMotionPredRefLayerId(mIdx++, vps->getLayerIdInNuh(j)); |
---|
2135 | } |
---|
2136 | if (decTop->getSamplePredEnabledFlag(j)) |
---|
2137 | { |
---|
2138 | decTop->setSamplePredRefLayerId(sIdx++, vps->getLayerIdInNuh(j)); |
---|
2139 | } |
---|
2140 | } |
---|
2141 | } |
---|
2142 | } |
---|
2143 | |
---|
2144 | #endif |
---|
2145 | |
---|
2146 | #if OUTPUT_LAYER_SET_INDEX |
---|
2147 | Void TDecTop::checkValueOfTargetOutputLayerSetIdx(TComVPS *vps) |
---|
2148 | { |
---|
2149 | CommonDecoderParams* params = this->getCommonDecoderParams(); |
---|
2150 | |
---|
2151 | assert( params->getTargetLayerId() < vps->getMaxLayers() ); |
---|
2152 | |
---|
2153 | if( params->getValueCheckedFlag() ) |
---|
2154 | { |
---|
2155 | return; // Already checked |
---|
2156 | } |
---|
2157 | if( params->getTargetOutputLayerSetIdx() == -1 ) // Output layer set index not specified |
---|
2158 | { |
---|
2159 | Bool layerSetMatchFound = false; |
---|
2160 | // Output layer set index not assigned. |
---|
2161 | // Based on the value of targetLayerId, check if any of the output layer matches |
---|
2162 | // Currently, the target layer ID in the encoder assumes that all the layers are decoded |
---|
2163 | // Check if any of the output layer sets match this description |
---|
2164 | for(Int i = 0; i < vps->getNumOutputLayerSets(); i++) |
---|
2165 | { |
---|
2166 | Bool layerSetMatchFlag = true; |
---|
2167 | Int layerSetIdx = vps->getOutputLayerSetIdx( i ); |
---|
2168 | if( vps->getNumLayersInIdList( layerSetIdx ) == params->getTargetLayerId() + 1 ) |
---|
2169 | { |
---|
2170 | for(Int j = 0; j < vps->getNumLayersInIdList( layerSetIdx ); j++) |
---|
2171 | { |
---|
2172 | if( vps->getLayerSetLayerIdList( layerSetIdx, j ) != j ) |
---|
2173 | { |
---|
2174 | layerSetMatchFlag = false; |
---|
2175 | break; |
---|
2176 | } |
---|
2177 | } |
---|
2178 | } |
---|
2179 | else |
---|
2180 | { |
---|
2181 | layerSetMatchFlag = false; |
---|
2182 | } |
---|
2183 | |
---|
2184 | if( layerSetMatchFlag ) // Potential output layer set candidate found |
---|
2185 | { |
---|
2186 | // If target dec layer ID list is also included - check if they match |
---|
2187 | if( params->getTargetDecLayerIdSet() ) |
---|
2188 | { |
---|
2189 | if( params->getTargetDecLayerIdSet()->size() ) |
---|
2190 | { |
---|
2191 | for(Int j = 0; j < vps->getNumLayersInIdList( layerSetIdx ); j++) |
---|
2192 | { |
---|
2193 | if( *(params->getTargetDecLayerIdSet()->begin() + j) != vps->getLayerIdInNuh(vps->getLayerSetLayerIdList( layerSetIdx, j ))) |
---|
2194 | { |
---|
2195 | layerSetMatchFlag = false; |
---|
2196 | } |
---|
2197 | } |
---|
2198 | } |
---|
2199 | } |
---|
2200 | if( layerSetMatchFlag ) // The target dec layer ID list also matches, if present |
---|
2201 | { |
---|
2202 | // Match found |
---|
2203 | layerSetMatchFound = true; |
---|
2204 | params->setTargetOutputLayerSetIdx( i ); |
---|
2205 | params->setValueCheckedFlag( true ); |
---|
2206 | break; |
---|
2207 | } |
---|
2208 | } |
---|
2209 | } |
---|
2210 | assert( layerSetMatchFound ); // No output layer set matched the value of either targetLayerId or targetdeclayerIdlist |
---|
2211 | } |
---|
2212 | else // Output layer set index is assigned - check if the values match |
---|
2213 | { |
---|
2214 | // Check if the target decoded layer is the highest layer in the list |
---|
2215 | assert( params->getTargetOutputLayerSetIdx() < vps->getNumLayerSets() ); |
---|
2216 | Int layerSetIdx = vps->getOutputLayerSetIdx( params->getTargetOutputLayerSetIdx() ); // Index to the layer set |
---|
2217 | assert( params->getTargetLayerId() == vps->getNumLayersInIdList( layerSetIdx ) - 1); |
---|
2218 | |
---|
2219 | Bool layerSetMatchFlag = true; |
---|
2220 | for(Int j = 0; j < vps->getNumLayersInIdList( layerSetIdx ); j++) |
---|
2221 | { |
---|
2222 | if( vps->getLayerSetLayerIdList( layerSetIdx, j ) != j ) |
---|
2223 | { |
---|
2224 | layerSetMatchFlag = false; |
---|
2225 | break; |
---|
2226 | } |
---|
2227 | } |
---|
2228 | |
---|
2229 | assert(layerSetMatchFlag); // Signaled output layer set index does not match targetOutputLayerId. |
---|
2230 | |
---|
2231 | // Check if the targetdeclayerIdlist matches the output layer set |
---|
2232 | if( params->getTargetDecLayerIdSet() ) |
---|
2233 | { |
---|
2234 | if( params->getTargetDecLayerIdSet()->size() ) |
---|
2235 | { |
---|
2236 | for(Int i = 0; i < vps->getNumLayersInIdList( layerSetIdx ); i++) |
---|
2237 | { |
---|
2238 | assert( *(params->getTargetDecLayerIdSet()->begin() + i) == vps->getLayerIdInNuh(vps->getLayerSetLayerIdList( layerSetIdx, i ))); |
---|
2239 | } |
---|
2240 | } |
---|
2241 | } |
---|
2242 | params->setValueCheckedFlag( true ); |
---|
2243 | |
---|
2244 | } |
---|
2245 | } |
---|
2246 | #endif |
---|
2247 | #if RESOLUTION_BASED_DPB |
---|
2248 | Void TDecTop::assignSubDpbs(TComVPS *vps) |
---|
2249 | { |
---|
2250 | if( m_subDpbIdx == -1 ) // Sub-DPB index is not already assigned |
---|
2251 | { |
---|
2252 | Int lsIdx = vps->getOutputLayerSetIdx( getCommonDecoderParams()->getTargetOutputLayerSetIdx() ); |
---|
2253 | |
---|
2254 | Int layerIdx = vps->findLayerIdxInLayerSet( lsIdx, getLayerId() ); |
---|
2255 | assert( layerIdx != -1 ); // Current layer should be found in the layer set. |
---|
2256 | |
---|
2257 | // Copy from the active VPS based on the layer ID. |
---|
2258 | m_subDpbIdx = vps->getSubDpbAssigned( lsIdx, layerIdx ); |
---|
2259 | } |
---|
2260 | } |
---|
2261 | #endif |
---|
2262 | #endif //SVC_EXTENSION |
---|
2263 | //! \} |
---|