HEVC Test Model (HM)  HM-16.3
TDecTop.cpp
Go to the documentation of this file.
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-2015, 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 
38 #include "NALread.h"
39 #include "TDecTop.h"
40 #if RExt__DECODER_DEBUG_BIT_STATISTICS
42 #endif
43 
46 
48  : m_pDecodedSEIOutputStream(NULL)
49 {
50  m_pcPic = 0;
51  m_iMaxRefPicNum = 0;
52 #if ENC_DEC_TRACE
53  if (g_hTrace == NULL)
54  {
55  g_hTrace = fopen( "TraceDec.txt", "wb" );
56  }
58  g_nSymbolCounter = 0;
59 #endif
61  m_pocCRA = 0;
66  m_prevSliceSkipped = false;
67  m_skippedPOC = 0;
70  m_craNoRaslOutputFlag = false;
71  m_isNoOutputPriorPics = false;
72 }
73 
75 {
76 #if ENC_DEC_TRACE
77  if (g_hTrace != stdout)
78  {
79  fclose( g_hTrace );
80  }
81 #endif
82 }
83 
85 {
88  m_uiSliceIdx = 0;
89 }
90 
92 {
94 
95  delete m_apcSlicePilot;
97 
99 }
100 
102 {
103  // initialize ROM
104  initROM();
108 }
109 
111 {
112  TComList<TComPic*>::iterator iterPic = m_cListPic.begin();
113  Int iSize = Int( m_cListPic.size() );
114 
115  for (Int i = 0; i < iSize; i++ )
116  {
117  TComPic* pcPic = *(iterPic++);
118  pcPic->destroy();
119 
120  delete pcPic;
121  pcPic = NULL;
122  }
123 
124  m_cSAO.destroy();
125 
127 
128  // destroy ROM
129  destroyROM();
130 }
131 
132 Void TDecTop::xGetNewPicBuffer ( const TComSPS &sps, const TComPPS &pps, TComPic*& rpcPic, const UInt temporalLayer )
133 {
134  m_iMaxRefPicNum = sps.getMaxDecPicBuffering(temporalLayer); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
135  if (m_cListPic.size() < (UInt)m_iMaxRefPicNum)
136  {
137  rpcPic = new TComPic();
138 
139  rpcPic->create ( sps, pps, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true);
140 
141  m_cListPic.pushBack( rpcPic );
142 
143  return;
144  }
145 
146  Bool bBufferIsAvailable = false;
147  TComList<TComPic*>::iterator iterPic = m_cListPic.begin();
148  while (iterPic != m_cListPic.end())
149  {
150  rpcPic = *(iterPic++);
151  if ( rpcPic->getReconMark() == false && rpcPic->getOutputMark() == false)
152  {
153  rpcPic->setOutputMark(false);
154  bBufferIsAvailable = true;
155  break;
156  }
157 
158  if ( rpcPic->getSlice( 0 )->isReferenced() == false && rpcPic->getOutputMark() == false)
159  {
160  rpcPic->setOutputMark(false);
161  rpcPic->setReconMark( false );
162  rpcPic->getPicYuvRec()->setBorderExtension( false );
163  bBufferIsAvailable = true;
164  break;
165  }
166  }
167 
168  if ( !bBufferIsAvailable )
169  {
170  //There is no room for this picture, either because of faulty encoder or dropped NAL. Extend the buffer.
171  m_iMaxRefPicNum++;
172  rpcPic = new TComPic();
173  m_cListPic.pushBack( rpcPic );
174  }
175  rpcPic->destroy();
176  rpcPic->create ( sps, pps, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true);
177 }
178 
180 {
181  if (!m_pcPic)
182  {
183  /* nothing to deblock */
184  return;
185  }
186 
187  TComPic* pcPic = m_pcPic;
188 
189  // Execute Deblock + Cleanup
190 
192 
193  TComSlice::sortPicList( m_cListPic ); // sorting for application output
194  poc = pcPic->getSlice(m_uiSliceIdx-1)->getPOC();
195  rpcListPic = &m_cListPic;
197  m_bFirstSliceInPicture = true;
198 
199  return;
200 }
201 
203 {
204  if (!pcListPic || !m_isNoOutputPriorPics)
205  {
206  return;
207  }
208 
209  TComList<TComPic*>::iterator iterPic = pcListPic->begin();
210 
211  while (iterPic != pcListPic->end())
212  {
213  TComPic* pcPicTmp = *(iterPic++);
214  if (m_lastPOCNoOutputPriorPics != pcPicTmp->getPOC())
215  {
216  pcPicTmp->setOutputMark(false);
217  }
218  }
219 }
220 
222 {
223  printf("\ninserting lost poc : %d\n",iLostPoc);
224  TComPic *cFillPic;
226  cFillPic->getSlice(0)->initSlice();
227 
228  TComList<TComPic*>::iterator iterPic = m_cListPic.begin();
229  Int closestPoc = 1000000;
230  while ( iterPic != m_cListPic.end())
231  {
232  TComPic * rpcPic = *(iterPic++);
233  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())
234  {
235  closestPoc=abs(rpcPic->getPicSym()->getSlice(0)->getPOC() -iLostPoc);
236  }
237  }
238  iterPic = m_cListPic.begin();
239  while ( iterPic != m_cListPic.end())
240  {
241  TComPic *rpcPic = *(iterPic++);
242  if(abs(rpcPic->getPicSym()->getSlice(0)->getPOC() -iLostPoc)==closestPoc&&rpcPic->getPicSym()->getSlice(0)->getPOC()!=m_apcSlicePilot->getPOC())
243  {
244  printf("copying picture %d to %d (%d)\n",rpcPic->getPicSym()->getSlice(0)->getPOC() ,iLostPoc,m_apcSlicePilot->getPOC());
245  rpcPic->getPicYuvRec()->copyToPic(cFillPic->getPicYuvRec());
246  break;
247  }
248  }
249  cFillPic->setCurrSliceIdx(0);
250  for(Int ctuRsAddr=0; ctuRsAddr<cFillPic->getNumberOfCtusInFrame(); ctuRsAddr++)
251  {
252  cFillPic->getCtu(ctuRsAddr)->initCtu(cFillPic, ctuRsAddr);
253  }
254  cFillPic->getSlice(0)->setReferenced(true);
255  cFillPic->getSlice(0)->setPOC(iLostPoc);
256  cFillPic->setReconMark(true);
257  cFillPic->setOutputMark(true);
259  {
260  m_pocRandomAccess = iLostPoc;
261  }
262 }
263 
264 
266 {
268  {
269  const TComPPS *pps = m_parameterSetManager.getPPS(m_apcSlicePilot->getPPSId()); // this is a temporary PPS object. Do not store this value
270  assert (pps != 0);
271 
272  const TComSPS *sps = m_parameterSetManager.getSPS(pps->getSPSId()); // this is a temporary SPS object. Do not store this value
273  assert (sps != 0);
274 
277 
279  {
280  printf ("Parameter set activation failed!");
281  assert (0);
282  }
283 
284  // TODO: remove the use of the following globals:
285  for (UInt channel = 0; channel < MAX_NUM_CHANNEL_TYPE; channel++)
286  {
287  g_bitDepth[channel] = sps->getBitDepth(ChannelType(channel));
288  g_maxTrDynamicRange[channel] = (sps->getUseExtendedPrecision()) ? std::max<Int>(15, (g_bitDepth[channel] + 6)) : 15;
289  }
290  g_uiMaxCUWidth = sps->getMaxCUWidth();
292  g_uiMaxCUDepth = sps->getMaxCUDepth();
294 
295  // Get a new picture buffer. This will also set up m_pcPic, and therefore give us a SPS and PPS pointer that we can use.
296  xGetNewPicBuffer (*(sps), *(pps), m_pcPic, m_apcSlicePilot->getTLayer());
298 
299  // make the slice-pilot a real slice, and set up the slice-pilot for the next slice
300  assert(m_pcPic->getNumAllocatedSlice() == (m_uiSliceIdx + 1));
302 
303  // we now have a real slice:
305 
306  // Update the PPS and SPS pointers with the ones of the picture.
307  pps=pSlice->getPPS();
308  sps=pSlice->getSPS();
309 
310  // Initialise the various objects for the new set of settings
314 
315 
316  Bool isField = false;
317  Bool isTopField = false;
318 
319  if(!m_SEIs.empty())
320  {
321  // Check if any new Picture Timing SEI has arrived
323  if (pictureTimingSEIs.size()>0)
324  {
325  SEIPictureTiming* pictureTiming = (SEIPictureTiming*) *(pictureTimingSEIs.begin());
326  isField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 2) || (pictureTiming->m_picStruct == 9) || (pictureTiming->m_picStruct == 10) || (pictureTiming->m_picStruct == 11) || (pictureTiming->m_picStruct == 12);
327  isTopField = (pictureTiming->m_picStruct == 1) || (pictureTiming->m_picStruct == 9) || (pictureTiming->m_picStruct == 11);
328  }
329  }
330 
331  //Set Field/Frame coding mode
332  m_pcPic->setField(isField);
333  m_pcPic->setTopField(isTopField);
334 
335  // transfer any SEI messages that have been received to the picture
337  m_SEIs.clear();
338 
339  // Recursive structure
342  m_cTrQuant.init ( sps->getMaxTrSize() );
343 
345  }
346  else
347  {
348  // make the slice-pilot a real slice, and set up the slice-pilot for the next slice
350  assert(m_pcPic->getNumAllocatedSlice() == (m_uiSliceIdx + 1));
352 
353  TComSlice *pSlice = m_pcPic->getSlice(m_uiSliceIdx); // we now have a real slice.
354 
355  const TComSPS *sps = pSlice->getSPS();
356  const TComPPS *pps = pSlice->getPPS();
357 
358  // check that the current active PPS has not changed...
360  {
361  printf("Error - a new SPS has been decoded while processing a picture\n");
362  exit(1);
363  }
365  {
366  printf("Error - a new PPS has been decoded while processing a picture\n");
367  exit(1);
368  }
369 
370  // Check if any new SEI has arrived
371  if(!m_SEIs.empty())
372  {
373  // Currently only decoding Unit SEI message occurring between VCL NALUs copied
374  SEIMessages &picSEI = m_pcPic->getSEIs();
376  picSEI.insert(picSEI.end(), decodingUnitInfos.begin(), decodingUnitInfos.end());
378  }
379  }
380 
381 }
382 
383 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay )
384 {
385  m_apcSlicePilot->initSlice(); // the slice pilot is an object to prepare for a new slice
386  // it is not associated with picture, sps or pps structures.
387 
389  {
390  m_uiSliceIdx = 0;
391  }
392  else
393  {
395  }
397 
405  m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS
407 
408 #if ENC_DEC_TRACE
409  const UInt64 originalSymbolCount = g_nSymbolCounter;
410 #endif
411 
413 
414  // set POC for dependent slices in skipped pictures
416  {
418  }
419 
422 
423  //For inference of NoOutputOfPriorPicsFlag
425  {
429  {
431  }
432  //the inference for NoOutputPriorPicsFlag
434  {
436  {
438  }
439  }
440  else
441  {
443  }
444 
446  {
448  }
449  }
451  {
453  m_isNoOutputPriorPics = true;
454  }
455  else
456  {
457  m_isNoOutputPriorPics = false;
458  }
459 
460  //For inference of PicOutputFlag
462  {
463  if ( m_craNoRaslOutputFlag )
464  {
466  }
467  }
468 
469  if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_craNoRaslOutputFlag) //Reset POC MSB when CRA has NoRaslOutputFlag equal to 1
470  {
472  assert (pps != 0);
474  assert (sps != 0);
475  Int iMaxPOClsb = 1 << sps->getBitsForPOC();
476  m_apcSlicePilot->setPOC( m_apcSlicePilot->getPOC() & (iMaxPOClsb - 1) );
477  }
478 
479  // Skip pictures due to random access
480  if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
481  {
482  m_prevSliceSkipped = true;
484  return false;
485  }
486  // Skip TFD pictures associated with BLA/BLANT pictures
487  if (isSkipPictureForBLA(iPOCLastDisplay))
488  {
489  m_prevSliceSkipped = true;
491  return false;
492  }
493 
494  // clear previous slice skipped flag
495  m_prevSliceSkipped = false;
496 
497  //we should only get a different poc for a new picture (with CTU address==0)
499  {
500  printf ("Warning, the first slice of a picture might have been lost!\n");
501  }
502 
503  // exit when a new picture is found
505  {
507  {
509 #if ENC_DEC_TRACE
510  //rewind the trace counter since we didn't actually decode the slice
511  g_nSymbolCounter = originalSymbolCount;
512 #endif
513  return true;
514  }
516  }
517 
518  //detect lost reference picture and insert copy of earlier frame.
519  {
520  Int lostPoc;
522  {
523  xCreateLostPicture(lostPoc-1);
524  }
525  }
526 
528  {
530  }
531 
532  // actual decoding starts here
534 
535  m_bFirstSliceInSequence = false;
536  m_bFirstSliceInBitstream = false;
537 
538 
540 
541  // When decoding the slice header, the stored start and end addresses were actually RS addresses, not TS addresses.
542  // Now, having set up the maps, convert them to the correct form.
545  if(!pcSlice->getDependentSliceSegmentFlag())
546  {
549  }
550 
552 
553  if (!pcSlice->getDependentSliceSegmentFlag())
554  {
555  pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_associatedIRAPType, m_cListPic );
556  // Set reference list
557  pcSlice->setRefPicList( m_cListPic, true );
558 
559  // For generalized B
560  // note: maybe not existed case (always L0 is copied to L1 if L1 is empty)
561  if (pcSlice->isInterB() && pcSlice->getNumRefIdx(REF_PIC_LIST_1) == 0)
562  {
563  Int iNumRefIdx = pcSlice->getNumRefIdx(REF_PIC_LIST_0);
564  pcSlice->setNumRefIdx ( REF_PIC_LIST_1, iNumRefIdx );
565 
566  for (Int iRefIdx = 0; iRefIdx < iNumRefIdx; iRefIdx++)
567  {
568  pcSlice->setRefPic(pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx), REF_PIC_LIST_1, iRefIdx);
569  }
570  }
571  if (!pcSlice->isIntra())
572  {
573  Bool bLowDelay = true;
574  Int iCurrPOC = pcSlice->getPOC();
575  Int iRefIdx = 0;
576 
577  for (iRefIdx = 0; iRefIdx < pcSlice->getNumRefIdx(REF_PIC_LIST_0) && bLowDelay; iRefIdx++)
578  {
579  if ( pcSlice->getRefPic(REF_PIC_LIST_0, iRefIdx)->getPOC() > iCurrPOC )
580  {
581  bLowDelay = false;
582  }
583  }
584  if (pcSlice->isInterB())
585  {
586  for (iRefIdx = 0; iRefIdx < pcSlice->getNumRefIdx(REF_PIC_LIST_1) && bLowDelay; iRefIdx++)
587  {
588  if ( pcSlice->getRefPic(REF_PIC_LIST_1, iRefIdx)->getPOC() > iCurrPOC )
589  {
590  bLowDelay = false;
591  }
592  }
593  }
594 
595  pcSlice->setCheckLDC(bLowDelay);
596  }
597 
598  //---------------
599  pcSlice->setRefPOCList();
600  }
601 
603  if(pcSlice->getSPS()->getScalingListFlag())
604  {
605  TComScalingList scalingList;
606  if(pcSlice->getPPS()->getScalingListPresentFlag())
607  {
608  scalingList = pcSlice->getPPS()->getScalingList();
609  }
610  else if (pcSlice->getSPS()->getScalingListPresentFlag())
611  {
612  scalingList = pcSlice->getSPS()->getScalingList();
613  }
614  else
615  {
616  scalingList.setDefaultScalingList();
617  }
618  m_cTrQuant.setScalingListDec(scalingList, pcSlice->getSPS()->getChromaFormatIdc());
620  }
621  else
622  {
625  }
626 
627  // Decode a picture
629 
630  m_bFirstSliceInPicture = false;
631  m_uiSliceIdx++;
632 
633  return false;
634 }
635 
636 Void TDecTop::xDecodeVPS(const std::vector<UChar> *pNaluData)
637 {
638  TComVPS* vps = new TComVPS();
639 
641  m_parameterSetManager.storeVPS(vps, pNaluData);
642 }
643 
644 Void TDecTop::xDecodeSPS(const std::vector<UChar> *pNaluData)
645 {
646  TComSPS* sps = new TComSPS();
647 #if O0043_BEST_EFFORT_DECODING
648  sps->setForceDecodeBitDepth(m_forceDecodeBitDepth);
649 #endif
651  m_parameterSetManager.storeSPS(sps, pNaluData);
652 }
653 
654 Void TDecTop::xDecodePPS(const std::vector<UChar> *pNaluData)
655 {
656  TComPPS* pps = new TComPPS();
658  m_parameterSetManager.storePPS( pps, pNaluData);
659 }
660 
662 {
663  if(nalUnitType == NAL_UNIT_SUFFIX_SEI)
664  {
666  }
667  else
668  {
670 
672  if (activeParamSets.size()>0)
673  {
674  SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin());
675  assert(seiAps->activeSeqParameterSetId.size()>0);
677  {
678  printf ("Warning SPS activation with Active parameter set SEI failed");
679  }
680  }
681  }
682 }
683 
684 Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay)
685 {
686  // ignore all NAL units of layers > 0
687  if (nalu.m_nuhLayerId > 0)
688  {
689  fprintf (stderr, "Warning: found NAL unit with nuh_layer_id equal to %d. Ignoring.\n", nalu.m_nuhLayerId);
690  return false;
691  }
692  // Initialize entropy decoder
695 
696  switch (nalu.m_nalUnitType)
697  {
698  case NAL_UNIT_VPS:
699  xDecodeVPS(nalu.m_Bitstream->getFifo());
700 #if RExt__DECODER_DEBUG_BIT_STATISTICS
702 #endif
703  return false;
704 
705  case NAL_UNIT_SPS:
706  xDecodeSPS(nalu.m_Bitstream->getFifo());
707 #if RExt__DECODER_DEBUG_BIT_STATISTICS
709 #endif
710  return false;
711 
712  case NAL_UNIT_PPS:
713  xDecodePPS(nalu.m_Bitstream->getFifo());
714 #if RExt__DECODER_DEBUG_BIT_STATISTICS
716 #endif
717  return false;
718 
719  case NAL_UNIT_PREFIX_SEI:
720  case NAL_UNIT_SUFFIX_SEI:
721  xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType );
722  return false;
723 
740  return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay);
741  break;
742 
743  case NAL_UNIT_EOS:
745  m_pocCRA = 0;
747  m_prevPOC = MAX_INT;
748  m_prevSliceSkipped = false;
749  m_skippedPOC = 0;
750  return false;
751 
753  // TODO: process AU delimiter
754  return false;
755 
756  case NAL_UNIT_EOB:
757  return false;
758 
760  return false;
761 
768 
771 
780 
788  printf ("Note: found reserved NAL unit.\n");
789  return false;
806  printf ("Note: found unspecified NAL unit.\n");
807  return false;
808  default:
809  assert (0);
810  break;
811  }
812 
813  return false;
814 }
815 
823 {
826  {
827  iPOCLastDisplay++;
828  return true;
829  }
830  return false;
831 }
832 
846 Bool TDecTop::isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay)
847 {
848  if (iSkipFrame)
849  {
850  iSkipFrame--; // decrement the counter
851  return true;
852  }
853  else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet.
854  {
859  {
860  // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT.
862  }
864  {
865  m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
866  }
867  else
868  {
869  static Bool warningMessage = false;
870  if(!warningMessage)
871  {
872  printf("\nWarning: this is not a valid random access point and the data is discarded until the first CRA picture");
873  warningMessage = true;
874  }
875  return true;
876  }
877  }
878  // skip the reordered pictures, if necessary
880  {
881  iPOCLastDisplay++;
882  return true;
883  }
884  // if we reach here, then the picture is not skipped.
885  return false;
886 }
887 
Void setRefPicList(TComList< TComPic * > &rcListPic, Bool checkNumPocTotalCurr=false)
Definition: TComSlice.cpp:322
Void storeVPS(TComVPS *vps, const std::vector< UChar > *pNaluData)
store sequence parameter set and take ownership of it
Definition: TComSlice.h:1629
Void setCheckLDC(Bool b)
Definition: TComSlice.h:1401
virtual Void destroy()
Definition: TComPic.cpp:91
Void setSliceSegmentCurEndCtuTsAddr(UInt ctuTsAddr)
Definition: TComSlice.h:1479
UInt g_uiMaxCUDepth
Definition: TComRom.cpp:253
Void setNoOutputPriorPicsFlag(Bool val)
Definition: TComSlice.h:1453
Void executeLoopFilters(Int &poc, TComList< TComPic * > *&rpcListPic)
Definition: TDecTop.cpp:179
TDecTop()
Definition: TDecTop.cpp:47
Int getSPSId() const
Definition: TComSlice.h:1043
TComInputBitstream * m_Bitstream
Definition: NALread.h:60
Void create(UInt uiMaxCUDepth)
Void xDecodeSPS(const std::vector< UChar > *pNaluData)
Definition: TDecTop.cpp:644
Int getLog2MinCodingBlockSize() const
Definition: TComSlice.h:839
Void setSEIs(SEIMessages &seis)
Definition: TComPic.h:158
Bool getUseExtendedPrecision() const
Definition: TComSlice.h:887
Void init(TDecEntropy *pcEntropyDecoder, TDecSbac *pcSbacDecoder, TDecBinCABAC *pcBinCABAC, TDecCavlc *pcCavlcDecoder, TDecSlice *pcSliceDecoder, TComLoopFilter *pcLoopFilter, TComSampleAdaptiveOffset *pcSAO)
Definition: TDecGop.cpp:77
#define MAX_INT
max. value of signed 32-bit integer
Definition: CommonDef.h:116
ChannelType
Definition: TypeDef.h:361
Bool m_isNoOutputPriorPics
Definition: TDecTop.h:105
Int getSPSId() const
Definition: TComSlice.h:812
TDecCu m_cCuDecoder
Definition: TDecTop.h:85
Bool getPPSChangedFlag(Int ppsId) const
Definition: TComSlice.h:1648
UInt getNumberOfCtusInFrame() const
Definition: TComPic.h:116
picture class (symbol + YUV buffers)
Definition: TComPic.h:56
void Void
Definition: TypeDef.h:285
Void storePPS(TComPPS *pps, const std::vector< UChar > *pNaluData)
store picture parameter set and take ownership of it
Definition: TComSlice.h:1645
Void xDecodeSEI(TComInputBitstream *bs, const NalUnitType nalUnitType)
Definition: TDecTop.cpp:661
reading funtionality for NAL units
Int m_prevPOC
Definition: TDecTop.h:98
Void deleteSEIs(SEIMessages &seiList)
delete list of SEI messages (freeing the referenced objects)
Definition: SEI.cpp:79
Void init()
Definition: TDecTop.cpp:101
SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType)
output a selection of SEI messages by payload type. Ownership stays in original message list...
Definition: SEI.cpp:44
#define NULL
Definition: CommonDef.h:100
TComSlice * m_apcSlicePilot
Definition: TDecTop.h:76
TDecSbac m_cSbacDecoder
Definition: TDecTop.h:88
UInt getBitsForPOC() const
Definition: TComSlice.h:857
TComSlice * getSlice(Int i)
Definition: TComPic.h:103
Void initROM()
Definition: TComRom.cpp:146
TComPrediction m_cPrediction
Definition: TDecTop.h:81
Void xActivateParameterSets()
Definition: TDecTop.cpp:265
TComSlice * getSlice(UInt i)
Definition: TComPicSym.h:126
Bool getScalingListPresentFlag() const
Definition: TComSlice.h:924
unsigned int UInt
Definition: TypeDef.h:297
const std::vector< uint8_t > * getFifo() const
Void setRefPOCList()
Definition: TComSlice.cpp:293
UInt getSaoOffsetBitShift(ChannelType type) const
Definition: TComSlice.h:1110
NalUnitType m_nalUnitType
nal_unit_type
Definition: NAL.h:49
Void clearSPSChangedFlag(Int spsId)
Definition: TComSlice.h:1641
Bool isReferenced() const
Definition: TComSlice.h:1368
Void checkCRA(const TComReferencePictureSet *pReferencePictureSet, Int &pocCRA, NalUnitType &associatedIRAPType, TComList< TComPic * > &rcListPic)
Definition: TComSlice.cpp:539
Void initTempBuff(ChromaFormat chromaFormatIDC)
Void clearPPSChangedFlag(Int ppsId)
Definition: TComSlice.h:1649
SCALING_LIST class.
Definition: TComSlice.h:150
Void setNalUnitType(NalUnitType e)
Definition: TComSlice.h:1371
Void initCtu(TComPic *pcPic, UInt ctuRsAddr)
Definition: TComDataCU.cpp:448
Void destroy()
Definition: TDecSlice.cpp:59
Void decompressSlice(TComInputBitstream *pcBitstream, TComPic *pcPic)
Definition: TDecGop.cpp:103
UInt getMaxCUHeight() const
Definition: TComSlice.h:847
UInt getMaxDecPicBuffering(UInt tlayer) const
Definition: TComSlice.h:929
Bool getNoRaslOutputFlag() const
Definition: TComSlice.h:1457
UInt g_uiAddCUDepth
Definition: TComRom.cpp:254
Bool isSkipPictureForBLA(Int &iPOCLastDisplay)
Definition: TDecTop.cpp:822
UInt getMaxCUDepth() const
Definition: TComSlice.h:849
Void setUseScalingList(Bool bUseScalingList)
get DeQuant Coefficent
Definition: TComTrQuant.h:179
Void setSliceCurStartCtuTsAddr(UInt ctuTsAddr)
Definition: TComSlice.h:1466
UInt64 g_nSymbolCounter
Definition: TComRom.cpp:566
Void setAssociatedIRAPPOC(Int iAssociatedIRAPPOC)
Definition: TComSlice.h:1333
Bool getHandleCraAsBlaFlag() const
Definition: TComSlice.h:1460
Void setField(Bool b)
Definition: TComPic.h:154
ChromaFormat getChromaFormatIdc() const
Definition: TComSlice.h:814
Void setTLayer(UInt uiTLayer)
Definition: TComPic.h:93
Void setSliceIdx(UInt i)
Definition: TComSlice.h:1470
Void setBitstream(TComInputBitstream *p)
Definition: TDecEntropy.h:134
Int getNumRefIdx(RefPicList e) const
Definition: TComSlice.h:1353
std::vector< Int > activeSeqParameterSetId
Definition: SEI.h:154
Void setScalingListDec(const TComScalingList &scalingList, const ChromaFormat format)
Void filterPicture(TComPic *pcPic)
Definition: TDecGop.cpp:136
UInt getCtuRsToTsAddrMap(Int ctuRsAddr) const
Definition: TComPicSym.h:152
Bool getRapPicFlag() const
Definition: TComSlice.cpp:182
UInt getMaxTrSize() const
Definition: TComSlice.h:879
SEIMessages extractSeisByType(SEIMessages &seiList, SEI::PayloadType seiType)
remove a selection of SEI messages by payload type from the original list and return them in a new li...
Definition: SEI.cpp:58
Void applyReferencePictureSet(TComList< TComPic * > &rcListPic, const TComReferencePictureSet *RPSList)
Definition: TComSlice.cpp:1015
Bool isInterB() const
Definition: TComSlice.h:1405
Void setEntropyDecoder(TDecEntropyIf *p)
Definition: TDecEntropy.cpp:52
TComPicYuv * getPicYuvRec()
Definition: TComPic.h:109
Void init(TComPrediction *p)
Definition: TDecEntropy.h:126
UInt m_picStruct
Definition: SEI.h:211
TDecCavlc m_cCavlcDecoder
Definition: TDecTop.h:87
Bool m_bFirstSliceInSequence
Definition: TDecTop.h:100
virtual ~TDecTop()
Definition: TDecTop.cpp:74
Int m_pocCRA
POC number of the latest CRA picture.
Definition: TDecTop.h:71
Void setFlatScalingList(const ChromaFormat format)
Bool getDependentSliceSegmentFlag() const
Definition: TComSlice.h:1340
Bool getSPSChangedFlag(Int spsId) const
Definition: TComSlice.h:1640
Void xGetNewPicBuffer(const TComSPS &sps, const TComPPS &pps, TComPic *&rpcPic, const UInt temporalLayer)
Definition: TDecTop.cpp:132
Void create(Int picWidth, Int picHeight, ChromaFormat format, UInt maxCUWidth, UInt maxCUHeight, UInt maxCUDepth, UInt lumaBitShift, UInt chromaBitShift)
Void setNoRaslOutputFlag(Bool val)
Definition: TComSlice.h:1456
TComLoopFilter m_cLoopFilter
Definition: TDecTop.h:91
Void setTemporalLayerNonReferenceFlag(Bool x)
Definition: TComSlice.h:1517
FILE * g_hTrace
Definition: TComRom.cpp:561
TComScalingList & getScalingList()
Definition: TComSlice.h:1160
Void decodeSPS(TComSPS *pcSPS)
Definition: TDecEntropy.h:138
Void copySliceInfo(TComSlice *pcSliceSrc)
Definition: TComSlice.cpp:680
bool Bool
Definition: TypeDef.h:286
Int m_iMaxRefPicNum
Definition: TDecTop.h:68
Int g_maxTrDynamicRange[MAX_NUM_CHANNEL_TYPE]
Definition: TComRom.cpp:325
Bool isRandomAccessSkipPicture(Int &iSkipFrame, Int &iPOCLastDisplay)
Definition: TDecTop.cpp:846
UInt g_uiMaxCUHeight
Definition: TComRom.cpp:252
TComList< TComPic * > m_cListPic
Definition: TDecTop.h:74
UInt g_uiMaxCUWidth
Definition: TComRom.cpp:251
Void create()
Definition: TDecSlice.cpp:55
Bool g_bJustDoIt
Definition: TComRom.cpp:565
Int m_pocRandomAccess
POC number of the random access point (the first IDR or CRA picture)
Definition: TDecTop.h:72
PPS class.
Definition: TComSlice.h:977
Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay)
Definition: TDecTop.cpp:383
Void copyToPic(TComPicYuv *pcPicYuvDst) const
Definition: TComPicYuv.cpp:176
Void setRefPic(TComPic *p, RefPicList e, Int iRefIdx)
Definition: TComSlice.h:1391
NalUnitType m_associatedIRAPType
NAL unit type of the associated IRAP picture.
Definition: TDecTop.h:70
Bool m_craNoRaslOutputFlag
Definition: TDecTop.h:106
Void xDecodeVPS(const std::vector< UChar > *pNaluData)
Definition: TDecTop.cpp:636
UInt getPicHeightInLumaSamples() const
Definition: TComSlice.h:824
Void setAssociatedIRAPType(NalUnitType associatedIRAPType)
Definition: TComSlice.h:1335
decoder class (header)
Void deletePicBuffer()
Definition: TDecTop.cpp:110
Int m_lastPOCNoOutputPriorPics
Definition: TDecTop.h:104
reference list 0
Definition: TypeDef.h:417
Int getBitDepth(ChannelType type) const
Definition: TComSlice.h:882
Void storeSPS(TComSPS *sps, const std::vector< UChar > *pNaluData)
store sequence parameter set and take ownership of it
Definition: TComSlice.h:1637
Void parseSEImessage(TComInputBitstream *bs, SEIMessages &seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:119
Void setSliceCurEndCtuTsAddr(UInt ctuTsAddr)
Definition: TComSlice.h:1468
Void xCreateLostPicture(Int iLostPOC)
Definition: TDecTop.cpp:221
TComPicSym * getPicSym()
Definition: TComPic.h:102
UInt getQuadtreeTULog2MinSize() const
Definition: TComSlice.h:863
UInt getSliceSegmentCurStartCtuTsAddr() const
Definition: TComSlice.h:1478
Void pushBack(const C &rcT)
Definition: TComList.h:89
Bool getNoOutputPriorPicsFlag() const
Definition: TComSlice.h:1454
const TComPPS * getPPS() const
Definition: TComSlice.h:1309
UInt getPicWidthInLumaSamples() const
Definition: TComSlice.h:822
Bool m_prevSliceSkipped
Definition: TDecTop.h:101
Int getPPSId() const
Definition: TComSlice.h:1318
TComTrQuant m_cTrQuant
Definition: TDecTop.h:82
TDecEntropy m_cEntropyDecoder
Definition: TDecTop.h:86
Void init(TDecEntropy *pcEntropyDecoder, TDecCu *pcMbDecoder)
Definition: TDecSlice.cpp:63
UInt m_nuhLayerId
nuh_layer_id
Definition: NAL.h:51
Bool isIntra() const
Definition: TComSlice.h:1404
Bool getScalingListPresentFlag() const
Definition: TComSlice.h:1158
Void setTLayerInfo(UInt uiTLayer)
Definition: TComSlice.cpp:798
TComSPS * getFirstSPS()
Definition: TComSlice.h:1642
reference list 1
Definition: TypeDef.h:418
Int getPPSId() const
Definition: TComSlice.h:1041
Void destroy()
destroy internal buffers
Definition: TDecCu.cpp:105
TDecGop m_cGopDecoder
Definition: TDecTop.h:83
Int getPOC() const
Definition: TComSlice.h:1338
Int getPOC() const
Definition: TComPic.h:104
SEIReader m_seiReader
Definition: TDecTop.h:90
Void setOutputMark(Bool b)
Definition: TComPic.h:133
UInt getSliceCurStartCtuTsAddr() const
Definition: TComSlice.h:1467
TDecBinCABAC m_cBinCABAC
Definition: TDecTop.h:89
unsigned long long UInt64
Definition: TypeDef.h:318
Int g_bitDepth[MAX_NUM_CHANNEL_TYPE]
Definition: TComRom.cpp:548
Bool getScalingListFlag() const
Definition: TComSlice.h:922
const TComSPS * getActiveSPS() const
Definition: TComSlice.h:1661
UInt m_uiSliceIdx
Definition: TDecTop.h:97
TComDataCU * getCtu(UInt ctuRsAddr)
Definition: TComPic.h:105
ParameterSetManager m_parameterSetManager
Definition: TDecTop.h:75
Void setPOC(Int i)
Definition: TComSlice.h:1370
Void decodePPS(TComPPS *pcPPS)
Definition: TDecEntropy.h:139
Void destroy()
Definition: TDecTop.cpp:91
Bool m_bFirstSliceInPicture
Definition: TDecTop.h:99
Void init(UInt uiMaxTrSize, Bool useRDOQ=false, Bool useRDOQTS=false, Bool bEnc=false, Bool useTransformSkipFast=false, Bool bUseAdaptQpSelect=false)
TComPPS * getPPS(Int ppsId)
get pointer to existing picture parameter set
Definition: TComSlice.h:1647
Void decodeVPS(TComVPS *pcVPS)
Definition: TDecEntropy.h:137
Void setReconMark(Bool b)
Definition: TComPic.h:131
TComSampleAdaptiveOffset m_cSAO
Definition: TDecTop.h:92
SEIMessages m_SEIs
List of SEI messages that have been received before the first slice and between slices.
Definition: TDecTop.h:78
std::ostream * m_pDecodedSEIOutputStream
Definition: TDecTop.h:110
list template
Definition: TComList.h:61
UInt getSliceSegmentCurEndCtuTsAddr() const
Definition: TComSlice.h:1480
std::list< SEI * > SEIMessages
Definition: SEI.h:479
TComPPS * getFirstPPS()
Definition: TComSlice.h:1650
Void create(UInt uiMaxDepth, UInt uiMaxWidth, UInt uiMaxHeight, ChromaFormat chromaFormatIDC)
create internal buffers
Definition: TDecCu.cpp:73
Int m_skippedPOC
Definition: TDecTop.h:102
TDecSlice m_cSliceDecoder
Definition: TDecTop.h:84
TComScalingList & getScalingList()
Definition: TComSlice.h:927
int Int
Definition: TypeDef.h:296
Void setSliceSegmentCurStartCtuTsAddr(UInt ctuTsAddr)
Definition: TComSlice.h:1477
static UInt getMaxCUDepthOffset(const ChromaFormat chFmt, const UInt quadtreeTULog2MinSize)
Bool m_bFirstSliceInBitstream
Definition: TDecTop.h:103
Void init(TDecEntropy *pcEntropyDecoder, TComTrQuant *pcTrQuant, TComPrediction *pcPrediction)
initialize access channels
Definition: TDecCu.cpp:60
TComSPS * getSPS(Int spsId)
get pointer to existing sequence parameter set
Definition: TComSlice.h:1639
Void xDecodePPS(const std::vector< UChar > *pNaluData)
Definition: TDecTop.cpp:654
Void destroy()
Definition: TDecGop.cpp:73
UInt getNumAllocatedSlice() const
Definition: TComPic.h:139
Void setTopField(Bool b)
Definition: TComPic.h:152
const Bool g_bEncDecTraceDisable
Definition: TComRom.cpp:563
NalUnitType
Definition: CommonDef.h:218
Void create(const TComSPS &sps, const TComPPS &pps, const UInt uiMaxWidth, const UInt uiMaxHeight, const UInt uiMaxDepth, const Bool bIsVirtual)
Definition: TComPic.cpp:69
Bool getReconMark() const
Definition: TComPic.h:132
Bool activatePPS(Int ppsId, Bool isIRAP)
Definition: TComSlice.cpp:2287
SEIMessages & getSEIs()
Definition: TComPic.h:163
Void setBorderExtension(Bool b)
Definition: TComPicYuv.h:155
NalUnitType getNalUnitType() const
Definition: TComSlice.h:1372
Bool activateSPSWithSEI(Int SPSId)
Definition: TComSlice.cpp:2260
slice header class
Definition: TComSlice.h:1198
Bool getOutputMark() const
Definition: TComPic.h:134
UInt m_temporalId
temporal_id
Definition: NAL.h:50
Bool isIRAP() const
Definition: TComSlice.h:1375
UInt getTLayer() const
Definition: TComSlice.h:1434
Void setNumRefIdx(RefPicList e, Int i)
Definition: TComSlice.h:1393
TComSlice * swapSliceObject(TComSlice *p, UInt i)
Definition: TComPicSym.h:138
Bool decode(InputNALUnit &nalu, Int &iSkipFrame, Int &iPOCLastDisplay)
Definition: TDecTop.cpp:684
static Void sortPicList(TComList< TComPic * > &rcListPic)
Definition: TComSlice.cpp:193
Void setPicOutputFlag(Bool b)
Definition: TComSlice.h:1319
TComPic * m_pcPic
Definition: TDecTop.h:96
Void create()
Definition: TDecTop.cpp:84
Void initSlice()
Definition: TComSlice.cpp:155
Void setDefaultScalingList()
Definition: TComSlice.cpp:1946
Void checkNoOutputPriorPics(TComList< TComPic * > *rpcListPic)
Definition: TDecTop.cpp:202
Void setReferenced(Bool b)
Definition: TComSlice.h:1367
static Void IncrementStatisticEP(const TComCodingStatisticsClassType &stat, const Int numBits, const Int value)
TComPic * getRefPic(RefPicList e, Int iRefIdx)
Definition: TComSlice.h:1355
Int checkThatAllRefPicsAreAvailable(TComList< TComPic * > &rcListPic, const TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess=0, Bool bUseRecoveryPoint=false)
Definition: TComSlice.cpp:1094
Void destroyROM()
Definition: TComRom.cpp:230
UInt getSliceCurEndCtuTsAddr() const
Definition: TComSlice.h:1469
Void create()
Definition: TDecGop.cpp:67
Void setCurrSliceIdx(UInt i)
Definition: TComPic.h:138
UInt getMaxCUWidth() const
Definition: TComSlice.h:845
const TComSPS * getSPS() const
Definition: TComSlice.h:1306
SPS class.
Definition: TComSlice.h:722
TComReferencePictureSet * getRPS()
Definition: TComSlice.h:1324
Void decodeSliceHeader(TComSlice *pcSlice, ParameterSetManager *parameterSetManager)
Definition: TDecEntropy.h:140
Void allocateNewSlice()
Definition: TComPic.h:140