Newer
Older
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
#if DB_PARAM_TID
bool TcAllZero = true, BetaAllZero = true;
for (int i = 0; i < pps.getDeblockingFilterBetaOffsetDiv2().size(); i++)
{
if (pps.getDeblockingFilterBetaOffsetDiv2()[i] != 0)
{
BetaAllZero = false;
break;
}
}
for (int i = 0; i < pps.getDeblockingFilterTcOffsetDiv2().size(); i++)
{
if (pps.getDeblockingFilterTcOffsetDiv2()[i] != 0)
{
TcAllZero = false;
break;
}
}
const bool deblockingFilterControlPresentFlag = pps.getDeblockingFilterOverrideEnabledFlag() ||
pps.getPPSDeblockingFilterDisabledFlag() ||
BetaAllZero == false ||
TcAllZero == false ||
pps.getDeblockingFilterCbBetaOffsetDiv2() != 0 ||
pps.getDeblockingFilterCbTcOffsetDiv2() != 0 ||
pps.getDeblockingFilterCrBetaOffsetDiv2() != 0 ||
pps.getDeblockingFilterCrTcOffsetDiv2() != 0;
#else
const bool deblockingFilterControlPresentFlag = pps.getDeblockingFilterOverrideEnabledFlag() ||
pps.getPPSDeblockingFilterDisabledFlag() ||
pps.getDeblockingFilterBetaOffsetDiv2() != 0 ||
pps.getDeblockingFilterTcOffsetDiv2() != 0 ||
pps.getDeblockingFilterCbBetaOffsetDiv2() != 0 ||
pps.getDeblockingFilterCbTcOffsetDiv2() != 0 ||
pps.getDeblockingFilterCrBetaOffsetDiv2() != 0 ||
pps.getDeblockingFilterCrTcOffsetDiv2() != 0;

