HEVC Test Model (HM)  HM-16.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TComSlice.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-2017, 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 "CommonDef.h"
39 #include "TComSlice.h"
40 #include "TComPic.h"
41 #include "TLibEncoder/TEncSbac.h"
42 #include "TLibDecoder/TDecSbac.h"
43 
44 
47 
49 : m_iPPSId ( -1 )
50 , m_PicOutputFlag ( true )
51 , m_iPOC ( 0 )
52 , m_iLastIDR ( 0 )
53 , m_iAssociatedIRAP ( 0 )
54 , m_iAssociatedIRAPType ( NAL_UNIT_INVALID )
55 , m_pRPS ( 0 )
56 , m_localRPS ( )
57 , m_rpsIdx ( 0 )
58 , m_RefPicListModification ( )
59 , m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR_W_RADL )
60 , m_eSliceType ( I_SLICE )
61 , m_iSliceQp ( 0 )
62 , m_dependentSliceSegmentFlag ( false )
64 , m_iSliceQpBase ( 0 )
65 #endif
66 , m_ChromaQpAdjEnabled ( false )
67 , m_deblockingFilterDisable ( false )
68 , m_deblockingFilterOverrideFlag ( false )
69 , m_deblockingFilterBetaOffsetDiv2( 0 )
70 , m_deblockingFilterTcOffsetDiv2 ( 0 )
71 , m_bCheckLDC ( false )
72 , m_iSliceQpDelta ( 0 )
73 , m_iDepth ( 0 )
74 , m_bRefenced ( false )
75 , m_pcVPS ( NULL )
76 , m_pcSPS ( NULL )
77 , m_pcPPS ( NULL )
78 , m_pcPic ( NULL )
79 , m_colFromL0Flag ( true )
80 , m_noOutputPriorPicsFlag ( false )
81 , m_noRaslOutputFlag ( false )
82 , m_handleCraAsBlaFlag ( false )
83 , m_colRefIdx ( 0 )
84 , m_maxNumMergeCand ( 0 )
85 , m_uiTLayer ( 0 )
86 , m_bTLayerSwitchingFlag ( false )
87 , m_sliceMode ( NO_SLICES )
88 , m_sliceArgument ( 0 )
89 , m_sliceCurStartCtuTsAddr ( 0 )
90 , m_sliceCurEndCtuTsAddr ( 0 )
91 , m_sliceIdx ( 0 )
92 , m_sliceSegmentMode ( NO_SLICES )
93 , m_sliceSegmentArgument ( 0 )
94 , m_sliceSegmentCurStartCtuTsAddr ( 0 )
95 , m_sliceSegmentCurEndCtuTsAddr ( 0 )
96 , m_nextSlice ( false )
97 , m_nextSliceSegment ( false )
98 , m_sliceBits ( 0 )
99 , m_sliceSegmentBits ( 0 )
100 , m_bFinalized ( false )
101 , m_bTestWeightPred ( false )
102 , m_bTestWeightBiPred ( false )
103 , m_substreamSizes ( )
104 , m_cabacInitFlag ( false )
105 , m_bLMvdL1Zero ( false )
106 , m_temporalLayerNonReferenceFlag ( false )
107 , m_LFCrossSliceBoundaryFlag ( false )
108 , m_enableTMVPFlag ( true )
109 , m_encCABACTableIdx (I_SLICE)
110 {
111  for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++)
112  {
113  m_aiNumRefIdx[i] = 0;
114  }
115 
116  for (UInt component = 0; component < MAX_NUM_COMPONENT; component++)
117  {
118  m_lambdas [component] = 0.0;
119  m_iSliceChromaQpDelta[component] = 0;
120  }
121 
122  initEqualRef();
123 
124  for ( Int idx = 0; idx < MAX_NUM_REF; idx++ )
125  {
126  m_list1IdxToList0Idx[idx] = -1;
127  }
128 
129  for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++)
130  {
131  for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++)
132  {
133  m_apcRefPicList [i][iNumCount] = NULL;
134  m_aiRefPOCList [i][iNumCount] = 0;
135  }
136  }
137 
138  resetWpScaling();
139  initWpAcDcParam();
140 
141  for(Int ch=0; ch < MAX_NUM_CHANNEL_TYPE; ch++)
142  {
143  m_saoEnabledFlag[ch] = false;
144  }
145 }
146 
148 {
149 }
150 
151 
153 {
154  for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++)
155  {
156  m_aiNumRefIdx[i] = 0;
157  }
158  m_colFromL0Flag = true;
159 
160  m_colRefIdx = 0;
161  initEqualRef();
162 
163  m_bCheckLDC = false;
164 
165  for (UInt component = 0; component < MAX_NUM_COMPONENT; component++)
166  {
167  m_iSliceChromaQpDelta[component] = 0;
168  }
169 
171 
172  m_bFinalized=false;
173 
174  m_substreamSizes.clear();
175  m_cabacInitFlag = false;
176  m_enableTMVPFlag = true;
177 }
178 
180 {
187 }
188 
189 
191 {
192  TComPic* pcPicExtract;
193  TComPic* pcPicInsert;
194 
195  TComList<TComPic*>::iterator iterPicExtract;
196  TComList<TComPic*>::iterator iterPicExtract_1;
197  TComList<TComPic*>::iterator iterPicInsert;
198 
199  for (Int i = 1; i < (Int)(rcListPic.size()); i++)
200  {
201  iterPicExtract = rcListPic.begin();
202  for (Int j = 0; j < i; j++)
203  {
204  iterPicExtract++;
205  }
206  pcPicExtract = *(iterPicExtract);
207  pcPicExtract->setCurrSliceIdx(0);
208 
209  iterPicInsert = rcListPic.begin();
210  while (iterPicInsert != iterPicExtract)
211  {
212  pcPicInsert = *(iterPicInsert);
213  pcPicInsert->setCurrSliceIdx(0);
214  if (pcPicInsert->getPOC() >= pcPicExtract->getPOC())
215  {
216  break;
217  }
218 
219  iterPicInsert++;
220  }
221 
222  iterPicExtract_1 = iterPicExtract; iterPicExtract_1++;
223 
224  // swap iterPicExtract and iterPicInsert, iterPicExtract = curr. / iterPicInsert = insertion position
225  rcListPic.insert (iterPicInsert, iterPicExtract, iterPicExtract_1);
226  rcListPic.erase (iterPicExtract);
227  }
228 }
229 
231 {
232  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
233  TComPic* pcPic = *(iterPic);
234  while ( iterPic != rcListPic.end() )
235  {
236  if(pcPic->getPOC() == poc)
237  {
238  break;
239  }
240  iterPic++;
241  pcPic = *(iterPic);
242  }
243  return pcPic;
244 }
245 
246 
248 {
249  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
250  TComPic* pcPic = *(iterPic);
251  TComPic* pcStPic = pcPic;
252 
253  Int pocCycle = 1 << getSPS()->getBitsForPOC();
254  if (!pocHasMsb)
255  {
256  poc = poc & (pocCycle - 1);
257  }
258 
259  while ( iterPic != rcListPic.end() )
260  {
261  pcPic = *(iterPic);
262  if (pcPic && pcPic->getPOC()!=this->getPOC() && pcPic->getSlice( 0 )->isReferenced())
263  {
264  Int picPoc = pcPic->getPOC();
265  if (!pocHasMsb)
266  {
267  picPoc = picPoc & (pocCycle - 1);
268  }
269 
270  if (poc == picPoc)
271  {
272  if(pcPic->getIsLongTerm())
273  {
274  return pcPic;
275  }
276  else
277  {
278  pcStPic = pcPic;
279  }
280  break;
281  }
282  }
283 
284  iterPic++;
285  }
286 
287  return pcStPic;
288 }
289 
291 {
292  for (Int iDir = 0; iDir < NUM_REF_PIC_LIST_01; iDir++)
293  {
294  for (Int iNumRefIdx = 0; iNumRefIdx < m_aiNumRefIdx[iDir]; iNumRefIdx++)
295  {
296  m_aiRefPOCList[iDir][iNumRefIdx] = m_apcRefPicList[iDir][iNumRefIdx]->getPOC();
297  }
298  }
299 
300 }
301 
303 {
304  Int idxL0, idxL1;
305  for ( idxL1 = 0; idxL1 < getNumRefIdx( REF_PIC_LIST_1 ); idxL1++ )
306  {
307  m_list1IdxToList0Idx[idxL1] = -1;
308  for ( idxL0 = 0; idxL0 < getNumRefIdx( REF_PIC_LIST_0 ); idxL0++ )
309  {
311  {
312  m_list1IdxToList0Idx[idxL1] = idxL0;
313  break;
314  }
315  }
316  }
317 }
318 
319 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr )
320 {
321  if ( m_eSliceType == I_SLICE)
322  {
323  ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
324  ::memset( m_aiNumRefIdx, 0, sizeof ( m_aiNumRefIdx ));
325 
326  if (!checkNumPocTotalCurr)
327  {
328  return;
329  }
330  }
331 
332  TComPic* pcRefPic= NULL;
333  static const UInt MAX_NUM_NEGATIVE_PICTURES=16;
334  TComPic* RefPicSetStCurr0[MAX_NUM_NEGATIVE_PICTURES];
335  TComPic* RefPicSetStCurr1[MAX_NUM_NEGATIVE_PICTURES];
336  TComPic* RefPicSetLtCurr[MAX_NUM_NEGATIVE_PICTURES];
337  UInt NumPicStCurr0 = 0;
338  UInt NumPicStCurr1 = 0;
339  UInt NumPicLtCurr = 0;
340  Int i;
341 
342  for(i=0; i < m_pRPS->getNumberOfNegativePictures(); i++)
343  {
344  if(m_pRPS->getUsed(i))
345  {
346  pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pRPS->getDeltaPOC(i));
347  pcRefPic->setIsLongTerm(0);
348  pcRefPic->getPicYuvRec()->extendPicBorder();
349  RefPicSetStCurr0[NumPicStCurr0] = pcRefPic;
350  NumPicStCurr0++;
351  pcRefPic->setCheckLTMSBPresent(false);
352  }
353  }
354 
356  {
357  if(m_pRPS->getUsed(i))
358  {
359  pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pRPS->getDeltaPOC(i));
360  pcRefPic->setIsLongTerm(0);
361  pcRefPic->getPicYuvRec()->extendPicBorder();
362  RefPicSetStCurr1[NumPicStCurr1] = pcRefPic;
363  NumPicStCurr1++;
364  pcRefPic->setCheckLTMSBPresent(false);
365  }
366  }
367 
369  {
370  if(m_pRPS->getUsed(i))
371  {
372  pcRefPic = xGetLongTermRefPic(rcListPic, m_pRPS->getPOC(i), m_pRPS->getCheckLTMSBPresent(i));
373  pcRefPic->setIsLongTerm(1);
374  pcRefPic->getPicYuvRec()->extendPicBorder();
375  RefPicSetLtCurr[NumPicLtCurr] = pcRefPic;
376  NumPicLtCurr++;
377  }
378  if(pcRefPic==NULL)
379  {
380  pcRefPic = xGetLongTermRefPic(rcListPic, m_pRPS->getPOC(i), m_pRPS->getCheckLTMSBPresent(i));
381  }
383  }
384 
385  // ref_pic_list_init
386  TComPic* rpsCurrList0[MAX_NUM_REF+1];
387  TComPic* rpsCurrList1[MAX_NUM_REF+1];
388  Int numPicTotalCurr = NumPicStCurr0 + NumPicStCurr1 + NumPicLtCurr;
389 
390  if (checkNumPocTotalCurr)
391  {
392  // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr:
393  // - If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
394  // - Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
395  if (getRapPicFlag())
396  {
397  assert(numPicTotalCurr == 0);
398  }
399 
400  if (m_eSliceType == I_SLICE)
401  {
402  return;
403  }
404 
405  assert(numPicTotalCurr > 0);
406  // general tier and level limit:
407  assert(numPicTotalCurr <= 8);
408  }
409 
410  Int cIdx = 0;
411  for ( i=0; i<NumPicStCurr0; i++, cIdx++)
412  {
413  rpsCurrList0[cIdx] = RefPicSetStCurr0[i];
414  }
415  for ( i=0; i<NumPicStCurr1; i++, cIdx++)
416  {
417  rpsCurrList0[cIdx] = RefPicSetStCurr1[i];
418  }
419  for ( i=0; i<NumPicLtCurr; i++, cIdx++)
420  {
421  rpsCurrList0[cIdx] = RefPicSetLtCurr[i];
422  }
423  assert(cIdx == numPicTotalCurr);
424 
425  if (m_eSliceType==B_SLICE)
426  {
427  cIdx = 0;
428  for ( i=0; i<NumPicStCurr1; i++, cIdx++)
429  {
430  rpsCurrList1[cIdx] = RefPicSetStCurr1[i];
431  }
432  for ( i=0; i<NumPicStCurr0; i++, cIdx++)
433  {
434  rpsCurrList1[cIdx] = RefPicSetStCurr0[i];
435  }
436  for ( i=0; i<NumPicLtCurr; i++, cIdx++)
437  {
438  rpsCurrList1[cIdx] = RefPicSetLtCurr[i];
439  }
440  assert(cIdx == numPicTotalCurr);
441  }
442 
443  ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm));
444 
445  for (Int rIdx = 0; rIdx < m_aiNumRefIdx[REF_PIC_LIST_0]; rIdx ++)
446  {
448  assert(cIdx >= 0 && cIdx < numPicTotalCurr);
449  m_apcRefPicList[REF_PIC_LIST_0][rIdx] = rpsCurrList0[ cIdx ];
450  m_bIsUsedAsLongTerm[REF_PIC_LIST_0][rIdx] = ( cIdx >= NumPicStCurr0 + NumPicStCurr1 );
451  }
452  if ( m_eSliceType != B_SLICE )
453  {
454  m_aiNumRefIdx[REF_PIC_LIST_1] = 0;
455  ::memset( m_apcRefPicList[REF_PIC_LIST_1], 0, sizeof(m_apcRefPicList[REF_PIC_LIST_1]));
456  }
457  else
458  {
459  for (Int rIdx = 0; rIdx < m_aiNumRefIdx[REF_PIC_LIST_1]; rIdx ++)
460  {
462  assert(cIdx >= 0 && cIdx < numPicTotalCurr);
463  m_apcRefPicList[REF_PIC_LIST_1][rIdx] = rpsCurrList1[ cIdx ];
464  m_bIsUsedAsLongTerm[REF_PIC_LIST_1][rIdx] = ( cIdx >= NumPicStCurr0 + NumPicStCurr1 );
465  }
466  }
467 }
468 
470 {
471  Int numRpsCurrTempList = 0;
472 
473  if (m_eSliceType == I_SLICE)
474  {
475  return 0;
476  }
478  {
479  if(m_pRPS->getUsed(i))
480  {
481  numRpsCurrTempList++;
482  }
483  }
484  return numRpsCurrTempList;
485 }
486 
488 {
489  for (Int iDir = 0; iDir < NUM_REF_PIC_LIST_01; iDir++)
490  {
491  for (Int iRefIdx1 = 0; iRefIdx1 < MAX_NUM_REF; iRefIdx1++)
492  {
493  for (Int iRefIdx2 = iRefIdx1; iRefIdx2 < MAX_NUM_REF; iRefIdx2++)
494  {
495  m_abEqualRef[iDir][iRefIdx1][iRefIdx2] = m_abEqualRef[iDir][iRefIdx2][iRefIdx1] = (iRefIdx1 == iRefIdx2? true : false);
496  }
497  }
498  }
499 }
500 
502 {
503  Int i;
504  TComSlice* curSlice = pic->getSlice(curSliceIdx);
505  Int currColRefPOC = curSlice->getRefPOC( RefPicList(1 - curSlice->getColFromL0Flag()), curSlice->getColRefIdx());
506  TComSlice* preSlice;
507  Int preColRefPOC;
508  for(i=curSliceIdx-1; i>=0; i--)
509  {
510  preSlice = pic->getSlice(i);
511  if(preSlice->getSliceType() != I_SLICE)
512  {
513  preColRefPOC = preSlice->getRefPOC( RefPicList(1 - preSlice->getColFromL0Flag()), preSlice->getColRefIdx());
514  if(currColRefPOC != preColRefPOC)
515  {
516  printf("Collocated_ref_idx shall always be the same for all slices of a coded picture!\n");
517  exit(EXIT_FAILURE);
518  }
519  else
520  {
521  break;
522  }
523  }
524  }
525 }
526 
527 Void TComSlice::checkCRA(const TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic)
528 {
529  for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++)
530  {
531  if(pocCRA < MAX_UINT && getPOC() > pocCRA)
532  {
533  assert(getPOC()+pReferencePictureSet->getDeltaPOC(i) >= pocCRA);
534  }
535  }
536  for(Int i = pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i < pReferencePictureSet->getNumberOfPictures(); i++)
537  {
538  if(pocCRA < MAX_UINT && getPOC() > pocCRA)
539  {
540  if (!pReferencePictureSet->getCheckLTMSBPresent(i))
541  {
542  assert(xGetLongTermRefPic(rcListPic, pReferencePictureSet->getPOC(i), false)->getPOC() >= pocCRA);
543  }
544  else
545  {
546  assert(pReferencePictureSet->getPOC(i) >= pocCRA);
547  }
548  }
549  }
551  {
552  pocCRA = getPOC();
553  associatedIRAPType = getNalUnitType();
554  }
555  else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found
556  {
557  pocCRA = getPOC();
558  associatedIRAPType = getNalUnitType();
559  }
562  || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) // BLA picture found
563  {
564  pocCRA = getPOC();
565  associatedIRAPType = getNalUnitType();
566  }
567 }
568 
587 Void TComSlice::decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic, const bool bEfficientFieldIRAPEnabled)
588 {
589  TComPic* rpcPic;
590  Int pocCurr = getPOC();
591 
596  || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR or BLA picture
597  {
598  // mark all pictures as not used for reference
599  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
600  while (iterPic != rcListPic.end())
601  {
602  rpcPic = *(iterPic);
603  rpcPic->setCurrSliceIdx(0);
604  if (rpcPic->getPOC() != pocCurr)
605  {
606  rpcPic->getSlice(0)->setReferenced(false);
607  }
608  iterPic++;
609  }
613  {
614  pocCRA = pocCurr;
615  }
616  if (bEfficientFieldIRAPEnabled)
617  {
618  bRefreshPending = true;
619  }
620  }
621  else // CRA or No DR
622  {
624  {
625  if (bRefreshPending==true && pocCurr > m_iLastIDR) // IDR reference marking pending
626  {
627  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
628  while (iterPic != rcListPic.end())
629  {
630  rpcPic = *(iterPic);
631  if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != m_iLastIDR)
632  {
633  rpcPic->getSlice(0)->setReferenced(false);
634  }
635  iterPic++;
636  }
637  bRefreshPending = false;
638  }
639  }
640  else
641  {
642  if (bRefreshPending==true && pocCurr > pocCRA) // CRA reference marking pending
643  {
644  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
645  while (iterPic != rcListPic.end())
646  {
647  rpcPic = *(iterPic);
648  if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA)
649  {
650  rpcPic->getSlice(0)->setReferenced(false);
651  }
652  iterPic++;
653  }
654  bRefreshPending = false;
655  }
656  }
657  if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found
658  {
659  bRefreshPending = true;
660  pocCRA = pocCurr;
661  }
662  }
663 }
664 
666 {
667  assert( pSrc != NULL );
668 
669  Int i, j, k;
670 
671  m_iPOC = pSrc->m_iPOC;
673  m_eSliceType = pSrc->m_eSliceType;
674  m_iSliceQp = pSrc->m_iSliceQp;
675 #if ADAPTIVE_QP_SELECTION
677 #endif
683 
684  for (i = 0; i < NUM_REF_PIC_LIST_01; i++)
685  {
686  m_aiNumRefIdx[i] = pSrc->m_aiNumRefIdx[i];
687  }
688 
689  for (i = 0; i < MAX_NUM_REF; i++)
690  {
692  }
693 
694  m_bCheckLDC = pSrc->m_bCheckLDC;
696  for (UInt component = 0; component < MAX_NUM_COMPONENT; component++)
697  {
698  m_iSliceChromaQpDelta[component] = pSrc->m_iSliceChromaQpDelta[component];
699  }
700  for (i = 0; i < NUM_REF_PIC_LIST_01; i++)
701  {
702  for (j = 0; j < MAX_NUM_REF; j++)
703  {
704  m_apcRefPicList[i][j] = pSrc->m_apcRefPicList[i][j];
705  m_aiRefPOCList[i][j] = pSrc->m_aiRefPOCList[i][j];
706  m_bIsUsedAsLongTerm[i][j] = pSrc->m_bIsUsedAsLongTerm[i][j];
707  }
709  }
710  m_iDepth = pSrc->m_iDepth;
711 
712  // referenced slice
713  m_bRefenced = pSrc->m_bRefenced;
714 
715  // access channel
716  m_pRPS = pSrc->m_pRPS;
717  m_iLastIDR = pSrc->m_iLastIDR;
718 
719  m_pcPic = pSrc->m_pcPic;
720 
722  m_colRefIdx = pSrc->m_colRefIdx;
723 
724  setLambdas(pSrc->getLambdas());
725 
726  for (i = 0; i < NUM_REF_PIC_LIST_01; i++)
727  {
728  for (j = 0; j < MAX_NUM_REF; j++)
729  {
730  for (k =0; k < MAX_NUM_REF; k++)
731  {
732  m_abEqualRef[i][j][k] = pSrc->m_abEqualRef[i][j][k];
733  }
734  }
735  }
736 
737  m_uiTLayer = pSrc->m_uiTLayer;
739 
740  m_sliceMode = pSrc->m_sliceMode;
744  m_sliceIdx = pSrc->m_sliceIdx;
749  m_nextSlice = pSrc->m_nextSlice;
751 
752  for ( UInt e=0 ; e<NUM_REF_PIC_LIST_01 ; e++ )
753  {
754  for ( UInt n=0 ; n<MAX_NUM_REF ; n++ )
755  {
756  memcpy(m_weightPredTable[e][n], pSrc->m_weightPredTable[e][n], sizeof(WPScalingParam)*MAX_NUM_COMPONENT );
757  }
758  }
759 
760  for( UInt ch = 0 ; ch < MAX_NUM_CHANNEL_TYPE; ch++)
761  {
762  m_saoEnabledFlag[ch] = pSrc->m_saoEnabledFlag[ch];
763  }
764 
766 
772 }
773 
774 
782 {
783  m_uiTLayer = uiTLayer;
784 }
785 
789 {
790  TComPic* rpcPic;
791  // loop through all pictures in the reference picture buffer
792  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
793  while ( iterPic != rcListPic.end())
794  {
795  rpcPic = *(iterPic++);
796  if(rpcPic->getSlice(0)->isReferenced() && rpcPic->getPOC() != getPOC())
797  {
798  if(rpcPic->getTLayer() >= getTLayer())
799  {
800  return false;
801  }
802  }
803  }
804  return true;
805 }
806 
810 {
811  TComPic* rpcPic;
812 
813  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
814  while ( iterPic != rcListPic.end())
815  {
816  rpcPic = *(iterPic++);
817  if(rpcPic->getSlice(0)->isReferenced() && (rpcPic->getUsedByCurr()==true) && rpcPic->getPOC() != getPOC())
818  {
819  if(rpcPic->getTLayer() >= getTLayer())
820  {
821  return false;
822  }
823  }
824  }
825  return true;
826 }
827 
828 
830 {
831  TComPic* rpcPic;
832 
833  Int nalUnitType = this->getNalUnitType();
834 
835  // When a picture is a leading picture, it shall be a RADL or RASL picture.
836  if(this->getAssociatedIRAPPOC() > this->getPOC())
837  {
838  // Do not check IRAP pictures since they may get a POC lower than their associated IRAP
839  if(nalUnitType < NAL_UNIT_CODED_SLICE_BLA_W_LP ||
840  nalUnitType > NAL_UNIT_RESERVED_IRAP_VCL23)
841  {
842  assert(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
843  nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R ||
844  nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N ||
845  nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R);
846  }
847  }
848 
849  // When a picture is a trailing picture, it shall not be a RADL or RASL picture.
850  if(this->getAssociatedIRAPPOC() < this->getPOC())
851  {
852  assert(nalUnitType != NAL_UNIT_CODED_SLICE_RASL_N &&
853  nalUnitType != NAL_UNIT_CODED_SLICE_RASL_R &&
854  nalUnitType != NAL_UNIT_CODED_SLICE_RADL_N &&
855  nalUnitType != NAL_UNIT_CODED_SLICE_RADL_R);
856  }
857 
858  // No RASL pictures shall be present in the bitstream that are associated
859  // with a BLA picture having nal_unit_type equal to BLA_W_RADL or BLA_N_LP.
860  if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
861  nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R)
862  {
865  }
866 
867  // No RASL pictures shall be present in the bitstream that are associated with
868  // an IDR picture.
869  if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
870  nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R)
871  {
874  }
875 
876  // No RADL pictures shall be present in the bitstream that are associated with
877  // a BLA picture having nal_unit_type equal to BLA_N_LP or that are associated
878  // with an IDR picture having nal_unit_type equal to IDR_N_LP.
879  if(nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N ||
880  nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R)
881  {
884  }
885 
886  // loop through all pictures in the reference picture buffer
887  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
888  while ( iterPic != rcListPic.end())
889  {
890  rpcPic = *(iterPic++);
891  if(!rpcPic->getReconMark())
892  {
893  continue;
894  }
895  if (rpcPic->getPOC() == this->getPOC())
896  {
897  continue;
898  }
899 
900  // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture
901  // in decoding order shall precede the IRAP picture in output order.
902  // (Note that any picture following in output order would be present in the DPB)
903  if(rpcPic->getSlice(0)->getPicOutputFlag() == 1 && !this->getNoOutputPriorPicsFlag())
904  {
905  if(nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP ||
906  nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ||
907  nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL ||
908  nalUnitType == NAL_UNIT_CODED_SLICE_CRA ||
909  nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP ||
910  nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL)
911  {
912  assert(rpcPic->getPOC() < this->getPOC());
913  }
914  }
915 
916  // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture
917  // in decoding order shall precede any RADL picture associated with the IRAP
918  // picture in output order.
919  if(rpcPic->getSlice(0)->getPicOutputFlag() == 1)
920  {
921  if((nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N ||
922  nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R))
923  {
924  // rpcPic precedes the IRAP in decoding order
925  if(this->getAssociatedIRAPPOC() > rpcPic->getSlice(0)->getAssociatedIRAPPOC())
926  {
927  // rpcPic must not be the IRAP picture
928  if(this->getAssociatedIRAPPOC() != rpcPic->getPOC())
929  {
930  assert(rpcPic->getPOC() < this->getPOC());
931  }
932  }
933  }
934  }
935 
936  // When a picture is a leading picture, it shall precede, in decoding order,
937  // all trailing pictures that are associated with the same IRAP picture.
938  if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
939  nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R ||
940  nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N ||
941  nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R)
942  {
943  if(rpcPic->getSlice(0)->getAssociatedIRAPPOC() == this->getAssociatedIRAPPOC())
944  {
945  // rpcPic is a picture that preceded the leading in decoding order since it exist in the DPB
946  // rpcPic would violate the constraint if it was a trailing picture
947  assert(rpcPic->getPOC() <= this->getAssociatedIRAPPOC());
948  }
949  }
950 
951  // Any RASL picture associated with a CRA or BLA picture shall precede any
952  // RADL picture associated with the CRA or BLA picture in output order
953  if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
954  nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R)
955  {
960  this->getAssociatedIRAPPOC() == rpcPic->getSlice(0)->getAssociatedIRAPPOC())
961  {
964  {
965  assert(rpcPic->getPOC() > this->getPOC());
966  }
967  }
968  }
969 
970  // Any RASL picture associated with a CRA picture shall follow, in output
971  // order, any IRAP picture that precedes the CRA picture in decoding order.
972  if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
973  nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R)
974  {
976  {
977  if(rpcPic->getSlice(0)->getPOC() < this->getAssociatedIRAPPOC() &&
984  {
985  assert(this->getPOC() > rpcPic->getSlice(0)->getPOC());
986  }
987  }
988  }
989  }
990 }
991 
992 
993 
997 {
998  TComPic* rpcPic;
999  Int i, isReference;
1000 
1002 
1003  // loop through all pictures in the reference picture buffer
1004  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
1005  while ( iterPic != rcListPic.end())
1006  {
1007  rpcPic = *(iterPic++);
1008 
1009  if(!rpcPic->getSlice( 0 )->isReferenced())
1010  {
1011  continue;
1012  }
1013 
1014  isReference = 0;
1015  // loop through all pictures in the Reference Picture Set
1016  // to see if the picture should be kept as reference picture
1017  for(i=0;i<pReferencePictureSet->getNumberOfPositivePictures()+pReferencePictureSet->getNumberOfNegativePictures();i++)
1018  {
1019  if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i))
1020  {
1021  isReference = 1;
1022  rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i));
1023  rpcPic->setIsLongTerm(0);
1024  }
1025  }
1026  for(;i<pReferencePictureSet->getNumberOfPictures();i++)
1027  {
1028  if(pReferencePictureSet->getCheckLTMSBPresent(i)==true)
1029  {
1030  if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()) == pReferencePictureSet->getPOC(i))
1031  {
1032  isReference = 1;
1033  rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i));
1034  }
1035  }
1036  else
1037  {
1038  Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC();
1039  Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1);
1040  Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1);
1041  if(rpcPic->getIsLongTerm() && curPoc == refPoc)
1042  {
1043  isReference = 1;
1044  rpcPic->setUsedByCurr(pReferencePictureSet->getUsed(i));
1045  }
1046  }
1047 
1048  }
1049  // mark the picture as "unused for reference" if it is not in
1050  // the Reference Picture Set
1051  if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && isReference == 0)
1052  {
1053  rpcPic->getSlice( 0 )->setReferenced( false );
1054  rpcPic->setUsedByCurr(0);
1055  rpcPic->setIsLongTerm(0);
1056  }
1057  //check that pictures of higher temporal layers are not used
1058  assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getTLayer()<=this->getTLayer());
1059  //check that pictures of higher or equal temporal layer are not in the RPS if the current picture is a TSA picture
1061  {
1062  assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getTLayer()<this->getTLayer());
1063  }
1064  //check that pictures marked as temporal layer non-reference pictures are not used for reference
1065  if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && rpcPic->getTLayer()==this->getTLayer())
1066  {
1067  assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getSlice( 0 )->getTemporalLayerNonReferenceFlag()==false);
1068  }
1069  }
1070 }
1071 
1074 Int TComSlice::checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, const TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess, Bool bUseRecoveryPoint)
1075 {
1076  Int atLeastOneUnabledByRecoveryPoint = 0;
1077  Int atLeastOneFlushedByPreviousIDR = 0;
1078  TComPic* rpcPic;
1079  Int i, isAvailable;
1080  Int atLeastOneLost = 0;
1081  Int atLeastOneRemoved = 0;
1082  Int iPocLost = 0;
1083 
1084  // loop through all long-term pictures in the Reference Picture Set
1085  // to see if the picture should be kept as reference picture
1086  for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++)
1087  {
1088  isAvailable = 0;
1089  // loop through all pictures in the reference picture buffer
1090  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
1091  while ( iterPic != rcListPic.end())
1092  {
1093  rpcPic = *(iterPic++);
1094  if(pReferencePictureSet->getCheckLTMSBPresent(i)==true)
1095  {
1096  if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()) == pReferencePictureSet->getPOC(i) && rpcPic->getSlice(0)->isReferenced())
1097  {
1098  if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess)
1099  {
1100  isAvailable = 0;
1101  }
1102  else
1103  {
1104  isAvailable = 1;
1105  }
1106  }
1107  }
1108  else
1109  {
1110  Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC();
1111  Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1);
1112  Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1);
1113  if(rpcPic->getIsLongTerm() && curPoc == refPoc && rpcPic->getSlice(0)->isReferenced())
1114  {
1115  if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess)
1116  {
1117  isAvailable = 0;
1118  }
1119  else
1120  {
1121  isAvailable = 1;
1122  }
1123  }
1124  }
1125  }
1126  // if there was no such long-term check the short terms
1127  if(!isAvailable)
1128  {
1129  iterPic = rcListPic.begin();
1130  while ( iterPic != rcListPic.end())
1131  {
1132  rpcPic = *(iterPic++);
1133 
1134  Int pocCycle = 1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC();
1135  Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC();
1136  Int refPoc = pReferencePictureSet->getPOC(i);
1137  if (!pReferencePictureSet->getCheckLTMSBPresent(i))
1138  {
1139  curPoc = curPoc & (pocCycle - 1);
1140  refPoc = refPoc & (pocCycle - 1);
1141  }
1142 
1143  if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc)
1144  {
1145  if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess)
1146  {
1147  isAvailable = 0;
1148  }
1149  else
1150  {
1151  isAvailable = 1;
1152  rpcPic->setIsLongTerm(1);
1153  break;
1154  }
1155  }
1156  }
1157  }
1158  // report that a picture is lost if it is in the Reference Picture Set
1159  // but not available as reference picture
1160  if(isAvailable == 0)
1161  {
1162  if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess)
1163  {
1164  if(!pReferencePictureSet->getUsed(i) )
1165  {
1166  if(printErrors)
1167  {
1168  printf("\nLong-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
1169  }
1170  atLeastOneRemoved = 1;
1171  }
1172  else
1173  {
1174  if(printErrors)
1175  {
1176  printf("\nLong-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
1177  }
1178  atLeastOneLost = 1;
1179  iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i);
1180  }
1181  }
1182  else if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess)
1183  {
1184  atLeastOneUnabledByRecoveryPoint = 1;
1185  }
1187  {
1188  atLeastOneFlushedByPreviousIDR = 1;
1189  }
1190  }
1191  }
1192  // loop through all short-term pictures in the Reference Picture Set
1193  // to see if the picture should be kept as reference picture
1194  for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++)
1195  {
1196  isAvailable = 0;
1197  // loop through all pictures in the reference picture buffer
1198  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
1199  while ( iterPic != rcListPic.end())
1200  {
1201  rpcPic = *(iterPic++);
1202 
1203  if(!rpcPic->getIsLongTerm() && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced())
1204  {
1205  if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess)
1206  {
1207  isAvailable = 0;
1208  }
1209  else
1210  {
1211  isAvailable = 1;
1212  }
1213  }
1214  }
1215  // report that a picture is lost if it is in the Reference Picture Set
1216  // but not available as reference picture
1217  if(isAvailable == 0)
1218  {
1219  if (this->getPOC() + pReferencePictureSet->getDeltaPOC(i) >= pocRandomAccess)
1220  {
1221  if(!pReferencePictureSet->getUsed(i) )
1222  {
1223  if(printErrors)
1224  {
1225  printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
1226  }
1227  atLeastOneRemoved = 1;
1228  }
1229  else
1230  {
1231  if(printErrors)
1232  {
1233  printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
1234  }
1235  atLeastOneLost = 1;
1236  iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i);
1237  }
1238  }
1239  else if(bUseRecoveryPoint && this->getPOC() > pocRandomAccess)
1240  {
1241  atLeastOneUnabledByRecoveryPoint = 1;
1242  }
1244  {
1245  atLeastOneFlushedByPreviousIDR = 1;
1246  }
1247  }
1248  }
1249 
1250  if(atLeastOneUnabledByRecoveryPoint || atLeastOneFlushedByPreviousIDR)
1251  {
1252  return -1;
1253  }
1254  if(atLeastOneLost)
1255  {
1256  return iPocLost+1;
1257  }
1258  if(atLeastOneRemoved)
1259  {
1260  return -2;
1261  }
1262  else
1263  {
1264  return 0;
1265  }
1266 }
1267 
1270 Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, const TComReferencePictureSet *pReferencePictureSet, Bool isRAP, Int pocRandomAccess, Bool bUseRecoveryPoint, const Bool bEfficientFieldIRAPEnabled)
1271 {
1272  TComPic* rpcPic;
1273  Int i, j;
1274  Int k = 0;
1275  Int nrOfNegativePictures = 0;
1276  Int nrOfPositivePictures = 0;
1277  TComReferencePictureSet* pLocalRPS = this->getLocalRPS();
1278  (*pLocalRPS)=TComReferencePictureSet();
1279 
1280  Bool irapIsInRPS = false; // Used when bEfficientFieldIRAPEnabled==true
1281 
1282  // loop through all pictures in the Reference Picture Set
1283  for(i=0;i<pReferencePictureSet->getNumberOfPictures();i++)
1284  {
1285  j = 0;
1286  // loop through all pictures in the reference picture buffer
1287  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
1288  while ( iterPic != rcListPic.end())
1289  {
1290  j++;
1291  rpcPic = *(iterPic++);
1292 
1293  if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced())
1294  {
1295  // This picture exists as a reference picture
1296  // and should be added to the explicit Reference Picture Set
1297  pLocalRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i));
1298  pLocalRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP));
1299  if (bEfficientFieldIRAPEnabled)
1300  {
1301  pLocalRPS->setUsed(k, pLocalRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) );
1302  }
1303 
1304  if(pLocalRPS->getDeltaPOC(k) < 0)
1305  {
1306  nrOfNegativePictures++;
1307  }
1308  else
1309  {
1310  if(bEfficientFieldIRAPEnabled && rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC()+1)
1311  {
1312  irapIsInRPS = true;
1313  }
1314  nrOfPositivePictures++;
1315  }
1316  k++;
1317  }
1318  }
1319  }
1320 
1321  Bool useNewRPS = false;
1322  // if current picture is complimentary field associated to IRAP, add the IRAP to its RPS.
1323  if(bEfficientFieldIRAPEnabled && m_pcPic->isField() && !irapIsInRPS)
1324  {
1325  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
1326  while ( iterPic != rcListPic.end())
1327  {
1328  rpcPic = *(iterPic++);
1329  if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC()+1)
1330  {
1331  pLocalRPS->setDeltaPOC(k, 1);
1332  pLocalRPS->setUsed(k, true);
1333  nrOfPositivePictures++;
1334  k ++;
1335  useNewRPS = true;
1336  }
1337  }
1338  }
1339  pLocalRPS->setNumberOfNegativePictures(nrOfNegativePictures);
1340  pLocalRPS->setNumberOfPositivePictures(nrOfPositivePictures);
1341  pLocalRPS->setNumberOfPictures(nrOfNegativePictures+nrOfPositivePictures);
1342  // This is a simplistic inter rps example. A smarter encoder will look for a better reference RPS to do the
1343  // inter RPS prediction with. Here we just use the reference used by pReferencePictureSet.
1344  // If pReferencePictureSet is not inter_RPS_predicted, then inter_RPS_prediction is for the current RPS also disabled.
1345  if (!pReferencePictureSet->getInterRPSPrediction() || useNewRPS )
1346  {
1347  pLocalRPS->setInterRPSPrediction(false);
1348  pLocalRPS->setNumRefIdc(0);
1349  }
1350  else
1351  {
1352  Int rIdx = this->getRPSidx() - pReferencePictureSet->getDeltaRIdxMinus1() - 1;
1353  Int deltaRPS = pReferencePictureSet->getDeltaRPS();
1354  const TComReferencePictureSet* pcRefRPS = this->getSPS()->getRPSList()->getReferencePictureSet(rIdx);
1355  Int iRefPics = pcRefRPS->getNumberOfPictures();
1356  Int iNewIdc=0;
1357  for(i=0; i<= iRefPics; i++)
1358  {
1359  Int deltaPOC = ((i != iRefPics)? pcRefRPS->getDeltaPOC(i) : 0); // check if the reference abs POC is >= 0
1360  Int iRefIdc = 0;
1361  for (j=0; j < pLocalRPS->getNumberOfPictures(); j++) // loop through the pictures in the new RPS
1362  {
1363  if ( (deltaPOC + deltaRPS) == pLocalRPS->getDeltaPOC(j))
1364  {
1365  if (pLocalRPS->getUsed(j))
1366  {
1367  iRefIdc = 1;
1368  }
1369  else
1370  {
1371  iRefIdc = 2;
1372  }
1373  }
1374  }
1375  pLocalRPS->setRefIdc(i, iRefIdc);
1376  iNewIdc++;
1377  }
1378  pLocalRPS->setInterRPSPrediction(true);
1379  pLocalRPS->setNumRefIdc(iNewIdc);
1380  pLocalRPS->setDeltaRPS(deltaRPS);
1381  pLocalRPS->setDeltaRIdxMinus1(pReferencePictureSet->getDeltaRIdxMinus1() + this->getSPS()->getRPSList()->getNumberOfReferencePictureSets() - this->getRPSidx());
1382  }
1383 
1384  this->setRPS(pLocalRPS);
1385  this->setRPSidx(-1);
1386 }
1387 
1390 {
1391  wp = m_weightACDCParam;
1392 }
1393 
1396 {
1397  for(Int iComp = 0; iComp < MAX_NUM_COMPONENT; iComp++ )
1398  {
1399  m_weightACDCParam[iComp].iAC = 0;
1400  m_weightACDCParam[iComp].iDC = 0;
1401  }
1402 }
1403 
1406 {
1407  assert (e<NUM_REF_PIC_LIST_01);
1408  wp = m_weightPredTable[e][iRefIdx];
1409 }
1410 
1413 {
1414  for ( Int e=0 ; e<NUM_REF_PIC_LIST_01 ; e++ )
1415  {
1416  for ( Int i=0 ; i<MAX_NUM_REF ; i++ )
1417  {
1418  for ( Int yuv=0 ; yuv<MAX_NUM_COMPONENT ; yuv++ )
1419  {
1420  WPScalingParam *pwp = &(m_weightPredTable[e][i][yuv]);
1421  pwp->bPresentFlag = false;
1422  pwp->uiLog2WeightDenom = 0;
1423  pwp->uiLog2WeightDenom = 0;
1424  pwp->iWeight = 1;
1425  pwp->iOffset = 0;
1426  }
1427  }
1428  }
1429 }
1430 
1433 {
1434  const Bool bUseHighPrecisionPredictionWeighting = sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag();
1435  for ( Int e=0 ; e<NUM_REF_PIC_LIST_01 ; e++ )
1436  {
1437  for ( Int i=0 ; i<MAX_NUM_REF ; i++ )
1438  {
1439  for ( Int yuv=0 ; yuv<MAX_NUM_COMPONENT ; yuv++ )
1440  {
1441  WPScalingParam *pwp = &(m_weightPredTable[e][i][yuv]);
1442  if ( !pwp->bPresentFlag )
1443  {
1444  // Inferring values not present :
1445  pwp->iWeight = (1 << pwp->uiLog2WeightDenom);
1446  pwp->iOffset = 0;
1447  }
1448 
1449  const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (sps->getBitDepth(toChannelType(ComponentID(yuv)))-8));
1450 
1451  pwp->w = pwp->iWeight;
1452  pwp->o = pwp->iOffset * offsetScalingFactor; //NOTE: This value of the ".o" variable is never used - .o is set immediately before it gets used
1453  pwp->shift = pwp->uiLog2WeightDenom;
1454  pwp->round = (pwp->uiLog2WeightDenom>=1) ? (1 << (pwp->uiLog2WeightDenom-1)) : (0);
1455  }
1456  }
1457  }
1458 }
1459 
1460 // ------------------------------------------------------------------------------------------------
1461 // Video parameter set (VPS)
1462 // ------------------------------------------------------------------------------------------------
1464 : m_VPSId ( 0)
1465 , m_uiMaxTLayers ( 1)
1466 , m_uiMaxLayers ( 1)
1467 , m_bTemporalIdNestingFlag (false)
1468 , m_numHrdParameters ( 0)
1469 , m_maxNuhReservedZeroLayerId ( 0)
1470 , m_hrdParameters ()
1471 , m_hrdOpSetIdx ()
1472 , m_cprmsPresentFlag ()
1473 {
1474 
1475  for( Int i = 0; i < MAX_TLAYER; i++)
1476  {
1477  m_numReorderPics[i] = 0;
1478  m_uiMaxDecPicBuffering[i] = 1;
1479  m_uiMaxLatencyIncrease[i] = 0;
1480  }
1481 }
1482 
1484 {
1485 }
1486 
1487 // ------------------------------------------------------------------------------------------------
1488 // Sequence parameter set (SPS)
1489 // ------------------------------------------------------------------------------------------------
1490 
1492  : m_transformSkipRotationEnabledFlag (false)
1493  , m_transformSkipContextEnabledFlag (false)
1494 // m_rdpcmEnabledFlag initialized below
1495  , m_extendedPrecisionProcessingFlag (false)
1496  , m_intraSmoothingDisabledFlag (false)
1497  , m_highPrecisionOffsetsEnabledFlag (false)
1498  , m_persistentRiceAdaptationEnabledFlag(false)
1499  , m_cabacBypassAlignmentEnabledFlag (false)
1500 {
1501  for (UInt signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++)
1502  {
1503  m_rdpcmEnabledFlag[signallingModeIndex] = false;
1504  }
1505 }
1506 
1508 : m_SPSId ( 0)
1509 , m_VPSId ( 0)
1510 , m_chromaFormatIdc (CHROMA_420)
1511 , m_uiMaxTLayers ( 1)
1512 // Structure
1513 , m_picWidthInLumaSamples (352)
1514 , m_picHeightInLumaSamples (288)
1515 , m_log2MinCodingBlockSize ( 0)
1516 , m_log2DiffMaxMinCodingBlockSize(0)
1517 , m_uiMaxCUWidth ( 32)
1518 , m_uiMaxCUHeight ( 32)
1519 , m_uiMaxTotalCUDepth ( 3)
1520 , m_bLongTermRefsPresent (false)
1521 , m_uiQuadtreeTULog2MaxSize ( 0)
1522 , m_uiQuadtreeTULog2MinSize ( 0)
1523 , m_uiQuadtreeTUMaxDepthInter ( 0)
1524 , m_uiQuadtreeTUMaxDepthIntra ( 0)
1525 // Tool list
1526 , m_usePCM (false)
1527 , m_pcmLog2MaxSize ( 5)
1528 , m_uiPCMLog2MinSize ( 7)
1529 , m_bPCMFilterDisableFlag (false)
1530 , m_uiBitsForPOC ( 8)
1531 , m_numLongTermRefPicSPS ( 0)
1532 , m_uiMaxTrSize ( 32)
1533 , m_bUseSAO (false)
1534 , m_bTemporalIdNestingFlag (false)
1535 , m_scalingListEnabledFlag (false)
1536 , m_useStrongIntraSmoothing (false)
1537 , m_vuiParametersPresentFlag (false)
1538 , m_vuiParameters ()
1539 {
1540  for(Int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
1541  {
1542  m_bitDepths.recon[ch] = 8;
1543 #if O0043_BEST_EFFORT_DECODING
1544  m_bitDepths.stream[ch] = 8;
1545 #endif
1546  m_pcmBitDepths[ch] = 8;
1547  m_qpBDOffset [ch] = 0;
1548  }
1549 
1550  for ( Int i = 0; i < MAX_TLAYER; i++ )
1551  {
1553  m_uiMaxDecPicBuffering[i] = 1;
1554  m_numReorderPics[i] = 0;
1555  }
1556 
1557  ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps));
1558  ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag));
1559 }
1560 
1562 {
1563  m_RPSList.destroy();
1564 }
1565 
1567 {
1568  m_RPSList.destroy();
1569  m_RPSList.create(numRPS);
1570 }
1571 
1572 
1573 const Int TComSPS::m_winUnitX[]={1,2,2,1};
1574 const Int TComSPS::m_winUnitY[]={1,2,1,1};
1575 
1577 : m_log2MaxTransformSkipBlockSize (2)
1578 , m_crossComponentPredictionEnabledFlag(false)
1579 , m_diffCuChromaQpOffsetDepth (0)
1580 , m_chromaQpOffsetListLen (0)
1581 // m_ChromaQpAdjTableIncludingNullEntry initialized below
1582 // m_log2SaoOffsetScale initialized below
1583 {
1584  m_ChromaQpAdjTableIncludingNullEntry[0].u.comp.CbOffset = 0; // Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0. This is initialised here and never subsequently changed.
1586  for(Int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++)
1587  {
1588  m_log2SaoOffsetScale[ch] = 0;
1589  }
1590 }
1591 
1593 : m_PPSId (0)
1594 , m_SPSId (0)
1595 , m_picInitQPMinus26 (0)
1596 , m_useDQP (false)
1597 , m_bConstrainedIntraPred (false)
1598 , m_bSliceChromaQpFlag (false)
1599 , m_uiMaxCuDQPDepth (0)
1600 , m_chromaCbQpOffset (0)
1601 , m_chromaCrQpOffset (0)
1602 , m_numRefIdxL0DefaultActive (1)
1603 , m_numRefIdxL1DefaultActive (1)
1604 , m_TransquantBypassEnabledFlag (false)
1605 , m_useTransformSkip (false)
1606 , m_dependentSliceSegmentsEnabledFlag(false)
1607 , m_tilesEnabledFlag (false)
1608 , m_entropyCodingSyncEnabledFlag (false)
1609 , m_loopFilterAcrossTilesEnabledFlag (true)
1610 , m_uniformSpacingFlag (false)
1611 , m_numTileColumnsMinus1 (0)
1612 , m_numTileRowsMinus1 (0)
1613 , m_signDataHidingEnabledFlag (false)
1614 , m_cabacInitPresentFlag (false)
1615 , m_sliceHeaderExtensionPresentFlag (false)
1616 , m_loopFilterAcrossSlicesEnabledFlag(false)
1617 , m_listsModificationPresentFlag (0)
1618 , m_numExtraSliceHeaderBits (0)
1619 {
1620 }
1621 
1623 {
1624 }
1625 
1627 : m_numberOfPictures (0)
1628 , m_numberOfNegativePictures (0)
1629 , m_numberOfPositivePictures (0)
1630 , m_numberOfLongtermPictures (0)
1631 , m_interRPSPrediction (0)
1632 , m_deltaRIdxMinus1 (0)
1633 , m_deltaRPS (0)
1634 , m_numRefIdc (0)
1635 {
1636  ::memset( m_deltaPOC, 0, sizeof(m_deltaPOC) );
1637  ::memset( m_POC, 0, sizeof(m_POC) );
1638  ::memset( m_used, 0, sizeof(m_used) );
1639  ::memset( m_refIdc, 0, sizeof(m_refIdc) );
1640  ::memset( m_bCheckLTMSB, 0, sizeof(m_bCheckLTMSB) );
1641  ::memset( m_pocLSBLT, 0, sizeof(m_pocLSBLT) );
1642  ::memset( m_deltaPOCMSBCycleLT, 0, sizeof(m_deltaPOCMSBCycleLT) );
1643  ::memset( m_deltaPocMSBPresentFlag, 0, sizeof(m_deltaPocMSBPresentFlag) );
1644 }
1645 
1647 {
1648 }
1649 
1651 {
1652  m_used[bufferNum] = used;
1653 }
1654 
1656 {
1657  m_deltaPOC[bufferNum] = deltaPOC;
1658 }
1659 
1661 {
1662  m_numberOfPictures = numberOfPictures;
1663 }
1664 
1666 {
1667  return m_used[bufferNum];
1668 }
1669 
1671 {
1672  return m_deltaPOC[bufferNum];
1673 }
1674 
1676 {
1677  return m_numberOfPictures;
1678 }
1679 
1681 {
1682  return m_POC[bufferNum];
1683 }
1684 
1686 {
1687  m_POC[bufferNum] = POC;
1688 }
1689 
1691 {
1692  return m_bCheckLTMSB[bufferNum];
1693 }
1694 
1696 {
1697  m_bCheckLTMSB[bufferNum] = b;
1698 }
1699 
1702 {
1703  m_refIdc[bufferNum] = refIdc;
1704 }
1705 
1708 {
1709  return m_refIdc[bufferNum];
1710 }
1711 
1718 {
1719  // sort in increasing order (smallest first)
1720  for(Int j=1; j < getNumberOfPictures(); j++)
1721  {
1722  Int deltaPOC = getDeltaPOC(j);
1723  Bool used = getUsed(j);
1724  for (Int k=j-1; k >= 0; k--)
1725  {
1726  Int temp = getDeltaPOC(k);
1727  if (deltaPOC < temp)
1728  {
1729  setDeltaPOC(k+1, temp);
1730  setUsed(k+1, getUsed(k));
1731  setDeltaPOC(k, deltaPOC);
1732  setUsed(k, used);
1733  }
1734  }
1735  }
1736  // flip the negative values to largest first
1737  Int numNegPics = getNumberOfNegativePictures();
1738  for(Int j=0, k=numNegPics-1; j < numNegPics>>1; j++, k--)
1739  {
1740  Int deltaPOC = getDeltaPOC(j);
1741  Bool used = getUsed(j);
1742  setDeltaPOC(j, getDeltaPOC(k));
1743  setUsed(j, getUsed(k));
1744  setDeltaPOC(k, deltaPOC);
1745  setUsed(k, used);
1746  }
1747 }
1748 
1754 {
1755  printf("DeltaPOC = { ");
1756  for(Int j=0; j < getNumberOfPictures(); j++)
1757  {
1758  printf("%d%s ", getDeltaPOC(j), (getUsed(j)==1)?"*":"");
1759  }
1760  if (getInterRPSPrediction())
1761  {
1762  printf("}, RefIdc = { ");
1763  for(Int j=0; j < getNumRefIdc(); j++)
1764  {
1765  printf("%d ", getRefIdc(j));
1766  }
1767  }
1768  printf("}\n");
1769 }
1770 
1772 : m_refPicListModificationFlagL0 (false)
1773 , m_refPicListModificationFlagL1 (false)
1774 {
1775  ::memset( m_RefPicSetIdxL0, 0, sizeof(m_RefPicSetIdxL0) );
1776  ::memset( m_RefPicSetIdxL1, 0, sizeof(m_RefPicSetIdxL1) );
1777 }
1778 
1780 {
1781 }
1782 
1784 {
1785  for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
1786  {
1787  for(UInt listId = 0; listId < SCALING_LIST_NUM; listId++)
1788  {
1789  m_scalingListCoef[sizeId][listId].resize(min<Int>(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]));
1790  }
1791  }
1792 }
1793 
1797 {
1798  for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
1799  {
1800  for(UInt listId=0;listId<SCALING_LIST_NUM;listId++)
1801  {
1802  processDefaultMatrix(sizeId, listId);
1803  }
1804  }
1805 }
1810 {
1811  UInt defaultCounter=0;
1812 
1813  for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
1814  {
1815  for(UInt listId=0;listId<SCALING_LIST_NUM;listId++)
1816  {
1817  if( !memcmp(getScalingListAddress(sizeId,listId), getScalingListDefaultAddress(sizeId, listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix
1818  && ((sizeId < SCALING_LIST_16x16) || (getScalingListDC(sizeId,listId) == 16))) // check DC value
1819  {
1820  defaultCounter++;
1821  }
1822  }
1823  }
1824 
1825  return (defaultCounter == (SCALING_LIST_NUM * SCALING_LIST_SIZE_NUM )) ? false : true;
1826 }
1827 
1833 Void TComScalingList::processRefMatrix( UInt sizeId, UInt listId , UInt refListId )
1834 {
1835  ::memcpy(getScalingListAddress(sizeId, listId),((listId == refListId)? getScalingListDefaultAddress(sizeId, refListId): getScalingListAddress(sizeId, refListId)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]));
1836 }
1837 
1839 {
1840  Int predListStep = (sizeId == SCALING_LIST_32x32? (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) : 1); // if 32x32, skip over chroma entries.
1841 
1842  for(Int predListIdx = (Int)listId ; predListIdx >= 0; predListIdx-=predListStep)
1843  {
1844  if( !memcmp(getScalingListAddress(sizeId,listId),((listId == predListIdx) ?
1845  getScalingListDefaultAddress(sizeId, predListIdx): getScalingListAddress(sizeId, predListIdx)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix
1846  && ((sizeId < SCALING_LIST_16x16) || (getScalingListDC(sizeId,listId) == getScalingListDC(sizeId,predListIdx)))) // check DC value
1847  {
1848  setRefMatrixId(sizeId, listId, predListIdx);
1849  setScalingListPredModeFlag(sizeId, listId, false);
1850  return;
1851  }
1852  }
1853  setScalingListPredModeFlag(sizeId, listId, true);
1854 }
1855 
1856 static Void outputScalingListHelp(std::ostream &os)
1857 {
1858  os << "The scaling list file specifies all matrices and their DC values; none can be missing,\n"
1859  "but their order is arbitrary.\n\n"
1860  "The matrices are specified by:\n"
1861  "<matrix name><unchecked data>\n"
1862  " <value>,<value>,<value>,....\n\n"
1863  " Line-feeds can be added arbitrarily between values, and the number of values needs to be\n"
1864  " at least the number of entries for the matrix (superfluous entries are ignored).\n"
1865  " The <unchecked data> is text on the same line as the matrix that is not checked\n"
1866  " except to ensure that the matrix name token is unique. It is recommended that it is ' ='\n"
1867  " The values in the matrices are the absolute values (0-255), not the delta values as\n"
1868  " exchanged between the encoder and decoder\n\n"
1869  "The DC values (for matrix sizes larger than 8x8) are specified by:\n"
1870  "<matrix name>_DC<unchecked data>\n"
1871  " <value>\n";
1872 
1873  os << "The permitted matrix names are:\n";
1874  for(UInt sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++)
1875  {
1876  for(UInt listIdc = 0; listIdc < SCALING_LIST_NUM; listIdc++)
1877  {
1878  if ((sizeIdc!=SCALING_LIST_32x32) || (listIdc%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) == 0))
1879  {
1880  os << " " << MatrixType[sizeIdc][listIdc] << '\n';
1881  }
1882  }
1883  }
1884 }
1885 
1887 {
1888  for(UInt sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++)
1889  {
1890  const UInt size = min(8,4<<(sizeIdc));
1891  for(UInt listIdc = 0; listIdc < SCALING_LIST_NUM; listIdc++)
1892  {
1893  if ((sizeIdc!=SCALING_LIST_32x32) || (listIdc%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) == 0))
1894  {
1895  const Int *src = getScalingListAddress(sizeIdc, listIdc);
1896  os << (MatrixType[sizeIdc][listIdc]) << " =\n ";
1897  for(UInt y=0; y<size; y++)
1898  {
1899  for(UInt x=0; x<size; x++, src++)
1900  {
1901  os << std::setw(3) << (*src) << ", ";
1902  }
1903  os << (y+1<size?"\n ":"\n");
1904  }
1905  if(sizeIdc > SCALING_LIST_8x8)
1906  {
1907  os << MatrixType_DC[sizeIdc][listIdc] << " = \n " << std::setw(3) << getScalingListDC(sizeIdc, listIdc) << "\n";
1908  }
1909  os << "\n";
1910  }
1911  }
1912  }
1913 }
1914 
1915 Bool TComScalingList::xParseScalingList(const std::string &fileName)
1916 {
1917  static const Int LINE_SIZE=1024;
1918  FILE *fp = NULL;
1919  TChar line[LINE_SIZE];
1920 
1921  if (fileName.empty())
1922  {
1923  fprintf(stderr, "Error: no scaling list file specified. Help on scaling lists being output\n");
1924  outputScalingListHelp(std::cout);
1925  std::cout << "\n\nExample scaling list file using default values:\n\n";
1926  outputScalingLists(std::cout);
1927  exit (1);
1928  return true;
1929  }
1930  else if ((fp = fopen(fileName.c_str(),"r")) == (FILE*)NULL)
1931  {
1932  fprintf(stderr, "Error: cannot open scaling list file %s for reading\n", fileName.c_str());
1933  return true;
1934  }
1935 
1936  for(UInt sizeIdc = 0; sizeIdc < SCALING_LIST_SIZE_NUM; sizeIdc++)
1937  {
1938  const UInt size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeIdc]);
1939 
1940  for(UInt listIdc = 0; listIdc < SCALING_LIST_NUM; listIdc++)
1941  {
1942  Int * const src = getScalingListAddress(sizeIdc, listIdc);
1943 
1944  if ((sizeIdc==SCALING_LIST_32x32) && (listIdc%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) != 0)) // derive chroma32x32 from chroma16x16
1945  {
1946  const Int *srcNextSmallerSize = getScalingListAddress(sizeIdc-1, listIdc);
1947  for(UInt i=0; i<size; i++)
1948  {
1949  src[i] = srcNextSmallerSize[i];
1950  }
1951  setScalingListDC(sizeIdc,listIdc,(sizeIdc > SCALING_LIST_8x8) ? getScalingListDC(sizeIdc-1, listIdc) : src[0]);
1952  }
1953  else
1954  {
1955  {
1956  fseek(fp, 0, SEEK_SET);
1957  Bool bFound=false;
1958  while ((!feof(fp)) && (!bFound))
1959  {
1960  TChar *ret = fgets(line, LINE_SIZE, fp);
1961  TChar *findNamePosition= ret==NULL ? NULL : strstr(line, MatrixType[sizeIdc][listIdc]);
1962  // This could be a match against the DC string as well, so verify it isn't
1963  if (findNamePosition!= NULL && (MatrixType_DC[sizeIdc][listIdc]==NULL || strstr(line, MatrixType_DC[sizeIdc][listIdc])==NULL))
1964  {
1965  bFound=true;
1966  }
1967  }
1968  if (!bFound)
1969  {
1970  fprintf(stderr, "Error: cannot find Matrix %s from scaling list file %s\n", MatrixType[sizeIdc][listIdc], fileName.c_str());
1971  return true;
1972  }
1973  }
1974  for (UInt i=0; i<size; i++)
1975  {
1976  Int data;
1977  if (fscanf(fp, "%d,", &data)!=1)
1978  {
1979  fprintf(stderr, "Error: cannot read value #%d for Matrix %s from scaling list file %s at file position %ld\n", i, MatrixType[sizeIdc][listIdc], fileName.c_str(), ftell(fp));
1980  return true;
1981  }
1982  if (data<0 || data>255)
1983  {
1984  fprintf(stderr, "Error: QMatrix entry #%d of value %d for Matrix %s from scaling list file %s at file position %ld is out of range (0 to 255)\n", i, data, MatrixType[sizeIdc][listIdc], fileName.c_str(), ftell(fp));
1985  return true;
1986  }
1987  src[i] = data;
1988  }
1989 
1990  //set DC value for default matrix check
1991  setScalingListDC(sizeIdc,listIdc,src[0]);
1992 
1993  if(sizeIdc > SCALING_LIST_8x8)
1994  {
1995  {
1996  fseek(fp, 0, SEEK_SET);
1997  Bool bFound=false;
1998  while ((!feof(fp)) && (!bFound))
1999  {
2000  TChar *ret = fgets(line, LINE_SIZE, fp);
2001  TChar *findNamePosition= ret==NULL ? NULL : strstr(line, MatrixType_DC[sizeIdc][listIdc]);
2002  if (findNamePosition!= NULL)
2003  {
2004  // This won't be a match against the non-DC string.
2005  bFound=true;
2006  }
2007  }
2008  if (!bFound)
2009  {
2010  fprintf(stderr, "Error: cannot find DC Matrix %s from scaling list file %s\n", MatrixType_DC[sizeIdc][listIdc], fileName.c_str());
2011  return true;
2012  }
2013  }
2014  Int data;
2015  if (fscanf(fp, "%d,", &data)!=1)
2016  {
2017  fprintf(stderr, "Error: cannot read DC %s from scaling list file %s at file position %ld\n", MatrixType_DC[sizeIdc][listIdc], fileName.c_str(), ftell(fp));
2018  return true;
2019  }
2020  if (data<0 || data>255)
2021  {
2022  fprintf(stderr, "Error: DC value %d for Matrix %s from scaling list file %s at file position %ld is out of range (0 to 255)\n", data, MatrixType[sizeIdc][listIdc], fileName.c_str(), ftell(fp));
2023  return true;
2024  }
2025  //overwrite DC value when size of matrix is larger than 16x16
2026  setScalingListDC(sizeIdc,listIdc,data);
2027  }
2028  }
2029  }
2030  }
2031 // std::cout << "\n\nRead scaling lists of:\n\n";
2032 // outputScalingLists(std::cout);
2033 
2034  fclose(fp);
2035  return false;
2036 }
2037 
2038 
2045 {
2046  const Int *src = 0;
2047  switch(sizeId)
2048  {
2049  case SCALING_LIST_4x4:
2050  src = g_quantTSDefault4x4;
2051  break;
2052  case SCALING_LIST_8x8:
2053  case SCALING_LIST_16x16:
2054  case SCALING_LIST_32x32:
2056  break;
2057  default:
2058  assert(0);
2059  src = NULL;
2060  break;
2061  }
2062  return src;
2063 }
2064 
2070 {
2071  ::memcpy(getScalingListAddress(sizeId, listId),getScalingListDefaultAddress(sizeId,listId),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]));
2072  setScalingListDC(sizeId,listId,SCALING_LIST_DC);
2073 }
2074 
2078 {
2079  for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
2080  {
2081  for(UInt listId = 0; listId < SCALING_LIST_NUM; listId++)
2082  {
2083  //check default matrix?
2084  if(getScalingListDC(sizeId,listId) == 0)
2085  {
2086  processDefaultMatrix(sizeId, listId);
2087  }
2088  }
2089  }
2090 }
2091 
2093 : m_vpsMap(MAX_NUM_VPS)
2094 , m_spsMap(MAX_NUM_SPS)
2095 , m_ppsMap(MAX_NUM_PPS)
2096 , m_activeVPSId(-1)
2097 , m_activeSPSId(-1)
2098 {
2099 }
2100 
2101 
2103 {
2104 }
2105 
2108 //Bool ParameterSetManager::activateSPSWithSEI(Int spsId)
2109 //{
2110 // TComSPS *sps = m_spsMap.getPS(spsId);
2111 // if (sps)
2112 // {
2113 // Int vpsId = sps->getVPSId();
2114 // TComVPS *vps = m_vpsMap.getPS(vpsId);
2115 // if (vps)
2116 // {
2117 // m_activeVPS = *(vps);
2118 // m_activeSPS = *(sps);
2119 // return true;
2120 // }
2121 // else
2122 // {
2123 // printf("Warning: tried to activate SPS using an Active parameter sets SEI message. Referenced VPS does not exist.");
2124 // }
2125 // }
2126 // else
2127 // {
2128 // printf("Warning: tried to activate non-existing SPS using an Active parameter sets SEI message.");
2129 // }
2130 // return false;
2131 //}
2132 
2136 {
2137  TComPPS *pps = m_ppsMap.getPS(ppsId);
2138  if (pps)
2139  {
2140  Int spsId = pps->getSPSId();
2141  if (!isIRAP && (spsId != m_activeSPSId ))
2142  {
2143  printf("Warning: tried to activate PPS referring to a inactive SPS at non-IDR.");
2144  }
2145  else
2146  {
2147  TComSPS *sps = m_spsMap.getPS(spsId);
2148  if (sps)
2149  {
2150  Int vpsId = sps->getVPSId();
2151  if (!isIRAP && (vpsId != m_activeVPSId ))
2152  {
2153  printf("Warning: tried to activate PPS referring to a inactive VPS at non-IDR.");
2154  }
2155  else
2156  {
2157  TComVPS *vps =m_vpsMap.getPS(vpsId);
2158  if (vps)
2159  {
2160  m_activeVPSId = vpsId;
2161  m_activeSPSId = spsId;
2162  return true;
2163  }
2164  else
2165  {
2166  printf("Warning: tried to activate PPS that refers to a non-existing VPS.");
2167  }
2168  }
2169  }
2170  else
2171  {
2172  printf("Warning: tried to activate a PPS that refers to a non-existing SPS.");
2173  }
2174  }
2175  }
2176  else
2177  {
2178  printf("Warning: tried to activate non-existing PPS.");
2179  }
2180 
2181  // Failed to activate if reach here.
2182  m_activeSPSId=-1;
2183  m_activeVPSId=-1;
2184  return false;
2185 }
2186 
2187 template <>
2189 {
2190  parameterSet->setPPSId(psId);
2191 }
2192 
2193 template <>
2195 {
2196  parameterSet->setSPSId(psId);
2197 }
2198 
2200  : m_profileSpace (0)
2201  , m_tierFlag (Level::MAIN)
2202  , m_profileIdc (Profile::NONE)
2203  , m_levelIdc (Level::NONE)
2204  , m_progressiveSourceFlag (false)
2205  , m_interlacedSourceFlag (false)
2206  , m_nonPackedConstraintFlag(false)
2207  , m_frameOnlyConstraintFlag(false)
2208 {
2210 }
2211 
2213 {
2216 }
2217 
2218 Void calculateParameterSetChangedFlag(Bool &bChanged, const std::vector<UChar> *pOldData, const std::vector<UChar> *pNewData)
2219 {
2220  if (!bChanged)
2221  {
2222  if ((pOldData==0 && pNewData!=0) || (pOldData!=0 && pNewData==0))
2223  {
2224  bChanged=true;
2225  }
2226  else if (pOldData!=0 && pNewData!=0)
2227  {
2228  // compare the two
2229  if (pOldData->size() != pNewData->size())
2230  {
2231  bChanged=true;
2232  }
2233  else
2234  {
2235  const UChar *pNewDataArray=&(*pNewData)[0];
2236  const UChar *pOldDataArray=&(*pOldData)[0];
2237  if (memcmp(pOldDataArray, pNewDataArray, pOldData->size()))
2238  {
2239  bChanged=true;
2240  }
2241  }
2242  }
2243  }
2244 }
2245 
Bool m_profileCompatibilityFlag[32]
Definition: TComSlice.h:190
const Int g_quantTSDefault4x4[4 *4]
Definition: TComRom.cpp:660
Int getNumberOfPositivePictures() const
Definition: TComSlice.h:109
Bool m_bIsUsedAsLongTerm[NUM_REF_PIC_LIST_01][MAX_NUM_REF+1]
Definition: TComSlice.h:1263
Bool getPicOutputFlag() const
Definition: TComSlice.h:1337
Bool m_bLMvdL1Zero
Definition: TComSlice.h:1313
Void setPPSId(Int i)
Definition: TComSlice.h:1093
const TComReferencePictureSet * m_pRPS
Definition: TComSlice.h:1237
Bool isStepwiseTemporalLayerSwitchingPointCandidate(TComList< TComPic * > &rcListPic)
Definition: TComSlice.cpp:809
virtual ~TComSPS()
Definition: TComSlice.cpp:1561
Void checkPredMode(UInt sizeId, UInt listId)
Definition: TComSlice.cpp:1838
virtual ~ParameterSetManager()
Definition: TComSlice.cpp:2102
static const Int SCALING_LIST_NUM
list number for quantization matrix
Definition: CommonDef.h:232
Void setUsed(Int bufferNum, Bool used)
Definition: TComSlice.cpp:1650
Int getSPSId() const
Definition: TComSlice.h:1094
Bool m_subLayerLevelPresentFlag[MAX_TLAYER-1]
Definition: TComSlice.h:255
T * getPS(Int psId)
Definition: TComSlice.h:1642
SBAC decoder class (header)
Bool isField() const
Definition: TComPic.h:166
Void setSPSId(Int i)
Definition: TComSlice.h:825
virtual ~TComPPS()
Definition: TComSlice.cpp:1622
Void extendPicBorder()
Definition: TComPicYuv.cpp:229
Int * getScalingListAddress(UInt sizeId, UInt listId)
get matrix coefficient
Definition: TComSlice.h:155
Void getWpAcDcParam(WPACDCParam *&wp)
get AC and DC values for weighted pred
Definition: TComSlice.cpp:1389
SliceType getSliceType() const
Definition: TComSlice.h:1353
Int m_aiRefPOCList[NUM_REF_PIC_LIST_01][MAX_NUM_REF+1]
Definition: TComSlice.h:1262
Bool getTemporalLayerNonReferenceFlag()
Definition: TComSlice.h:1530
static Void setID(T *parameterSet, const Int psId)
Bool checkDefaultScalingList()
Definition: TComSlice.cpp:1809
Void printDeltaPOC() const
Definition: TComSlice.cpp:1753
Void processRefMatrix(UInt sizeId, UInt listId, UInt refListId)
Definition: TComSlice.cpp:1833
BitDepths m_bitDepths
Definition: TComSlice.h:777
picture class (symbol + YUV buffers)
Definition: TComPic.h:56
Int m_iPOC
Definition: TComSlice.h:1233
TComPic * xGetLongTermRefPic(TComList< TComPic * > &rcListPic, Int poc, Bool pocHasMsb)
Definition: TComSlice.cpp:247
Defines version information, constants and small in-line functions.
void Void
Definition: TypeDef.h:203
Int getRPSidx() const
Definition: TComSlice.h:1345
Void initEqualRef()
Definition: TComSlice.cpp:487
Void setScalingListPredModeFlag(UInt sizeId, UInt listId, Bool bIsDPCM)
Definition: TComSlice.h:168
Int m_iLastIDR
Definition: TComSlice.h:1234
Int getUsed(Int bufferNum) const
Definition: TComSlice.cpp:1665
Void setNumberOfNegativePictures(Int number)
Definition: TComSlice.h:106
static const Int MAX_NUM_PPS
Definition: CommonDef.h:165
Int m_iDepth
Definition: TComSlice.h:1264
static const Int MRG_MAX_NUM_CANDS
MERGE.
Definition: CommonDef.h:131
const TComSPSRExt & getSpsRangeExtension() const
Definition: TComSlice.h:941
Int getVPSId() const
Definition: TComSlice.h:822
UInt m_sliceArgument
Definition: TComSlice.h:1290
NalUnitType getAssociatedIRAPType() const
Definition: TComSlice.h:1352
const Int * getScalingListDefaultAddress(UInt sizeId, UInt listId)
get default matrix coefficient
Definition: TComSlice.cpp:2044
#define NULL
Definition: CommonDef.h:107
union ChromaQpAdj::@2 u
UInt getBitsForPOC() const
Definition: TComSlice.h:869
TComSlice * getSlice(Int i)
Definition: TComPic.h:113
Void checkDcOfMatrix()
Definition: TComSlice.cpp:2077
Bool m_bCheckLDC
Definition: TComSlice.h:1256
Bool m_bRefenced
Definition: TComSlice.h:1267
Void copySliceInfo(TComSlice *pcSliceSrc)
Definition: TComSlice.cpp:665
don&#39;t use slices / slice segments
Definition: TypeDef.h:516
slice header and SPS class (header)
SliceConstraint m_sliceSegmentMode
Definition: TComSlice.h:1294
UInt m_log2SaoOffsetScale[MAX_NUM_CHANNEL_TYPE]
Definition: TComSlice.h:984
Bool m_bCheckLTMSB[MAX_NUM_REF_PICS]
Definition: TComSlice.h:80
const Int g_quantInterDefault8x8[8 *8]
Definition: TComRom.cpp:680
TComSlice * getSlice(UInt i)
Definition: TComPicSym.h:154
unsigned int UInt
Definition: TypeDef.h:212
Void setDeltaPOC(Int bufferNum, Int deltaPOC)
Definition: TComSlice.cpp:1655
Bool m_usedByCurrPicLtSPSFlag[MAX_NUM_LONG_TERM_REF_PICS]
Definition: TComSlice.h:785
UInt m_colRefIdx
Definition: TComSlice.h:1280
Void setRefPOCList()
Definition: TComSlice.cpp:290
Bool getIsLongTerm() const
Definition: TComPic.h:106
Bool isReferenced() const
Definition: TComSlice.h:1387
Void destroy()
Definition: TComSlice.h:140
Int m_iSliceQp
Definition: TComSlice.h:1243
const TComRPSList * getRPSList() const
Definition: TComSlice.h:883
Int m_deblockingFilterTcOffsetDiv2
Definition: TComSlice.h:1252
TComPic * m_apcRefPicList[NUM_REF_PIC_LIST_01][MAX_NUM_REF+1]
Definition: TComSlice.h:1261
Bool isTemporalLayerSwitchingPoint(TComList< TComPic * > &rcListPic)
Definition: TComSlice.cpp:788
Bool xParseScalingList(const std::string &fileName)
Definition: TComSlice.cpp:1915
picture class (header)
TComPic * xGetRefPic(TComList< TComPic * > &rcListPic, Int poc)
Definition: TComSlice.cpp:230
static const Int MAX_NUM_REF
max. number of entries in picture reference list
Definition: CommonDef.h:125
virtual ~TComReferencePictureSet()
Definition: TComSlice.cpp:1646
Int getScalingListDC(UInt sizeId, UInt listId) const
get DC value
Definition: TComSlice.h:166
Void setRPS(const TComReferencePictureSet *pcRPS)
Definition: TComSlice.h:1340
UInt m_ltRefPicPocLsbSps[MAX_NUM_LONG_TERM_REF_PICS]
Definition: TComSlice.h:784
Int recon[MAX_NUM_CHANNEL_TYPE]
the bit depth as indicated in the SPS
Definition: TypeDef.h:793
Bool m_LFCrossSliceBoundaryFlag
Definition: TComSlice.h:1315
Int getNumRefIdx(RefPicList e) const
Definition: TComSlice.h:1370
Void resetWpScaling()
reset Default WP tables settings : no weight.
Definition: TComSlice.cpp:1412
UInt m_sliceCurStartCtuTsAddr
Definition: TComSlice.h:1291
Bool getRefPicListModificationFlagL1() const
Definition: TComSlice.h:962
char TChar
Definition: TypeDef.h:206
Bool m_deltaPocMSBPresentFlag[MAX_NUM_REF_PICS]
Definition: TComSlice.h:83
Bool m_deblockingFilterDisable
Definition: TComSlice.h:1249
Void setInterRPSPrediction(Bool flag)
Definition: TComSlice.h:113
TComRefPicListModification m_RefPicListModification
Definition: TComSlice.h:1240
TComPicYuv * getPicYuvRec()
Definition: TComPic.h:120
Int getRefIdc(Int bufferNum) const
get the reference idc value at uiBufferNum
Definition: TComSlice.cpp:1707
Void setList1IdxToList0Idx()
Definition: TComSlice.cpp:302
Int m_POC[MAX_NUM_REF_PICS]
Definition: TComSlice.h:73
ParameterSetMap< TComVPS > m_vpsMap
Definition: TComSlice.h:1706
std::vector< Int > m_scalingListCoef[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]
quantization matrix
Definition: TComSlice.h:182
virtual ~TComVPS()
Definition: TComSlice.cpp:1483
Int getDeltaRIdxMinus1() const
Definition: TComSlice.h:116
WPScalingParam m_weightPredTable[NUM_REF_PIC_LIST_01][MAX_NUM_REF][MAX_NUM_COMPONENT]
Definition: TComSlice.h:1306
Bool m_cabacInitFlag
Definition: TComSlice.h:1311
Double m_lambdas[MAX_NUM_COMPONENT]
Definition: TComSlice.h:1283
Void setPOC(Int bufferNum, Int deltaPOC)
Definition: TComSlice.cpp:1685
Int m_pocLSBLT[MAX_NUM_REF_PICS]
Definition: TComSlice.h:81
Void setRefIdc(Int bufferNum, Int refIdc)
set the reference idc value at uiBufferNum entry to the value of iRefIdc
Definition: TComSlice.cpp:1701
Int m_deltaPOC[MAX_NUM_REF_PICS]
Definition: TComSlice.h:72
static const Int MAX_NUM_VPS
Definition: CommonDef.h:163
Int m_iSliceQpBase
Definition: TComSlice.h:1246
Void checkLeadingPictureRestrictions(TComList< TComPic * > &rcListPic)
Definition: TComSlice.cpp:829
virtual ~TComRefPicListModification()
Definition: TComSlice.cpp:1779
Void setNumberOfPositivePictures(Int number)
Definition: TComSlice.h:108
Void setDeltaRPS(Int x)
Definition: TComSlice.h:117
Bool m_rdpcmEnabledFlag[NUMBER_OF_RDPCM_SIGNALLING_MODES]
Definition: TComSlice.h:690
UInt m_maxNumMergeCand
Definition: TComSlice.h:1281
WPACDCParam m_weightACDCParam[MAX_NUM_COMPONENT]
Definition: TComSlice.h:1307
UInt m_uiMaxDecPicBuffering[MAX_TLAYER]
Definition: TComSlice.h:444
Void setScalingListDC(UInt sizeId, UInt listId, UInt u)
set DC value
Definition: TComSlice.h:165
Bool getUsedByCurr() const
Definition: TComPic.h:104
bool Bool
Definition: TypeDef.h:204
Int m_deblockingFilterBetaOffsetDiv2
Definition: TComSlice.h:1251
UInt m_sliceSegmentCurStartCtuTsAddr
Definition: TComSlice.h:1296
Bool m_nextSliceSegment
Definition: TComSlice.h:1299
TComReferencePictureSet * getReferencePictureSet(Int referencePictureSetNum)
Definition: TComSlice.h:143
#define ADAPTIVE_QP_SELECTION
G382: Adaptive reconstruction levels, non-normative part for adaptive QP selection.
Definition: TypeDef.h:112
Int getAssociatedIRAPPOC() const
Definition: TComSlice.h:1350
static const Int MAX_MATRIX_COEF_NUM
max coefficient number for quantization matrix
Definition: CommonDef.h:235
const TChar * MatrixType[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]
Definition: TComRom.cpp:600
Bool getRefPicListModificationFlagL0() const
Definition: TComSlice.h:960
PPS class.
Definition: TComSlice.h:1034
Void decodingRefreshMarking(Int &pocCRA, Bool &bRefreshPending, TComList< TComPic * > &rcListPic, const bool bEfficientFieldIRAPEnabled)
Definition: TComSlice.cpp:587
UInt m_uiMaxDecPicBuffering[MAX_TLAYER]
Definition: TComSlice.h:796
Bool m_bTLayerSwitchingFlag
Definition: TComSlice.h:1287
UInt m_uiTLayer
Definition: TComSlice.h:1286
UInt uiLog2WeightDenom
Definition: TComSlice.h:1206
TComRPSList m_RPSList
Definition: TComSlice.h:761
Int getDeltaPOC(Int bufferNum) const
Definition: TComSlice.cpp:1670
Void setRefPicList(TComList< TComPic * > &rcListPic, Bool checkNumPocTotalCurr=false)
Definition: TComSlice.cpp:319
Int getDeltaRPS() const
Definition: TComSlice.h:118
static ChannelType toChannelType(const ComponentID id)
Bool m_used[MAX_NUM_REF_PICS]
Definition: TComSlice.h:74
ChromaQpAdj m_ChromaQpAdjTableIncludingNullEntry[1+MAX_QP_OFFSET_LIST_SIZE]
Array includes entry [0] for the null offset used when cu_chroma_qp_offset_flag=0, and entries [cu_chroma_qp_offset_idx+1...] otherwise.
Definition: TComSlice.h:982
Int m_qpBDOffset[MAX_NUM_CHANNEL_TYPE]
Definition: TComSlice.h:778
Int getRefPOC(RefPicList e, Int iRefIdx) const
Definition: TComSlice.h:1375
Void processDefaultMatrix(UInt sizeId, UInt listId)
Definition: TComSlice.cpp:2069
reference list 0
Definition: TypeDef.h:372
Int getBitDepth(ChannelType type) const
Definition: TComSlice.h:894
Void setUsedByCurr(Bool bUsed)
Definition: TComPic.h:105
Int m_iSliceChromaQpDelta[MAX_NUM_COMPONENT]
Definition: TComSlice.h:1260
RefPicList
reference list index
Definition: TypeDef.h:370
Bool getColFromL0Flag() const
Definition: TComSlice.h:1377
static Void sortPicList(TComList< TComPic * > &rcListPic)
Definition: TComSlice.cpp:190
TComPicSym * getPicSym()
Definition: TComPic.h:111
Void getWpScaling(RefPicList e, Int iRefIdx, WPScalingParam *&wp)
get tables for weighted prediction
Definition: TComSlice.cpp:1405
Void setCheckLTMSBPresent(Int bufferNum, Bool b)
Definition: TComSlice.cpp:1695
unsigned char UChar
Definition: TypeDef.h:208
UInt m_sliceIdx
Definition: TComSlice.h:1293
Bool getCheckLTMSBPresent(Int bufferNum) const
Definition: TComSlice.cpp:1690
Bool getNoOutputPriorPicsFlag() const
Definition: TComSlice.h:1468
const UInt g_scalingListSize[SCALING_LIST_SIZE_NUM]
Definition: TComRom.cpp:692
UInt m_numReorderPics[MAX_TLAYER]
Definition: TComSlice.h:443
Void setNumberOfPictures(Int numberOfPictures)
Definition: TComSlice.cpp:1660
Bool m_deblockingFilterOverrideFlag
Definition: TComSlice.h:1250
Void setRPSidx(Int rpsIdx)
Definition: TComSlice.h:1344
Void initWpScaling(const TComSPS *sps)
init WP table
Definition: TComSlice.cpp:1432
reference list 1
Definition: TypeDef.h:373
Void checkCRA(const TComReferencePictureSet *pReferencePictureSet, Int &pocCRA, NalUnitType &associatedIRAPType, TComList< TComPic * > &rcListPic)
Definition: TComSlice.cpp:527
Void initWpAcDcParam()
init AC and DC values for weighted pred
Definition: TComSlice.cpp:1395
Int getPOC() const
Definition: TComSlice.h:1354
Int getPOC() const
Definition: TComPic.h:115
virtual ~TComSlice()
Definition: TComSlice.cpp:147
Int m_deltaPOCMSBCycleLT[MAX_NUM_REF_PICS]
Definition: TComSlice.h:82
static const Int MAX_TLAYER
Explicit temporal layer QP offset - max number of temporal layer.
Definition: CommonDef.h:134
Context-adaptive entropy encoder class (header)
Int m_list1IdxToList0Idx[MAX_NUM_REF]
Definition: TComSlice.h:1253
SliceType m_eSliceType
Definition: TComSlice.h:1242
ParameterSetMap< TComSPS > m_spsMap
Definition: TComSlice.h:1710
ParameterSetMap< TComPPS > m_ppsMap
Definition: TComSlice.h:1711
Void setIsLongTerm(Bool lt)
Definition: TComPic.h:107
UInt m_uiMaxLatencyIncrease[MAX_TLAYER]
Definition: TComSlice.h:445
Void initSlice()
Definition: TComSlice.cpp:152
Int getNumberOfReferencePictureSets() const
Definition: TComSlice.h:146
Bool m_abEqualRef[NUM_REF_PIC_LIST_01][MAX_NUM_REF][MAX_NUM_REF]
Definition: TComSlice.h:1285
std::vector< UInt > m_substreamSizes
Definition: TComSlice.h:1309
Int m_iSliceQpDelta
Definition: TComSlice.h:1259
Int getNumberOfNegativePictures() const
Definition: TComSlice.h:107
Int m_refIdc[MAX_NUM_REF_PICS+1]
Definition: TComSlice.h:79
static const Int m_winUnitX[NUM_CHROMA_FORMAT]
Definition: TComSlice.h:806
TComPic * m_pcPic
Definition: TComSlice.h:1273
UInt getTLayer() const
Definition: TComPic.h:101
Void setRefMatrixId(UInt sizeId, UInt listId, UInt u)
set reference matrix ID
Definition: TComSlice.h:159
Int getNumRefIdc() const
Definition: TComSlice.h:120
Void checkColRefIdx(UInt curSliceIdx, TComPic *pic)
Definition: TComSlice.cpp:501
Void createRPSList(Int numRPS)
Definition: TComSlice.cpp:1566
Int getPOC(Int bufferNum) const
Definition: TComSlice.cpp:1680
UInt getRefPicSetIdxL1(UInt idx) const
Definition: TComSlice.h:966
Int getNumberOfPictures() const
Definition: TComSlice.cpp:1675
int Int
Definition: TypeDef.h:211
const char data[10]
Void setCheckLTMSBPresent(Bool b)
Definition: TComPic.h:108
SliceType m_encCABACTableIdx
Definition: TComSlice.h:1319
Bool m_bFinalized
Definition: TComSlice.h:1302
Void applyReferencePictureSet(TComList< TComPic * > &rcListPic, const TComReferencePictureSet *RPSList)
Definition: TComSlice.cpp:996
static Void outputScalingListHelp(std::ostream &os)
Definition: TComSlice.cpp:1856
static const UInt MAX_UINT
max. value of unsigned 32-bit integer
Definition: CommonDef.h:114
ComponentID
Definition: TypeDef.h:308
Int getNumRpsCurrTempList() const
Definition: TComSlice.cpp:469
const Double * getLambdas() const
Definition: TComSlice.h:1428
Bool getRapPicFlag() const
Definition: TComSlice.cpp:179
Void setDeltaRIdxMinus1(Int x)
Definition: TComSlice.h:115
NalUnitType
Definition: TypeDef.h:664
Int checkThatAllRefPicsAreAvailable(TComList< TComPic * > &rcListPic, const TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess=0, Bool bUseRecoveryPoint=false)
Definition: TComSlice.cpp:1074
const TChar * MatrixType_DC[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]
Definition: TComRom.cpp:636
Void setLambdas(const Double lambdas[MAX_NUM_COMPONENT])
Definition: TComSlice.h:1427
Bool getReconMark() const
Definition: TComPic.h:143
Bool m_nextSlice
Definition: TComSlice.h:1298
Int getNumberOfLongtermPictures() const
Definition: TComSlice.h:111
Bool m_saoEnabledFlag[MAX_NUM_CHANNEL_TYPE]
Definition: TComSlice.h:1230
Bool activatePPS(Int ppsId, Bool isIRAP)
Definition: TComSlice.cpp:2135
UInt m_RefPicSetIdxL0[REF_PIC_LIST_NUM_IDX]
Definition: TComSlice.h:953
Void setTLayerInfo(UInt uiTLayer)
Definition: TComSlice.cpp:781
Void create(Int numberOfEntries)
Definition: TComSlice.h:139
Int m_numReorderPics[MAX_TLAYER]
Definition: TComSlice.h:764
static const Int m_winUnitY[NUM_CHROMA_FORMAT]
Definition: TComSlice.h:807
Int m_aiNumRefIdx[NUM_REF_PIC_LIST_01]
Definition: TComSlice.h:1254
UInt getColRefIdx() const
Definition: TComSlice.h:1378
Bool getInterRPSPrediction() const
Definition: TComSlice.h:114
Void createExplicitReferencePictureSetFromReference(TComList< TComPic * > &rcListPic, const TComReferencePictureSet *pReferencePictureSet, Bool isRAP, Int pocRandomAccess, Bool bUseRecoveryPoint, const Bool bEfficientFieldIRAPEnabled)
Definition: TComSlice.cpp:1270
Bool m_enableTMVPFlag
Definition: TComSlice.h:1317
Void outputScalingLists(std::ostream &os) const
Definition: TComSlice.cpp:1886
Reference Picture Set class.
Definition: TComSlice.h:65
NalUnitType getNalUnitType() const
Definition: TComSlice.h:1391
slice header class
Definition: TComSlice.h:1225
Void calculateParameterSetChangedFlag(Bool &bChanged, const std::vector< UChar > *pOldData, const std::vector< UChar > *pNewData)
Definition: TComSlice.cpp:2218
UInt getTLayer() const
Definition: TComSlice.h:1453
Bool m_ChromaQpAdjEnabled
Definition: TComSlice.h:1248
UInt m_sliceCurEndCtuTsAddr
Definition: TComSlice.h:1292
Int m_pcmBitDepths[MAX_NUM_CHANNEL_TYPE]
Definition: TComSlice.h:779
UInt m_sliceSegmentArgument
Definition: TComSlice.h:1295
Void setDefaultScalingList()
Definition: TComSlice.cpp:1796
static const Int SCALING_LIST_DC
default DC value
Definition: CommonDef.h:239
Void setReferenced(Bool b)
Definition: TComSlice.h:1386
Bool m_subLayerProfilePresentFlag[MAX_TLAYER-1]
Definition: TComSlice.h:254
SliceConstraint m_sliceMode
Definition: TComSlice.h:1289
UInt m_RefPicSetIdxL1[REF_PIC_LIST_NUM_IDX]
Definition: TComSlice.h:954
NalUnitType m_eNalUnitType
Nal unit type for the slice.
Definition: TComSlice.h:1241
TComReferencePictureSet * getLocalRPS()
Definition: TComSlice.h:1342
UInt m_sliceSegmentCurEndCtuTsAddr
Definition: TComSlice.h:1297
UInt m_uiMaxLatencyIncreasePlus1[MAX_TLAYER]
Definition: TComSlice.h:797
static const Int MAX_NUM_SPS
Definition: CommonDef.h:164
Void setNumRefIdc(Int x)
Definition: TComSlice.h:119
UInt getRefPicSetIdxL0(UInt idx) const
Definition: TComSlice.h:964
Void setCurrSliceIdx(UInt i)
Definition: TComPic.h:149
const Int g_quantIntraDefault8x8[8 *8]
Definition: TComRom.cpp:668
const TComSPS * getSPS() const
Definition: TComSlice.h:1329
SPS class.
Definition: TComSlice.h:740
Bool getHighPrecisionOffsetsEnabledFlag() const
Definition: TComSlice.h:729
struct ChromaQpAdj::@2::@3 comp
Bool m_colFromL0Flag
Definition: TComSlice.h:1274