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