Karsten Suehring
committed
pps.setDeblockingFilterControlPresentFlag(deblockingFilterControlPresentFlag);
pps.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG);
pps.setLoopFilterAcrossSlicesEnabledFlag( m_bLFCrossSliceBoundaryFlag );
bool chromaQPOffsetNotZero = false;
if( pps.getQpOffset(COMPONENT_Cb) != 0 || pps.getQpOffset(COMPONENT_Cr) != 0 || pps.getJointCbCrQpOffsetPresentFlag() || pps.getSliceChromaQpFlag() || pps.getCuChromaQpOffsetListEnabledFlag() )
{
chromaQPOffsetNotZero = true;
bool chromaDbfOffsetNotSameAsLuma = true;
if( pps.getDeblockingFilterCbBetaOffsetDiv2() == pps.getDeblockingFilterBetaOffsetDiv2() && pps.getDeblockingFilterCrBetaOffsetDiv2() == pps.getDeblockingFilterBetaOffsetDiv2()
&& pps.getDeblockingFilterCbTcOffsetDiv2() == pps.getDeblockingFilterTcOffsetDiv2() && pps.getDeblockingFilterCrTcOffsetDiv2() == pps.getDeblockingFilterTcOffsetDiv2() )
{
chromaDbfOffsetNotSameAsLuma = false;
const uint32_t chromaArrayType = (int)sps.getSeparateColourPlaneFlag() ? 0 : sps.getChromaFormatIdc();
if( ( chromaArrayType != CHROMA_400 ) && ( chromaQPOffsetNotZero || chromaDbfOffsetNotSameAsLuma ) )
if ((sps.getChromaFormatIdc() != CHROMA_400) && (chromaQPOffsetNotZero || chromaDbfOffsetNotSameAsLuma))
#endif
{
pps.setPPSChromaToolFlag(true);
}
else
{
pps.setPPSChromaToolFlag(false);
}

Karsten Suehring
committed
int histogram[MAX_NUM_REF + 1];
for( int i = 0; i <= MAX_NUM_REF; i++ )
{
histogram[i]=0;
}
for( int i = 0; i < getGOPSize(); i++)
{
CHECK(!(getRPLEntry(0, i).m_numRefPicsActive >= 0 && getRPLEntry(0, i).m_numRefPicsActive <= MAX_NUM_REF), "Unspecified error");
histogram[getRPLEntry(0, i).m_numRefPicsActive]++;

Karsten Suehring
committed
}
int maxHist=-1;
int bestPos=0;
for( int i = 0; i <= MAX_NUM_REF; i++ )
{
if(histogram[i]>maxHist)
{
maxHist=histogram[i];
bestPos=i;
}
}
CHECK(!(bestPos <= 15), "Unspecified error");
pps.setNumRefIdxL0DefaultActive(bestPos);

Karsten Suehring
committed
pps.setNumRefIdxL1DefaultActive(bestPos);
pps.setPictureHeaderExtensionPresentFlag(false);
Sheng-Yen Lin
committed
pps.setRplInfoInPhFlag(getSliceLevelRpl() ? false : true);
pps.setDbfInfoInPhFlag(getSliceLevelDblk() ? false : true);
pps.setSaoInfoInPhFlag(getSliceLevelSao() ? false : true);
pps.setAlfInfoInPhFlag(getSliceLevelAlf() ? false : true);
pps.setWpInfoInPhFlag(getSliceLevelWp() ? false : true);
pps.setQpDeltaInfoInPhFlag(getSliceLevelDeltaQp() ? false : true);

Karsten Suehring
committed
pps.pcv = new PreCalcValues( sps, pps, true );
pps.setRpl1IdxPresentFlag(sps.getRPL1IdxPresentFlag());

Karsten Suehring
committed
}
void EncLib::xInitPicHeader(PicHeader &picHeader, const SPS &sps, const PPS &pps)
{
int i;
picHeader.initPicHeader();
// parameter sets
picHeader.setSPSId( sps.getSPSId() );
picHeader.setPPSId( pps.getPPSId() );
picHeader.setMaxNumAffineMergeCand(getMaxNumAffineMergeCand());
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
// copy partitioning constraints from SPS
picHeader.setSplitConsOverrideFlag(false);
picHeader.setMinQTSizes( sps.getMinQTSizes() );
picHeader.setMaxMTTHierarchyDepths( sps.getMaxMTTHierarchyDepths() );
picHeader.setMaxBTSizes( sps.getMaxBTSizes() );
picHeader.setMaxTTSizes( sps.getMaxTTSizes() );
bool bUseDQP = (getCuQpDeltaSubdiv() > 0)? true : false;
if( (getMaxDeltaQP() != 0 )|| getUseAdaptiveQP() )
{
bUseDQP = true;
}
#if SHARP_LUMA_DELTA_QP
if( getLumaLevelToDeltaQPMapping().isEnabled() )
{
bUseDQP = true;
}
#endif
#if ENABLE_QPA
if( getUsePerceptQPA() && !bUseDQP )
{
CHECK( m_cuQpDeltaSubdiv != 0, "max. delta-QP subdiv must be zero!" );
bUseDQP = (getBaseQP() < 38) && (getSourceWidth() > 512 || getSourceHeight() > 320);
}
#endif
if( m_costMode==COST_SEQUENCE_LEVEL_LOSSLESS || m_costMode==COST_LOSSLESS_CODING )
{
bUseDQP=false;
}
if( m_RCEnableRateControl )
{
picHeader.setCuQpDeltaSubdivIntra( 0 );
picHeader.setCuQpDeltaSubdivInter( 0 );
}
else if( bUseDQP )
{
picHeader.setCuQpDeltaSubdivIntra( m_cuQpDeltaSubdiv );
picHeader.setCuQpDeltaSubdivInter( m_cuQpDeltaSubdiv );
}
else
{
picHeader.setCuQpDeltaSubdivIntra( 0 );
picHeader.setCuQpDeltaSubdivInter( 0 );
}
if( m_cuChromaQpOffsetSubdiv >= 0 )
{
picHeader.setCuChromaQpOffsetSubdivIntra(m_cuChromaQpOffsetSubdiv);
picHeader.setCuChromaQpOffsetSubdivInter(m_cuChromaQpOffsetSubdiv);
}
else
{
picHeader.setCuChromaQpOffsetSubdivIntra(0);
picHeader.setCuChromaQpOffsetSubdivInter(0);
}
if( sps.getVirtualBoundariesEnabledFlag() )
{
picHeader.setVirtualBoundariesPresentFlag( sps.getVirtualBoundariesPresentFlag() );
picHeader.setNumVerVirtualBoundaries(sps.getNumVerVirtualBoundaries());
picHeader.setNumHorVirtualBoundaries(sps.getNumHorVirtualBoundaries());
for(i=0; i<3; i++) {
picHeader.setVirtualBoundariesPosX(sps.getVirtualBoundariesPosX(i), i);
picHeader.setVirtualBoundariesPosY(sps.getVirtualBoundariesPosY(i), i);
}
}
// gradual decoder refresh flag
picHeader.setGdrPicFlag(false);

Xuewei Meng
committed
picHeader.setDisBdofFlag(false);
picHeader.setDisDmvrFlag(false);
picHeader.setDisProfFlag(false);
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
#if JVET_W0097_GPM_MMVD_TM
if (sps.getUseGeo())
{
#if TOOLS
if (getIntraPeriod() > 0)
{
if ((getSourceWidth() * getSourceHeight()) > (1920 * 1080))
{
picHeader.setGPMMMVDTableFlag(false);
}
else
{
picHeader.setGPMMMVDTableFlag(true);
}
}
else
{
picHeader.setGPMMMVDTableFlag(true);
}
#else
picHeader.setGPMMMVDTableFlag(false);
#endif
}
#endif
void EncLib::xInitAPS(APS &aps)
{
//Do nothing now
}
void EncLib::xInitRPL(SPS &sps, bool isFieldCoding)
{
ReferencePictureList* rpl;
int numRPLCandidates = getRPLCandidateSize(0);
// To allocate one additional memory for RPL of POC1 (first bottom field) which is not specified in cfg file
sps.createRPLList0(numRPLCandidates + (isFieldCoding ? 1 : 0));
sps.createRPLList1(numRPLCandidates + (isFieldCoding ? 1 : 0));
RPLList* rplList = 0;
for (int i = 0; i < 2; i++)
{
rplList = (i == 0) ? sps.getRPLList0() : sps.getRPLList1();
for (int j = 0; j < numRPLCandidates; j++)
{
const RPLEntry &ge = getRPLEntry(i, j);
rpl = rplList->getReferencePictureList(j);
rpl->setNumberOfShorttermPictures(ge.m_numRefPics);
rpl->setNumberOfLongtermPictures(0); //Hardcoded as 0 for now. need to update this when implementing LTRP
rpl->setNumberOfActivePictures(ge.m_numRefPicsActive);
Philip Cowan
committed
rpl->setLtrpInSliceHeaderFlag(ge.m_ltrp_in_slice_header_flag);
rpl->setInterLayerPresentFlag( sps.getInterLayerPresentFlag() );
// inter-layer reference picture is not signaled in SPS RPL, SPS is shared currently
rpl->setNumberOfInterLayerPictures( 0 );
for (int k = 0; k < ge.m_numRefPics; k++)
{
#if JVET_S0045_SIGN
rpl->setRefPicIdentifier(k, -ge.m_deltaRefPics[k], 0, false, 0);
#else
rpl->setRefPicIdentifier( k, ge.m_deltaRefPics[k], 0, false, 0 );
if (isFieldCoding)
{
// To set RPL of POC1 (first bottom field) which is not specified in cfg file
for (int i = 0; i < 2; i++)
{
rplList = (i == 0) ? sps.getRPLList0() : sps.getRPLList1();
rpl = rplList->getReferencePictureList(numRPLCandidates);
rpl->setNumberOfShorttermPictures(1);
rpl->setNumberOfLongtermPictures(0);
rpl->setNumberOfActivePictures(1);
rpl->setLtrpInSliceHeaderFlag(0);
#if JVET_S0045_SIGN
rpl->setRefPicIdentifier(0, -1, 0, false, 0);
#else
rpl->setRefPicIdentifier(0, 1, 0, false, 0);
rpl->setPOC(0, 0);
}
}
bool isRpl1CopiedFromRpl0 = true;
for( int i = 0; isRpl1CopiedFromRpl0 && i < numRPLCandidates; i++)
{
if( sps.getRPLList0()->getReferencePictureList(i)->getNumRefEntries() == sps.getRPLList1()->getReferencePictureList(i)->getNumRefEntries() )
{
for( int j = 0; isRpl1CopiedFromRpl0 && j < sps.getRPLList0()->getReferencePictureList(i)->getNumRefEntries(); j++ )
{
if( sps.getRPLList0()->getReferencePictureList(i)->getRefPicIdentifier(j) != sps.getRPLList1()->getReferencePictureList(i)->getRefPicIdentifier(j) )
{
isRpl1CopiedFromRpl0 = false;
}
}
}
else
{
isRpl1CopiedFromRpl0 = false;
}
}
sps.setRPL1CopyFromRPL0Flag(isRpl1CopiedFromRpl0);
//Check if all delta POC of STRP in each RPL has the same sign
//Check RPLL0 first
const RPLList* rplList0 = sps.getRPLList0();
const RPLList* rplList1 = sps.getRPLList1();
uint32_t numberOfRPL = sps.getNumRPL0();
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
bool isAllEntriesinRPLHasSameSignFlag = true;
bool isFirstEntry = true;
bool lastSign = true; //true = positive ; false = negative
for (uint32_t ii = 0; isAllEntriesinRPLHasSameSignFlag && ii < numberOfRPL; ii++)
{
const ReferencePictureList* rpl = rplList0->getReferencePictureList(ii);
for (uint32_t jj = 0; isAllEntriesinRPLHasSameSignFlag && jj < rpl->getNumberOfActivePictures(); jj++)
{
if (!rpl->isRefPicLongterm(jj) && isFirstEntry)
{
lastSign = (rpl->getRefPicIdentifier(jj) >= 0) ? true : false;
isFirstEntry = false;
}
else if (!rpl->isRefPicLongterm(jj) && (((rpl->getRefPicIdentifier(jj) - rpl->getRefPicIdentifier(jj - 1)) >= 0 && lastSign == false) || ((rpl->getRefPicIdentifier(jj) - rpl->getRefPicIdentifier(jj - 1)) < 0 && lastSign == true)))
{
isAllEntriesinRPLHasSameSignFlag = false;
}
}
}
//Check RPLL1. Skip it if it is already found out that this flag is not true for RPL0 or if RPL1 is the same as RPL0
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
isFirstEntry = true;
lastSign = true;
for (uint32_t ii = 0; isAllEntriesinRPLHasSameSignFlag && !sps.getRPL1CopyFromRPL0Flag() && ii < numberOfRPL; ii++)
{
isFirstEntry = true;
const ReferencePictureList* rpl = rplList1->getReferencePictureList(ii);
for (uint32_t jj = 0; isAllEntriesinRPLHasSameSignFlag && jj < rpl->getNumberOfActivePictures(); jj++)
{
if (!rpl->isRefPicLongterm(jj) && isFirstEntry)
{
lastSign = (rpl->getRefPicIdentifier(jj) >= 0) ? true : false;
isFirstEntry = false;
}
else if (!rpl->isRefPicLongterm(jj) && (((rpl->getRefPicIdentifier(jj) - rpl->getRefPicIdentifier(jj - 1)) >= 0 && lastSign == false) || ((rpl->getRefPicIdentifier(jj) - rpl->getRefPicIdentifier(jj - 1)) < 0 && lastSign == true)))
{
isAllEntriesinRPLHasSameSignFlag = false;
}
}
}
sps.setAllActiveRplEntriesHasSameSignFlag(isAllEntriesinRPLHasSameSignFlag);
}
void EncLib::getActiveRefPicListNumForPOC(const SPS *sps, int POCCurr, int GOPid, uint32_t *activeL0, uint32_t *activeL1)
{
{
*activeL0 = *activeL1 = 0;
return;
}
uint32_t rpl0Idx = GOPid;
uint32_t rpl1Idx = GOPid;
int fullListNum = m_iGOPSize;
int partialListNum = getRPLCandidateSize(0) - m_iGOPSize;
int extraNum = fullListNum;
int candidateIdx = (POCCurr + m_iGOPSize - 1 >= fullListNum + partialListNum) ? GOPid : POCCurr + m_iGOPSize - 1;
rpl0Idx = candidateIdx;
rpl1Idx = candidateIdx;
}
else
{
rpl0Idx = (POCCurr%m_iGOPSize == 0) ? m_iGOPSize - 1 : POCCurr%m_iGOPSize - 1;
rpl1Idx = (POCCurr%m_iGOPSize == 0) ? m_iGOPSize - 1 : POCCurr%m_iGOPSize - 1;
}
extraNum = fullListNum + partialListNum;
}
for (; extraNum<fullListNum + partialListNum; extraNum++)
{
if (m_intraPeriod > 0 && getDecodingRefreshType() > 0)
int POCIndex = POCCurr % m_intraPeriod;
{
POCIndex = m_intraPeriod;
}
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
if (POCIndex == m_RPLList0[extraNum].m_POC)
{
rpl0Idx = extraNum;
rpl1Idx = extraNum;
extraNum++;
}
}
}
const ReferencePictureList *rpl0 = sps->getRPLList0()->getReferencePictureList(rpl0Idx);
*activeL0 = rpl0->getNumberOfActivePictures();
const ReferencePictureList *rpl1 = sps->getRPLList1()->getReferencePictureList(rpl1Idx);
*activeL1 = rpl1->getNumberOfActivePictures();
}
void EncLib::selectReferencePictureList(Slice* slice, int POCCurr, int GOPid, int ltPoc)
{
bool isEncodeLtRef = (POCCurr == ltPoc);
if (m_compositeRefEnabled && isEncodeLtRef)
{
POCCurr++;
}
slice->setRPL0idx(GOPid);
slice->setRPL1idx(GOPid);
int fullListNum = m_iGOPSize;
int partialListNum = getRPLCandidateSize(0) - m_iGOPSize;
int extraNum = fullListNum;
if( rplPeriod < 0 ) //Need to check if it is low delay or RA but with no RAP
{
if( slice->getSPS()->getRPLList0()->getReferencePictureList(1)->getRefPicIdentifier(0) * slice->getSPS()->getRPLList1()->getReferencePictureList(1)->getRefPicIdentifier(0) < 0)
{
rplPeriod = m_iGOPSize * 2;
}
}
if (rplPeriod < 0)
int candidateIdx = (POCCurr + m_iGOPSize - 1 >= fullListNum + partialListNum) ? GOPid : POCCurr + m_iGOPSize - 1;
slice->setRPL0idx(candidateIdx);
slice->setRPL1idx(candidateIdx);
}
else
{
slice->setRPL0idx((POCCurr%m_iGOPSize == 0) ? m_iGOPSize - 1 : POCCurr%m_iGOPSize - 1);
slice->setRPL1idx((POCCurr%m_iGOPSize == 0) ? m_iGOPSize - 1 : POCCurr%m_iGOPSize - 1);
}
extraNum = fullListNum + partialListNum;
}
for (; extraNum < fullListNum + partialListNum; extraNum++)
{
if (POCIndex == m_RPLList0[extraNum].m_POC)
{
slice->setRPL0idx(extraNum);
slice->setRPL1idx(extraNum);
extraNum++;
}
}
}
if (slice->getPic()->fieldPic)
{
// To set RPL index of POC1 (first bottom field)
if (POCCurr == 1)
{
slice->setRPL0idx(getRPLCandidateSize(0));
slice->setRPL1idx(getRPLCandidateSize(0));
}
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
{
// To set RPL indexes for LD
int numRPLCandidates = getRPLCandidateSize(0);
if (POCCurr < numRPLCandidates - m_iGOPSize + 2)
{
slice->setRPL0idx(POCCurr + m_iGOPSize - 2);
slice->setRPL1idx(POCCurr + m_iGOPSize - 2);
}
else
{
if (POCCurr%m_iGOPSize == 0)
{
slice->setRPL0idx(m_iGOPSize - 2);
slice->setRPL1idx(m_iGOPSize - 2);
}
else if (POCCurr%m_iGOPSize == 1)
{
slice->setRPL0idx(m_iGOPSize - 1);
slice->setRPL1idx(m_iGOPSize - 1);
}
else
{
slice->setRPL0idx(POCCurr % m_iGOPSize - 2);
slice->setRPL1idx(POCCurr % m_iGOPSize - 2);
}
}
}
}
const ReferencePictureList *rpl0 = (slice->getSPS()->getRPLList0()->getReferencePictureList(slice->getRPL0idx()));
const ReferencePictureList *rpl1 = (slice->getSPS()->getRPLList1()->getReferencePictureList(slice->getRPL1idx()));
slice->setRPL0(rpl0);
slice->setRPL1(rpl1);
}

