source: 3DVCSoftware/branches/HTM-4.1-dev2-HHI/source/Lib/TLibDecoder/TDecGop.cpp @ 193

Last change on this file since 193 was 100, checked in by tech, 12 years ago

Adopted modifications:

  • disparity vector generation (A0097)
  • inter-view motion prediction modification (A0049)
  • simplification of disparity vector derivation (A0126)
  • region boundary chain coding (A0070)
  • residual skip intra (A0087)
  • VSO modification (A0033/A0093)

+ Clean ups + Bug fixes

Update of cfg files (A0033 modification 2)

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