HEVC Test Model (HM)  HM-16.3
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-2015, ITU/ISO/IEC
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18  * be used to endorse or promote products derived from this software without
19  * specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31  * THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
38 #include "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 {
55  m_iPOCLast = -1;
56  m_iNumPicRcvd = 0;
61 #if ENC_DEC_TRACE
62  if (g_hTrace == NULL)
63  {
64  g_hTrace = fopen( "TraceEnc.txt", "wb" );
65  }
67  g_nSymbolCounter = 0;
68 #endif
69 
70  m_iMaxRefPicNum = 0;
71 
72 #if FAST_BIT_EST
74 #endif
75 }
76 
78 {
79 #if ENC_DEC_TRACE
80  if (g_hTrace != stdout)
81  {
82  fclose( g_hTrace );
83  }
84 #endif
85 }
86 
88 {
89  // initialize global variables
90  initROM();
91 
92  // create processing unit classes
96  if (m_bUseSAO)
97  {
99 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK
101 #else
103 #endif
104  }
105 #if ADAPTIVE_QP_SELECTION
107  {
109  }
110 #endif
111 
113 
114  if ( m_RCEnableRateControl )
115  {
118  }
119 
121 #if FAST_BIT_EST
123 #else
125 #endif
126 
127  for ( Int iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ )
128  {
129  m_pppcRDSbacCoder[iDepth] = new TEncSbac* [CI_NUM];
130 #if FAST_BIT_EST
132 #else
133  m_pppcBinCoderCABAC[iDepth] = new TEncBinCABAC* [CI_NUM];
134 #endif
135 
136  for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ )
137  {
138  m_pppcRDSbacCoder[iDepth][iCIIdx] = new TEncSbac;
139 #if FAST_BIT_EST
140  m_pppcBinCoderCABAC [iDepth][iCIIdx] = new TEncBinCABACCounter;
141 #else
142  m_pppcBinCoderCABAC [iDepth][iCIIdx] = new TEncBinCABAC;
143 #endif
144  m_pppcRDSbacCoder [iDepth][iCIIdx]->init( m_pppcBinCoderCABAC [iDepth][iCIIdx] );
145  }
146  }
147 }
148 
150 {
151  // destroy processing unit classes
155  m_cEncSAO. destroyEncData();
156  m_cEncSAO. destroy();
158  m_cRateCtrl. destroy();
159  Int iDepth;
160  for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ )
161  {
162  for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ )
163  {
164  delete m_pppcRDSbacCoder[iDepth][iCIIdx];
165  delete m_pppcBinCoderCABAC[iDepth][iCIIdx];
166  }
167  }
168 
169  for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ )
170  {
171  delete [] m_pppcRDSbacCoder[iDepth];
172  delete [] m_pppcBinCoderCABAC[iDepth];
173  }
174 
175  delete [] m_pppcRDSbacCoder;
176  delete [] m_pppcBinCoderCABAC;
177 
178  // destroy ROM
179  destroyROM();
180 
181  return;
182 }
183 
184 Void TEncTop::init(Bool isFieldCoding)
185 {
186  // initialize SPS
187  xInitSPS();
188  xInitVPS();
189 
191 
192  // initialize PPS
193  xInitPPS();
194  xInitRPS(isFieldCoding);
195 
197 
198  // initialize processing unit classes
199  m_cGOPEncoder. init( this );
200  m_cSliceEncoder.init( this );
201  m_cCuEncoder. init( this );
202 
203  // initialize transform & quantization class
205 
207  m_useRDOQ,
208  m_useRDOQTS,
209  true
213 #endif
214  );
215 
216  // initialize encoder search class
218 
219  m_iMaxRefPicNum = 0;
220 
222 }
223 
225 {
226  // Initialise scaling lists
227  // The encoder will only use the SPS scaling lists. The PPS will never be marked present.
228 
230  {
232  getTrQuant()->setUseScalingList(false);
235  }
237  {
242  getTrQuant()->setUseScalingList(true);
243  }
245  {
248  {
249  Bool bParsedScalingList=false; // Use of boolean so that assertion outputs useful string
250  assert(bParsedScalingList);
251  exit(1);
252  }
257  getTrQuant()->setUseScalingList(true);
258  }
259  else
260  {
261  printf("error : ScalingList == %d not supported\n",getUseScalingListId());
262  assert(0);
263  }
264 
265  // Prepare delta's:
266  for(UInt sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
267  {
268  const Int predListStep = (sizeId == SCALING_LIST_32x32? (SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) : 1); // if 32x32, skip over chroma entries.
269 
270  for(UInt listId = 0; listId < SCALING_LIST_NUM; listId+=predListStep)
271  {
272  m_cSPS.getScalingList().checkPredMode( sizeId, listId );
273  }
274  }
275 
276 }
277 
278 // ====================================================================================================================
279 // Public member functions
280 // ====================================================================================================================
281 
283 {
284  TComList<TComPic*>::iterator iterPic = m_cListPic.begin();
285  Int iSize = Int( m_cListPic.size() );
286 
287  for ( Int i = 0; i < iSize; i++ )
288  {
289  TComPic* pcPic = *(iterPic++);
290 
291  pcPic->destroy();
292  delete pcPic;
293  pcPic = NULL;
294  }
295 }
296 
310 Void TEncTop::encode( Bool flush, TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded )
311 {
312  if (pcPicYuvOrg != NULL)
313  {
314  // get original YUV
315  TComPic* pcPicCurr = NULL;
316 
317  xGetNewPicBuffer( pcPicCurr );
318  pcPicYuvOrg->copyToPic( pcPicCurr->getPicYuvOrg() );
319  pcPicYuvTrueOrg->copyToPic( pcPicCurr->getPicYuvTrueOrg() );
320 
321  // compute image characteristics
322  if ( getUseAdaptiveQP() )
323  {
324  m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcPicCurr ) );
325  }
326  }
327 
328  if ((m_iNumPicRcvd == 0) || (!flush && (m_iPOCLast != 0) && (m_iNumPicRcvd != m_iGOPSize) && (m_iGOPSize != 0)))
329  {
330  iNumEncoded = 0;
331  return;
332  }
333 
334  if ( m_RCEnableRateControl )
335  {
337  }
338 
339  // compress GOP
340  m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, false, false, snrCSC, m_printFrameMSE);
341 
342  if ( m_RCEnableRateControl )
343  {
345  }
346 
347  iNumEncoded = m_iNumPicRcvd;
348  m_iNumPicRcvd = 0;
349  m_uiNumAllPicCoded += iNumEncoded;
350 }
351 
355 Void separateFields(Pel* org, Pel* dstField, UInt stride, UInt width, UInt height, Bool isTop)
356 {
357  if (!isTop)
358  {
359  org += stride;
360  }
361  for (Int y = 0; y < height>>1; y++)
362  {
363  for (Int x = 0; x < width; x++)
364  {
365  dstField[x] = org[x];
366  }
367 
368  dstField += stride;
369  org += stride*2;
370  }
371 
372 }
373 
374 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Bool isTff)
375 {
376  iNumEncoded = 0;
377 
378  for (Int fieldNum=0; fieldNum<2; fieldNum++)
379  {
380  if (pcPicYuvOrg)
381  {
382 
383  /* -- field initialization -- */
384  const Bool isTopField=isTff==(fieldNum==0);
385 
386  TComPic *pcField;
387  xGetNewPicBuffer( pcField );
388  pcField->setReconMark (false); // where is this normally?
389 
390  if (fieldNum==1) // where is this normally?
391  {
392  TComPicYuv* rpcPicYuvRec;
393 
394  // org. buffer
395  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.
396  {
397  rpcPicYuvRec = rcListPicYuvRecOut.popFront();
398  }
399  else
400  {
401  rpcPicYuvRec = new TComPicYuv;
403  }
404  rcListPicYuvRecOut.pushBack( rpcPicYuvRec );
405  }
406 
407  pcField->getSlice(0)->setPOC( m_iPOCLast ); // superfluous?
408  pcField->getPicYuvRec()->setBorderExtension(false);// where is this normally?
409 
410  pcField->setTopField(isTopField); // interlaced requirement
411 
412  for (UInt componentIndex = 0; componentIndex < pcPicYuvOrg->getNumberValidComponents(); componentIndex++)
413  {
414  const ComponentID component = ComponentID(componentIndex);
415  const UInt stride = pcPicYuvOrg->getStride(component);
416 
417  separateFields((pcPicYuvOrg->getBuf(component) + pcPicYuvOrg->getMarginX(component) + (pcPicYuvOrg->getMarginY(component) * stride)),
418  pcField->getPicYuvOrg()->getAddr(component),
419  pcPicYuvOrg->getStride(component),
420  pcPicYuvOrg->getWidth(component),
421  pcPicYuvOrg->getHeight(component),
422  isTopField);
423 
424  separateFields((pcPicYuvTrueOrg->getBuf(component) + pcPicYuvTrueOrg->getMarginX(component) + (pcPicYuvTrueOrg->getMarginY(component) * stride)),
425  pcField->getPicYuvTrueOrg()->getAddr(component),
426  pcPicYuvTrueOrg->getStride(component),
427  pcPicYuvTrueOrg->getWidth(component),
428  pcPicYuvTrueOrg->getHeight(component),
429  isTopField);
430  }
431 
432  // compute image characteristics
433  if ( getUseAdaptiveQP() )
434  {
435  m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcField ) );
436  }
437  }
438 
439  if ( m_iNumPicRcvd && ((flush&&fieldNum==1) || (m_iPOCLast/2)==0 || m_iNumPicRcvd==m_iGOPSize ) )
440  {
441  // compress GOP
442  m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, accessUnitsOut, true, isTff, snrCSC, m_printFrameMSE);
443 
444  iNumEncoded += m_iNumPicRcvd;
446  m_iNumPicRcvd = 0;
447  }
448  }
449 }
450 
451 // ====================================================================================================================
452 // Protected member functions
453 // ====================================================================================================================
454 
463 {
464  // At this point, the SPS and PPS can be considered activated - they are copied to the new TComPic.
465 
467 
468 
469  if (m_cListPic.size() >= (UInt)(m_iGOPSize + getMaxDecPicBuffering(MAX_TLAYER-1) + 2) )
470  {
471  TComList<TComPic*>::iterator iterPic = m_cListPic.begin();
472  Int iSize = Int( m_cListPic.size() );
473  for ( Int i = 0; i < iSize; i++ )
474  {
475  rpcPic = *(iterPic++);
476  if(rpcPic->getSlice(0)->isReferenced() == false)
477  {
478  break;
479  }
480  }
481  }
482  else
483  {
484  if ( getUseAdaptiveQP() )
485  {
486  TEncPic* pcEPic = new TEncPic;
488  rpcPic = pcEPic;
489  }
490  else
491  {
492  rpcPic = new TComPic;
494  }
495 
496  m_cListPic.pushBack( rpcPic );
497  }
498  rpcPic->setReconMark (false);
499 
500  m_iPOCLast++;
501  m_iNumPicRcvd++;
502 
503  rpcPic->getSlice(0)->setPOC( m_iPOCLast );
504  // mark it should be extended
505  rpcPic->getPicYuvRec()->setBorderExtension(false);
506 }
507 
509 {
510  // The SPS must have already been set up.
511  // set the VPS profile information.
512  *m_cVPS.getPTL() = *m_cSPS.getPTL();
513  m_cVPS.setMaxOpSets(1);
516 
518  for( UInt i = 0; i < m_cVPS.getNumHrdParameters(); i ++ )
519  {
520  m_cVPS.setHrdOpSetIdx( 0, i );
521  m_cVPS.setCprmsPresentFlag( false, i );
522  // Set up HrdParameters here.
523  }
524 }
525 
527 {
528  ProfileTierLevel& profileTierLevel = *m_cSPS.getPTL()->getGeneralPTL();
529  profileTierLevel.setLevelIdc(m_level);
530  profileTierLevel.setTierFlag(m_levelTier);
531  profileTierLevel.setProfileIdc(m_profile);
532  profileTierLevel.setProfileCompatibilityFlag(m_profile, 1);
541 
543  {
544  /* The above constraint is equal to Profile::MAIN */
545  profileTierLevel.setProfileCompatibilityFlag(Profile::MAIN, 1);
546  }
547  if (m_profile == Profile::MAIN)
548  {
549  /* A Profile::MAIN10 decoder can always decode Profile::MAIN */
550  profileTierLevel.setProfileCompatibilityFlag(Profile::MAIN10, 1);
551  }
552  /* XXX: should Main be marked as compatible with still picture? */
553  /* XXX: may be a good idea to refactor the above into a function
554  * that chooses the actual compatibility based upon options */
555 
563 
565  Int log2MinCUSize = 0;
566  while(minCUSize > 1)
567  {
568  minCUSize >>= 1;
569  log2MinCUSize++;
570  }
571 
572  m_cSPS.setLog2MinCodingBlockSize(log2MinCUSize);
574 
578 
583 
585 
587 
589 
590  for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
591  {
592  m_cSPS.setBitDepth (ChannelType(channelType), g_bitDepth[channelType] );
593  m_cSPS.setQpBDOffset (ChannelType(channelType), (6 * (g_bitDepth[channelType] - 8)));
594  m_cSPS.setPCMBitDepth (ChannelType(channelType), g_PCMBitDepth[channelType] );
595  }
596 
599 
605 
606  for (UInt signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++)
607  {
608  m_cSPS.setUseResidualDPCM(RDPCMSignallingMode(signallingModeIndex), m_useResidualDPCM[signallingModeIndex]);
609  }
610 
612  m_cSPS.setTemporalIdNestingFlag( ( m_maxTempLayer == 1 ) ? true : false );
613 
614  for (Int i = 0; i < min(m_cSPS.getMaxTLayers(),(UInt) MAX_TLAYER); i++ )
615  {
618  }
619 
625 
627  {
628  TComVUI* pcVUI = m_cSPS.getVuiParameters();
631  pcVUI->setSarWidth(getSarWidth());
632  pcVUI->setSarHeight(getSarHeight());
636  pcVUI->setVideoFormat(getVideoFormat());
648  pcVUI->setFieldSeqFlag(false);
649  pcVUI->setHrdParametersPresentFlag(false);
660  }
663  for (Int k = 0; k < NUM_LONG_TERM_REF_PIC_SPS; k++)
664  {
667  }
669  {
670  const UInt picWidth = m_cSPS.getPicWidthInLumaSamples();
671  const UInt picHeight= m_cSPS.getPicWidthInLumaSamples();
672 
673  const UInt frameWidthInCtus = ( picWidth + g_uiMaxCUWidth -1 ) / g_uiMaxCUWidth;
674  const UInt frameHeightInCtus = ( picHeight + g_uiMaxCUHeight - 1 ) / g_uiMaxCUHeight;
675  const UInt numCtusInFrame = frameWidthInCtus * frameHeightInCtus;
676 
677  UInt maxCU = getSliceArgument();
678  UInt numDU = ( getSliceMode() == FIXED_NUMBER_OF_CTU ) ? ( numCtusInFrame / maxCU ) : ( 0 );
679  if( numCtusInFrame % maxCU != 0 || numDU == 0 )
680  {
681  numDU ++;
682  }
685  }
687  {
689  }
690 
691 }
692 
694 {
696  Bool bUseDQP = (getMaxCuDQPDepth() > 0)? true : false;
697 
698  if((getMaxDeltaQP() != 0 )|| getUseAdaptiveQP())
699  {
700  bUseDQP = true;
701  }
702 
704  {
705  bUseDQP=false;
706  }
707 
708 
709  if ( m_RCEnableRateControl )
710  {
711  m_cPPS.setUseDQP(true);
713  }
714  else if(bUseDQP)
715  {
716  m_cPPS.setUseDQP(true);
718  }
719  else
720  {
721  m_cPPS.setUseDQP(false);
723  }
724 
726  {
728  m_cPPS.setChromaQpAdjTableAt(1, 6, 6);
729  /* todo, insert table entries from command line (NB, 0 should not be touched) */
730  }
731  else
732  {
735  }
736 
739 
750  {
756  }
757  else
758  {
760 
762  {
765  }
766  }
767 
769  {
772  }
776 
777 
778  Int histogram[MAX_NUM_REF + 1];
779  for( Int i = 0; i <= MAX_NUM_REF; i++ )
780  {
781  histogram[i]=0;
782  }
783  for( Int i = 0; i < getGOPSize(); i++)
784  {
785  assert(getGOPEntry(i).m_numRefPicsActive >= 0 && getGOPEntry(i).m_numRefPicsActive <= MAX_NUM_REF);
786  histogram[getGOPEntry(i).m_numRefPicsActive]++;
787  }
788 
789  Int maxHist=-1;
790  Int bestPos=0;
791  for( Int i = 0; i <= MAX_NUM_REF; i++ )
792  {
793  if(histogram[i]>maxHist)
794  {
795  maxHist=histogram[i];
796  bestPos=i;
797  }
798  }
799  assert(bestPos <= 15);
805 
807  {
809  }
810 }
811 
812 //Function for initializing m_RPSList, a list of TComReferencePictureSet, based on the GOPEntry objects read from the config file.
814 {
816 
818  TComRPSList* rpsList = m_cSPS.getRPSList();
819 
820  for( Int i = 0; i < getGOPSize()+m_extraRPSs; i++)
821  {
822  GOPEntry ge = getGOPEntry(i);
823  rps = rpsList->getReferencePictureSet(i);
825  rps->setNumRefIdc(ge.m_numRefIdc);
826  Int numNeg = 0;
827  Int numPos = 0;
828  for( Int j = 0; j < ge.m_numRefPics; j++)
829  {
830  rps->setDeltaPOC(j,ge.m_referencePics[j]);
831  rps->setUsed(j,ge.m_usedByCurrPic[j]);
832  if(ge.m_referencePics[j]>0)
833  {
834  numPos++;
835  }
836  else
837  {
838  numNeg++;
839  }
840  }
841  rps->setNumberOfNegativePictures(numNeg);
842  rps->setNumberOfPositivePictures(numPos);
843 
844  // handle inter RPS intialization from the config file.
845  rps->setInterRPSPrediction(ge.m_interRPSPrediction > 0); // not very clean, converting anything > 0 to true.
846  rps->setDeltaRIdxMinus1(0); // index to the Reference RPS is always the previous one.
847  TComReferencePictureSet* RPSRef = i>0 ? rpsList->getReferencePictureSet(i-1): NULL; // get the reference RPS
848 
849  if (ge.m_interRPSPrediction == 2) // Automatic generation of the inter RPS idc based on the RIdx provided.
850  {
851  assert (RPSRef!=NULL);
852  Int deltaRPS = getGOPEntry(i-1).m_POC - ge.m_POC; // the ref POC - current POC
853  Int numRefDeltaPOC = RPSRef->getNumberOfPictures();
854 
855  rps->setDeltaRPS(deltaRPS); // set delta RPS
856  rps->setNumRefIdc(numRefDeltaPOC+1); // set the numRefIdc to the number of pictures in the reference RPS + 1.
857  Int count=0;
858  for (Int j = 0; j <= numRefDeltaPOC; j++ ) // cycle through pics in reference RPS.
859  {
860  Int RefDeltaPOC = (j<numRefDeltaPOC)? RPSRef->getDeltaPOC(j): 0; // if it is the last decoded picture, set RefDeltaPOC = 0
861  rps->setRefIdc(j, 0);
862  for (Int k = 0; k < rps->getNumberOfPictures(); k++ ) // cycle through pics in current RPS.
863  {
864  if (rps->getDeltaPOC(k) == ( RefDeltaPOC + deltaRPS)) // if the current RPS has a same picture as the reference RPS.
865  {
866  rps->setRefIdc(j, (rps->getUsed(k)?1:2));
867  count++;
868  break;
869  }
870  }
871  }
872  if (count != rps->getNumberOfPictures())
873  {
874  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");
875  rps->setInterRPSPrediction(0);
876  }
877  }
878  else if (ge.m_interRPSPrediction == 1) // inter RPS idc based on the RefIdc values provided in config file.
879  {
880  assert (RPSRef!=NULL);
881  rps->setDeltaRPS(ge.m_deltaRPS);
882  rps->setNumRefIdc(ge.m_numRefIdc);
883  for (Int j = 0; j < ge.m_numRefIdc; j++ )
884  {
885  rps->setRefIdc(j, ge.m_refIdc[j]);
886  }
887 #if WRITE_BACK
888  // the following code overwrite the deltaPOC and Used by current values read from the config file with the ones
889  // computed from the RefIdc. A warning is printed if they are not identical.
890  numNeg = 0;
891  numPos = 0;
892  TComReferencePictureSet RPSTemp; // temporary variable
893 
894  for (Int j = 0; j < ge.m_numRefIdc; j++ )
895  {
896  if (ge.m_refIdc[j])
897  {
898  Int deltaPOC = ge.m_deltaRPS + ((j < RPSRef->getNumberOfPictures())? RPSRef->getDeltaPOC(j) : 0);
899  RPSTemp.setDeltaPOC((numNeg+numPos),deltaPOC);
900  RPSTemp.setUsed((numNeg+numPos),ge.m_refIdc[j]==1?1:0);
901  if (deltaPOC<0)
902  {
903  numNeg++;
904  }
905  else
906  {
907  numPos++;
908  }
909  }
910  }
911  if (numNeg != rps->getNumberOfNegativePictures())
912  {
913  printf("Warning: number of negative pictures in RPS is different between intra and inter RPS specified in the config file.\n");
914  rps->setNumberOfNegativePictures(numNeg);
915  rps->setNumberOfPictures(numNeg+numPos);
916  }
917  if (numPos != rps->getNumberOfPositivePictures())
918  {
919  printf("Warning: number of positive pictures in RPS is different between intra and inter RPS specified in the config file.\n");
920  rps->setNumberOfPositivePictures(numPos);
921  rps->setNumberOfPictures(numNeg+numPos);
922  }
923  RPSTemp.setNumberOfPictures(numNeg+numPos);
924  RPSTemp.setNumberOfNegativePictures(numNeg);
925  RPSTemp.sortDeltaPOC(); // sort the created delta POC before comparing
926  // check if Delta POC and Used are the same
927  // print warning if they are not.
928  for (Int j = 0; j < ge.m_numRefIdc; j++ )
929  {
930  if (RPSTemp.getDeltaPOC(j) != rps->getDeltaPOC(j))
931  {
932  printf("Warning: delta POC is different between intra RPS and inter RPS specified in the config file.\n");
933  rps->setDeltaPOC(j,RPSTemp.getDeltaPOC(j));
934  }
935  if (RPSTemp.getUsed(j) != rps->getUsed(j))
936  {
937  printf("Warning: Used by Current in RPS is different between intra and inter RPS specified in the config file.\n");
938  rps->setUsed(j,RPSTemp.getUsed(j));
939  }
940  }
941 #endif
942  }
943  }
944  //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.
945  //The position = GOPSize + extraRPSs which is (a priori) unused is reserved for this field in the RPS.
946  if (isFieldCoding)
947  {
948  rps = rpsList->getReferencePictureSet(getGOPSize()+m_extraRPSs);
949  rps->setNumberOfPictures(1);
953  rps->setDeltaPOC(0,-1);
954  rps->setPOC(0,0);
955  rps->setUsed(0,true);
956  rps->setInterRPSPrediction(false);
957  rps->setDeltaRIdxMinus1(0);
958  rps->setDeltaRPS(0);
959  rps->setNumRefIdc(0);
960  }
961 }
962 
963  // This is a function that
964  // determines what Reference Picture Set to use
965  // for a specific slice (with POC = POCCurr)
967 {
968  slice->setRPSidx(GOPid);
969 
970  for(Int extraNum=m_iGOPSize; extraNum<m_extraRPSs+m_iGOPSize; extraNum++)
971  {
972  if(m_uiIntraPeriod > 0 && getDecodingRefreshType() > 0)
973  {
974  Int POCIndex = POCCurr%m_uiIntraPeriod;
975  if(POCIndex == 0)
976  {
977  POCIndex = m_uiIntraPeriod;
978  }
979  if(POCIndex == m_GOPList[extraNum].m_POC)
980  {
981  slice->setRPSidx(extraNum);
982  }
983  }
984  else
985  {
986  if(POCCurr==m_GOPList[extraNum].m_POC)
987  {
988  slice->setRPSidx(extraNum);
989  }
990  }
991  }
992 
993  if(POCCurr == 1 && slice->getPic()->isField())
994  {
995  slice->setRPSidx(m_iGOPSize+m_extraRPSs);
996  }
997 
998  TComReferencePictureSet *rps=slice->getLocalRPS();
999  (*rps) = *(slice->getSPS()->getRPSList()->getReferencePictureSet(slice->getRPSidx()));
1000  slice->setRPS(rps);
1002 }
1003 
1005 {
1006  Int rpsIdx = GOPid;
1007 
1008  for(Int extraNum=m_iGOPSize; extraNum<m_extraRPSs+m_iGOPSize; extraNum++)
1009  {
1010  if(m_uiIntraPeriod > 0 && getDecodingRefreshType() > 0)
1011  {
1012  Int POCIndex = POCCurr%m_uiIntraPeriod;
1013  if(POCIndex == 0)
1014  {
1015  POCIndex = m_uiIntraPeriod;
1016  }
1017  if(POCIndex == m_GOPList[extraNum].m_POC)
1018  {
1019  rpsIdx = extraNum;
1020  }
1021  }
1022  else
1023  {
1024  if(POCCurr==m_GOPList[extraNum].m_POC)
1025  {
1026  rpsIdx = extraNum;
1027  }
1028  }
1029  }
1030 
1031  return rpsIdx;
1032 }
1033 
1035 {
1040  {
1043  }
1045 
1046  // # substreams is "per tile" when tiles are independent.
1047 }
1048 
1050 {
1053  UInt uiCummulativeColumnWidth = 0;
1054  UInt uiCummulativeRowHeight = 0;
1055 
1056  //check the column relative parameters
1058  {
1059  printf( "The number of columns is larger than the maximum allowed number of columns.\n" );
1060  exit( EXIT_FAILURE );
1061  }
1062 
1063  if( m_iNumColumnsMinus1 >= iWidthInCU )
1064  {
1065  printf( "The current picture can not have so many columns.\n" );
1066  exit( EXIT_FAILURE );
1067  }
1068 
1070  {
1071  for(Int i=0; i<m_iNumColumnsMinus1; i++)
1072  {
1073  uiCummulativeColumnWidth += m_tileColumnWidth[i];
1074  }
1075 
1076  if( uiCummulativeColumnWidth >= iWidthInCU )
1077  {
1078  printf( "The width of the column is too large.\n" );
1079  exit( EXIT_FAILURE );
1080  }
1081  }
1082 
1083  //check the row relative parameters
1084  if( m_iNumRowsMinus1 >= (1<<(LOG2_MAX_NUM_ROWS_MINUS1+1)) )
1085  {
1086  printf( "The number of rows is larger than the maximum allowed number of rows.\n" );
1087  exit( EXIT_FAILURE );
1088  }
1089 
1090  if( m_iNumRowsMinus1 >= iHeightInCU )
1091  {
1092  printf( "The current picture can not have so many rows.\n" );
1093  exit( EXIT_FAILURE );
1094  }
1095 
1097  {
1098  for(Int i=0; i<m_iNumRowsMinus1; i++)
1099  {
1100  uiCummulativeRowHeight += m_tileRowHeight[i];
1101  }
1102 
1103  if( uiCummulativeRowHeight >= iHeightInCU )
1104  {
1105  printf( "The height of the row is too large.\n" );
1106  exit( EXIT_FAILURE );
1107  }
1108  }
1109 }
Void setScalingList(TComScalingList *scalingList, const ChromaFormat format)
Bool m_useStrongIntraSmoothing
enable the use of strong intra smoothing (bi_linear interpolation) for 32x32 blocks when reference sa...
Definition: TEncCfg.h:359
Void setNumTileColumnsMinus1(Int i)
Definition: TComSlice.h:1134
Int getNumberOfPositivePictures() const
Definition: TComSlice.h:109
Void setColourDescriptionPresentFlag(Bool i)
Definition: TComSlice.h:651
Bool getOverscanAppropriateFlag()
Definition: TEncCfg.h:790
virtual Void destroy()
Definition: TComPic.cpp:91
Void init(TEncBinIf *p)
Definition: TEncSbac.h:72
Level::Tier m_levelTier
Definition: TEncCfg.h:118
Int m_maxTempLayer
Max temporal layer.
Definition: TEncCfg.h:146
UInt getIntraPeriod()
Definition: TEncCfg.h:473
#define LOG2_MAX_NUM_ROWS_MINUS1
Definition: TypeDef.h:198
UInt g_uiMaxCUDepth
Definition: TComRom.cpp:253
Void checkPredMode(UInt sizeId, UInt listId)
Definition: TComSlice.cpp:1988
UInt m_bitDepthConstraintValue
Definition: TEncCfg.h:124
Void setUsed(Int bufferNum, Bool used)
Definition: TComSlice.cpp:1800
Void setQuadtreeTULog2MaxSize(UInt u)
Definition: TComSlice.h:860
Int getSarWidth()
Definition: TEncCfg.h:784
Bool m_useSingleSignificanceMapContext
Definition: TEncCfg.h:205
Int getFrameRate()
Definition: TEncCfg.h:464
Void setVideoSignalTypePresentFlag(Bool i)
Definition: TComSlice.h:642
Void create(UInt uiMaxCUDepth)
Bool getUseAdaptiveQP()
Definition: TEncCfg.h:503
TEncSbac *** getRDSbacCoder()
Definition: TEncTop.h:152
Void setSarHeight(Int i)
Definition: TComSlice.h:633
Void create(const Int iPicWidth, const Int iPicHeight, const ChromaFormat chromaFormatIDC, const UInt uiMaxCUWidth, const UInt uiMaxCUHeight, const UInt uiMaxCUDepth)
Definition: TComPicYuv.cpp:81
Void setMaxCUHeight(UInt u)
Definition: TComSlice.h:846
Void setUseWP(Bool b)
Definition: TComSlice.h:1104
picture YUV buffer class
Definition: TComPicYuv.h:55
Void setUseDQP(Bool b)
Definition: TComSlice.h:1049
GOPEntry m_GOPList[64]
Definition: TEncCfg.h:133
TComPPS m_cPPS
PPS. This is the base value. This is copied to TComPicSym.
Definition: TEncTop.h:96
ChannelType
Definition: TypeDef.h:361
SliceConstraint m_sliceSegmentMode
Definition: TEncCfg.h:220
Bool checkDefaultScalingList()
Definition: TComSlice.cpp:1959
Void setMatrixCoefficients(Int i)
Definition: TComSlice.h:660
Int getMaxBytesPerPicDenom()
Definition: TEncCfg.h:830
picture class (symbol + YUV buffers)
Definition: TComPic.h:56
Void setTierFlag(Level::Tier x)
Definition: TComSlice.h:209
Defines constants, macros and tool parameters.
#define CABAC_INIT_PRESENT_FLAG
Definition: TypeDef.h:210
Int getNumTicksPocDiffOneMinus1()
Definition: TEncCfg.h:820
void Void
Definition: TypeDef.h:285
Int getRPSidx() const
Definition: TComSlice.h:1328
Void setVideoFullRangeFlag(Bool i)
Definition: TComSlice.h:648
#define NUM_LONG_TERM_REF_PIC_SPS
Definition: TypeDef.h:216
TEncEntropy m_cEntropyCoder
entropy encoder
Definition: TEncTop.h:85
Void init(TEncTop *pcEncTop)
Definition: TEncSlice.cpp:117
Int getAspectRatioIdc()
Definition: TEncCfg.h:782
Bool m_useCrossComponentPrediction
Definition: TEncCfg.h:198
Int m_deltaRPS
Definition: TEncCfg.h:64
Int getUsed(Int bufferNum) const
Definition: TComSlice.cpp:1815
Bool m_frameOnlyConstraintFlag
Definition: TEncCfg.h:123
Void xPreanalyze(TEncPic *pcPic)
Void setNumberOfNegativePictures(Int number)
Definition: TComSlice.h:106
Int getStride(const ComponentID id) const
Definition: TComPicYuv.h:113
Void setMinSpatialSegmentationIdc(Int i)
Definition: TComSlice.h:700
TComPicYuv * getPicYuvTrueOrg()
Definition: TComPic.h:61
Int getTMVPModeId()
Definition: TEncCfg.h:744
Bool xParseScalingList(Char *pchFile)
Definition: TComSlice.cpp:2065
Int m_RCTargetBitrate
Definition: TEncCfg.h:311
Void setDependentSliceSegmentsEnabledFlag(Bool val)
Definition: TComSlice.h:1126
Void setMaxCUWidth(UInt u)
Definition: TComSlice.h:844
TEncSlice m_cSliceEncoder
slice encoder
Definition: TEncTop.h:92
Int m_RCKeepHierarchicalBit
Definition: TEncCfg.h:312
Void setTransquantBypassEnableFlag(Bool b)
Definition: TComSlice.h:1115
UInt m_pcmLog2MaxSize
Definition: TEncCfg.h:214
Void setHrdParameters(UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess)
Definition: TComSlice.cpp:1625
Void setScalingListPresentFlag(Bool b)
Definition: TComSlice.h:1159
C popFront()
Definition: TComList.h:82
#define NULL
Definition: CommonDef.h:100
TEncSbac m_cRDGoOnSbacCoder
going on SBAC model for RD stage
Definition: TEncTop.h:100
Void setChromaSampleLocTypeTopField(Int i)
Definition: TComSlice.h:666
Void setChromaQpAdjTableAt(Int cuChromaQpOffsetIdxPlus1, Int cbOffset, Int crOffset)
Definition: TComSlice.h:1089
Bool m_useWeightedPred
Definition: TEncCfg.h:302
UInt m_saoOffsetBitShift[MAX_NUM_CHANNEL_TYPE]
Definition: TEncCfg.h:200
Int m_iGOPSize
Definition: TEncCfg.h:132
Int getHeight(const ComponentID id) const
Definition: TComPicYuv.h:109
UInt m_uiQuadtreeTULog2MinSize
Definition: TEncCfg.h:150
TComSlice * getSlice(Int i)
Definition: TComPic.h:103
Void initROM()
Definition: TComRom.cpp:146
Void checkDcOfMatrix()
Definition: TComSlice.cpp:2227
UInt m_uiQuadtreeTULog2MaxSize
Definition: TEncCfg.h:149
Void setCabacInitPresentFlag(Bool flag)
Definition: TComSlice.h:1146
don't use slices / slice segments
Definition: TypeDef.h:564
TEncPreanalyzer m_cPreanalyzer
image characteristics analyzer for TM5-step3-like adaptive QP
Definition: TEncTop.h:110
Void xInitVPS()
initialize VPS from encoder options
Definition: TEncTop.cpp:508
Void setPCMFilterDisableFlag(Bool bValue)
Definition: TComSlice.h:917
UInt m_transformSkipLog2MaxSize
Definition: TEncCfg.h:203
Void setFrameOnlyConstraintFlag(Bool b)
Definition: TComSlice.h:230
Bool m_useRDOQTS
Definition: TEncCfg.h:191
UInt getNumHrdParameters() const
Definition: TComSlice.h:497
Bool m_bLFCrossSliceBoundaryFlag
Definition: TEncCfg.h:222
Bool m_bUseSAO
Definition: TEncCfg.h:161
unsigned int UInt
Definition: TypeDef.h:297
Void setDeltaPOC(Int bufferNum, Int deltaPOC)
Definition: TComSlice.cpp:1805
Int getLog2MaxMvLengthVertical()
Definition: TEncCfg.h:836
Void setCprmsPresentFlag(Bool val, UInt i)
Definition: TComSlice.h:474
Void setMaxBytesPerPicDenom(Int i)
Definition: TComSlice.h:703
#define MAX_TLAYER
max number of temporal layer
Definition: CommonDef.h:192
Bool getPicDisableDeblockingFilterFlag() const
get offset for deblocking filter disabled
Definition: TComSlice.h:1153
UInt m_uiNumAllPicCoded
number of coded pictures
Definition: TEncTop.h:74
Void setLowerBitRateConstraintFlag(Bool b)
Definition: TComSlice.h:242
Bool isReferenced() const
Definition: TComSlice.h:1368
Void setMaxBitsPerMinCuDenom(Int i)
Definition: TComSlice.h:706
Void setMaxCuDQPDepth(UInt u)
Definition: TComSlice.h:1055
Void setQuadtreeTUMaxDepthInter(UInt u)
Definition: TComSlice.h:864
Short Pel
pixel type
Definition: TypeDef.h:692
Void setUseCrossComponentPrediction(Bool value)
Definition: TComSlice.h:1108
Void setLtRefPicPocLsbSps(UInt index, UInt val)
Definition: TComSlice.h:834
Void setQpOffset(ComponentID compID, Int i)
Definition: TComSlice.h:1058
Int m_iMaxCuDQPDepth
Definition: TEncCfg.h:172
Char * getScalingListFile()
Definition: TEncCfg.h:742
Void setNumHrdParameters(UInt v)
Definition: TComSlice.h:498
Int getMaxBitsPerMinCuDenom()
Definition: TEncCfg.h:832
Void setTransformSkipLog2MaxSize(UInt u)
Definition: TComSlice.h:1121
const TComRPSList * getRPSList() const
Definition: TComSlice.h:871
Void setUseHighPrecisionPredictionWeighting(Bool value)
Definition: TComSlice.h:890
Int getBufferingPeriodSEIEnabled()
Definition: TEncCfg.h:607
Void setPicHeightInLumaSamples(UInt u)
Definition: TComSlice.h:823
Int m_numRefPics
Definition: TEncCfg.h:60
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:306
Void setNumReorderPics(Int i, UInt tlayer)
Definition: TComSlice.h:868
Int m_numReorderPics[7]
Definition: TEncCfg.h:136
UInt g_uiAddCUDepth
Definition: TComRom.cpp:254
Int getLoopFilterTcOffset()
Definition: TEncCfg.h:492
Int getMinSpatialSegmentationIdc()
Definition: TEncCfg.h:828
UInt getMaxCUDepth() const
Definition: TComSlice.h:849
Void setUseScalingList(Bool bUseScalingList)
get DeQuant Coefficent
Definition: TComTrQuant.h:179
Void setChromaFormatConstraint(ChromaFormat fmt)
Definition: TComSlice.h:236
Bool m_bUseAdaptQpSelect
Definition: TEncCfg.h:180
Bool getBitstreamRestrictionFlag()
Definition: TEncCfg.h:822
Picture class including local image characteristics information for QP adaptation.
Definition: TEncPic.h:95
Bool m_intraConstraintFlag
Definition: TEncCfg.h:126
UInt64 g_nSymbolCounter
Definition: TComRom.cpp:566
Void setUseAMP(Bool b)
Definition: TComSlice.h:859
Bool m_useWeightedBiPred
Definition: TEncCfg.h:303
ChromaFormat getChromaFormatIdc() const
Definition: TComSlice.h:814
Bool getVideoSignalTypePresentFlag()
Definition: TEncCfg.h:792
TComTrQuant m_cTrQuant
transform & quantization class
Definition: TEncTop.h:82
UInt m_uiPCMLog2MinSize
Definition: TEncCfg.h:215
Void setChromaSampleLocTypeBottomField(Int i)
Definition: TComSlice.h:669
TComVPS m_cVPS
Definition: TEncCfg.h:322
Bool m_disableIntraReferenceSmoothing
Definition: TEncCfg.h:228
Int getPictureTimingSEIEnabled()
Definition: TEncCfg.h:609
Int m_framesToBeEncoded
Definition: TEncCfg.h:108
Void setEntropyCodingSyncEnabledFlag(Bool val)
Definition: TComSlice.h:1128
Bool getLoopFilterDisable()
Definition: TEncCfg.h:489
Void setIntraConstraintFlag(Bool b)
Definition: TComSlice.h:239
Bool m_useRDOQ
Definition: TEncCfg.h:190
Int m_iNumColumnsMinus1
Definition: TEncCfg.h:231
TEncGOP m_cGOPEncoder
GOP encoder.
Definition: TEncTop.h:91
Int m_chromaCbQpOffset
Definition: TEncCfg.h:175
Void setChromaFormatIdc(ChromaFormat i)
Definition: TComSlice.h:815
Bool getSaoCtuBoundary()
Definition: TEncCfg.h:588
Int m_referencePics[16]
Definition: TEncCfg.h:61
Void setTileUniformSpacingFlag(Bool b)
Definition: TComSlice.h:1132
TComVUI * getVuiParameters()
Definition: TComSlice.h:939
Void setFieldSeqFlag(Bool i)
Definition: TComSlice.h:675
Void setUsedByCurrPicLtSPSFlag(Int i, Bool x)
Definition: TComSlice.h:837
Void setLog2MaxMvLengthVertical(Int i)
Definition: TComSlice.h:712
Void setCostMode(CostMode m)
Definition: TComRdCost.h:148
Bool getChromaLocInfoPresentFlag()
Definition: TEncCfg.h:806
TEncSbac *** m_pppcRDSbacCoder
temporal storage for RD computation
Definition: TEncTop.h:99
Int m_interRPSPrediction
Definition: TEncCfg.h:63
Void setInterRPSPrediction(Bool flag)
Definition: TComSlice.h:113
Void setRPSidx(Int iBDidx)
Definition: TComSlice.h:1327
Bool m_useAMP
Definition: TEncCfg.h:147
#define LOG2_MAX_NUM_COLUMNS_MINUS1
Definition: TypeDef.h:197
TComPicYuv * getPicYuvRec()
Definition: TComPic.h:109
Void setAspectRatioIdc(Int i)
Definition: TComSlice.h:627
Void setPicDisableDeblockingFilterFlag(Bool val)
set offset for deblocking filter disabled
Definition: TComSlice.h:1152
TEncSbac * getRDGoOnSbacCoder()
Definition: TEncTop.h:153
Bool m_tileUniformSpacingFlag
Definition: TEncCfg.h:230
Void setFlatScalingList(const ChromaFormat format)
Bool getVideoFullRangeFlag()
Definition: TEncCfg.h:796
Int getTransferCharacteristics()
Definition: TEncCfg.h:802
Void setPOC(Int bufferNum, Int deltaPOC)
Definition: TComSlice.cpp:1835
Void setLog2DiffMaxMinCodingBlockSize(Int val)
Definition: TComSlice.h:842
Bool m_bUseConstrainedIntraPred
Definition: TEncCfg.h:212
#define SCALING_LIST_NUM
list number for quantization matrix
Definition: TComRom.h:215
Void setRefIdc(Int bufferNum, Int refIdc)
set the reference idc value at uiBufferNum entry to the value of iRefIdc
Definition: TComSlice.cpp:1851
Void setPocProportionalToTimingFlag(Bool x)
Definition: TComSlice.h:415
ProfileTierLevel * getGeneralPTL()
Definition: TComSlice.h:261
Bool getNeutralChromaIndicationFlag()
Definition: TEncCfg.h:812
Void create()
Definition: TEncTop.cpp:87
Void setDeblockingFilterBetaOffsetDiv2(Int val)
set beta offset for deblocking filter
Definition: TComSlice.h:1154
Profile::Name m_profile
Definition: TEncCfg.h:117
Void setNonPackedConstraintFlag(Bool b)
Definition: TComSlice.h:227
Void xCheckGSParameters()
Definition: TEncTop.cpp:1049
Void deletePicBuffer()
Definition: TEncTop.cpp:282
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:108
Void setTileColumnWidth(const std::vector< Int > &columnWidth)
Definition: TComSlice.h:1136
Void setLevelIdc(Level::Name x)
Definition: TComSlice.h:218
Void setUseExtendedPrecision(Bool value)
Definition: TComSlice.h:888
Void setQuadtreeTULog2MinSize(UInt u)
Definition: TComSlice.h:862
ChromaFormat m_chromaFormatIDC
Definition: TEncCfg.h:177
Void setNumberOfPositivePictures(Int number)
Definition: TComSlice.h:108
Bool m_useGolombRiceParameterAdaptation
Definition: TEncCfg.h:206
GOPEntry getGOPEntry(Int i)
Definition: TEncCfg.h:401
FILE * g_hTrace
Definition: TComRom.cpp:561
ChromaFormat m_chromaFormatConstraintValue
Definition: TEncCfg.h:125
Void setTilesFixedStructureFlag(Bool i)
Definition: TComSlice.h:691
TComRdCost m_cRdCost
RD cost computation class.
Definition: TEncTop.h:98
Void setDeltaRPS(Int x)
Definition: TComSlice.h:117
Int getMaxDecPicBuffering(UInt tlayer)
Definition: TEncCfg.h:476
Int m_maxDecPicBuffering[7]
Definition: TEncCfg.h:135
TEncSampleAdaptiveOffset m_cEncSAO
sample adaptive offset class
Definition: TEncTop.h:84
Void setOverscanInfoPresentFlag(Bool i)
Definition: TComSlice.h:636
bool Bool
Definition: TypeDef.h:286
Int m_iSourceWidth
Definition: TEncCfg.h:105
Void setLog2ParallelMergeLevelMinus2(UInt mrgLevel)
Definition: TComSlice.h:1165
Bool getFrameFieldInfoPresentFlag()
Definition: TEncCfg.h:816
Int m_chromaCrQpOffset
Definition: TEncCfg.h:176
Int m_maxCUChromaQpAdjustmentDepth
Definition: TEncCfg.h:173
Bool getPocProportionalToTimingFlag()
Definition: TEncCfg.h:818
TComReferencePictureSet * getReferencePictureSet(Int referencePictureSetNum)
Definition: TComSlice.h:143
UInt g_uiMaxCUHeight
Definition: TComRom.cpp:252
#define ADAPTIVE_QP_SELECTION
G382: Adaptive reconstruction levels, non-normative part for adaptive QP selection.
Definition: TypeDef.h:148
Int getVideoFormat()
Definition: TEncCfg.h:794
UInt g_uiMaxCUWidth
Definition: TComRom.cpp:251
std::vector< Int > m_tileColumnWidth
Definition: TEncCfg.h:233
Void xInitPPSforTiles()
Definition: TEncTop.cpp:1034
Bool g_bJustDoIt
Definition: TComRom.cpp:565
Int getSourceWidth()
Definition: TEncCfg.h:466
Int m_iSourceHeight
Definition: TEncCfg.h:106
total number
Definition: TypeDef.h:485
Void separateFields(Pel *org, Pel *dstField, UInt stride, UInt width, UInt height, Bool isTop)
Definition: TEncTop.cpp:355
Bool getTransquantBypassEnableFlag()
Definition: TEncCfg.h:761
UInt m_log2ParallelMergeLevelMinus2
Parallel merge estimation region.
Definition: TEncCfg.h:304
Void initRCGOP(Int numberOfPictures)
Bool m_lowerBitRateConstraintFlag
Definition: TEncCfg.h:127
Void setUseResidualDPCM(const RDPCMSignallingMode signallingMode, const Bool value)
Definition: TComSlice.h:908
Void copyToPic(TComPicYuv *pcPicYuvDst) const
Definition: TComPicYuv.cpp:176
Void setColourPrimaries(Int i)
Definition: TComSlice.h:654
Void setRPS(TComReferencePictureSet *pcRPS)
Definition: TComSlice.h:1323
Void setMaxTLayers(UInt uiMaxTLayers)
Definition: TComSlice.h:911
Void setUseSAO(Bool bVal)
Definition: TComSlice.h:892
TimingInfo * getTimingInfo()
Definition: TComSlice.h:510
Void setProfileCompatibilityFlag(Int i, Bool x)
Definition: TComSlice.h:215
Int getDeltaPOC(Int bufferNum) const
Definition: TComSlice.cpp:1820
Int getLog2MaxMvLengthHorizontal()
Definition: TEncCfg.h:834
Bool m_RCUseLCUSeparateModel
Definition: TEncCfg.h:314
TComTrQuant * getTrQuant()
Definition: TEncTop.h:140
Void setScalingListPresentFlag(Bool b)
Definition: TComSlice.h:925
Bool m_useResidualRotation
Definition: TEncCfg.h:204
Void setLog2MaxMvLengthHorizontal(Int i)
Definition: TComSlice.h:709
Int m_iFrameRate
Definition: TEncCfg.h:103
Void create(const TComSPS &sps, const TComPPS &pps, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, Bool bIsVirtual)
Definition: TEncPic.cpp:127
Void setDefaultDisplayWindow(Window &defaultDisplayWindow)
Definition: TComSlice.h:682
Bool getColourDescriptionPresentFlag()
Definition: TEncCfg.h:798
Int getSliceArgument()
Definition: TEncCfg.h:574
Reference Picture Set set class.
Definition: TComSlice.h:130
Int m_numRefIdc
Definition: TEncCfg.h:65
Void setTileRowHeight(const std::vector< Int > &rowHeight)
Definition: TComSlice.h:1140
Int getChromaSampleLocTypeBottomField()
Definition: TEncCfg.h:810
Void setHrdParametersPresentFlag(Bool i)
Definition: TComSlice.h:685
Bool m_DeblockingFilterControlPresent
Definition: TEncCfg.h:159
TComPicYuv * getPicYuvOrg()
Definition: TComPic.h:108
Void setNumTicksPocDiffOneMinus1(Int x)
Definition: TComSlice.h:418
Void setSaoOffsetBitShift(ChannelType type, UInt uiBitShift)
Definition: TComSlice.h:1111
Void xInitScalingLists()
initialize scaling lists
Definition: TEncTop.cpp:224
Void setTilesEnabledFlag(Bool val)
Definition: TComSlice.h:1130
Void xInitSPS()
initialize SPS from encoder options
Definition: TEncTop.cpp:526
Int getColourPrimaries()
Definition: TEncCfg.h:800
Void setUseStrongIntraSmoothing(Bool bVal)
Definition: TComSlice.h:934
Int g_PCMBitDepth[MAX_NUM_CHANNEL_TYPE]
Definition: TComRom.cpp:552
const TComPTL * getPTL() const
Definition: TComSlice.h:943
UInt getMaxCuDQPDepth() const
Definition: TComSlice.h:1056
Void setUseSingleSignificanceMapContext(const Bool value)
Definition: TComSlice.h:899
Void setScalingListFlag(Bool b)
Definition: TComSlice.h:923
TEncCavlc * getCavlcCoder()
Definition: TEncTop.h:147
Void setUseResidualRotation(const Bool value)
Definition: TComSlice.h:896
UInt getQuadtreeTULog2MinSize() const
Definition: TComSlice.h:863
RDPCMSignallingMode
Definition: TypeDef.h:335
Bool m_alignCABACBeforeBypass
Definition: TEncCfg.h:207
Void pushBack(const C &rcT)
Definition: TComList.h:89
Limit maximum number of largest coding tree units in a slice / slice segments.
Definition: TypeDef.h:565
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:310
Void setPCMBitDepth(ChannelType type, UInt u)
Definition: TComSlice.h:916
Int getDecodingUnitInfoSEIEnabled()
Definition: TEncCfg.h:693
TComSPS m_cSPS
SPS. This is the base value. This is copied to TComPicSym.
Definition: TEncTop.h:95
TEncRateCtrl m_cRateCtrl
Rate control class.
Definition: TEncTop.h:112
Void setNumberOfPictures(Int numberOfPictures)
Definition: TComSlice.cpp:1810
UInt getPicWidthInLumaSamples() const
Definition: TComSlice.h:822
Void setQpBDOffset(ChannelType type, Int i)
Definition: TComSlice.h:886
Int m_iNumRowsMinus1
Definition: TEncCfg.h:232
Void setMaxTrSize(UInt u)
Definition: TComSlice.h:878
Bool m_useTransformSkipFast
Definition: TEncCfg.h:202
Bool m_usePCM
Definition: TEncCfg.h:213
TEncBinCABACCounter m_cRDGoOnBinCoderCABAC
going on bin coder CABAC for RD stage
Definition: TEncTop.h:103
Void init(Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[64])
Int m_iPOCLast
time index (POC)
Definition: TEncTop.h:72
Int getMaxDeltaQP()
Definition: TEncCfg.h:501
Void setNumDU(UInt value)
Definition: TComSlice.h:385
Window & getDefaultDisplayWindow()
Definition: TEncCfg.h:814
#define MAX_NUM_REF
max. number of entries in picture reference list
Definition: CommonDef.h:113
UInt getNumberValidComponents() const
Definition: TComPicYuv.h:111
TEncSearch m_cSearch
encoder search class
Definition: TEncTop.h:78
Void xInitRPS(Bool isFieldCoding)
initialize PPS from encoder options
Definition: TEncTop.cpp:813
#define MAX_NUM_LONG_TERM_REF_PICS
Definition: TypeDef.h:215
Void setProfileIdc(Profile::Name x)
Definition: TComSlice.h:212
Level::Name m_level
Definition: TEncCfg.h:119
Void setConformanceWindow(Window &conformanceWindow)
Definition: TComSlice.h:828
Void setDisableIntraReferenceSmoothing(Bool bValue)
Definition: TComSlice.h:919
Int m_refIdc[16+1]
Definition: TEncCfg.h:66
Void setFrameFieldInfoPresentFlag(Bool i)
Definition: TComSlice.h:678
TEncTop()
Definition: TEncTop.cpp:53
Void setPCMLog2MinSize(UInt u)
Definition: TComSlice.h:854
Void init(Bool isFieldCoding)
Definition: TEncTop.cpp:184
Void setMaxCuChromaQpAdjDepth(UInt u)
Definition: TComSlice.h:1078
Int getMarginX(const ComponentID id) const
Definition: TComPicYuv.h:116
Void clearChromaQpAdjTable()
Definition: TComSlice.h:1080
Bool m_printFrameMSE
Definition: TEncCfg.h:112
static Void buildNextStateTable()
encoder class (header)
Bool getDeblockingFilterControlPresentFlag() const
Definition: TComSlice.h:1149
Void setAspectRatioInfoPresentFlag(Bool i)
Definition: TComSlice.h:624
Int getMaxCuDQPDepth()
Definition: TEncCfg.h:502
TimingInfo * getTimingInfo()
Definition: TComSlice.h:717
TComPTL * getPTL()
Definition: TComSlice.h:508
Void setHrdOpSetIdx(UInt val, UInt i)
Definition: TComSlice.h:472
Void xGetNewPicBuffer(TComPic *&rpcPic)
get picture buffer which will be processed
Definition: TEncTop.cpp:462
InputColourSpaceConversion
Definition: TypeDef.h:376
Bool m_progressiveSourceFlag
Definition: TEncCfg.h:120
Void setMaxDecPicBuffering(UInt ui, UInt tlayer)
Definition: TComSlice.h:930
Int m_iSearchRange
Definition: TEncCfg.h:167
Void setProgressiveSourceFlag(Bool b)
Definition: TComSlice.h:221
context model class (header)
Int m_iWaveFrontSynchro
Definition: TEncCfg.h:236
Int getSourceHeight()
Definition: TEncCfg.h:467
Int g_bitDepth[MAX_NUM_CHANNEL_TYPE]
Definition: TComRom.cpp:548
Void setUsePCM(Bool b)
Definition: TComSlice.h:850
Void setWPBiPred(Bool b)
Definition: TComSlice.h:1105
Int m_iMaxRefPicNum
this is used to mimic the sliding mechanism used by the decoder
Definition: TEncCfg.h:143
Void initSliceQpDelta()
Bool getLoopFilterOffsetInPPS()
Definition: TEncCfg.h:490
TEncBinCABACCounter *** m_pppcBinCoderCABAC
temporal CABAC state storage for RD computation
Definition: TEncTop.h:102
Void setPOC(Int i)
Definition: TComSlice.h:1370
TComPic * getPic()
Definition: TComSlice.h:1354
Int m_bipredSearchRange
Definition: TEncCfg.h:168
Void setNumTileRowsMinus1(Int i)
Definition: TComSlice.h:1138
Void setInterlacedSourceFlag(Bool b)
Definition: TComSlice.h:224
Void setNumRefIdxL1DefaultActive(UInt ui)
Definition: TComSlice.h:1099
Int m_numRefPicsActive
Definition: TEncCfg.h:58
Void setQuadtreeTUMaxDepthIntra(UInt u)
Definition: TComSlice.h:865
Void init(UInt uiMaxTrSize, Bool useRDOQ=false, Bool useRDOQTS=false, Bool bEnc=false, Bool useTransformSkipFast=false, Bool bUseAdaptQpSelect=false)
Void setBitstreamRestrictionFlag(Bool i)
Definition: TComSlice.h:688
Void createHrdParamBuffer()
Definition: TComSlice.h:462
Void setChromaLocInfoPresentFlag(Bool i)
Definition: TComSlice.h:663
Void setMotionVectorsOverPicBoundariesFlag(Bool i)
Definition: TComSlice.h:694
Int getReferencePictureSetIdxForSOP(TComSlice *slice, Int POCCurr, Int GOPid)
Definition: TEncTop.cpp:1004
Void setTransferCharacteristics(Int i)
Definition: TComSlice.h:657
UInt m_uiQuadtreeTUMaxDepthIntra
Definition: TEncCfg.h:152
Int getNumberOfNegativePictures() const
Definition: TComSlice.h:107
Void setLoopFilterAcrossSlicesEnabledFlag(Bool bValue)
Definition: TComSlice.h:1168
Void setReconMark(Bool b)
Definition: TComPic.h:131
Bool m_useExtendedPrecision
Definition: TEncCfg.h:182
Void setTMVPFlagsPresent(Bool b)
Definition: TComSlice.h:876
Pel * getAddr(const ComponentID ch)
Definition: TComPicYuv.h:127
list template
Definition: TComList.h:61
Void setNumRefIdxL0DefaultActive(UInt ui)
Definition: TComSlice.h:1097
Void createRPSList(Int numRPS)
Definition: TComSlice.cpp:1619
Void setDeblockingFilterControlPresentFlag(Bool val)
Definition: TComSlice.h:1148
TEncCavlc * m_pcCavlcCoder
CAVLC encoder.
Definition: TEncTop.h:80
Void setTimingInfoPresentFlag(Bool flag)
Definition: TComSlice.h:406
Bool getDeblockingFilterMetric()
Definition: TEncCfg.h:494
Bool m_useTransformSkip
Definition: TEncCfg.h:201
TComLoopFilter m_cLoopFilter
deblocking filter class
Definition: TEncTop.h:83
Void setVideoFormat(Int i)
Definition: TComSlice.h:645
Bool m_nonPackedConstraintFlag
Definition: TEncCfg.h:122
Bool getOverscanInfoPresentFlag()
Definition: TEncCfg.h:788
UInt m_uiIntraPeriod
Definition: TEncCfg.h:130
Void setLog2MinCodingBlockSize(Int val)
Definition: TComSlice.h:840
Void setOutputFlagPresentFlag(Bool b)
Definition: TComSlice.h:1113
TComScalingList & getScalingList()
Definition: TComSlice.h:927
Int getNumberOfPictures() const
Definition: TComSlice.cpp:1825
Void setLoopFilterAcrossTilesEnabledFlag(Bool b)
Definition: TComSlice.h:1123
int Int
Definition: TypeDef.h:296
Bool m_bPCMFilterDisableFlag
Definition: TEncCfg.h:227
Void setVuiParametersPresentFlag(Bool b)
Definition: TComSlice.h:938
Bool getSignHideFlag()
Definition: TEncCfg.h:746
static UInt getMaxCUDepthOffset(const ChromaFormat chFmt, const UInt quadtreeTULog2MinSize)
Void setPicWidthInLumaSamples(UInt u)
Definition: TComSlice.h:821
ScalingListMode getUseScalingListId()
Definition: TEncCfg.h:740
UInt getMaxTLayers() const
Definition: TComSlice.h:910
ComponentID
Definition: TypeDef.h:368
std::vector< Int > m_tileRowHeight
Definition: TEncCfg.h:234
Void setAlignCABACBeforeBypass(const Bool value)
Definition: TComSlice.h:905
Void setMaxCUDepth(UInt u)
Definition: TComSlice.h:848
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)
Definition: TEncGOP.cpp:528
UInt m_uiQuadtreeTUMaxDepthInter
Definition: TEncCfg.h:151
Void setTopField(Bool b)
Definition: TComPic.h:152
const Bool g_bEncDecTraceDisable
Definition: TComRom.cpp:563
Void setNumLongTermRefPicSPS(UInt val)
Definition: TComSlice.h:831
Void setDeltaRIdxMinus1(Int x)
Definition: TComSlice.h:115
Bool m_interlacedSourceFlag
Definition: TEncCfg.h:121
Bool getTilesFixedStructureFlag()
Definition: TEncCfg.h:824
Void create(const TComSPS &sps, const TComPPS &pps, const UInt uiMaxWidth, const UInt uiMaxHeight, const UInt uiMaxDepth, const Bool bIsVirtual)
Definition: TComPic.cpp:69
Bool getVuiParametersPresentFlag()
Definition: TEncCfg.h:778
Void setPCMLog2MaxSize(UInt u)
Definition: TComSlice.h:852
UInt getDecodingRefreshType()
Definition: TEncCfg.h:474
Int getMarginY(const ComponentID id) const
Definition: TComPicYuv.h:117
SliceConstraint getSliceMode() const
Definition: TEncCfg.h:573
Bool m_useHighPrecisionPredictionWeighting
Definition: TEncCfg.h:183
Int getTargetBitrate()
Definition: TEncCfg.h:749
Bool m_useResidualDPCM[NUMBER_OF_RDPCM_SIGNALLING_MODES]
Definition: TEncCfg.h:208
Void selectReferencePictureSet(TComSlice *slice, Int POCCurr, Int GOPid)
Definition: TEncTop.cpp:966
Void setBitDepthConstraint(UInt bitDepth)
Definition: TComSlice.h:233
Void destroy()
Definition: TEncTop.cpp:149
Void setOverscanAppropriateFlag(Bool i)
Definition: TComSlice.h:639
Bool m_loopFilterAcrossTilesEnabledFlag
Definition: TEncCfg.h:229
SBAC encoder class.
Definition: TEncSbac.h:66
Void setDeblockingFilterOverrideEnabledFlag(Bool val)
Definition: TComSlice.h:1150
Void setBorderExtension(Bool b)
Definition: TComPicYuv.h:155
Void setDeblockingFilterTcOffsetDiv2(Int val)
set tc offset for deblocking filter
Definition: TComSlice.h:1156
Int getMatrixCoefficients()
Definition: TEncCfg.h:804
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:1051
Void setUseGolombRiceParameterAdaptation(const Bool value)
Definition: TComSlice.h:902
virtual ~TEncTop()
Definition: TEncTop.cpp:77
Reference Picture Set class.
Definition: TComSlice.h:65
Void createEncData(Bool isPreDBFSamplesUsed)
slice header class
Definition: TComSlice.h:1198
Pel * getBuf(const ComponentID ch)
Definition: TComPicYuv.h:124
Void setSignHideFlag(Bool signHideFlag)
Definition: TComSlice.h:1143
Int getChromaSampleLocTypeTopField()
Definition: TEncCfg.h:808
static Void sortPicList(TComList< TComPic * > &rcListPic)
Definition: TComSlice.cpp:193
Int getGOPSize()
Definition: TEncCfg.h:475
Void setBitDepth(ChannelType type, Int u)
Definition: TComSlice.h:883
class of picture which includes side information for encoder (header)
Bool isField()
Definition: TComPic.h:155
Void setDefaultScalingList()
Definition: TComSlice.cpp:1946
Int m_iFastSearch
Definition: TEncCfg.h:166
Int m_usedByCurrPic[16]
Definition: TEncCfg.h:62
Int getLoopFilterBetaOffset()
Definition: TEncCfg.h:491
Void setNeutralChromaIndicationFlag(Bool i)
Definition: TComSlice.h:672
Void init(TEncCfg *pcEncCfg, TComTrQuant *pcTrQuant, Int iSearchRange, Int bipredSearchRange, Int iFastSearch, TEncEntropy *pcEntropyCoder, TComRdCost *pcRdCost, TEncSbac ***pppcRDSbacCoder, TEncSbac *pcRDGoOnSbacCoder)
Definition: TEncSearch.cpp:201
Int getSarHeight()
Definition: TEncCfg.h:786
Void setTemporalIdNestingFlag(Bool bValue)
Definition: TComSlice.h:914
Void setMaxOpSets(UInt v)
Definition: TComSlice.h:504
Bool getAspectRatioInfoPresentFlag()
Definition: TEncCfg.h:780
Window m_conformanceWindow
Definition: TEncCfg.h:107
TEncCu m_cCuEncoder
CU encoder.
Definition: TEncTop.h:93
TComReferencePictureSet * getLocalRPS()
Definition: TComSlice.h:1325
TComHRD * getHrdParameters()
Definition: TComSlice.h:714
Bool getVuiParametersPresentFlag() const
Definition: TComSlice.h:937
Void setNumberOfLongtermPictures(Int number)
Definition: TComSlice.h:110
Void destroyROM()
Definition: TComRom.cpp:230
Void setUseTransformSkip(Bool b)
Definition: TComSlice.h:1119
Int m_extraRPSs
Definition: TEncCfg.h:134
Void setSarWidth(Int i)
Definition: TComSlice.h:630
CostMode m_costMode
The cost function to use, primarily when considering lossless coding.
Definition: TEncCfg.h:320
Void setNumRefIdc(Int x)
Definition: TComSlice.h:119
UInt getMaxCUWidth() const
Definition: TComSlice.h:845
Void xInitPPS()
initialize PPS from encoder options
Definition: TEncTop.cpp:693
const TComSPS * getSPS() const
Definition: TComSlice.h:1306
TComReferencePictureSet * getRPS()
Definition: TComSlice.h:1324
Bool getMotionVectorsOverPicBoundariesFlag()
Definition: TEncCfg.h:826
Bool m_RCEnableRateControl
Definition: TEncCfg.h:310