Karsten Suehring
committed
void EncLib::setParamSetChanged(int spsId, int ppsId)
{
m_ppsMap.setChangedFlag(ppsId);
m_spsMap.setChangedFlag(spsId);
}
Hendry
committed
bool isChanged = m_apsMap.getChangedFlag(apsId);
Hendry
committed
return isChanged;

Karsten Suehring
committed
bool EncLib::PPSNeedsWriting(int ppsId)
{
bool bChanged=m_ppsMap.getChangedFlag(ppsId);
m_ppsMap.clearChangedFlag(ppsId);
return bChanged;
}
bool EncLib::SPSNeedsWriting(int spsId)
{
bool bChanged=m_spsMap.getChangedFlag(spsId);
m_spsMap.clearChangedFlag(spsId);
return bChanged;
}
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
void EncLib::checkPltStats( Picture* pic )
{
int totalArea = 0;
int pltArea = 0;
for (auto apu : pic->cs->pus)
{
for (int i = 0; i < MAX_NUM_TBLOCKS; ++i)
{
int puArea = apu->blocks[i].width * apu->blocks[i].height;
if (apu->blocks[i].width > 0 && apu->blocks[i].height > 0)
{
totalArea += puArea;
if (CU::isPLT(*apu->cu) || CU::isIBC(*apu->cu))
{
pltArea += puArea;
}
break;
}
}
}
if (pltArea * PLT_FAST_RATIO < totalArea)
{
m_doPlt = false;
}
else
{
m_doPlt = true;
}
}

