HEVC Test Model (HM)  HM-16.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TEncTop.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 "TLibCommon/CommonDef.h"
39 #include "TEncTop.h"
40 #include "TEncPic.h"
42 #if FAST_BIT_EST
44 #endif
45 
48 
49 // ====================================================================================================================
50 // Constructor / destructor / create / destroy
51 // ====================================================================================================================
52 
54  m_spsMap(MAX_NUM_SPS)
55  , m_ppsMap(MAX_NUM_PPS)
56 {
57  m_iPOCLast = -1;
58  m_iNumPicRcvd = 0;
63 #if ENC_DEC_TRACE
64  if (g_hTrace == NULL)
65  {
66  g_hTrace = fopen( "TraceEnc.txt", "wb" );
67  }
68  g_bJustDoIt = g_bEncDecTraceDisable;
69  g_nSymbolCounter = 0;
70 #endif
71 
72  m_iMaxRefPicNum = 0;
73 
74 #if FAST_BIT_EST
76 #endif
77 }
78 
80 {
81 #if ENC_DEC_TRACE
82  if (g_hTrace != stdout)
83  {
84  fclose( g_hTrace );
85  }
86 #endif
87 }
88 
90 {
91  // initialize global variables
92  initROM();
93 
94  // create processing unit classes
98  if (m_bUseSAO)
99  {
102  }
103 #if ADAPTIVE_QP_SELECTION
105  {
107  }
108 #endif
109 
111 
112  if ( m_RCEnableRateControl )
113  {
116  }
117 
119 #if FAST_BIT_EST
121 #else
123 #endif
124 
125  for ( Int iDepth = 0; iDepth < m_maxTotalCUDepth+1; iDepth++ )
126  {
127  m_pppcRDSbacCoder[iDepth] = new TEncSbac* [CI_NUM];
128 #if FAST_BIT_EST
130 #else
131  m_pppcBinCoderCABAC[iDepth] = new TEncBinCABAC* [CI_NUM];
132 #endif
133 
134  for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ )
135  {
136  m_pppcRDSbacCoder[iDepth][iCIIdx] = new TEncSbac;
137 #if FAST_BIT_EST
138  m_pppcBinCoderCABAC [iDepth][iCIIdx] = new TEncBinCABACCounter;
139 #else
140  m_pppcBinCoderCABAC [iDepth][iCIIdx] = new TEncBinCABAC;
141 #endif
142  m_pppcRDSbacCoder [iDepth][iCIIdx]->init( m_pppcBinCoderCABAC [iDepth][iCIIdx] );
143  }
144  }
145 }
146 
148 {
149  // destroy processing unit classes
153  m_cEncSAO. destroyEncData();
154  m_cEncSAO. destroy();
156  m_cRateCtrl. destroy();
157  m_cSearch. destroy();
158  Int iDepth;
159  for ( iDepth = 0; iDepth < m_maxTotalCUDepth+1; iDepth++ )
160  {
161  for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ )
162  {
163  delete m_pppcRDSbacCoder[iDepth][iCIIdx];
164  delete m_pppcBinCoderCABAC[iDepth][iCIIdx];
165  }
166  }
167 
168  for ( iDepth = 0; iDepth < m_maxTotalCUDepth+1; iDepth++ )
169  {
170  delete [] m_pppcRDSbacCoder[iDepth];
171  delete [] m_pppcBinCoderCABAC[iDepth];
172  }
173 
174  delete [] m_pppcRDSbacCoder;
175  delete [] m_pppcBinCoderCABAC;
176 
177  // destroy ROM
178  destroyROM();
179 
180  return;
181 }
182 
183 Void TEncTop::init(Bool isFieldCoding)
184 {
185  TComSPS &sps0=*(m_spsMap.allocatePS(0)); // NOTE: implementations that use more than 1 SPS need to be aware of activation issues.
186  TComPPS &pps0=*(m_ppsMap.allocatePS(0));
187  // initialize SPS
188  xInitSPS(sps0);
189  xInitVPS(m_cVPS, sps0);
190 
192  {
194  }
195 
197 
198  // initialize PPS
199  xInitPPS(pps0, sps0);
200  xInitRPS(sps0, isFieldCoding);
201  xInitScalingLists(sps0, pps0);
202 
204  {
205  TComPPS &pps1=*(m_ppsMap.allocatePS(1));
206  xInitPPS(pps1, sps0);
207  xInitScalingLists(sps0, pps1);
208  }
209 
210  // initialize processing unit classes
211  m_cGOPEncoder. init( this );
212  m_cSliceEncoder.init( this );
213  m_cCuEncoder. init( this );
215 
216  // initialize transform & quantization class
218 
220  m_useRDOQ,
221  m_useRDOQTS,
223  true
227 #endif
228  );
229 
230  // initialize encoder search class
232 
233  m_iMaxRefPicNum = 0;
234 }
235 
237 {
238  // Initialise scaling lists
239  // The encoder will only use the SPS scaling lists. The PPS will never be marked present.
240  const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE] =
241  {
244  };
246  {
247  getTrQuant()->setFlatScalingList(maxLog2TrDynamicRange, sps.getBitDepths());
248  getTrQuant()->setUseScalingList(false);
249  sps.setScalingListPresentFlag(false);
250  pps.setScalingListPresentFlag(false);
251  }
253  {
255  sps.setScalingListPresentFlag(false);
256  pps.setScalingListPresentFlag(false);
257 
258  getTrQuant()->setScalingList(&(sps.getScalingList()), maxLog2TrDynamicRange, sps.getBitDepths());
259  getTrQuant()->setUseScalingList(true);
260  }
262  {
265  {
266  Bool bParsedScalingList=false; // Use of boolean so that assertion outputs useful string
267  assert(bParsedScalingList);
268  exit(1);
269  }
272  pps.setScalingListPresentFlag(false);
273  getTrQuant()->setScalingList(&(sps.getScalingList()), maxLog2TrDynamicRange, sps.getBitDepths());
274  getTrQuant()->setUseScalingList(true);
275  }
276  else
277  {
278  printf("error : ScalingList == %d not supported\n",getUseScalingListId());
279  assert(0);
280  }
281 
283  {
284  // Prepare delta's:
285  for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
286  {
287  const Int predListStep = (sizeId == SCALING_LIST_32x32? (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) : 1); // if 32x32, skip over chroma entries.
288 
289  for(UInt listId = 0; listId < SCALING_LIST_NUM; listId+=predListStep)
290  {
291  sps.getScalingList().checkPredMode( sizeId, listId );
292  }
293  }
294  }
295 }
296 
297 // ====================================================================================================================
298 // Public member functions
299 // ====================================================================================================================
300 
302 {
303  TComList<TComPic*>::iterator iterPic = m_cListPic.begin();
304  Int iSize = Int( m_cListPic.size() );
305 
306  for ( Int i = 0; i < iSize; i++ )
307  {
308  TComPic* pcPic = *(iterPic++);
309 
310  pcPic->destroy();
311  delete pcPic;
312  pcPic = NULL;
313  }
314 }
315 
329 Void TEncTop::encode( Bool flush, TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded )
330 {
331  if (pcPicYuvOrg != NULL)
332  {
333  // get original YUV
334  TComPic* pcPicCurr = NULL;
335 
336  Int ppsID=-1; // Use default PPS ID
337  if (getWCGChromaQPControl().isEnabled())
338  {
339  ppsID=getdQPs()[ m_iPOCLast+1 ];
340  }
341  xGetNewPicBuffer( pcPicCurr, ppsID );
342  pcPicYuvOrg->copyToPic( pcPicCurr->getPicYuvOrg() );
343  pcPicYuvTrueOrg->copyToPic( pcPicCurr->getPicYuvTrueOrg() );
344 
345  // compute image characteristics
346  if ( getUseAdaptiveQP() )
347  {
348  m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcPicCurr ) );
349  }
350  }
351 
352  if ((m_iNumPicRcvd == 0) || (!flush && (m_iPOCLast != 0) && (m_iNumPicRcvd != m_iGOPSize) && (m_iGOPSize != 0)))
353  {
354  iNumEncoded = 0;
355  return;
356  }
357 
358  if ( m_RCEnableRateControl )
359  {
361  }
362 
363  // compress GOP
364 #if JVET_F0064_MSSSIM
365  m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, false, false, snrCSC, m_printFrameMSE, m_printMSSSIM);
366 #else
367  m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, false, false, snrCSC, m_printFrameMSE);
368 #endif
369 
370  if ( m_RCEnableRateControl )
371  {
373  }
374 
375  iNumEncoded = m_iNumPicRcvd;
376  m_iNumPicRcvd = 0;
377  m_uiNumAllPicCoded += iNumEncoded;
378 }
379 
383 Void separateFields(Pel* org, Pel* dstField, UInt stride, UInt width, UInt height, Bool isTop)
384 {
385  if (!isTop)
386  {
387  org += stride;
388  }
389  for (Int y = 0; y < height>>1; y++)
390  {
391  for (Int x = 0; x < width; x++)
392  {
393  dstField[x] = org[x];
394  }
395 
396  dstField += stride;
397  org += stride*2;
398  }
399 
400 }
401 
402 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Bool isTff)
403 {
404  iNumEncoded = 0;
405 
406  for (Int fieldNum=0; fieldNum<2; fieldNum++)
407  {
408  if (pcPicYuvOrg)
409  {
410 
411  /* -- field initialization -- */
412  const Bool isTopField=isTff==(fieldNum==0);
413 
414  TComPic *pcField;
415  xGetNewPicBuffer( pcField, -1 );
416  pcField->setReconMark (false); // where is this normally?
417 
418  if (fieldNum==1) // where is this normally?
419  {
420  TComPicYuv* rpcPicYuvRec;
421 
422  // org. buffer
423  if ( rcListPicYuvRecOut.size() >= (UInt)m_iGOPSize+1 ) // need to maintain field 0 in list of RecOuts while processing field 1. Hence +1 on m_iGOPSize.
424  {
425  rpcPicYuvRec = rcListPicYuvRecOut.popFront();
426  }
427  else
428  {
429  rpcPicYuvRec = new TComPicYuv;
431  }
432  rcListPicYuvRecOut.pushBack( rpcPicYuvRec );
433  }
434 
435  pcField->getSlice(0)->setPOC( m_iPOCLast ); // superfluous?
436 #if !REDUCED_ENCODER_MEMORY
437  pcField->getPicYuvRec()->setBorderExtension(false);// where is this normally?
438 #endif
439 
440  pcField->setTopField(isTopField); // interlaced requirement
441 
442  for (UInt componentIndex = 0; componentIndex < pcPicYuvOrg->getNumberValidComponents(); componentIndex++)
443  {
444  const ComponentID component = ComponentID(componentIndex);
445  const UInt stride = pcPicYuvOrg->getStride(component);
446 
447  separateFields((pcPicYuvOrg->getBuf(component) + pcPicYuvOrg->getMarginX(component) + (pcPicYuvOrg->getMarginY(component) * stride)),
448  pcField->getPicYuvOrg()->getAddr(component),
449  pcPicYuvOrg->getStride(component),
450  pcPicYuvOrg->getWidth(component),
451  pcPicYuvOrg->getHeight(component),
452  isTopField);
453 
454  separateFields((pcPicYuvTrueOrg->getBuf(component) + pcPicYuvTrueOrg->getMarginX(component) + (pcPicYuvTrueOrg->getMarginY(component) * stride)),
455  pcField->getPicYuvTrueOrg()->getAddr(component),
456  pcPicYuvTrueOrg->getStride(component),
457  pcPicYuvTrueOrg->getWidth(component),
458  pcPicYuvTrueOrg->getHeight(component),
459  isTopField);
460  }
461 
462  // compute image characteristics
463  if ( getUseAdaptiveQP() )
464  {
465  m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcField ) );
466  }
467  }
468 
469  if ( m_iNumPicRcvd && ((flush&&fieldNum==1) || (m_iPOCLast/2)==0 || m_iNumPicRcvd==m_iGOPSize ) )
470  {
471  // compress GOP
472 #if JVET_F0064_MSSSIM
473  m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, true, isTff, snrCSC, m_printFrameMSE, m_printMSSSIM);
474 #else
475  m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, true, isTff, snrCSC, m_printFrameMSE);
476 #endif
477 
478  iNumEncoded += m_iNumPicRcvd;
480  m_iNumPicRcvd = 0;
481  }
482  }
483 }
484 
485 // ====================================================================================================================
486 // Protected member functions
487 // ====================================================================================================================
488 
497 {
498  rpcPic=0;
499 
500  // At this point, the SPS and PPS can be considered activated - they are copied to the new TComPic.
501  const TComPPS *pPPS=(ppsId<0) ? m_ppsMap.getFirstPS() : m_ppsMap.getPS(ppsId);
502  assert (pPPS!=0);
503  const TComPPS &pps=*pPPS;
504 
505  const TComSPS *pSPS=m_spsMap.getPS(pps.getSPSId());
506  assert (pSPS!=0);
507  const TComSPS &sps=*pSPS;
508 
510 
511  // use an entry in the buffered list if the maximum number that need buffering has been reached:
512  if (m_cListPic.size() >= (UInt)(m_iGOPSize + getMaxDecPicBuffering(MAX_TLAYER-1) + 2) )
513  {
514  TComList<TComPic*>::iterator iterPic = m_cListPic.begin();
515  Int iSize = Int( m_cListPic.size() );
516  for ( Int i = 0; i < iSize; i++ )
517  {
518  rpcPic = *iterPic;
519  if(rpcPic->getSlice(0)->isReferenced() == false)
520  {
521  break;
522  }
523  iterPic++;
524  }
525 
526  // If PPS ID is the same, we will assume that it has not changed since it was last used
527  // and return the old object.
528  if (pps.getPPSId() == rpcPic->getPicSym()->getPPS().getPPSId())
529  {
530 #if REDUCED_ENCODER_MEMORY
533 #endif
534  }
535  else
536  {
537  // the IDs differ - free up an entry in the list, and then create a new one, as with the case where the max buffering state has not been reached.
538  delete rpcPic;
539  m_cListPic.erase(iterPic);
540  rpcPic=0;
541  }
542  }
543 
544  if (rpcPic==0)
545  {
546  if ( getUseAdaptiveQP() )
547  {
548  TEncPic* pcEPic = new TEncPic;
549 #if REDUCED_ENCODER_MEMORY
550  pcEPic->create( sps, pps, pps.getMaxCuDQPDepth()+1);
551 #else
552  pcEPic->create( sps, pps, pps.getMaxCuDQPDepth()+1, false);
553 #endif
554  rpcPic = pcEPic;
555  }
556  else
557  {
558  rpcPic = new TComPic;
559 #if REDUCED_ENCODER_MEMORY
560  rpcPic->create( sps, pps, true, false );
561 #else
562  rpcPic->create( sps, pps, false );
563 #endif
564  }
565 
566  m_cListPic.pushBack( rpcPic );
567  }
568  rpcPic->setReconMark (false);
569 
570  m_iPOCLast++;
571  m_iNumPicRcvd++;
572 
573  rpcPic->getSlice(0)->setPOC( m_iPOCLast );
574 #if !REDUCED_ENCODER_MEMORY
575  // mark it should be extended
576  rpcPic->getPicYuvRec()->setBorderExtension(false);
577 #endif
578 }
579 
581 {
582  // The SPS must have already been set up.
583  // set the VPS profile information.
584  *vps.getPTL() = *sps.getPTL();
585  vps.setMaxOpSets(1);
586  vps.getTimingInfo()->setTimingInfoPresentFlag ( false );
587  vps.setNumHrdParameters( 0 );
588 
589  vps.createHrdParamBuffer();
590  for( UInt i = 0; i < vps.getNumHrdParameters(); i ++ )
591  {
592  vps.setHrdOpSetIdx( 0, i );
593  vps.setCprmsPresentFlag( false, i );
594  // Set up HrdParameters here.
595  }
596 }
597 
599 {
600  ProfileTierLevel& profileTierLevel = *sps.getPTL()->getGeneralPTL();
601  profileTierLevel.setLevelIdc(m_level);
602  profileTierLevel.setTierFlag(m_levelTier);
603  profileTierLevel.setProfileIdc(m_profile);
604  profileTierLevel.setProfileCompatibilityFlag(m_profile, 1);
614 
616  {
617  /* The above constraint is equal to Profile::MAIN */
618  profileTierLevel.setProfileCompatibilityFlag(Profile::MAIN, 1);
619  }
620  if (m_profile == Profile::MAIN)
621  {
622  /* A Profile::MAIN10 decoder can always decode Profile::MAIN */
623  profileTierLevel.setProfileCompatibilityFlag(Profile::MAIN10, 1);
624  }
625  /* XXX: should Main be marked as compatible with still picture? */
626  /* XXX: may be a good idea to refactor the above into a function
627  * that chooses the actual compatibility based upon options */
628 
632  sps.setMaxCUWidth ( m_maxCUWidth );
637 
638  Int minCUSize = sps.getMaxCUWidth() >> ( sps.getLog2DiffMaxMinCodingBlockSize() );
639  Int log2MinCUSize = 0;
640  while(minCUSize > 1)
641  {
642  minCUSize >>= 1;
643  log2MinCUSize++;
644  }
645 
646  sps.setLog2MinCodingBlockSize(log2MinCUSize);
647 
649  sps.setUsePCM ( m_usePCM );
651 
656 
658 
660 
661  sps.setUseAMP ( m_useAMP );
662 
663  for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
664  {
665  sps.setBitDepth (ChannelType(channelType), m_bitDepth[channelType] );
666 #if O0043_BEST_EFFORT_DECODING
667  sps.setStreamBitDepth(ChannelType(channelType), m_bitDepth[channelType] );
668 #endif
669  sps.setQpBDOffset (ChannelType(channelType), (6 * (m_bitDepth[channelType] - 8)));
670  sps.setPCMBitDepth (ChannelType(channelType), m_PCMBitDepth[channelType] );
671  }
672 
673  sps.setUseSAO( m_bUseSAO );
674 
676  sps.setTemporalIdNestingFlag( ( m_maxTempLayer == 1 ) ? true : false );
677 
678  for (Int i = 0; i < min(sps.getMaxTLayers(),(UInt) MAX_TLAYER); i++ )
679  {
682  }
683 
688 
689  if (sps.getVuiParametersPresentFlag())
690  {
691  TComVUI* pcVUI = sps.getVuiParameters();
694  pcVUI->setSarWidth(getSarWidth());
695  pcVUI->setSarHeight(getSarHeight());
699  pcVUI->setVideoFormat(getVideoFormat());
711  pcVUI->setFieldSeqFlag(false);
712  pcVUI->setHrdParametersPresentFlag(false);
723  }
726  for (Int k = 0; k < NUM_LONG_TERM_REF_PIC_SPS; k++)
727  {
728  sps.setLtRefPicPocLsbSps(k, 0);
729  sps.setUsedByCurrPicLtSPSFlag(k, 0);
730  }
731 
733  {
734  xInitHrdParameters(sps);
735  }
737  {
739  }
740 
741  // Set up SPS range extension settings
744  for (UInt signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++)
745  {
746  sps.getSpsRangeExtension().setRdpcmEnabledFlag(RDPCMSignallingMode(signallingModeIndex), m_rdpcmEnabledFlag[signallingModeIndex]);
747  }
753 }
754 
755 // calculate scale value of bitrate and initial delay
757 {
758  if (x==0)
759  {
760  return 0;
761  }
762  UInt iMask = 0xffffffff;
763  Int ScaleValue = 32;
764 
765  while ((x&iMask) != 0)
766  {
767  ScaleValue--;
768  iMask = (iMask >> 1);
769  }
770 
771  return ScaleValue;
772 }
773 
775 {
776  Bool useSubCpbParams = (getSliceMode() > 0) || (getSliceSegmentMode() > 0);
777  Int bitRate = getTargetBitrate();
778  Bool isRandomAccess = getIntraPeriod() > 0;
779  Int cpbSize = getCpbSize();
780  assert (cpbSize!=0); // CPB size may not be equal to zero. ToDo: have a better default and check for level constraints
782  {
783  return;
784  }
785 
786  TComVUI *vui = sps.getVuiParameters();
787  TComHRD *hrd = vui->getHrdParameters();
788 
789  TimingInfo *timingInfo = vui->getTimingInfo();
790  timingInfo->setTimingInfoPresentFlag( true );
791  switch( getFrameRate() )
792  {
793  case 24:
794  timingInfo->setNumUnitsInTick( 1125000 ); timingInfo->setTimeScale ( 27000000 );
795  break;
796  case 25:
797  timingInfo->setNumUnitsInTick( 1080000 ); timingInfo->setTimeScale ( 27000000 );
798  break;
799  case 30:
800  timingInfo->setNumUnitsInTick( 900900 ); timingInfo->setTimeScale ( 27000000 );
801  break;
802  case 50:
803  timingInfo->setNumUnitsInTick( 540000 ); timingInfo->setTimeScale ( 27000000 );
804  break;
805  case 60:
806  timingInfo->setNumUnitsInTick( 450450 ); timingInfo->setTimeScale ( 27000000 );
807  break;
808  default:
809  timingInfo->setNumUnitsInTick( 1001 ); timingInfo->setTimeScale ( 60000 );
810  break;
811  }
812 
814  {
815  UInt temporalSubsampleRatio = getTemporalSubsampleRatio();
816  if ( Double(timingInfo->getNumUnitsInTick()) * temporalSubsampleRatio > std::numeric_limits<UInt>::max() )
817  {
818  timingInfo->setTimeScale( timingInfo->getTimeScale() / temporalSubsampleRatio );
819  }
820  else
821  {
822  timingInfo->setNumUnitsInTick( timingInfo->getNumUnitsInTick() * temporalSubsampleRatio );
823  }
824  }
825 
826  Bool rateCnt = ( bitRate > 0 );
827  hrd->setNalHrdParametersPresentFlag( rateCnt );
828  hrd->setVclHrdParametersPresentFlag( rateCnt );
829  hrd->setSubPicCpbParamsPresentFlag( useSubCpbParams );
830 
831  if( hrd->getSubPicCpbParamsPresentFlag() )
832  {
833  hrd->setTickDivisorMinus2( 100 - 2 ); //
834  hrd->setDuCpbRemovalDelayLengthMinus1( 7 ); // 8-bit precision ( plus 1 for last DU in AU )
836  hrd->setDpbOutputDelayDuLengthMinus1( 5 + 7 ); // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay
837  }
838  else
839  {
841  }
842 
843  if (calcScale(bitRate) <= 6)
844  {
845  hrd->setBitRateScale(0);
846  }
847  else
848  {
849  hrd->setBitRateScale(calcScale(bitRate) - 6);
850  }
851 
852  if (calcScale(cpbSize) <= 4)
853  {
854  hrd->setCpbSizeScale(0);
855  }
856  else
857  {
858  hrd->setCpbSizeScale(calcScale(cpbSize) - 4);
859  }
860 
861  hrd->setDuCpbSizeScale( 6 ); // in units of 2^( 4 + 6 ) = 1,024 bit
862 
863  hrd->setInitialCpbRemovalDelayLengthMinus1(15); // assuming 0.5 sec, log2( 90,000 * 0.5 ) = 16-bit
864  if( isRandomAccess )
865  {
866  hrd->setCpbRemovalDelayLengthMinus1(5); // 32 = 2^5 (plus 1)
867  hrd->setDpbOutputDelayLengthMinus1 (5); // 32 + 3 = 2^6
868  }
869  else
870  {
871  hrd->setCpbRemovalDelayLengthMinus1(9); // max. 2^10
872  hrd->setDpbOutputDelayLengthMinus1 (9); // max. 2^10
873  }
874 
875  // Note: parameters for all temporal layers are initialized with the same values
876  Int i, j;
877  UInt bitrateValue, cpbSizeValue;
878  UInt duCpbSizeValue;
879  UInt duBitRateValue = 0;
880 
881  for( i = 0; i < MAX_TLAYER; i ++ )
882  {
883  hrd->setFixedPicRateFlag( i, 1 );
884  hrd->setPicDurationInTcMinus1( i, 0 );
885  hrd->setLowDelayHrdFlag( i, 0 );
886  hrd->setCpbCntMinus1( i, 0 );
887 
889  // BitRate[ i ] = ( bit_rate_value_minus1[ i ] + 1 ) * 2^( 6 + bit_rate_scale )
890  bitrateValue = bitRate / (1 << (6 + hrd->getBitRateScale()) ); // bitRate is in bits, so it needs to be scaled down
891  // CpbSize[ i ] = ( cpb_size_value_minus1[ i ] + 1 ) * 2^( 4 + cpb_size_scale )
892  cpbSizeValue = cpbSize / (1 << (4 + hrd->getCpbSizeScale()) ); // using bitRate results in 1 second CPB size
893 
894  // DU CPB size could be smaller (i.e. bitrateValue / number of DUs), but we don't know
895  // in how many DUs the slice segment settings will result
896  duCpbSizeValue = bitrateValue;
897  duBitRateValue = cpbSizeValue;
898 
899  for( j = 0; j < ( hrd->getCpbCntMinus1( i ) + 1 ); j ++ )
900  {
901  hrd->setBitRateValueMinus1( i, j, 0, ( bitrateValue - 1 ) );
902  hrd->setCpbSizeValueMinus1( i, j, 0, ( cpbSizeValue - 1 ) );
903  hrd->setDuCpbSizeValueMinus1( i, j, 0, ( duCpbSizeValue - 1 ) );
904  hrd->setDuBitRateValueMinus1( i, j, 0, ( duBitRateValue - 1 ) );
905  hrd->setCbrFlag( i, j, 0, false );
906 
907  hrd->setBitRateValueMinus1( i, j, 1, ( bitrateValue - 1) );
908  hrd->setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) );
909  hrd->setDuCpbSizeValueMinus1( i, j, 1, ( duCpbSizeValue - 1 ) );
910  hrd->setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) );
911  hrd->setCbrFlag( i, j, 1, false );
912  }
913  }
914 }
915 
917 {
918  // pps ID already initialised.
919  pps.setSPSId(sps.getSPSId());
920 
922  Bool bUseDQP = (getMaxCuDQPDepth() > 0)? true : false;
923 
924  if((getMaxDeltaQP() != 0 )|| getUseAdaptiveQP())
925  {
926  bUseDQP = true;
927  }
928 
930  {
931  bUseDQP = true;
932  }
933 
935  {
936  bUseDQP=false;
937  }
938 
939 
940  if ( m_RCEnableRateControl )
941  {
942  pps.setUseDQP(true);
943  pps.setMaxCuDQPDepth( 0 );
944  }
945  else if(bUseDQP)
946  {
947  pps.setUseDQP(true);
949  }
950  else
951  {
952  pps.setUseDQP(false);
953  pps.setMaxCuDQPDepth( 0 );
954  }
955 
956  if ( m_diffCuChromaQpOffsetDepth >= 0 )
957  {
961  /* todo, insert table entries from command line (NB, 0 should not be touched) */
962  }
963  else
964  {
967  }
971 
972  if (getWCGChromaQPControl().isEnabled())
973  {
974  const Int baseQp=m_iQP+pps.getPPSId();
976  const Double dcbQP = m_wcgChromaQpControl.chromaCbQpScale * chromaQp;
977  const Double dcrQP = m_wcgChromaQpControl.chromaCrQpScale * chromaQp;
978  const Int cbQP =(Int)(dcbQP + ( dcbQP < 0 ? -0.5 : 0.5) );
979  const Int crQP =(Int)(dcrQP + ( dcrQP < 0 ? -0.5 : 0.5) );
980  pps.setQpOffset(COMPONENT_Cb, Clip3( -12, 12, min(0, cbQP) + m_chromaCbQpOffset ));
981  pps.setQpOffset(COMPONENT_Cr, Clip3( -12, 12, min(0, crQP) + m_chromaCrQpOffset));
982  }
983  else
984  {
987  }
988  Bool bChromaDeltaQPEnabled = false;
989  {
991  if( !bChromaDeltaQPEnabled )
992  {
993  for( Int i=0; i<m_iGOPSize; i++ )
994  {
995  if( m_GOPList[i].m_CbQPoffset || m_GOPList[i].m_CrQPoffset )
996  {
997  bChromaDeltaQPEnabled = true;
998  break;
999  }
1000  }
1001  }
1002  }
1003  pps.setSliceChromaQpFlag(bChromaDeltaQPEnabled);
1004 
1007  pps.setUseWP( m_useWeightedPred );
1009  pps.setOutputFlagPresentFlag( false );
1011 
1012  if ( getDeblockingFilterMetric() )
1013  {
1016  }
1017  else
1018  {
1021  }
1022 
1024  {
1027  }
1028  else
1029  {
1032  }
1033 
1034  // deblockingFilterControlPresentFlag is true if any of the settings differ from the inferred values:
1035  const Bool deblockingFilterControlPresentFlag = pps.getDeblockingFilterOverrideEnabledFlag() ||
1037  pps.getDeblockingFilterBetaOffsetDiv2() != 0 ||
1039 
1040  pps.setDeblockingFilterControlPresentFlag(deblockingFilterControlPresentFlag);
1041 
1045 
1046 
1047  Int histogram[MAX_NUM_REF + 1];
1048  for( Int i = 0; i <= MAX_NUM_REF; i++ )
1049  {
1050  histogram[i]=0;
1051  }
1052  for( Int i = 0; i < getGOPSize(); i++)
1053  {
1054  assert(getGOPEntry(i).m_numRefPicsActive >= 0 && getGOPEntry(i).m_numRefPicsActive <= MAX_NUM_REF);
1055  histogram[getGOPEntry(i).m_numRefPicsActive]++;
1056  }
1057 
1058  Int maxHist=-1;
1059  Int bestPos=0;
1060  for( Int i = 0; i <= MAX_NUM_REF; i++ )
1061  {
1062  if(histogram[i]>maxHist)
1063  {
1064  maxHist=histogram[i];
1065  bestPos=i;
1066  }
1067  }
1068  assert(bestPos <= 15);
1069  pps.setNumRefIdxL0DefaultActive(bestPos);
1070  pps.setNumRefIdxL1DefaultActive(bestPos);
1074 
1076  {
1078  }
1079 
1080  xInitPPSforTiles(pps);
1081 }
1082 
1083 //Function for initializing m_RPSList, a list of TComReferencePictureSet, based on the GOPEntry objects read from the config file.
1084 Void TEncTop::xInitRPS(TComSPS &sps, Bool isFieldCoding)
1085 {
1087 
1088  sps.createRPSList(getGOPSize() + m_extraRPSs + 1);
1089  TComRPSList* rpsList = sps.getRPSList();
1090 
1091  for( Int i = 0; i < getGOPSize()+m_extraRPSs; i++)
1092  {
1093  const GOPEntry &ge = getGOPEntry(i);
1094  rps = rpsList->getReferencePictureSet(i);
1096  rps->setNumRefIdc(ge.m_numRefIdc);
1097  Int numNeg = 0;
1098  Int numPos = 0;
1099  for( Int j = 0; j < ge.m_numRefPics; j++)
1100  {
1101  rps->setDeltaPOC(j,ge.m_referencePics[j]);
1102  rps->setUsed(j,ge.m_usedByCurrPic[j]);
1103  if(ge.m_referencePics[j]>0)
1104  {
1105  numPos++;
1106  }
1107  else
1108  {
1109  numNeg++;
1110  }
1111  }
1112  rps->setNumberOfNegativePictures(numNeg);
1113  rps->setNumberOfPositivePictures(numPos);
1114 
1115  // handle inter RPS intialization from the config file.
1116  rps->setInterRPSPrediction(ge.m_interRPSPrediction > 0); // not very clean, converting anything > 0 to true.
1117  rps->setDeltaRIdxMinus1(0); // index to the Reference RPS is always the previous one.
1118  TComReferencePictureSet* RPSRef = i>0 ? rpsList->getReferencePictureSet(i-1): NULL; // get the reference RPS
1119 
1120  if (ge.m_interRPSPrediction == 2) // Automatic generation of the inter RPS idc based on the RIdx provided.
1121  {
1122  assert (RPSRef!=NULL);
1123  Int deltaRPS = getGOPEntry(i-1).m_POC - ge.m_POC; // the ref POC - current POC
1124  Int numRefDeltaPOC = RPSRef->getNumberOfPictures();
1125 
1126  rps->setDeltaRPS(deltaRPS); // set delta RPS
1127  rps->setNumRefIdc(numRefDeltaPOC+1); // set the numRefIdc to the number of pictures in the reference RPS + 1.
1128  Int count=0;
1129  for (Int j = 0; j <= numRefDeltaPOC; j++ ) // cycle through pics in reference RPS.
1130  {
1131  Int RefDeltaPOC = (j<numRefDeltaPOC)? RPSRef->getDeltaPOC(j): 0; // if it is the last decoded picture, set RefDeltaPOC = 0
1132  rps->setRefIdc(j, 0);
1133  for (Int k = 0; k < rps->getNumberOfPictures(); k++ ) // cycle through pics in current RPS.
1134  {
1135  if (rps->getDeltaPOC(k) == ( RefDeltaPOC + deltaRPS)) // if the current RPS has a same picture as the reference RPS.
1136  {
1137  rps->setRefIdc(j, (rps->getUsed(k)?1:2));
1138  count++;
1139  break;
1140  }
1141  }
1142  }
1143  if (count != rps->getNumberOfPictures())
1144  {
1145  printf("Warning: Unable fully predict all delta POCs using the reference RPS index given in the config file. Setting Inter RPS to false for this RPS.\n");
1146  rps->setInterRPSPrediction(0);
1147  }
1148  }
1149  else if (ge.m_interRPSPrediction == 1) // inter RPS idc based on the RefIdc values provided in config file.
1150  {
1151  assert (RPSRef!=NULL);
1152  rps->setDeltaRPS(ge.m_deltaRPS);
1153  rps->setNumRefIdc(ge.m_numRefIdc);
1154  for (Int j = 0; j < ge.m_numRefIdc; j++ )
1155  {
1156  rps->setRefIdc(j, ge.m_refIdc[j]);
1157  }
1158  // the following code overwrite the deltaPOC and Used by current values read from the config file with the ones
1159  // computed from the RefIdc. A warning is printed if they are not identical.
1160  numNeg = 0;
1161  numPos = 0;
1162  TComReferencePictureSet RPSTemp; // temporary variable
1163 
1164  for (Int j = 0; j < ge.m_numRefIdc; j++ )
1165  {
1166  if (ge.m_refIdc[j])
1167  {
1168  Int deltaPOC = ge.m_deltaRPS + ((j < RPSRef->getNumberOfPictures())? RPSRef->getDeltaPOC(j) : 0);
1169  RPSTemp.setDeltaPOC((numNeg+numPos),deltaPOC);
1170  RPSTemp.setUsed((numNeg+numPos),ge.m_refIdc[j]==1?1:0);
1171  if (deltaPOC<0)
1172  {
1173  numNeg++;
1174  }
1175  else
1176  {
1177  numPos++;
1178  }
1179  }
1180  }
1181  if (numNeg != rps->getNumberOfNegativePictures())
1182  {
1183  printf("Warning: number of negative pictures in RPS is different between intra and inter RPS specified in the config file.\n");
1184  rps->setNumberOfNegativePictures(numNeg);
1185  rps->setNumberOfPictures(numNeg+numPos);
1186  }
1187  if (numPos != rps->getNumberOfPositivePictures())
1188  {
1189  printf("Warning: number of positive pictures in RPS is different between intra and inter RPS specified in the config file.\n");
1190  rps->setNumberOfPositivePictures(numPos);
1191  rps->setNumberOfPictures(numNeg+numPos);
1192  }
1193  RPSTemp.setNumberOfPictures(numNeg+numPos);
1194  RPSTemp.setNumberOfNegativePictures(numNeg);
1195  RPSTemp.sortDeltaPOC(); // sort the created delta POC before comparing
1196  // check if Delta POC and Used are the same
1197  // print warning if they are not.
1198  for (Int j = 0; j < ge.m_numRefIdc; j++ )
1199  {
1200  if (RPSTemp.getDeltaPOC(j) != rps->getDeltaPOC(j))
1201  {
1202  printf("Warning: delta POC is different between intra RPS and inter RPS specified in the config file.\n");
1203  rps->setDeltaPOC(j,RPSTemp.getDeltaPOC(j));
1204  }
1205  if (RPSTemp.getUsed(j) != rps->getUsed(j))
1206  {
1207  printf("Warning: Used by Current in RPS is different between intra and inter RPS specified in the config file.\n");
1208  rps->setUsed(j,RPSTemp.getUsed(j));
1209  }
1210  }
1211  }
1212  }
1213  //In case of field coding, we need to set special parameters for the first bottom field of the sequence, since it is not specified in the cfg file.
1214  //The position = GOPSize + extraRPSs which is (a priori) unused is reserved for this field in the RPS.
1215  if (isFieldCoding)
1216  {
1217  rps = rpsList->getReferencePictureSet(getGOPSize()+m_extraRPSs);
1218  rps->setNumberOfPictures(1);
1222  rps->setDeltaPOC(0,-1);
1223  rps->setPOC(0,0);
1224  rps->setUsed(0,true);
1225  rps->setInterRPSPrediction(false);
1226  rps->setDeltaRIdxMinus1(0);
1227  rps->setDeltaRPS(0);
1228  rps->setNumRefIdc(0);
1229  }
1230 }
1231 
1232  // This is a function that
1233  // determines what Reference Picture Set to use
1234  // for a specific slice (with POC = POCCurr)
1236 {
1237  slice->setRPSidx(GOPid);
1238 
1239  for(Int extraNum=m_iGOPSize; extraNum<m_extraRPSs+m_iGOPSize; extraNum++)
1240  {
1241  if(m_uiIntraPeriod > 0 && getDecodingRefreshType() > 0)
1242  {
1243  Int POCIndex = POCCurr%m_uiIntraPeriod;
1244  if(POCIndex == 0)
1245  {
1246  POCIndex = m_uiIntraPeriod;
1247  }
1248  if(POCIndex == m_GOPList[extraNum].m_POC)
1249  {
1250  slice->setRPSidx(extraNum);
1251  }
1252  }
1253  else
1254  {
1255  if(POCCurr==m_GOPList[extraNum].m_POC)
1256  {
1257  slice->setRPSidx(extraNum);
1258  }
1259  }
1260  }
1261 
1262  if(POCCurr == 1 && slice->getPic()->isField())
1263  {
1264  slice->setRPSidx(m_iGOPSize+m_extraRPSs);
1265  }
1266 
1267  const TComReferencePictureSet *rps = (slice->getSPS()->getRPSList()->getReferencePictureSet(slice->getRPSidx()));
1268  slice->setRPS(rps);
1269 }
1270 
1272 {
1273  Int rpsIdx = GOPid;
1274 
1275  for(Int extraNum=m_iGOPSize; extraNum<m_extraRPSs+m_iGOPSize; extraNum++)
1276  {
1277  if(m_uiIntraPeriod > 0 && getDecodingRefreshType() > 0)
1278  {
1279  Int POCIndex = POCCurr%m_uiIntraPeriod;
1280  if(POCIndex == 0)
1281  {
1282  POCIndex = m_uiIntraPeriod;
1283  }
1284  if(POCIndex == m_GOPList[extraNum].m_POC)
1285  {
1286  rpsIdx = extraNum;
1287  }
1288  }
1289  else
1290  {
1291  if(POCCurr==m_GOPList[extraNum].m_POC)
1292  {
1293  rpsIdx = extraNum;
1294  }
1295  }
1296  }
1297 
1298  return rpsIdx;
1299 }
1300 
1302 {
1307  {
1310  }
1312 
1313  // # substreams is "per tile" when tiles are independent.
1314 }
1315 
1317 {
1320  UInt uiCummulativeColumnWidth = 0;
1321  UInt uiCummulativeRowHeight = 0;
1322 
1323  //check the column relative parameters
1325  {
1326  printf( "The number of columns is larger than the maximum allowed number of columns.\n" );
1327  exit( EXIT_FAILURE );
1328  }
1329 
1330  if( m_iNumColumnsMinus1 >= iWidthInCU )
1331  {
1332  printf( "The current picture can not have so many columns.\n" );
1333  exit( EXIT_FAILURE );
1334  }
1335 
1337  {
1338  for(Int i=0; i<m_iNumColumnsMinus1; i++)
1339  {
1340  uiCummulativeColumnWidth += m_tileColumnWidth[i];
1341  }
1342 
1343  if( uiCummulativeColumnWidth >= iWidthInCU )
1344  {
1345  printf( "The width of the column is too large.\n" );
1346  exit( EXIT_FAILURE );
1347  }
1348  }
1349 
1350  //check the row relative parameters
1351  if( m_iNumRowsMinus1 >= (1<<(LOG2_MAX_NUM_ROWS_MINUS1+1)) )
1352  {
1353  printf( "The number of rows is larger than the maximum allowed number of rows.\n" );
1354  exit( EXIT_FAILURE );
1355  }
1356 
1357  if( m_iNumRowsMinus1 >= iHeightInCU )
1358  {
1359  printf( "The current picture can not have so many rows.\n" );
1360  exit( EXIT_FAILURE );
1361  }
1362 
1364  {
1365  for(Int i=0; i<m_iNumRowsMinus1; i++)
1366  {
1367  uiCummulativeRowHeight += m_tileRowHeight[i];
1368  }
1369 
1370  if( uiCummulativeRowHeight >= iHeightInCU )
1371  {
1372  printf( "The height of the row is too large.\n" );
1373  exit( EXIT_FAILURE );
1374  }
1375  }
1376 }
1377 
1378 #if JCTVC_Y0038_PARAMS
1380 {
1381  m_ppsMap.setChangedFlag(ppsId);
1382  m_spsMap.setChangedFlag(spsId);
1383 }
1384 #endif
1385 
1387 {
1388  Bool bChanged=m_ppsMap.getChangedFlag(ppsId);
1389  m_ppsMap.clearChangedFlag(ppsId);
1390  return bChanged;
1391 }
1392 
1394 {
1395  Bool bChanged=m_spsMap.getChangedFlag(spsId);
1396  m_spsMap.clearChangedFlag(spsId);
1397  return bChanged;
1398 }
1399 
1400 #if X0038_LAMBDA_FROM_QP_CAPABILITY
1401 Int TEncCfg::getQPForPicture(const UInt gopIndex, const TComSlice *pSlice) const
1402 {
1403  const Int lumaQpBDOffset = pSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA);
1404  Int qp;
1405 
1407  {
1409  }
1410  else
1411  {
1412  const SliceType sliceType=pSlice->getSliceType();
1413 
1414  qp = getBaseQP();
1415 
1416 #if JVET_G0101_QP_SWITCHING
1417  // modify QP if a fractional QP was originally specified, cause dQPs to be 0 or 1.
1418  const Int* pdQPs = getdQPs();
1419  if ( pdQPs )
1420  {
1421  qp += pdQPs[ pSlice->getPOC() ];
1422  }
1423 #endif
1424 
1425  if(sliceType==I_SLICE)
1426  {
1427  qp += getIntraQPOffset();
1428  }
1429  else
1430  {
1431  // Only adjust QP when not lossless
1432  if (!(( getMaxDeltaQP() == 0 ) && (!getLumaLevelToDeltaQPMapping().isEnabled()) && (qp == -lumaQpBDOffset ) && (pSlice->getPPS()->getTransquantBypassEnabledFlag())))
1433  {
1434  const GOPEntry &gopEntry=getGOPEntry(gopIndex);
1435  // adjust QP according to the QP offset for the GOP entry.
1436  qp +=gopEntry.m_QPOffset;
1437 
1438  // adjust QP according to QPOffsetModel for the GOP entry.
1439  Double dqpOffset=qp*gopEntry.m_QPOffsetModelScale+gopEntry.m_QPOffsetModelOffset+0.5;
1440  Int qpOffset = (Int)floor(Clip3<Double>(0.0, 3.0, dqpOffset));
1441  qp += qpOffset ;
1442  }
1443  }
1444 
1445 #if !JVET_G0101_QP_SWITCHING
1446  // modify QP if a fractional QP was originally specified, cause dQPs to be 0 or 1.
1447  const Int* pdQPs = getdQPs();
1448  if ( pdQPs )
1449  {
1450  qp += pdQPs[ pSlice->getPOC() ];
1451  }
1452 #endif
1453  }
1454  qp = Clip3( -lumaQpBDOffset, MAX_QP, qp );
1455  return qp;
1456 }
1457 #endif
1458 
Bool m_useStrongIntraSmoothing
enable the use of strong intra smoothing (bi_linear interpolation) for 32x32 blocks when reference sa...
Definition: TEncCfg.h:506
Void setNumTileColumnsMinus1(Int i)
Definition: TComSlice.h:1158
Int getNumberOfPositivePictures() const
Definition: TComSlice.h:109
Void setColourDescriptionPresentFlag(Bool i)
Definition: TComSlice.h:614
Bool getOverscanAppropriateFlag()
Definition: TEncCfg.h:1175
virtual Void destroy()
Definition: TComPic.cpp:189
Void init(TEncBinIf *p)
Definition: TEncSbac.h:72
Level::Tier m_levelTier
Definition: TEncCfg.h:156
Int m_maxTempLayer
Max temporal layer.
Definition: TEncCfg.h:192
UInt getIntraPeriod()
Definition: TEncCfg.h:665
Void setMaxTotalCUDepth(UInt u)
Definition: TComSlice.h:860
Void setTransformSkipRotationEnabledFlag(const Bool value)
Definition: TComSlice.h:715
Void checkPredMode(UInt sizeId, UInt listId)
Definition: TComSlice.cpp:1838
UInt m_log2MaxTransformSkipBlockSize
Definition: TEncCfg.h:268
static const Int SCALING_LIST_NUM
list number for quantization matrix
Definition: CommonDef.h:232
UInt m_bitDepthConstraintValue
Definition: TEncCfg.h:162
Void setUsed(Int bufferNum, Bool used)
Definition: TComSlice.cpp:1650
Void setQuadtreeTULog2MaxSize(UInt u)
Definition: TComSlice.h:872
Int getSPSId() const
Definition: TComSlice.h:1094
Int getSarWidth()
Definition: TEncCfg.h:1169
Bool getSignDataHidingEnabledFlag()
Definition: TEncCfg.h:1119
SliceType
supported slice type
Definition: TypeDef.h:283
Void xInitSPS(TComSPS &sps)
initialize SPS from encoder options
Definition: TEncTop.cpp:598
Bool m_extendedPrecisionProcessingFlag
Definition: TEncCfg.h:245
Int getFrameRate()
Definition: TEncCfg.h:649
Void setVideoSignalTypePresentFlag(Bool i)
Definition: TComSlice.h:605
Void create(UInt uiMaxCUDepth)
T * getPS(Int psId)
Definition: TComSlice.h:1642
TEncSbac *** getRDSbacCoder()
Definition: TEncTop.h:153
Bool isField() const
Definition: TComPic.h:166
Void setSarHeight(Int i)
Definition: TComSlice.h:596
Int m_bitDepth[MAX_NUM_CHANNEL_TYPE]
Definition: TEncCfg.h:251
Int getIntraQPOffset() const
Definition: TEncCfg.h:674
Bool m_onePictureOnlyConstraintFlag
Definition: TEncCfg.h:165
Void setMaxCUHeight(UInt u)
Definition: TComSlice.h:858
Void setUseWP(Bool b)
Definition: TComSlice.h:1136
Int calcScale(Int x)
Definition: TEncTop.cpp:756
picture YUV buffer class
Definition: TComPicYuv.h:55
SliceType getSliceType() const
Definition: TComSlice.h:1353
Void initROM()
Definition: TComRom.cpp:179
Void setUseDQP(Bool b)
Definition: TComSlice.h:1100
Double chromaQpOffset
Chroma QP Offset (0.0:default)
Definition: TypeDef.h:904
Void setFixedPicRateFlag(Int layer, Bool flag)
Definition: TComSlice.h:361
ChannelType
Definition: TypeDef.h:301
const std::string & getScalingListFileName() const
Definition: TEncCfg.h:1113
Int getSPSId() const
Definition: TComSlice.h:824
Void setScalingList(TComScalingList *scalingList, const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths)
SliceConstraint m_sliceSegmentMode
Definition: TEncCfg.h:291
static const Int LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP
QP to use for lossless coding.
Definition: CommonDef.h:210
Bool checkDefaultScalingList()
Definition: TComSlice.cpp:1809
Bool m_persistentRiceAdaptationEnabledFlag
Definition: TEncCfg.h:271
Void setParamSetChanged(Int spsId, Int ppsId)
Definition: TEncTop.cpp:1379
Void setMatrixCoefficients(Int i)
Definition: TComSlice.h:623
Int getMaxBytesPerPicDenom()
Definition: TEncCfg.h:1215
picture class (symbol + YUV buffers)
Definition: TComPic.h:56
Void setTierFlag(Level::Tier x)
Definition: TComSlice.h:210
Void setFlatScalingList(const Int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths)
Defines version information, constants and small in-line functions.
Int getNumTicksPocDiffOneMinus1()
Definition: TEncCfg.h:1205
void Void
Definition: TypeDef.h:203
UInt m_log2DiffMaxMinCodingBlockSize
Definition: TEncCfg.h:197
Int getRPSidx() const
Definition: TComSlice.h:1345
Void setVideoFullRangeFlag(Bool i)
Definition: TComSlice.h:611
Void setDuCpbSizeScale(UInt value)
Definition: TComSlice.h:349
TEncEntropy m_cEntropyCoder
entropy encoder
Definition: TEncTop.h:85
Void init(TEncTop *pcEncTop)
Definition: TEncSlice.cpp:79
Int getAspectRatioIdc()
Definition: TEncCfg.h:1167
Int m_deltaRPS
Definition: TEncCfg.h:70
Int getUsed(Int bufferNum) const
Definition: TComSlice.cpp:1665
Bool getPictureTimingSEIEnabled() const
Definition: TEncCfg.h:841
Bool m_frameOnlyConstraintFlag
Definition: TEncCfg.h:161
const TComPPS & getPPS() const
Definition: TComPicSym.h:164
Void xPreanalyze(TEncPic *pcPic)
Void setNumberOfNegativePictures(Int number)
Definition: TComSlice.h:106
WCGChromaQPControl m_wcgChromaQpControl
Wide-colour-gamut chroma QP control.
Definition: TEncCfg.h:236
const TComPPSRExt & getPpsRangeExtension() const
Definition: TComSlice.h:1197
Int getStride(const ComponentID id) const
Definition: TComPicYuv.h:121
static const Int MAX_NUM_PPS
Definition: CommonDef.h:165
Void setMinSpatialSegmentationIdc(Int i)
Definition: TComSlice.h:663
TComPicYuv * getPicYuvTrueOrg()
Definition: TComPic.h:61
const TComSPSRExt & getSpsRangeExtension() const
Definition: TComSlice.h:941
Int getTMVPModeId()
Definition: TEncCfg.h:1115
Void setTransquantBypassEnabledFlag(Bool b)
Definition: TComSlice.h:1141
UInt getTimeScale() const
Definition: TComSlice.h:414
Int m_RCTargetBitrate
Definition: TEncCfg.h:455
Void setDependentSliceSegmentsEnabledFlag(Bool val)
Definition: TComSlice.h:1150
Void setMaxCUWidth(UInt u)
Definition: TComSlice.h:856
static const Int NUM_LONG_TERM_REF_PIC_SPS
Definition: CommonDef.h:204
TEncSlice m_cSliceEncoder
slice encoder
Definition: TEncTop.h:92
Void clearChangedFlag(Int psId)
Definition: TComSlice.h:1624
Int m_RCKeepHierarchicalBit
Definition: TEncCfg.h:456
UInt m_pcmLog2MaxSize
Definition: TEncCfg.h:285
Void setScalingListPresentFlag(Bool b)
Definition: TComSlice.h:1183
C popFront()
Definition: TComList.h:82
#define NULL
Definition: CommonDef.h:107
TEncSbac m_cRDGoOnSbacCoder
going on SBAC model for RD stage
Definition: TEncTop.h:100
Void setChromaSampleLocTypeTopField(Int i)
Definition: TComSlice.h:629
Int m_sliceChromaQpOffsetIntraOrPeriodic[2]
Chroma Cb QP Offset at slice level for I slice or for periodic inter slices as defined by SliceChroma...
Definition: TEncCfg.h:238
Bool m_useWeightedPred
Definition: TEncCfg.h:445
UInt m_maxCUHeight
Definition: TEncCfg.h:195
Int m_iGOPSize
Definition: TEncCfg.h:174
Int getHeight(const ComponentID id) const
Definition: TComPicYuv.h:117
UInt m_uiQuadtreeTULog2MinSize
Definition: TEncCfg.h:201
TComSlice * getSlice(Int i)
Definition: TComPic.h:113
Void checkDcOfMatrix()
Definition: TComSlice.cpp:2077
UInt m_uiQuadtreeTULog2MaxSize
Definition: TEncCfg.h:200
Void setCabacInitPresentFlag(Bool flag)
Definition: TComSlice.h:1170
don&#39;t use slices / slice segments
Definition: TypeDef.h:516
TEncPreanalyzer m_cPreanalyzer
image characteristics analyzer for TM5-step3-like adaptive QP
Definition: TEncTop.h:110
Void setPCMFilterDisableFlag(Bool bValue)
Definition: TComSlice.h:917
Void setFrameOnlyConstraintFlag(Bool b)
Definition: TComSlice.h:231
Void setPersistentRiceAdaptationEnabledFlag(const Bool value)
Definition: TComSlice.h:733
Bool m_useRDOQTS
Definition: TEncCfg.h:255
UInt getNumHrdParameters() const
Definition: TComSlice.h:498
Bool m_bLFCrossSliceBoundaryFlag
Definition: TEncCfg.h:293
Bool m_bUseSAO
Definition: TEncCfg.h:211
Void setDuCpbSizeValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl, UInt value)
Definition: TComSlice.h:381
unsigned int UInt
Definition: TypeDef.h:212
Void setDeltaPOC(Int bufferNum, Int deltaPOC)
Definition: TComSlice.cpp:1655
Int getLog2MaxMvLengthVertical()
Definition: TEncCfg.h:1221
Void setCprmsPresentFlag(Bool val, UInt i)
Definition: TComSlice.h:475
Void setDiffCuChromaQpOffsetDepth(UInt u)
Definition: TComSlice.h:1007
Void setMaxBytesPerPicDenom(Int i)
Definition: TComSlice.h:666
UInt m_uiNumAllPicCoded
number of coded pictures
Definition: TEncTop.h:74
Bool m_cabacBypassAlignmentEnabledFlag
Definition: TEncCfg.h:272
Void setLowerBitRateConstraintFlag(Bool b)
Definition: TComSlice.h:246
Bool isReferenced() const
Definition: TComSlice.h:1387
Void setMaxBitsPerMinCuDenom(Int i)
Definition: TComSlice.h:669
Void setMaxCuDQPDepth(UInt u)
Definition: TComSlice.h:1106
Void setQuadtreeTUMaxDepthInter(UInt u)
Definition: TComSlice.h:876
Short Pel
pixel type
Definition: TypeDef.h:249
Void setLtRefPicPocLsbSps(UInt index, UInt val)
Definition: TComSlice.h:846
Void setQpOffset(ComponentID compID, Int i)
Definition: TComSlice.h:1109
Int m_iMaxCuDQPDepth
Definition: TEncCfg.h:231
Void setNumHrdParameters(UInt v)
Definition: TComSlice.h:499
Int getMaxBitsPerMinCuDenom()
Definition: TEncCfg.h:1217
const TComRPSList * getRPSList() const
Definition: TComSlice.h:883
Void setTransformSkipContextEnabledFlag(const Bool value)
Definition: TComSlice.h:718
Void setPicHeightInLumaSamples(UInt u)
Definition: TComSlice.h:835
Void create(const TComSPS &sps, const TComPPS &pps, const Bool bCreateEncoderSourcePicYuv, const Bool bCreateForImmediateReconstruction)
Definition: TComPic.cpp:71
Int m_numRefPics
Definition: TEncCfg.h:66
Void setCpbRemovalDelayLengthMinus1(UInt value)
Definition: TComSlice.h:355
Definition: TEncCfg.h:49
Int m_POC
Definition: TEncCfg.h:51
ScalingListMode m_useScalingListId
Using quantization matrix i.e. 0=off, 1=default, 2=file.
Definition: TEncCfg.h:450
Void setNumReorderPics(Int i, UInt tlayer)
Definition: TComSlice.h:880
Int getLoopFilterTcOffset()
Definition: TEncCfg.h:698
Int getMinSpatialSegmentationIdc()
Definition: TEncCfg.h:1213
Bool getPPSDeblockingFilterDisabledFlag() const
get offset for deblocking filter disabled
Definition: TComSlice.h:1177
Bool xParseScalingList(const std::string &fileName)
Definition: TComSlice.cpp:1915
Void init(UInt uiMaxTrSize, Bool useRDOQ=false, Bool useRDOQTS=false, Bool useSelectiveRDOQ=false, Bool bEnc=false, Bool useTransformSkipFast=false, Bool bUseAdaptQpSelect=false)
Void setUseScalingList(Bool bUseScalingList)
get DeQuant Coefficent
Definition: TComTrQuant.h:180
Bool m_RCCpbSaturationEnabled
Definition: TEncCfg.h:461
Void setChromaFormatConstraint(ChromaFormat fmt)
Definition: TComSlice.h:237
Bool m_bUseAdaptQpSelect
Definition: TEncCfg.h:243
Bool getBitstreamRestrictionFlag()
Definition: TEncCfg.h:1207
Picture class including local image characteristics information for QP adaptation.
Definition: TEncPic.h:95
Bool m_intraConstraintFlag
Definition: TEncCfg.h:164
Double chromaQpScale
Chroma QP Scale (0.0:default)
Definition: TypeDef.h:903
Void setUseAMP(Bool b)
Definition: TComSlice.h:871
Bool m_useWeightedBiPred
Definition: TEncCfg.h:446
static const Int MAX_NUM_REF
max. number of entries in picture reference list
Definition: CommonDef.h:125
Bool getVideoSignalTypePresentFlag()
Definition: TEncCfg.h:1177
Bool isEnabled() const
Definition: TypeDef.h:899
TComTrQuant m_cTrQuant
transform &amp; quantization class
Definition: TEncTop.h:82
Int m_usedByCurrPic[MAX_NUM_REF_PICS]
Definition: TEncCfg.h:68
UInt m_uiPCMLog2MinSize
Definition: TEncCfg.h:286
Void setChromaSampleLocTypeBottomField(Int i)
Definition: TComSlice.h:632
Void setRPS(const TComReferencePictureSet *pcRPS)
Definition: TComSlice.h:1340
TComVPS m_cVPS
Definition: TEncCfg.h:469
Void setCrossComponentPredictionEnabledFlag(Bool value)
Definition: TComSlice.h:1002
Bool getTransquantBypassEnabledFlag() const
Definition: TComSlice.h:1142
Int m_framesToBeEncoded
Definition: TEncCfg.h:141
Void setEntropyCodingSyncEnabledFlag(Bool val)
Definition: TComSlice.h:1152
Bool getLoopFilterDisable()
Definition: TEncCfg.h:695
Void setIntraConstraintFlag(Bool b)
Definition: TComSlice.h:240
Bool m_useRDOQ
Definition: TEncCfg.h:254
Int m_iNumColumnsMinus1
Definition: TEncCfg.h:300
Void setTimeScale(UInt value)
Definition: TComSlice.h:413
Void setNalHrdParametersPresentFlag(Bool flag)
Definition: TComSlice.h:323
const WCGChromaQPControl & getWCGChromaQPControl() const
Definition: TEncCfg.h:623
TEncGOP m_cGOPEncoder
GOP encoder.
Definition: TEncTop.h:91
Void setSPSId(Int i)
Definition: TComSlice.h:1095
Int m_chromaCbQpOffset
Definition: TEncCfg.h:234
Bool m_crossComponentPredictionEnabledFlag
Definition: TEncCfg.h:263
Void setChromaFormatIdc(ChromaFormat i)
Definition: TComSlice.h:827
Bool getSaoCtuBoundary()
Definition: TEncCfg.h:818
Void setCpbSizeScale(UInt value)
Definition: TComSlice.h:347
Void setTileUniformSpacingFlag(Bool b)
Definition: TComSlice.h:1156
TComVUI * getVuiParameters()
Definition: TComSlice.h:936
Void setFieldSeqFlag(Bool i)
Definition: TComSlice.h:638
Void xInitScalingLists(TComSPS &sps, TComPPS &pps)
initialize scaling lists
Definition: TEncTop.cpp:236
Void setUsedByCurrPicLtSPSFlag(Int i, Bool x)
Definition: TComSlice.h:849
Void setDuCpbRemovalDelayLengthMinus1(UInt value)
Definition: TComSlice.h:335
Void setLog2MaxMvLengthVertical(Int i)
Definition: TComSlice.h:675
ParameterSetMap< TComPPS > m_ppsMap
PPS. This is the base value. This is copied to TComPicSym.
Definition: TEncTop.h:96
Int m_PCMBitDepth[MAX_NUM_CHANNEL_TYPE]
Definition: TEncCfg.h:284
Void setCostMode(CostMode m)
Definition: TComRdCost.h:145
static const Int LOG2_MAX_NUM_ROWS_MINUS1
Definition: CommonDef.h:196
Bool getChromaLocInfoPresentFlag()
Definition: TEncCfg.h:1191
TEncSbac *** m_pppcRDSbacCoder
temporal storage for RD computation
Definition: TEncTop.h:99
Int m_interRPSPrediction
Definition: TEncCfg.h:69
Void setInterRPSPrediction(Bool flag)
Definition: TComSlice.h:113
Bool m_useAMP
Definition: TEncCfg.h:193
TComPicYuv * getPicYuvRec()
Definition: TComPic.h:120
Void setAspectRatioIdc(Int i)
Definition: TComSlice.h:590
Void setSignDataHidingEnabledFlag(Bool b)
Definition: TComSlice.h:1167
static const Int LOG2_MAX_NUM_COLUMNS_MINUS1
Definition: CommonDef.h:195
TEncSbac * getRDGoOnSbacCoder()
Definition: TEncTop.h:154
Int m_maxDecPicBuffering[MAX_TLAYER]
Definition: TEncCfg.h:177
Bool m_tileUniformSpacingFlag
Definition: TEncCfg.h:299
UInt m_maxTotalCUDepth
Definition: TEncCfg.h:196
Bool getVideoFullRangeFlag()
Definition: TEncCfg.h:1181
Int getTransferCharacteristics()
Definition: TEncCfg.h:1187
Void setPOC(Int bufferNum, Int deltaPOC)
Definition: TComSlice.cpp:1685
Void setLog2DiffMaxMinCodingBlockSize(Int val)
Definition: TComSlice.h:854
Bool m_bUseConstrainedIntraPred
Definition: TEncCfg.h:279
Void setSliceChromaQpFlag(Bool b)
Definition: TComSlice.h:1104
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_refIdc[MAX_NUM_REF_PICS+1]
Definition: TEncCfg.h:72
Void setPocProportionalToTimingFlag(Bool x)
Definition: TComSlice.h:416
ProfileTierLevel * getGeneralPTL()
Definition: TComSlice.h:265
Bool getNeutralChromaIndicationFlag()
Definition: TEncCfg.h:1197
Void create()
Definition: TEncTop.cpp:89
Void setDeblockingFilterBetaOffsetDiv2(Int val)
set beta offset for deblocking filter
Definition: TComSlice.h:1178
Void prepareForEncoderSourcePicYuv()
Definition: TComPic.cpp:114
Profile::Name m_profile
Definition: TEncCfg.h:155
Void setNonPackedConstraintFlag(Bool b)
Definition: TComSlice.h:228
Void xCheckGSParameters()
Definition: TEncTop.cpp:1316
Void deletePicBuffer()
Definition: TEncTop.cpp:301
Void create(Int picWidth, Int picHeight, ChromaFormat format, UInt maxCUWidth, UInt maxCUHeight, UInt maxCUDepth, UInt lumaBitShift, UInt chromaBitShift)
Int getWidth(const ComponentID id) const
Definition: TComPicYuv.h:116
Void setTileColumnWidth(const std::vector< Int > &columnWidth)
Definition: TComSlice.h:1160
Void setLevelIdc(Level::Name x)
Definition: TComSlice.h:219
Int m_iQP
Definition: TEncCfg.h:180
Void setQuadtreeTULog2MinSize(UInt u)
Definition: TComSlice.h:874
ChromaFormat m_chromaFormatIDC
Definition: TEncCfg.h:240
Int getReferencePictureSetIdxForSOP(Int POCCurr, Int GOPid)
Definition: TEncTop.cpp:1271
Void setNumberOfPositivePictures(Int number)
Definition: TComSlice.h:108
Bool getBufferingPeriodSEIEnabled() const
Definition: TEncCfg.h:839
ChromaFormat m_chromaFormatConstraintValue
Definition: TEncCfg.h:163
Void setTilesFixedStructureFlag(Bool i)
Definition: TComSlice.h:654
TComRdCost m_cRdCost
RD cost computation class.
Definition: TEncTop.h:98
Int m_QPOffset
Definition: TEncCfg.h:52
Void setDpbOutputDelayDuLengthMinus1(UInt value)
Definition: TComSlice.h:341
Void clearChromaQpOffsetList()
Definition: TComSlice.h:1004
Void setDeltaRPS(Int x)
Definition: TComSlice.h:117
GOPEntry m_GOPList[MAX_GOP]
Definition: TEncCfg.h:175
Double m_QPOffsetModelScale
Definition: TEncCfg.h:55
Int getQpBDOffset(ChannelType type) const
Definition: TComSlice.h:904
Int getMaxDecPicBuffering(UInt tlayer)
Definition: TEncCfg.h:671
Void create(const TComSPS &sps, const TComPPS &pps, UInt uiMaxAdaptiveQPDepth)
Definition: TEncPic.cpp:125
TEncSampleAdaptiveOffset m_cEncSAO
sample adaptive offset class
Definition: TEncTop.h:84
Void setOverscanInfoPresentFlag(Bool i)
Definition: TComSlice.h:599
bool Bool
Definition: TypeDef.h:204
Int m_iSourceWidth
Definition: TEncCfg.h:138
Bool getCpbSaturationEnabled()
Definition: TEncCfg.h:1134
Void setLog2ParallelMergeLevelMinus2(UInt mrgLevel)
Definition: TComSlice.h:1189
Bool getFrameFieldInfoPresentFlag()
Definition: TEncCfg.h:1201
Int m_chromaCrQpOffset
Definition: TEncCfg.h:235
Bool getPocProportionalToTimingFlag()
Definition: TEncCfg.h:1203
Bool getSubPicCpbParamsPresentFlag() const
Definition: TComSlice.h:330
TComReferencePictureSet * getReferencePictureSet(Int referencePictureSetNum)
Definition: TComSlice.h:143
Void setBitRateValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl, UInt value)
Definition: TComSlice.h:376
#define ADAPTIVE_QP_SELECTION
G382: Adaptive reconstruction levels, non-normative part for adaptive QP selection.
Definition: TypeDef.h:112
Void setVclHrdParametersPresentFlag(Bool flag)
Definition: TComSlice.h:326
Int getVideoFormat()
Definition: TEncCfg.h:1179
std::vector< Int > m_tileColumnWidth
Definition: TEncCfg.h:302
Int getSourceWidth()
Definition: TEncCfg.h:652
Int m_iSourceHeight
Definition: TEncCfg.h:139
Void setPicDurationInTcMinus1(Int layer, UInt value)
Definition: TComSlice.h:367
total number
Definition: TypeDef.h:435
Void setCbrFlag(Int layer, Int cpbcnt, Int nalOrVcl, Bool value)
Definition: TComSlice.h:385
Void separateFields(Pel *org, Pel *dstField, UInt stride, UInt width, UInt height, Bool isTop)
Definition: TEncTop.cpp:383
UInt m_log2ParallelMergeLevelMinus2
Parallel merge estimation region.
Definition: TEncCfg.h:448
Double m_RCInitialCpbFullness
Definition: TEncCfg.h:463
PPS class.
Definition: TComSlice.h:1034
Bool PPSNeedsWriting(Int ppsId)
Definition: TEncTop.cpp:1386
Void setLog2MaxTransformSkipBlockSize(UInt u)
Definition: TComSlice.h:999
Void initRCGOP(Int numberOfPictures)
Bool m_lowerBitRateConstraintFlag
Definition: TEncCfg.h:166
Void copyToPic(TComPicYuv *pcPicYuvDst) const
Definition: TComPicYuv.cpp:198
Void setColourPrimaries(Int i)
Definition: TComSlice.h:617
UInt getCpbSizeScale() const
Definition: TComSlice.h:348
Void setMaxTLayers(UInt uiMaxTLayers)
Definition: TComSlice.h:911
Void setUseSAO(Bool bVal)
Definition: TComSlice.h:907
TimingInfo * getTimingInfo()
Definition: TComSlice.h:511
Double chromaCrQpScale
Chroma Cr QP Scale (1.0:default)
Definition: TypeDef.h:902
Void setProfileCompatibilityFlag(Int i, Bool x)
Definition: TComSlice.h:216
Int getDeltaPOC(Int bufferNum) const
Definition: TComSlice.cpp:1670
Int getQPForPicture(const UInt gopIndex, const TComSlice *pSlice) const
Definition: TEncTop.cpp:1401
Int getLog2MaxMvLengthHorizontal()
Definition: TEncCfg.h:1219
Bool m_RCUseLCUSeparateModel
Definition: TEncCfg.h:458
TComTrQuant * getTrQuant()
Definition: TEncTop.h:141
Void setScalingListPresentFlag(Bool b)
Definition: TComSlice.h:923
Int getMaxDeltaQP() const
Definition: TEncCfg.h:711
Void setLog2MaxMvLengthHorizontal(Int i)
Definition: TComSlice.h:672
Int m_iFrameRate
Definition: TEncCfg.h:135
Void setDefaultDisplayWindow(Window &defaultDisplayWindow)
Definition: TComSlice.h:645
T Clip3(const T minVal, const T maxVal, const T a)
general min/max clip
Definition: CommonDef.h:252
Bool m_transformSkipContextEnabledFlag
Definition: TEncCfg.h:270
Bool getColourDescriptionPresentFlag()
Definition: TEncCfg.h:1183
Reference Picture Set set class.
Definition: TComSlice.h:130
CostMode getCostMode() const
Definition: TEncCfg.h:1144
Int m_numRefIdc
Definition: TEncCfg.h:71
Void setTileRowHeight(const std::vector< Int > &rowHeight)
Definition: TComSlice.h:1164
Int getChromaSampleLocTypeBottomField()
Definition: TEncCfg.h:1195
Bool SPSNeedsWriting(Int spsId)
Definition: TEncTop.cpp:1393
Void setHrdParametersPresentFlag(Bool i)
Definition: TComSlice.h:648
TComPicYuv * getPicYuvOrg()
Definition: TComPic.h:119
Void setNumTicksPocDiffOneMinus1(Int x)
Definition: TComSlice.h:419
Double m_QPOffsetModelOffset
Definition: TEncCfg.h:54
ParameterSetMap< TComSPS > m_spsMap
SPS. This is the base value. This is copied to TComPicSym.
Definition: TEncTop.h:95
Bool m_printMSSSIM
Definition: TEncCfg.h:150
Void setTilesEnabledFlag(Bool val)
Definition: TComSlice.h:1154
Int getColourPrimaries()
Definition: TEncCfg.h:1185
Void setUseStrongIntraSmoothing(Bool bVal)
Definition: TComSlice.h:931
static Void sortPicList(TComList< TComPic * > &rcListPic)
Definition: TComSlice.cpp:190
UInt getCpbSize()
Definition: TEncCfg.h:1136
const TComPTL * getPTL() const
Definition: TComSlice.h:938
TComPicSym * getPicSym()
Definition: TComPic.h:111
UInt getMaxCuDQPDepth() const
Definition: TComSlice.h:1107
Void init(TEncCfg *pcEncCfg, TComTrQuant *pcTrQuant, Int iSearchRange, Int bipredSearchRange, MESearchMethod motionEstimationSearchMethod, const UInt maxCUWidth, const UInt maxCUHeight, const UInt maxTotalCUDepth, TEncEntropy *pcEntropyCoder, TComRdCost *pcRdCost, TEncSbac ***pppcRDSbacCoder, TEncSbac *pcRDGoOnSbacCoder)
Definition: TEncSearch.cpp:216
Void setScalingListFlag(Bool b)
Definition: TComSlice.h:921
Bool m_useSelectiveRDOQ
Definition: TEncCfg.h:256
TEncCavlc * getCavlcCoder()
Definition: TEncTop.h:148
Void setSliceEncoder(TEncSlice *pSliceEncoder)
Definition: TEncCu.h:108
static const Int CABAC_INIT_PRESENT_FLAG
Definition: CommonDef.h:198
const BitDepths & getBitDepths() const
Definition: TComSlice.h:900
RDPCMSignallingMode
Definition: TypeDef.h:275
Void initHrdParam(const TComHRD *pcHrd, Int iFrameRate, Double fInitialCpbFullness)
Int getMaxLog2TrDynamicRange(ChannelType channelType) const
Definition: TComSlice.h:901
Void pushBack(const C &rcT)
Definition: TComList.h:89
Void encode(Bool bEos, TComPicYuv *pcPicYuvOrg, TComPicYuv *pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, TComList< TComPicYuv * > &rcListPicYuvRecOut, std::list< AccessUnit > &accessUnitsOut, Int &iNumEncoded)
encode several number of pictures until end-of-sequence
Definition: TEncTop.cpp:329
T * allocatePS(const Int psId)
Definition: TComSlice.h:1573
Void setPCMBitDepth(ChannelType type, UInt u)
Definition: TComSlice.h:916
TEncRateCtrl m_cRateCtrl
Rate control class.
Definition: TEncTop.h:112
Void setNumberOfPictures(Int numberOfPictures)
Definition: TComSlice.cpp:1660
const TComPPS * getPPS() const
Definition: TComSlice.h:1332
Double chromaCbQpScale
Chroma Cb QP Scale (1.0:default)
Definition: TypeDef.h:901
Int getDeblockingFilterBetaOffsetDiv2() const
get beta offset for deblocking filter
Definition: TComSlice.h:1179
Void setQpBDOffset(ChannelType type, Int i)
Definition: TComSlice.h:905
Int m_iNumRowsMinus1
Definition: TEncCfg.h:301
Void setMaxTrSize(UInt u)
Definition: TComSlice.h:890
UInt getTemporalSubsampleRatio()
Definition: TEncCfg.h:651
Void setExtendedPrecisionProcessingFlag(Bool value)
Definition: TComSlice.h:724
Bool m_useTransformSkipFast
Definition: TEncCfg.h:267
Bool getUseAdaptiveQP() const
Definition: TEncCfg.h:713
Void setCpbCntMinus1(Int layer, UInt value)
Definition: TComSlice.h:373
Bool m_usePCM
Definition: TEncCfg.h:283
Bool getTransquantBypassEnabledFlag()
Definition: TEncCfg.h:1140
TEncBinCABACCounter m_cRDGoOnBinCoderCABAC
going on bin coder CABAC for RD stage
Definition: TEncTop.h:103
Int m_iPOCLast
time index (POC)
Definition: TEncTop.h:72
UInt m_maxCUWidth
Definition: TEncCfg.h:194
Void setRPSidx(Int rpsIdx)
Definition: TComSlice.h:1344
Window & getDefaultDisplayWindow()
Definition: TEncCfg.h:1199
UInt getNumberValidComponents() const
Definition: TComPicYuv.h:119
TEncSearch m_cSearch
encoder search class
Definition: TEncTop.h:78
Void setProfileIdc(Profile::Name x)
Definition: TComSlice.h:213
Level::Name m_level
Definition: TEncCfg.h:157
Void setConformanceWindow(Window &conformanceWindow)
Definition: TComSlice.h:840
Void setHighPrecisionOffsetsEnabledFlag(Bool value)
Definition: TComSlice.h:730
Int getPPSId() const
Definition: TComSlice.h:1092
Void setFrameFieldInfoPresentFlag(Bool i)
Definition: TComSlice.h:641
TEncTop()
Definition: TEncTop.cpp:53
Void setPCMLog2MinSize(UInt u)
Definition: TComSlice.h:866
Void init(Bool isFieldCoding)
Definition: TEncTop.cpp:183
Int getMarginX(const ComponentID id) const
Definition: TComPicYuv.h:127
Bool m_printFrameMSE
Definition: TEncCfg.h:147
Int getPOC() const
Definition: TComSlice.h:1354
static Void buildNextStateTable()
encoder class (header)
Void setAspectRatioInfoPresentFlag(Bool i)
Definition: TComSlice.h:587
Void setSPSTemporalMVPEnabledFlag(Bool b)
Definition: TComSlice.h:888
TimingInfo * getTimingInfo()
Definition: TComSlice.h:680
TComPTL * getPTL()
Definition: TComSlice.h:509
Void setHrdOpSetIdx(UInt val, UInt i)
Definition: TComSlice.h:473
Int getLog2DiffMaxMinCodingBlockSize() const
Definition: TComSlice.h:853
Bool m_intraSmoothingDisabledFlag
Definition: TEncCfg.h:297
Int getBaseQP() const
Definition: TEncCfg.h:677
static const Int MAX_TLAYER
Explicit temporal layer QP offset - max number of temporal layer.
Definition: CommonDef.h:134
InputColourSpaceConversion
Definition: TypeDef.h:316
Bool m_progressiveSourceFlag
Definition: TEncCfg.h:158
Void setMaxDecPicBuffering(UInt ui, UInt tlayer)
Definition: TComSlice.h:927
Int m_iSearchRange
Definition: TEncCfg.h:222
Void setProgressiveSourceFlag(Bool b)
Definition: TComSlice.h:222
context model class (header)
const GOPEntry & getGOPEntry(Int i) const
Definition: TEncCfg.h:566
Int getSourceHeight()
Definition: TEncCfg.h:653
Void setUsePCM(Bool b)
Definition: TComSlice.h:862
Void setOnePictureOnlyConstraintFlag(Bool b)
Definition: TComSlice.h:243
Void releaseAllReconstructionData()
Definition: TComPic.cpp:177
Void setWPBiPred(Bool b)
Definition: TComSlice.h:1137
Int m_iMaxRefPicNum
this is used to mimic the sliding mechanism used by the decoder
Definition: TEncCfg.h:189
Void setDpbOutputDelayLengthMinus1(UInt value)
Definition: TComSlice.h:358
Void initSliceQpDelta()
Bool getLoopFilterOffsetInPPS()
Definition: TEncCfg.h:696
TEncBinCABACCounter *** m_pppcBinCoderCABAC
temporal CABAC state storage for RD computation
Definition: TEncTop.h:102
Void setPOC(Int i)
Definition: TComSlice.h:1389
TComPic * getPic()
Definition: TComSlice.h:1371
const LumaLevelToDeltaQPMapping & getLumaLevelToDeltaQPMapping() const
Definition: TEncCfg.h:632
Int m_bipredSearchRange
Definition: TEncCfg.h:223
Void setNumTileRowsMinus1(Int i)
Definition: TComSlice.h:1162
Void setInterlacedSourceFlag(Bool b)
Definition: TComSlice.h:225
Void setNumRefIdxL1DefaultActive(UInt ui)
Definition: TComSlice.h:1131
Void setSubPicCpbParamsInPicTimingSEIFlag(Bool flag)
Definition: TComSlice.h:338
Void setNumUnitsInTick(UInt value)
Definition: TComSlice.h:410
Int m_numRefPicsActive
Definition: TEncCfg.h:64
Void setQuadtreeTUMaxDepthIntra(UInt u)
Definition: TComSlice.h:877
Void setBitstreamRestrictionFlag(Bool i)
Definition: TComSlice.h:651
Void createHrdParamBuffer()
Definition: TComSlice.h:463
Void setChromaLocInfoPresentFlag(Bool i)
Definition: TComSlice.h:626
const Int * getdQPs() const
Definition: TEncCfg.h:789
Void setMotionVectorsOverPicBoundariesFlag(Bool i)
Definition: TComSlice.h:657
Void setCpbSizeValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl, UInt value)
Definition: TComSlice.h:379
Void setTransferCharacteristics(Int i)
Definition: TComSlice.h:620
UInt m_uiQuadtreeTUMaxDepthIntra
Definition: TEncCfg.h:203
Int getNumberOfNegativePictures() const
Definition: TComSlice.h:107
Bool m_transformSkipRotationEnabledFlag
Definition: TEncCfg.h:269
Void xInitVPS(TComVPS &vps, const TComSPS &sps)
initialize VPS from encoder options
Definition: TEncTop.cpp:580
Void setLoopFilterAcrossSlicesEnabledFlag(Bool bValue)
Definition: TComSlice.h:1192
Void setBitRateScale(UInt value)
Definition: TComSlice.h:344
Void setReconMark(Bool b)
Definition: TComPic.h:142
Pel * getAddr(const ComponentID ch)
Definition: TComPicYuv.h:139
list template
Definition: TComList.h:61
Void setCabacBypassAlignmentEnabledFlag(const Bool value)
Definition: TComSlice.h:736
Void setNumRefIdxL0DefaultActive(UInt ui)
Definition: TComSlice.h:1129
Void createRPSList(Int numRPS)
Definition: TComSlice.cpp:1566
Void setDeblockingFilterControlPresentFlag(Bool val)
Definition: TComSlice.h:1172
Void setDuBitRateValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl, UInt value)
Definition: TComSlice.h:383
TEncCavlc * m_pcCavlcCoder
CAVLC encoder.
Definition: TEncTop.h:80
Void setTimingInfoPresentFlag(Bool flag)
Definition: TComSlice.h:407
UInt m_log2SaoOffsetScale[MAX_NUM_CHANNEL_TYPE]
Definition: TEncCfg.h:265
Bool m_useTransformSkip
Definition: TEncCfg.h:266
TComLoopFilter m_cLoopFilter
deblocking filter class
Definition: TEncTop.h:83
Void setLowDelayHrdFlag(Int layer, Bool flag)
Definition: TComSlice.h:370
Void setVideoFormat(Int i)
Definition: TComSlice.h:608
Void create(const Int picWidth, const Int picHeight, const ChromaFormat chromaFormatIDC, const UInt maxCUWidth, const UInt maxCUHeight, const UInt maxCUDepth, const Bool bUseMargin)
if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image...
Definition: TComPicYuv.cpp:121
Bool m_nonPackedConstraintFlag
Definition: TEncCfg.h:160
static const Int MAX_NUM_LONG_TERM_REF_PICS
Definition: CommonDef.h:203
Bool getOverscanInfoPresentFlag()
Definition: TEncCfg.h:1173
UInt m_uiIntraPeriod
Definition: TEncCfg.h:169
Void setLog2MinCodingBlockSize(Int val)
Definition: TComSlice.h:852
Void setOutputFlagPresentFlag(Bool b)
Definition: TComSlice.h:1139
TComScalingList & getScalingList()
Definition: TComSlice.h:924
Int getNumberOfPictures() const
Definition: TComSlice.cpp:1675
Void setLoopFilterAcrossTilesEnabledFlag(Bool b)
Definition: TComSlice.h:1147
int Int
Definition: TypeDef.h:211
Bool m_highPrecisionOffsetsEnabledFlag
Definition: TEncCfg.h:246
Bool m_bPCMFilterDisableFlag
Definition: TEncCfg.h:296
Void setVuiParametersPresentFlag(Bool b)
Definition: TComSlice.h:935
Int getMaxCuDQPDepth() const
Definition: TEncCfg.h:712
Bool m_entropyCodingSyncEnabledFlag
Definition: TEncCfg.h:305
Void setPicWidthInLumaSamples(UInt u)
Definition: TComSlice.h:833
ScalingListMode getUseScalingListId()
Definition: TEncCfg.h:1111
UInt getMaxTLayers() const
Definition: TComSlice.h:910
ComponentID
Definition: TypeDef.h:308
std::vector< Int > m_tileRowHeight
Definition: TEncCfg.h:303
Void setPPSDeblockingFilterDisabledFlag(Bool val)
set offset for deblocking filter disabled
Definition: TComSlice.h:1176
Bool getDecodingUnitInfoSEIEnabled() const
Definition: TEncCfg.h:925
Void xInitPPS(TComPPS &pps, const TComSPS &sps)
initialize PPS from encoder options
Definition: TEncTop.cpp:916
UInt m_uiQuadtreeTUMaxDepthInter
Definition: TEncCfg.h:202
Void setTopField(Bool b)
Definition: TComPic.h:163
Void setSubPicCpbParamsPresentFlag(Bool flag)
Definition: TComSlice.h:329
Bool m_rdpcmEnabledFlag[NUMBER_OF_RDPCM_SIGNALLING_MODES]
Definition: TEncCfg.h:273
Void setNumLongTermRefPicSPS(UInt val)
Definition: TComSlice.h:843
Void setTickDivisorMinus2(UInt value)
Definition: TComSlice.h:332
Void setDeltaRIdxMinus1(Int x)
Definition: TComSlice.h:115
Bool isEnabled() const
Definition: TypeDef.h:894
Void xInitHrdParameters(TComSPS &sps)
initialize HRD parameters
Definition: TEncTop.cpp:774
Bool m_interlacedSourceFlag
Definition: TEncCfg.h:159
Bool getTilesFixedStructureFlag()
Definition: TEncCfg.h:1209
Void setRdpcmEnabledFlag(const RDPCMSignallingMode signallingMode, const Bool value)
Definition: TComSlice.h:721
Void xGetNewPicBuffer(TComPic *&rpcPic, Int ppsId)
get picture buffer which will be processed. If ppsId&lt;0, then the ppsMap will be queried for the first...
Definition: TEncTop.cpp:496
UInt getCpbCntMinus1(Int layer) const
Definition: TComSlice.h:374
Bool getVuiParametersPresentFlag()
Definition: TEncCfg.h:1163
Void setPCMLog2MaxSize(UInt u)
Definition: TComSlice.h:864
Void setLog2SaoOffsetScale(ChannelType type, UInt uiBitShift)
Definition: TComSlice.h:1028
UInt getDecodingRefreshType()
Definition: TEncCfg.h:666
Int m_diffCuChromaQpOffsetDepth
If negative, then do not apply chroma qp offsets.
Definition: TEncCfg.h:232
Int getMarginY(const ComponentID id) const
Definition: TComPicYuv.h:128
SliceConstraint getSliceMode() const
Definition: TEncCfg.h:796
UInt m_temporalSubsampleRatio
Definition: TEncCfg.h:137
SliceConstraint getSliceSegmentMode() const
Definition: TEncCfg.h:801
Int getTargetBitrate()
Definition: TEncCfg.h:1122
Void selectReferencePictureSet(TComSlice *slice, Int POCCurr, Int GOPid)
Definition: TEncTop.cpp:1235
Void setBitDepthConstraint(UInt bitDepth)
Definition: TComSlice.h:234
Void destroy()
Definition: TEncTop.cpp:147
Void setOverscanAppropriateFlag(Bool i)
Definition: TComSlice.h:602
Void setChromaQpOffsetListEntry(Int cuChromaQpOffsetIdxPlus1, Int cbOffset, Int crOffset)
Definition: TComSlice.h:1018
Bool m_loopFilterAcrossTilesEnabledFlag
Definition: TEncCfg.h:298
SBAC encoder class.
Definition: TEncSbac.h:66
double Double
Definition: TypeDef.h:213
Void setDeblockingFilterOverrideEnabledFlag(Bool val)
Definition: TComSlice.h:1174
Void setBorderExtension(Bool b)
Definition: TComPicYuv.h:170
Void setDeblockingFilterTcOffsetDiv2(Int val)
set tc offset for deblocking filter
Definition: TComSlice.h:1180
Int getMatrixCoefficients()
Definition: TEncCfg.h:1189
TComList< TComPic * > m_cListPic
dynamic list of pictures
Definition: TEncTop.h:75
Int m_iNumPicRcvd
number of received pictures
Definition: TEncTop.h:73
Void setConstrainedIntraPred(Bool b)
Definition: TComSlice.h:1102
virtual ~TEncTop()
Definition: TEncTop.cpp:79
Reference Picture Set class.
Definition: TComSlice.h:65
Void createEncData(Bool isPreDBFSamplesUsed)
slice header class
Definition: TComSlice.h:1225
Pel * getBuf(const ComponentID ch)
Definition: TComPicYuv.h:135
static const Int MAX_QP
Definition: CommonDef.h:126
Void setChangedFlag(Int psId, Bool bChanged=true)
Definition: TComSlice.h:1616
Int getChromaSampleLocTypeTopField()
Definition: TEncCfg.h:1193
Int getGOPSize()
Definition: TEncCfg.h:670
Void setBitDepth(ChannelType type, Int u)
Definition: TComSlice.h:895
class of picture which includes side information for encoder (header)
Void xInitRPS(TComSPS &sps, Bool isFieldCoding)
initialize PPS from encoder options
Definition: TEncTop.cpp:1084
Int getDeblockingFilterTcOffsetDiv2() const
get tc offset for deblocking filter
Definition: TComSlice.h:1181
Void setDefaultScalingList()
Definition: TComSlice.cpp:1796
Int m_numReorderPics[MAX_TLAYER]
Definition: TEncCfg.h:178
Int m_referencePics[MAX_NUM_REF_PICS]
Definition: TEncCfg.h:67
Void xInitPPSforTiles(TComPPS &pps)
Definition: TEncTop.cpp:1301
Int getLoopFilterBetaOffset()
Definition: TEncCfg.h:697
Bool getChangedFlag(Int psId) const
Definition: TComSlice.h:1632
Void setNeutralChromaIndicationFlag(Bool i)
Definition: TComSlice.h:635
Int getDeblockingFilterMetric()
Definition: TEncCfg.h:699
UInt getNumUnitsInTick() const
Definition: TComSlice.h:411
Int getSarHeight()
Definition: TEncCfg.h:1171
Void setIntraSmoothingDisabledFlag(Bool bValue)
Definition: TComSlice.h:727
Bool getDeblockingFilterOverrideEnabledFlag() const
Definition: TComSlice.h:1175
Void setTemporalIdNestingFlag(Bool bValue)
Definition: TComSlice.h:914
Void setMaxOpSets(UInt v)
Definition: TComSlice.h:505
Bool getAspectRatioInfoPresentFlag()
Definition: TEncCfg.h:1165
Window m_conformanceWindow
Definition: TEncCfg.h:140
MESearchMethod m_motionEstimationSearchMethod
Definition: TEncCfg.h:221
TEncCu m_cCuEncoder
CU encoder.
Definition: TEncTop.h:93
TComHRD * getHrdParameters()
Definition: TComSlice.h:677
Bool getVuiParametersPresentFlag() const
Definition: TComSlice.h:934
Void init(Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP])
Void setNumberOfLongtermPictures(Int number)
Definition: TComSlice.h:110
Void setInitialCpbRemovalDelayLengthMinus1(UInt value)
Definition: TComSlice.h:352
Void destroyROM()
Definition: TComRom.cpp:263
Void setUseTransformSkip(Bool b)
Definition: TComSlice.h:1145
static const Int MAX_NUM_SPS
Definition: CommonDef.h:164
Int m_extraRPSs
Definition: TEncCfg.h:176
Void setSarWidth(Int i)
Definition: TComSlice.h:593
CostMode m_costMode
The cost function to use, primarily when considering lossless coding.
Definition: TEncCfg.h:467
Void setNumRefIdc(Int x)
Definition: TComSlice.h:119
UInt getMaxCUWidth() const
Definition: TComSlice.h:857
UInt getBitRateScale() const
Definition: TComSlice.h:345
Void compressGOP(Int iPOCLast, Int iNumPicRcvd, TComList< TComPic * > &rcListPic, TComList< TComPicYuv * > &rcListPicYuvRec, std::list< AccessUnit > &accessUnitsInGOP, Bool isField, Bool isTff, const InputColourSpaceConversion snr_conversion, const Bool printFrameMSE, const Bool printMSSSIM)
Definition: TEncGOP.cpp:1155
const TComSPS * getSPS() const
Definition: TComSlice.h:1329
SPS class.
Definition: TComSlice.h:740
Bool getMotionVectorsOverPicBoundariesFlag()
Definition: TEncCfg.h:1211
Bool m_RCEnableRateControl
Definition: TEncCfg.h:454