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-2012, 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 TDecGop.cpp |
---|
35 | \brief GOP decoder class |
---|
36 | */ |
---|
37 | |
---|
38 | extern bool g_md5_mismatch; ///< top level flag to signal when there is a decode problem |
---|
39 | |
---|
40 | #include "TDecGop.h" |
---|
41 | #include "TDecCAVLC.h" |
---|
42 | #include "TDecSbac.h" |
---|
43 | #include "TDecBinCoder.h" |
---|
44 | #include "TDecBinCoderCABAC.h" |
---|
45 | #include "libmd5/MD5.h" |
---|
46 | #include "TLibCommon/SEI.h" |
---|
47 | |
---|
48 | #include <time.h> |
---|
49 | |
---|
50 | //! \ingroup TLibDecoder |
---|
51 | //! \{ |
---|
52 | |
---|
53 | static void calcAndPrintMD5Status(TComPicYuv& pic, const SEImessages* seis); |
---|
54 | |
---|
55 | // ==================================================================================================================== |
---|
56 | // Constructor / destructor / initialization / destroy |
---|
57 | // ==================================================================================================================== |
---|
58 | |
---|
59 | TDecGop::TDecGop() |
---|
60 | { |
---|
61 | m_iGopSize = 0; |
---|
62 | m_dDecTime = 0; |
---|
63 | m_pcSbacDecoders = NULL; |
---|
64 | m_pcBinCABACs = NULL; |
---|
65 | m_first = true; |
---|
66 | } |
---|
67 | |
---|
68 | TDecGop::~TDecGop() |
---|
69 | { |
---|
70 | |
---|
71 | } |
---|
72 | |
---|
73 | Void TDecGop::create() |
---|
74 | { |
---|
75 | |
---|
76 | } |
---|
77 | |
---|
78 | |
---|
79 | Void TDecGop::destroy() |
---|
80 | { |
---|
81 | m_alfParamSetPilot.releaseALFParam(); |
---|
82 | } |
---|
83 | |
---|
84 | Void TDecGop::init( TDecEntropy* pcEntropyDecoder, |
---|
85 | TDecSbac* pcSbacDecoder, |
---|
86 | TDecBinCABAC* pcBinCABAC, |
---|
87 | TDecCavlc* pcCavlcDecoder, |
---|
88 | TDecSlice* pcSliceDecoder, |
---|
89 | TComLoopFilter* pcLoopFilter, |
---|
90 | TComAdaptiveLoopFilter* pcAdaptiveLoopFilter |
---|
91 | ,TComSampleAdaptiveOffset* pcSAO |
---|
92 | #if DEPTH_MAP_GENERATION |
---|
93 | ,TComDepthMapGenerator* pcDepthMapGenerator |
---|
94 | #endif |
---|
95 | #if H3D_IVRP |
---|
96 | ,TComResidualGenerator* pcResidualGenerator |
---|
97 | #endif |
---|
98 | ) |
---|
99 | { |
---|
100 | m_pcEntropyDecoder = pcEntropyDecoder; |
---|
101 | m_pcSbacDecoder = pcSbacDecoder; |
---|
102 | m_pcBinCABAC = pcBinCABAC; |
---|
103 | m_pcCavlcDecoder = pcCavlcDecoder; |
---|
104 | m_pcSliceDecoder = pcSliceDecoder; |
---|
105 | m_pcLoopFilter = pcLoopFilter; |
---|
106 | m_pcAdaptiveLoopFilter = pcAdaptiveLoopFilter; |
---|
107 | m_pcSAO = pcSAO; |
---|
108 | #if DEPTH_MAP_GENERATION |
---|
109 | m_pcDepthMapGenerator = pcDepthMapGenerator; |
---|
110 | #endif |
---|
111 | #if H3D_IVRP |
---|
112 | m_pcResidualGenerator = pcResidualGenerator; |
---|
113 | #endif |
---|
114 | } |
---|
115 | |
---|
116 | |
---|
117 | // ==================================================================================================================== |
---|
118 | // Private member functions |
---|
119 | // ==================================================================================================================== |
---|
120 | Void TDecGop::patchAlfLCUParams(ALFParam*** alfLCUParam, AlfParamSet* alfParamSet, Int firstLCUAddr) |
---|
121 | { |
---|
122 | Int numLCUInWidth = alfParamSet->numLCUInWidth; |
---|
123 | Int numLCU = alfParamSet->numLCU; |
---|
124 | |
---|
125 | Int rx, ry, pos, posUp; |
---|
126 | std::vector<ALFParam*> storedFilters[NUM_ALF_COMPONENT]; |
---|
127 | storedFilters[ALF_Y].clear(); |
---|
128 | storedFilters[ALF_Cb].clear(); |
---|
129 | storedFilters[ALF_Cr].clear(); |
---|
130 | |
---|
131 | for(Int i=0; i< numLCU; i++) |
---|
132 | { |
---|
133 | rx = (i+ firstLCUAddr)% numLCUInWidth; |
---|
134 | ry = (i+ firstLCUAddr)/ numLCUInWidth; |
---|
135 | pos = (ry*numLCUInWidth) + rx; |
---|
136 | posUp = pos-numLCUInWidth; |
---|
137 | |
---|
138 | for(Int compIdx =0; compIdx < NUM_ALF_COMPONENT; compIdx++) |
---|
139 | { |
---|
140 | AlfUnitParam& alfUnitParam = alfParamSet->alfUnitParam[compIdx][i]; |
---|
141 | ALFParam& alfFiltParam = *(alfLCUParam[compIdx][pos]); |
---|
142 | |
---|
143 | switch( alfUnitParam.mergeType ) |
---|
144 | { |
---|
145 | case ALF_MERGE_DISABLED: |
---|
146 | { |
---|
147 | if(alfUnitParam.isEnabled) |
---|
148 | { |
---|
149 | if(alfUnitParam.isNewFilt) |
---|
150 | { |
---|
151 | alfFiltParam = *alfUnitParam.alfFiltParam; |
---|
152 | storedFilters[compIdx].push_back( &alfFiltParam ); |
---|
153 | } |
---|
154 | else //stored filter |
---|
155 | { |
---|
156 | alfFiltParam = *(storedFilters[compIdx][alfUnitParam.storedFiltIdx]); |
---|
157 | assert(alfFiltParam.alf_flag == 1); |
---|
158 | } |
---|
159 | } |
---|
160 | else |
---|
161 | { |
---|
162 | alfFiltParam.alf_flag = 0; |
---|
163 | } |
---|
164 | } |
---|
165 | break; |
---|
166 | case ALF_MERGE_UP: |
---|
167 | { |
---|
168 | assert(posUp >= 0); |
---|
169 | alfFiltParam = *(alfLCUParam[compIdx][posUp]); |
---|
170 | } |
---|
171 | break; |
---|
172 | case ALF_MERGE_LEFT: |
---|
173 | { |
---|
174 | assert(pos-1 >= 0); |
---|
175 | alfFiltParam = *(alfLCUParam[compIdx][pos-1]); |
---|
176 | } |
---|
177 | break; |
---|
178 | case ALF_MERGE_FIRST: |
---|
179 | { |
---|
180 | alfFiltParam = *(alfLCUParam[compIdx][firstLCUAddr]); |
---|
181 | } |
---|
182 | break; |
---|
183 | default: |
---|
184 | { |
---|
185 | printf("not a supported ALF merge type\n"); |
---|
186 | assert(0); |
---|
187 | exit(-1); |
---|
188 | } |
---|
189 | } |
---|
190 | } //compIdx |
---|
191 | } //i (LCU) |
---|
192 | } |
---|
193 | |
---|
194 | // ==================================================================================================================== |
---|
195 | // Public member functions |
---|
196 | // ==================================================================================================================== |
---|
197 | |
---|
198 | Void TDecGop::decompressGop(TComInputBitstream* pcBitstream, TComPic*& rpcPic, Bool bExecuteDeblockAndAlf) |
---|
199 | { |
---|
200 | TComSlice* pcSlice = rpcPic->getSlice(rpcPic->getCurrSliceIdx()); |
---|
201 | // Table of extracted substreams. |
---|
202 | // These must be deallocated AND their internal fifos, too. |
---|
203 | TComInputBitstream **ppcSubstreams = NULL; |
---|
204 | |
---|
205 | //-- For time output for each slice |
---|
206 | long iBeforeTime = clock(); |
---|
207 | |
---|
208 | UInt uiStartCUAddr = pcSlice->getEntropySliceCurStartCUAddr(); |
---|
209 | |
---|
210 | if (!bExecuteDeblockAndAlf) |
---|
211 | { |
---|
212 | if(m_first) |
---|
213 | { |
---|
214 | m_uiILSliceCount = 0; |
---|
215 | m_puiILSliceStartLCU = new UInt[(rpcPic->getNumCUsInFrame()* rpcPic->getNumPartInCU()) +1]; |
---|
216 | m_first = false; |
---|
217 | } |
---|
218 | |
---|
219 | UInt uiSliceStartCuAddr = pcSlice->getSliceCurStartCUAddr(); |
---|
220 | if(uiSliceStartCuAddr == uiStartCUAddr) |
---|
221 | { |
---|
222 | m_puiILSliceStartLCU[m_uiILSliceCount] = uiSliceStartCuAddr; |
---|
223 | m_uiILSliceCount++; |
---|
224 | } |
---|
225 | |
---|
226 | m_pcSbacDecoder->init( (TDecBinIf*)m_pcBinCABAC ); |
---|
227 | m_pcEntropyDecoder->setEntropyDecoder (m_pcSbacDecoder); |
---|
228 | |
---|
229 | UInt uiNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); |
---|
230 | |
---|
231 | //init each couple {EntropyDecoder, Substream} |
---|
232 | UInt *puiSubstreamSizes = pcSlice->getSubstreamSizes(); |
---|
233 | ppcSubstreams = new TComInputBitstream*[uiNumSubstreams]; |
---|
234 | m_pcSbacDecoders = new TDecSbac[uiNumSubstreams]; |
---|
235 | m_pcBinCABACs = new TDecBinCABAC[uiNumSubstreams]; |
---|
236 | UInt uiBitsRead = pcBitstream->getByteLocation()<<3; |
---|
237 | for ( UInt ui = 0 ; ui < uiNumSubstreams ; ui++ ) |
---|
238 | { |
---|
239 | m_pcSbacDecoders[ui].init(&m_pcBinCABACs[ui]); |
---|
240 | UInt uiSubstreamSizeBits = (ui+1 < uiNumSubstreams ? puiSubstreamSizes[ui] : pcBitstream->getNumBitsLeft()); |
---|
241 | ppcSubstreams[ui] = pcBitstream->extractSubstream(ui+1 < uiNumSubstreams ? puiSubstreamSizes[ui] : pcBitstream->getNumBitsLeft()); |
---|
242 | // update location information from where tile markers were extracted |
---|
243 | { |
---|
244 | UInt uiDestIdx = 0; |
---|
245 | for (UInt uiSrcIdx = 0; uiSrcIdx<pcBitstream->getTileMarkerLocationCount(); uiSrcIdx++) |
---|
246 | { |
---|
247 | UInt uiLocation = pcBitstream->getTileMarkerLocation(uiSrcIdx); |
---|
248 | if ((uiBitsRead>>3)<=uiLocation && uiLocation<((uiBitsRead+uiSubstreamSizeBits)>>3)) |
---|
249 | { |
---|
250 | ppcSubstreams[ui]->setTileMarkerLocation( uiDestIdx, uiLocation - (uiBitsRead>>3) ); |
---|
251 | ppcSubstreams[ui]->setTileMarkerLocationCount( uiDestIdx+1 ); |
---|
252 | uiDestIdx++; |
---|
253 | } |
---|
254 | } |
---|
255 | ppcSubstreams[ui]->setTileMarkerLocationCount( uiDestIdx ); |
---|
256 | uiBitsRead += uiSubstreamSizeBits; |
---|
257 | } |
---|
258 | } |
---|
259 | |
---|
260 | for ( UInt ui = 0 ; ui+1 < uiNumSubstreams; ui++ ) |
---|
261 | { |
---|
262 | m_pcEntropyDecoder->setEntropyDecoder ( &m_pcSbacDecoders[uiNumSubstreams - 1 - ui] ); |
---|
263 | m_pcEntropyDecoder->setBitstream ( ppcSubstreams [uiNumSubstreams - 1 - ui] ); |
---|
264 | m_pcEntropyDecoder->resetEntropy (pcSlice); |
---|
265 | } |
---|
266 | |
---|
267 | m_pcEntropyDecoder->setEntropyDecoder ( m_pcSbacDecoder ); |
---|
268 | m_pcEntropyDecoder->setBitstream ( ppcSubstreams[0] ); |
---|
269 | m_pcEntropyDecoder->resetEntropy (pcSlice); |
---|
270 | |
---|
271 | if(uiSliceStartCuAddr == uiStartCUAddr) |
---|
272 | { |
---|
273 | if(pcSlice->getSPS()->getUseALF()) |
---|
274 | { |
---|
275 | if(pcSlice->getAlfEnabledFlag()) |
---|
276 | { |
---|
277 | if(pcSlice->getSPS()->getUseALFCoefInSlice()) |
---|
278 | { |
---|
279 | Int numSUinLCU = 1<< (g_uiMaxCUDepth << 1); |
---|
280 | Int firstLCUAddr = pcSlice->getSliceCurStartCUAddr() / numSUinLCU; |
---|
281 | patchAlfLCUParams(m_pcAdaptiveLoopFilter->getAlfLCUParam(), &m_alfParamSetPilot, firstLCUAddr); |
---|
282 | } |
---|
283 | |
---|
284 | if( !pcSlice->getSPS()->getUseALFCoefInSlice()) |
---|
285 | { |
---|
286 | m_vAlfCUCtrlSlices.push_back(m_cAlfCUCtrlOneSlice); |
---|
287 | } |
---|
288 | } |
---|
289 | } |
---|
290 | } |
---|
291 | |
---|
292 | #if DEPTH_MAP_GENERATION |
---|
293 | // init view component and predict virtual depth map |
---|
294 | if( uiStartCUAddr == 0 ) |
---|
295 | { |
---|
296 | m_pcDepthMapGenerator->initViewComponent( rpcPic ); |
---|
297 | #if !H3D_NBDV |
---|
298 | m_pcDepthMapGenerator->predictDepthMap ( rpcPic ); |
---|
299 | #endif |
---|
300 | #if H3D_IVRP |
---|
301 | m_pcResidualGenerator->initViewComponent( rpcPic ); |
---|
302 | #endif |
---|
303 | } |
---|
304 | #endif |
---|
305 | |
---|
306 | #if H3D_NBDV |
---|
307 | if(pcSlice->getViewId() && pcSlice->getSPS()->getMultiviewMvPredMode()) |
---|
308 | { |
---|
309 | Int iColPoc = pcSlice->getRefPOC(RefPicList(pcSlice->getColDir()), pcSlice->getColRefIdx()); |
---|
310 | rpcPic->setRapbCheck(rpcPic->getDisCandRefPictures(iColPoc)); |
---|
311 | } |
---|
312 | #endif |
---|
313 | |
---|
314 | m_pcSbacDecoders[0].load(m_pcSbacDecoder); |
---|
315 | m_pcSliceDecoder->decompressSlice( pcBitstream, ppcSubstreams, rpcPic, m_pcSbacDecoder, m_pcSbacDecoders); |
---|
316 | m_pcEntropyDecoder->setBitstream( ppcSubstreams[uiNumSubstreams-1] ); |
---|
317 | if ( uiNumSubstreams > 1 ) |
---|
318 | { |
---|
319 | // deallocate all created substreams, including internal buffers. |
---|
320 | for (UInt ui = 0; ui < uiNumSubstreams; ui++) |
---|
321 | { |
---|
322 | ppcSubstreams[ui]->deleteFifo(); |
---|
323 | delete ppcSubstreams[ui]; |
---|
324 | } |
---|
325 | delete[] ppcSubstreams; |
---|
326 | delete[] m_pcSbacDecoders; m_pcSbacDecoders = NULL; |
---|
327 | delete[] m_pcBinCABACs; m_pcBinCABACs = NULL; |
---|
328 | } |
---|
329 | m_dDecTime += (double)(clock()-iBeforeTime) / CLOCKS_PER_SEC; |
---|
330 | } |
---|
331 | else |
---|
332 | { |
---|
333 | #if H3D_IVRP |
---|
334 | // set residual picture |
---|
335 | m_pcResidualGenerator->setRecResidualPic( rpcPic ); |
---|
336 | #endif |
---|
337 | #if DEPTH_MAP_GENERATION |
---|
338 | #if !H3D_NBDV |
---|
339 | // update virtual depth map |
---|
340 | m_pcDepthMapGenerator->updateDepthMap( rpcPic ); |
---|
341 | #endif |
---|
342 | #endif |
---|
343 | // deblocking filter |
---|
344 | Bool bLFCrossTileBoundary = (pcSlice->getPPS()->getTileBehaviorControlPresentFlag() == 1)? |
---|
345 | (pcSlice->getPPS()->getLFCrossTileBoundaryFlag()):(pcSlice->getPPS()->getSPS()->getLFCrossTileBoundaryFlag()); |
---|
346 | if (pcSlice->getPPS()->getDeblockingFilterControlPresent()) |
---|
347 | { |
---|
348 | if(pcSlice->getSPS()->getUseDF()) |
---|
349 | { |
---|
350 | if(pcSlice->getInheritDblParamFromAPS()) |
---|
351 | { |
---|
352 | pcSlice->setLoopFilterDisable(pcSlice->getAPS()->getLoopFilterDisable()); |
---|
353 | if (!pcSlice->getLoopFilterDisable()) |
---|
354 | { |
---|
355 | pcSlice->setLoopFilterBetaOffset(pcSlice->getAPS()->getLoopFilterBetaOffset()); |
---|
356 | pcSlice->setLoopFilterTcOffset(pcSlice->getAPS()->getLoopFilterTcOffset()); |
---|
357 | } |
---|
358 | } |
---|
359 | } |
---|
360 | } |
---|
361 | m_pcLoopFilter->setCfg(pcSlice->getPPS()->getDeblockingFilterControlPresent(), pcSlice->getLoopFilterDisable(), pcSlice->getLoopFilterBetaOffset(), pcSlice->getLoopFilterTcOffset(), bLFCrossTileBoundary); |
---|
362 | m_pcLoopFilter->loopFilterPic( rpcPic ); |
---|
363 | |
---|
364 | pcSlice = rpcPic->getSlice(0); |
---|
365 | if(pcSlice->getSPS()->getUseSAO() || pcSlice->getSPS()->getUseALF()) |
---|
366 | { |
---|
367 | Int sliceGranularity = pcSlice->getPPS()->getSliceGranularity(); |
---|
368 | m_puiILSliceStartLCU[m_uiILSliceCount] = rpcPic->getNumCUsInFrame()* rpcPic->getNumPartInCU(); |
---|
369 | rpcPic->createNonDBFilterInfo(m_puiILSliceStartLCU, m_uiILSliceCount,sliceGranularity,pcSlice->getSPS()->getLFCrossSliceBoundaryFlag(),rpcPic->getPicSym()->getNumTiles() ,bLFCrossTileBoundary); |
---|
370 | } |
---|
371 | |
---|
372 | if( pcSlice->getSPS()->getUseSAO() ) |
---|
373 | { |
---|
374 | if(pcSlice->getSaoEnabledFlag()) |
---|
375 | { |
---|
376 | if (pcSlice->getSaoInterleavingFlag()) |
---|
377 | { |
---|
378 | pcSlice->getAPS()->setSaoInterleavingFlag(pcSlice->getSaoInterleavingFlag()); |
---|
379 | pcSlice->getAPS()->setSaoEnabled(pcSlice->getSaoEnabledFlag()); |
---|
380 | pcSlice->getAPS()->getSaoParam()->bSaoFlag[0] = pcSlice->getSaoEnabledFlag(); |
---|
381 | pcSlice->getAPS()->getSaoParam()->bSaoFlag[1] = pcSlice->getSaoEnabledFlagCb(); |
---|
382 | pcSlice->getAPS()->getSaoParam()->bSaoFlag[2] = pcSlice->getSaoEnabledFlagCr(); |
---|
383 | } |
---|
384 | m_pcSAO->setSaoInterleavingFlag(pcSlice->getAPS()->getSaoInterleavingFlag()); |
---|
385 | m_pcSAO->createPicSaoInfo(rpcPic, m_uiILSliceCount); |
---|
386 | m_pcSAO->SAOProcess(rpcPic, pcSlice->getAPS()->getSaoParam()); |
---|
387 | m_pcAdaptiveLoopFilter->PCMLFDisableProcess(rpcPic); |
---|
388 | m_pcSAO->destroyPicSaoInfo(); |
---|
389 | } |
---|
390 | } |
---|
391 | |
---|
392 | // adaptive loop filter |
---|
393 | if( pcSlice->getSPS()->getUseALF() ) |
---|
394 | { |
---|
395 | if( (pcSlice->getSPS()->getUseALFCoefInSlice())?(true):(pcSlice->getAlfEnabledFlag())) |
---|
396 | { |
---|
397 | |
---|
398 | if(!pcSlice->getSPS()->getUseALFCoefInSlice()) |
---|
399 | { |
---|
400 | patchAlfLCUParams(m_pcAdaptiveLoopFilter->getAlfLCUParam(), pcSlice->getAPS()->getAlfParam()); |
---|
401 | } |
---|
402 | m_pcAdaptiveLoopFilter->createPicAlfInfo(rpcPic, m_uiILSliceCount, pcSlice->getSliceQp()); |
---|
403 | m_pcAdaptiveLoopFilter->ALFProcess(rpcPic, m_vAlfCUCtrlSlices, pcSlice->getSPS()->getUseALFCoefInSlice()); |
---|
404 | m_pcAdaptiveLoopFilter->PCMLFDisableProcess(rpcPic); |
---|
405 | m_pcAdaptiveLoopFilter->destroyPicAlfInfo(); |
---|
406 | } |
---|
407 | m_pcAdaptiveLoopFilter->resetLCUAlfInfo(); //reset all LCU ALFParam->alf_flag = 0 |
---|
408 | } |
---|
409 | |
---|
410 | if(pcSlice->getSPS()->getUseSAO() || pcSlice->getSPS()->getUseALF()) |
---|
411 | { |
---|
412 | rpcPic->destroyNonDBFilterInfo(); |
---|
413 | } |
---|
414 | |
---|
415 | // rpcPic->compressMotion(); |
---|
416 | Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B'); |
---|
417 | if (!pcSlice->isReferenced()) c += 32; |
---|
418 | |
---|
419 | //-- For time output for each slice |
---|
420 | printf("\n%s View %2d POC %4d TId: %1d ( %c-SLICE, QP%3d ) ", |
---|
421 | pcSlice->getIsDepth() ? "Depth " : "Texture", |
---|
422 | pcSlice->getViewId(), |
---|
423 | pcSlice->getPOC(), |
---|
424 | pcSlice->getTLayer(), |
---|
425 | c, |
---|
426 | pcSlice->getSliceQp() ); |
---|
427 | |
---|
428 | m_dDecTime += (double)(clock()-iBeforeTime) / CLOCKS_PER_SEC; |
---|
429 | printf ("[DT %6.3f] ", m_dDecTime ); |
---|
430 | m_dDecTime = 0; |
---|
431 | |
---|
432 | for (Int iRefList = 0; iRefList < 2; iRefList++) |
---|
433 | { |
---|
434 | printf ("[L%d ", iRefList); |
---|
435 | for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++) |
---|
436 | { |
---|
437 | if( pcSlice->getViewId() != pcSlice->getRefViewId( RefPicList(iRefList), iRefIndex ) ) |
---|
438 | { |
---|
439 | printf( "V%d ", pcSlice->getRefViewId( RefPicList(iRefList), iRefIndex ) ); |
---|
440 | } |
---|
441 | else |
---|
442 | { |
---|
443 | printf ("%d ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)); |
---|
444 | } |
---|
445 | } |
---|
446 | printf ("] "); |
---|
447 | } |
---|
448 | if(pcSlice->getNumRefIdx(REF_PIC_LIST_C)>0 && !pcSlice->getNoBackPredFlag()) |
---|
449 | { |
---|
450 | printf ("[LC "); |
---|
451 | for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(REF_PIC_LIST_C); iRefIndex++) |
---|
452 | { |
---|
453 | if( pcSlice->getViewId() != pcSlice->getRefViewId( (RefPicList)pcSlice->getListIdFromIdxOfLC(iRefIndex), pcSlice->getRefIdxFromIdxOfLC(iRefIndex) ) ) |
---|
454 | { |
---|
455 | printf( "V%d ", pcSlice->getRefViewId( (RefPicList)pcSlice->getListIdFromIdxOfLC(iRefIndex), pcSlice->getRefIdxFromIdxOfLC(iRefIndex) ) ); |
---|
456 | } |
---|
457 | else |
---|
458 | { |
---|
459 | printf ("%d ", pcSlice->getRefPOC((RefPicList)pcSlice->getListIdFromIdxOfLC(iRefIndex), pcSlice->getRefIdxFromIdxOfLC(iRefIndex))); |
---|
460 | } |
---|
461 | } |
---|
462 | printf ("] "); |
---|
463 | } |
---|
464 | |
---|
465 | if (m_pictureDigestEnabled) |
---|
466 | { |
---|
467 | calcAndPrintMD5Status(*rpcPic->getPicYuvRec(), rpcPic->getSEIs()); |
---|
468 | } |
---|
469 | |
---|
470 | #if FIXED_ROUNDING_FRAME_MEMORY |
---|
471 | rpcPic->getPicYuvRec()->xFixedRoundingPic(); |
---|
472 | #endif |
---|
473 | |
---|
474 | rpcPic->setOutputMark(true); |
---|
475 | rpcPic->setReconMark(true); |
---|
476 | |
---|
477 | rpcPic->setUsedForTMVP( true ); |
---|
478 | |
---|
479 | m_uiILSliceCount = 0; |
---|
480 | m_vAlfCUCtrlSlices.clear(); |
---|
481 | } |
---|
482 | fflush(stdout); |
---|
483 | } |
---|
484 | |
---|
485 | /** |
---|
486 | * Calculate and print MD5 for pic, compare to picture_digest SEI if |
---|
487 | * present in seis. seis may be NULL. MD5 is printed to stdout, in |
---|
488 | * a manner suitable for the status line. Theformat is: |
---|
489 | * [MD5:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,(yyy)] |
---|
490 | * Where, x..x is the md5 |
---|
491 | * yyy has the following meanings: |
---|
492 | * OK - calculated MD5 matches the SEI message |
---|
493 | * ***ERROR*** - calculated MD5 does not match the SEI message |
---|
494 | * unk - no SEI message was available for comparison |
---|
495 | */ |
---|
496 | static void calcAndPrintMD5Status(TComPicYuv& pic, const SEImessages* seis) |
---|
497 | { |
---|
498 | /* calculate MD5sum for entire reconstructed picture */ |
---|
499 | unsigned char recon_digest[16]; |
---|
500 | calcMD5(pic, recon_digest); |
---|
501 | |
---|
502 | /* compare digest against received version */ |
---|
503 | const char* md5_ok = "(unk)"; |
---|
504 | bool md5_mismatch = false; |
---|
505 | |
---|
506 | if (seis && seis->picture_digest) |
---|
507 | { |
---|
508 | md5_ok = "(OK)"; |
---|
509 | for (unsigned i = 0; i < 16; i++) |
---|
510 | { |
---|
511 | if (recon_digest[i] != seis->picture_digest->digest[i]) |
---|
512 | { |
---|
513 | md5_ok = "(***ERROR***)"; |
---|
514 | md5_mismatch = true; |
---|
515 | } |
---|
516 | } |
---|
517 | } |
---|
518 | |
---|
519 | printf("[MD5:%s,%s] ", digestToString(recon_digest), md5_ok); |
---|
520 | if (md5_mismatch) |
---|
521 | { |
---|
522 | g_md5_mismatch = true; |
---|
523 | printf("[rxMD5:%s] ", digestToString(seis->picture_digest->digest)); |
---|
524 | } |
---|
525 | } |
---|
526 | //! \} |
---|