Karsten Suehring
committed
#if X0038_LAMBDA_FROM_QP_CAPABILITY
int EncCfg::getQPForPicture(const uint32_t gopIndex, const Slice *pSlice) const
{
const int lumaQpBDOffset = pSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA);
int qp;
if (getCostMode()==COST_LOSSLESS_CODING)
{
qp = getBaseQP();

Karsten Suehring
committed
}
else
{
const SliceType sliceType=pSlice->getSliceType();
qp = getBaseQP();
// switch at specific qp and keep this qp offset
static int appliedSwitchDQQ = 0; /* TODO: MT */
if( pSlice->getPOC() == getSwitchPOC() )
{
appliedSwitchDQQ = getSwitchDQP();
}
qp += appliedSwitchDQQ;
#if QP_SWITCHING_FOR_PARALLEL
const int* pdQPs = getdQPs();
if ( pdQPs )
{
qp += pdQPs[pSlice->getPOC() / (m_compositeRefEnabled ? 2 : 1)];

Karsten Suehring
committed
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
}
#endif
if(sliceType==I_SLICE)
{
qp += getIntraQPOffset();
}
else
{
const GOPEntry &gopEntry=getGOPEntry(gopIndex);
// adjust QP according to the QP offset for the GOP entry.
qp +=gopEntry.m_QPOffset;
// adjust QP according to QPOffsetModel for the GOP entry.
double dqpOffset=qp*gopEntry.m_QPOffsetModelScale+gopEntry.m_QPOffsetModelOffset+0.5;
int qpOffset = (int)floor(Clip3<double>(0.0, 3.0, dqpOffset));
qp += qpOffset ;
}
#if !QP_SWITCHING_FOR_PARALLEL
// modify QP if a fractional QP was originally specified, cause dQPs to be 0 or 1.
const int* pdQPs = getdQPs();
if ( pdQPs )
{
qp += pdQPs[ pSlice->getPOC() ];
}
#endif
}
qp = Clip3( -lumaQpBDOffset, MAX_QP, qp );
return qp;
}
#endif