Newer
Older
bool isIRAP() const { return (getNalUnitType() >= NAL_UNIT_CODED_SLICE_IDR_W_RADL) && (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA); }
bool isIDRorBLA() const { return (getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL) || (getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP); }
void checkCRA(const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1, int& pocCRA, NalUnitType& associatedIRAPType, PicList& rcListPic);

Karsten Suehring
committed
void decodingRefreshMarking(int& pocCRA, bool& bRefreshPending, PicList& rcListPic, const bool bEfficientFieldIRAPEnabled);
void setSliceType( SliceType e ) { m_eSliceType = e; }
void setSliceQp( int i ) { m_iSliceQp = i; }
void setSliceQpDelta( int i ) { m_iSliceQpDelta = i; }
void setSliceChromaQpDelta( ComponentID compID, int i ) { m_iSliceChromaQpDelta[compID] = isLuma(compID) ? 0 : i; }
void setUseChromaQpAdj( bool b ) { m_ChromaQpAdjEnabled = b; }
void setDeblockingFilterDisable( bool b ) { m_deblockingFilterDisable= b; }
void setDeblockingFilterOverrideFlag( bool b ) { m_deblockingFilterOverrideFlag = b; }
void setDeblockingFilterBetaOffsetDiv2( int i ) { m_deblockingFilterBetaOffsetDiv2 = i; }
void setDeblockingFilterTcOffsetDiv2( int i ) { m_deblockingFilterTcOffsetDiv2 = i; }
void setNumRefIdx( RefPicList e, int i ) { m_aiNumRefIdx[e] = i; }
void setPic( Picture* p ) { m_pcPic = p; }
void setDepth( int iDepth ) { m_iDepth = iDepth; }

Karsten Suehring
committed
void setRefPOCList();
void setColFromL0Flag( bool colFromL0 ) { m_colFromL0Flag = colFromL0; }
void setColRefIdx( uint32_t refIdx) { m_colRefIdx = refIdx; }
void setCheckLDC( bool b ) { m_bCheckLDC = b; }
void setMvdL1ZeroFlag( bool b) { m_bLMvdL1Zero = b; }
Daniel
committed
void setBiDirPred( bool b, int refIdx0, int refIdx1 ) { m_biDirPred = b; m_symRefIdx[0] = refIdx0; m_symRefIdx[1] = refIdx1; }
bool getBiDirPred() const { return m_biDirPred; }
int getSymRefIdx( int refList ) const { return m_symRefIdx[refList]; }

Karsten Suehring
committed
bool isIntra() const { return m_eSliceType == I_SLICE; }
bool isInterB() const { return m_eSliceType == B_SLICE; }
bool isInterP() const { return m_eSliceType == P_SLICE; }
#if JVET_N0494_DRAP
bool getEnableDRAPSEI () const { return m_enableDRAPSEI; }
void setEnableDRAPSEI ( bool b ) { m_enableDRAPSEI = b; }
bool getUseLTforDRAP () const { return m_useLTforDRAP; }
void setUseLTforDRAP ( bool b ) { m_useLTforDRAP = b; }
bool isDRAP () const { return m_isDRAP; }
void setDRAP ( bool b ) { m_isDRAP = b; }
void setLatestDRAPPOC ( int i ) { m_latestDRAPPOC = i; }
int getLatestDRAPPOC () const { return m_latestDRAPPOC; }
bool cvsHasPreviousDRAP() const { return m_latestDRAPPOC != MAX_INT; }
bool isPocRestrictedByDRAP( int poc, bool precedingDRAPinDecodingOrder );
bool isPOCInRefPicList( const ReferencePictureList *rpl, int poc );
void checkConformanceForDRAP( uint32_t temporalId );
#endif

Karsten Suehring
committed
void setLambdas( const double lambdas[MAX_NUM_COMPONENT] ) { for (int component = 0; component < MAX_NUM_COMPONENT; component++) m_lambdas[component] = lambdas[component]; }
const double* getLambdas() const { return m_lambdas; }
void setSplitConsOverrideFlag(bool b) { m_splitConsOverrideFlag = b; }
bool getSplitConsOverrideFlag() const { return m_splitConsOverrideFlag; }
void setMinQTSize(int i) { m_uiMinQTSize = i; }
uint32_t getMinQTSize() const { return m_uiMinQTSize; }
void setMaxMTTHierarchyDepth(int i) { m_uiMaxMTTHierarchyDepth = i; }
uint32_t getMaxMTTHierarchyDepth() const { return m_uiMaxMTTHierarchyDepth; }
void setMaxTTSize(int i) { m_uiMaxTTSize = i; }
uint32_t getMaxTTSize() const { return m_uiMaxTTSize; }
void setMinQTSizeIChroma(int i) { m_uiMinQTSizeIChroma = i; }
uint32_t getMinQTSizeIChroma() const { return m_uiMinQTSizeIChroma; }
void setMaxMTTHierarchyDepthIChroma(int i) { m_uiMaxMTTHierarchyDepthIChroma = i; }
uint32_t getMaxMTTHierarchyDepthIChroma() const { return m_uiMaxMTTHierarchyDepthIChroma; }
void setMaxBTSizeIChroma(int i) { m_uiMaxBTSizeIChroma = i; }
uint32_t getMaxBTSizeIChroma() const { return m_uiMaxBTSizeIChroma; }
void setMaxTTSizeIChroma(int i) { m_uiMaxTTSizeIChroma = i; }
uint32_t getMaxTTSizeIChroma() const { return m_uiMaxTTSizeIChroma; }

Karsten Suehring
committed
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
void setMaxBTSize(int i) { m_uiMaxBTSize = i; }
uint32_t getMaxBTSize() const { return m_uiMaxBTSize; }
void setDepQuantEnabledFlag( bool b ) { m_depQuantEnabledFlag = b; }
bool getDepQuantEnabledFlag() const { return m_depQuantEnabledFlag; }
void setSignDataHidingEnabledFlag( bool b ) { m_signDataHidingEnabledFlag = b; }
bool getSignDataHidingEnabledFlag() const { return m_signDataHidingEnabledFlag; }
void initEqualRef();
bool isEqualRef( RefPicList e, int iRefIdx1, int iRefIdx2 )
{
CHECK(e>=NUM_REF_PIC_LIST_01, "Invalid reference picture list");
if (iRefIdx1 < 0 || iRefIdx2 < 0)
{
return false;
}
else
{
return m_abEqualRef[e][iRefIdx1][iRefIdx2];
}
}
void setEqualRef( RefPicList e, int iRefIdx1, int iRefIdx2, bool b)
{
CHECK( e >= NUM_REF_PIC_LIST_01, "Invalid reference picture list" );
m_abEqualRef[e][iRefIdx1][iRefIdx2] = m_abEqualRef[e][iRefIdx2][iRefIdx1] = b;
}
static void sortPicList( PicList& rcListPic );
void setList1IdxToList0Idx();
uint32_t getTLayer() const { return m_uiTLayer; }
void setTLayer( uint32_t uiTLayer ) { m_uiTLayer = uiTLayer; }
void checkLeadingPictureRestrictions( PicList& rcListPic ) const;
void applyReferencePictureListBasedMarking( PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1 ) const;

Karsten Suehring
committed
bool isTemporalLayerSwitchingPoint( PicList& rcListPic ) const;
bool isStepwiseTemporalLayerSwitchingPointCandidate( PicList& rcListPic ) const;
int checkThatAllRefPicsAreAvailable(PicList& rcListPic, const ReferencePictureList *pRPL, int rplIdx, bool printErrors) const;
void createExplicitReferencePictureSetFromReference(PicList& rcListPic, const ReferencePictureList *pRPL0, const ReferencePictureList *pRPL1);

Karsten Suehring
committed
void setMaxNumMergeCand(uint32_t val ) { m_maxNumMergeCand = val; }
uint32_t getMaxNumMergeCand() const { return m_maxNumMergeCand; }
void setMaxNumAffineMergeCand( uint32_t val ) { m_maxNumAffineMergeCand = val; }
uint32_t getMaxNumAffineMergeCand() const { return m_maxNumAffineMergeCand; }
void setMaxNumTriangleCand(uint32_t val) { m_maxNumTriangleCand = val;}
uint32_t getMaxNumTriangleCand() const { return m_maxNumTriangleCand;}
#if JVET_O0455_IBC_MAX_MERGE_NUM
void setMaxNumIBCMergeCand( uint32_t val ) { m_maxNumIBCMergeCand = val; }
uint32_t getMaxNumIBCMergeCand() const { return m_maxNumIBCMergeCand; }
#endif
void setDisFracMMVD( bool val ) { m_disFracMMVD = val; }
bool getDisFracMMVD() const { return m_disFracMMVD; }
#if JVET_O1140_SLICE_DISABLE_BDOF_DMVR_FLAG
void setDisBdofDmvrFlag(bool val) { m_disBdofDmvrFlag = val; }
bool getDisBdofDmvrFlag() const { return m_disBdofDmvrFlag; }
#endif

Karsten Suehring
committed
void setNoOutputPriorPicsFlag( bool val ) { m_noOutputPriorPicsFlag = val; }
bool getNoOutputPriorPicsFlag() const { return m_noOutputPriorPicsFlag; }
#if JVET_N0865_NONSYNTAX
void setNoIncorrectPicOutputFlag(bool val) { m_noIncorrectPicOutputFlag = val; }
bool getNoIncorrectPicOutputFlag() const { return m_noIncorrectPicOutputFlag; }
#else

Karsten Suehring
committed
void setNoRaslOutputFlag( bool val ) { m_noRaslOutputFlag = val; }
bool getNoRaslOutputFlag() const { return m_noRaslOutputFlag; }
#endif

Karsten Suehring
committed
void setHandleCraAsCvsStartFlag( bool val ) { m_handleCraAsCvsStartFlag = val; }
bool getHandleCraAsCvsStartFlag() const { return m_handleCraAsCvsStartFlag; }

Karsten Suehring
committed
void setSliceMode( SliceConstraint mode ) { m_sliceMode = mode; }
SliceConstraint getSliceMode() const { return m_sliceMode; }
void setSliceArgument( uint32_t uiArgument ) { m_sliceArgument = uiArgument; }
uint32_t getSliceArgument() const { return m_sliceArgument; }
void setSliceCurStartCtuTsAddr( uint32_t ctuTsAddr ) { m_sliceCurStartCtuTsAddr = ctuTsAddr; } // CTU Tile-scan address (as opposed to raster-scan)
uint32_t getSliceCurStartCtuTsAddr() const { return m_sliceCurStartCtuTsAddr; } // CTU Tile-scan address (as opposed to raster-scan)
void setSliceCurEndCtuTsAddr( uint32_t ctuTsAddr ) { m_sliceCurEndCtuTsAddr = ctuTsAddr; } // CTU Tile-scan address (as opposed to raster-scan)
uint32_t getSliceCurEndCtuTsAddr() const { return m_sliceCurEndCtuTsAddr; } // CTU Tile-scan address (as opposed to raster-scan)
void setIndependentSliceIdx( uint32_t i) { m_independentSliceIdx = i; }
uint32_t getIndependentSliceIdx() const { return m_independentSliceIdx; }
void copySliceInfo(Slice *pcSliceSrc, bool cpyAlmostAll = true);
void setSliceBits( uint32_t uiVal ) { m_sliceBits = uiVal; }
uint32_t getSliceBits() const { return m_sliceBits; }
void setFinalized( bool uiVal ) { m_bFinalized = uiVal; }
bool getFinalized() const { return m_bFinalized; }
void setSliceCurStartBrickIdx(uint32_t brickIdx) { m_sliceCurStartBrickIdx = brickIdx; }
uint32_t getSliceCurStartBrickIdx() const { return m_sliceCurStartBrickIdx; }
void setSliceCurEndBrickIdx(uint32_t brickIdx) { m_sliceCurEndBrickIdx = brickIdx; }
uint32_t getSliceCurEndBrickIdx() const { return m_sliceCurEndBrickIdx; }
void setSliceNumBricks(uint32_t numBricks) { m_sliceNumBricks = numBricks; }
uint32_t getSliceNumBricks() const { return m_sliceNumBricks; }
void setSliceIndex(uint32_t idx) { m_sliceIdx = idx; }
uint32_t getSliceIndex() const { return m_sliceIdx; }

Karsten Suehring
committed
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
bool testWeightPred( ) const { return m_bTestWeightPred; }
void setTestWeightPred( bool bValue ) { m_bTestWeightPred = bValue; }
bool testWeightBiPred( ) const { return m_bTestWeightBiPred; }
void setTestWeightBiPred( bool bValue ) { m_bTestWeightBiPred = bValue; }
void setWpScaling( WPScalingParam wp[NUM_REF_PIC_LIST_01][MAX_NUM_REF][MAX_NUM_COMPONENT] )
{
memcpy(m_weightPredTable, wp, sizeof(WPScalingParam)*NUM_REF_PIC_LIST_01*MAX_NUM_REF*MAX_NUM_COMPONENT);
}
void getWpScaling( RefPicList e, int iRefIdx, WPScalingParam *&wp) const;
void resetWpScaling();
void initWpScaling(const SPS *sps);
void setWpAcDcParam( WPACDCParam wp[MAX_NUM_COMPONENT] ) { memcpy(m_weightACDCParam, wp, sizeof(WPACDCParam)*MAX_NUM_COMPONENT); }
void getWpAcDcParam( const WPACDCParam *&wp ) const;
void initWpAcDcParam();
void clearSubstreamSizes( ) { return m_substreamSizes.clear(); }
uint32_t getNumberOfSubstreamSizes( ) { return (uint32_t) m_substreamSizes.size(); }
void addSubstreamSize( uint32_t size ) { m_substreamSizes.push_back(size); }
uint32_t getSubstreamSize( uint32_t idx ) { CHECK(idx>=getNumberOfSubstreamSizes(),"Invalid index"); return m_substreamSizes[idx]; }
void setCabacInitFlag( bool val ) { m_cabacInitFlag = val; } //!< set CABAC initial flag
bool getCabacInitFlag() const { return m_cabacInitFlag; } //!< get CABAC initial flag
#if JVET_O0105_ICT
void setJointCbCrSignFlag( bool b ) { m_jointCbCrSignFlag = b; }
bool getJointCbCrSignFlag() const { return m_jointCbCrSignFlag; }
#endif

Karsten Suehring
committed
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
void setLFCrossSliceBoundaryFlag( bool val ) { m_LFCrossSliceBoundaryFlag = val; }
bool getLFCrossSliceBoundaryFlag() const { return m_LFCrossSliceBoundaryFlag; }
void setEnableTMVPFlag( bool b ) { m_enableTMVPFlag = b; }
bool getEnableTMVPFlag() const { return m_enableTMVPFlag; }
void setEncCABACTableIdx( SliceType idx ) { m_encCABACTableIdx = idx; }
SliceType getEncCABACTableIdx() const { return m_encCABACTableIdx; }
void setSliceQpBase( int i ) { m_iSliceQpBase = i; }
int getSliceQpBase() const { return m_iSliceQpBase; }
void setDefaultClpRng( const SPS& sps );
const ClpRngs& clpRngs() const { return m_clpRngs;}
const ClpRng& clpRng( ComponentID id) const { return m_clpRngs.comp[id];}
ClpRngs& getClpRngs() { return m_clpRngs;}
unsigned getMinPictureDistance() const ;
void startProcessingTimer();
void stopProcessingTimer();
void resetProcessingTime() { m_dProcessingTime = m_iProcessingStartTime = 0; }
double getProcessingTime() const { return m_dProcessingTime; }
void resetTileGroupAlfEnabledFlag() { memset(m_tileGroupAlfEnabledFlag, 0, sizeof(m_tileGroupAlfEnabledFlag)); }
bool getTileGroupAlfEnabledFlag(ComponentID compId) const { return m_tileGroupAlfEnabledFlag[compId]; }
void setTileGroupAlfEnabledFlag(ComponentID compId, bool b) { m_tileGroupAlfEnabledFlag[compId] = b; }
int getTileGroupNumAps() const { return m_tileGroupNumAps; }
void setTileGroupNumAps(int i) { m_tileGroupNumAps = i; }
int getTileGroupApsIdChroma() const { return m_tileGroupChromaApsId; }
void setTileGroupApsIdChroma(int i) { m_tileGroupChromaApsId = i; }
std::vector<int32_t> getTileGroupApsIdLuma() const { return m_tileGroupLumaApsId; }
void setAlfAPSs(std::vector<int> ApsIDs)
{
m_tileGroupLumaApsId.resize(m_tileGroupNumAps);
for (int i = 0; i < m_tileGroupNumAps; i++)
{
m_tileGroupLumaApsId[i] = ApsIDs[i];
}
}
void setDisableSATDForRD(bool b) { m_disableSATDForRd = b; }
bool getDisableSATDForRD() { return m_disableSATDForRd; }
#if JVET_O1164_RPR
#if JVET_O0299_APS_SCALINGLIST
void scaleRefPicList( Picture *scaledRefPic[ ], APS** apss, APS* lmcsAps, APS* scalingListAps, const bool isDecoder );
#else
void scaleRefPicList( Picture *scaledRefPic[], APS** apss, APS& lmcsAps, const bool isDecoder );
#endif
void freeScaledRefPicList( Picture *scaledRefPic[] );
bool checkRPR();
const std::pair<int, int>& getScalingRatio( const RefPicList refPicList, const int refIdx ) const { return m_scalingRatio[refPicList][refIdx]; }
#endif
#if JVET_N0865_SYNTAX
void setRecoveryPocCnt(int value) { m_recoveryPocCnt = value; }
int getRecoveryPocCnt() const { return m_recoveryPocCnt; }
void setRpPicOrderCntVal(int value) { m_rpPicOrderCntVal = value; }
int getRpPicOrderCntVal() const { return m_rpPicOrderCntVal; }
#endif
#if JVET_O0181
void setNonRefPictFlag(bool value) { m_nonReferencePicFlag = value; }
bool getNonRefPictFlag() const { return m_nonReferencePicFlag; }
#endif

Karsten Suehring
committed
protected:
Picture* xGetRefPic (PicList& rcListPic, int poc);
Picture* xGetLongTermRefPic(PicList& rcListPic, int poc, bool pocHasMsb);
Yung-Hsuan Chao (Jessie)
committed
#if JVET_O0119_BASE_PALETTE_444
public:
std::unordered_map< Position, std::unordered_map< Size, double> > m_mapPltCost;
Yung-Hsuan Chao (Jessie)
committed
private:
#endif

Karsten Suehring
committed
};// END CLASS DEFINITION Slice
void calculateParameterSetChangedFlag(bool &bChanged, const std::vector<uint8_t> *pOldData, const std::vector<uint8_t> *pNewData);
template <class T> class ParameterSetMap
{
public:
template <class Tm>
struct MapData
{
bool bChanged;
std::vector<uint8_t> *pNaluData; // Can be null
Tm* parameterSet;
};
ParameterSetMap(int maxId)
:m_maxId (maxId)
,m_lastActiveParameterSet(NULL)
{
m_activePsId.clear();
}

Karsten Suehring
committed
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
~ParameterSetMap()
{
for (typename std::map<int,MapData<T> >::iterator i = m_paramsetMap.begin(); i!= m_paramsetMap.end(); i++)
{
delete (*i).second.pNaluData;
delete (*i).second.parameterSet;
}
delete m_lastActiveParameterSet; m_lastActiveParameterSet = NULL;
}
T *allocatePS(const int psId)
{
CHECK( psId >= m_maxId, "Invalid PS id" );
if ( m_paramsetMap.find(psId) == m_paramsetMap.end() )
{
m_paramsetMap[psId].bChanged = true;
m_paramsetMap[psId].pNaluData=0;
m_paramsetMap[psId].parameterSet = new T;
setID(m_paramsetMap[psId].parameterSet, psId);
}
return m_paramsetMap[psId].parameterSet;
}
void clearMap()
{
m_paramsetMap.clear();
}

Karsten Suehring
committed
void storePS(int psId, T *ps, const std::vector<uint8_t> *pNaluData)
{
CHECK( psId >= m_maxId, "Invalid PS id" );
if ( m_paramsetMap.find(psId) != m_paramsetMap.end() )
{
MapData<T> &mapData=m_paramsetMap[psId];
// work out changed flag
calculateParameterSetChangedFlag(mapData.bChanged, mapData.pNaluData, pNaluData);
if( ! mapData.bChanged )
{
// just keep the old one
delete ps;
return;
}
if (find(m_activePsId.begin(), m_activePsId.end(), psId) != m_activePsId.end())

Karsten Suehring
committed
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
{
std::swap( m_paramsetMap[psId].parameterSet, m_lastActiveParameterSet );
}
delete m_paramsetMap[psId].pNaluData;
delete m_paramsetMap[psId].parameterSet;
m_paramsetMap[psId].parameterSet = ps;
}
else
{
m_paramsetMap[psId].parameterSet = ps;
m_paramsetMap[psId].bChanged = false;
}
if (pNaluData != 0)
{
m_paramsetMap[psId].pNaluData=new std::vector<uint8_t>;
*(m_paramsetMap[psId].pNaluData) = *pNaluData;
}
else
{
m_paramsetMap[psId].pNaluData=0;
}
}
Vadim Seregin
committed
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
#if JVET_O0245_VPS_DPS_APS
void checkAuApsContent( APS *aps, std::vector<int>& accessUnitApsNals )
{
int apsId = ( aps->getAPSId() << NUM_APS_TYPE_LEN ) + (int)aps->getAPSType();
if( std::find( accessUnitApsNals.begin(), accessUnitApsNals.end(), apsId ) != accessUnitApsNals.end() )
{
CHECK( m_paramsetMap.find( apsId ) == m_paramsetMap.end(), "APS does not exists" );
APS* existedAPS = m_paramsetMap[apsId].parameterSet;
if( aps->getAPSType() == LMCS_APS )
{
CHECK( aps->getReshaperAPSInfo() != existedAPS->getReshaperAPSInfo(), "All APS NAL units with a particular value of adaptation_parameter_set_id and a particular value of aps_params_type within an access unit shall have the same content" );
}
else if( aps->getAPSType() == ALF_APS )
{
CHECK( aps->getAlfAPSParam() != existedAPS->getAlfAPSParam(), "All APS NAL units with a particular value of adaptation_parameter_set_id and a particular value of aps_params_type within an access unit shall have the same content" );
}
else if( aps->getAPSType() == SCALING_LIST_APS )
{
CHECK( aps->getScalingList() != existedAPS->getScalingList(), "All APS NAL units with a particular value of adaptation_parameter_set_id and a particular value of aps_params_type within an access unit shall have the same content" );
}
else
{
CHECK( true, "Wrong APS type" );
}
}
else
{
accessUnitApsNals.push_back( apsId );
}
}
#endif

Karsten Suehring
committed
2392
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
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
void setChangedFlag(int psId, bool bChanged=true)
{
if ( m_paramsetMap.find(psId) != m_paramsetMap.end() )
{
m_paramsetMap[psId].bChanged=bChanged;
}
}
void clearChangedFlag(int psId)
{
if ( m_paramsetMap.find(psId) != m_paramsetMap.end() )
{
m_paramsetMap[psId].bChanged=false;
}
}
bool getChangedFlag(int psId) const
{
const typename std::map<int,MapData<T> >::const_iterator constit=m_paramsetMap.find(psId);
if ( constit != m_paramsetMap.end() )
{
return constit->second.bChanged;
}
return false;
}
T* getPS(int psId)
{
typename std::map<int,MapData<T> >::iterator it=m_paramsetMap.find(psId);
return ( it == m_paramsetMap.end() ) ? NULL : (it)->second.parameterSet;
}
const T* getPS(int psId) const
{
typename std::map<int,MapData<T> >::const_iterator it=m_paramsetMap.find(psId);
return ( it == m_paramsetMap.end() ) ? NULL : (it)->second.parameterSet;
}
T* getFirstPS()
{
return (m_paramsetMap.begin() == m_paramsetMap.end() ) ? NULL : m_paramsetMap.begin()->second.parameterSet;
}
void setActive(int psId) { m_activePsId.push_back(psId); }
void clear() { m_activePsId.clear(); }

Karsten Suehring
committed
private:
std::map<int,MapData<T> > m_paramsetMap;
int m_maxId;
std::vector<int> m_activePsId;

Karsten Suehring
committed
T* m_lastActiveParameterSet;
static void setID(T* parameterSet, const int psId);
};
class ParameterSetManager
{
public:
ParameterSetManager();
virtual ~ParameterSetManager();
void storeDPS(DPS *dps, const std::vector<uint8_t> &naluData) { m_dpsMap.storePS( dps->getDecodingParameterSetId(), dps, &naluData); };
//! get pointer to existing video parameter set
DPS* getDPS(int dpsId) { return m_dpsMap.getPS(dpsId); };
bool getDPSChangedFlag(int dpsId) const { return m_dpsMap.getChangedFlag(dpsId); }
void clearDPSChangedFlag(int dpsId) { m_dpsMap.clearChangedFlag(dpsId); }
DPS* getFirstDPS() { return m_dpsMap.getFirstPS(); };

Karsten Suehring
committed
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
//! store sequence parameter set and take ownership of it
void storeSPS(SPS *sps, const std::vector<uint8_t> &naluData) { m_spsMap.storePS( sps->getSPSId(), sps, &naluData); };
//! get pointer to existing sequence parameter set
SPS* getSPS(int spsId) { return m_spsMap.getPS(spsId); };
bool getSPSChangedFlag(int spsId) const { return m_spsMap.getChangedFlag(spsId); }
void clearSPSChangedFlag(int spsId) { m_spsMap.clearChangedFlag(spsId); }
SPS* getFirstSPS() { return m_spsMap.getFirstPS(); };
//! store picture parameter set and take ownership of it
void storePPS(PPS *pps, const std::vector<uint8_t> &naluData) { m_ppsMap.storePS( pps->getPPSId(), pps, &naluData); };
//! get pointer to existing picture parameter set
PPS* getPPS(int ppsId) { return m_ppsMap.getPS(ppsId); };
bool getPPSChangedFlag(int ppsId) const { return m_ppsMap.getChangedFlag(ppsId); }
void clearPPSChangedFlag(int ppsId) { m_ppsMap.clearChangedFlag(ppsId); }
PPS* getFirstPPS() { return m_ppsMap.getFirstPS(); };
//! activate a SPS from a active parameter sets SEI message
//! \returns true, if activation is successful
// bool activateSPSWithSEI(int SPSId);
//! activate a PPS and depending on isIDR parameter also SPS
//! \returns true, if activation is successful
bool activatePPS(int ppsId, bool isIRAP);
APS** getAPSs() { return &m_apss[0]; }
ParameterSetMap<APS>* getApsMap() { return &m_apsMap; }
void storeAPS(APS *aps, const std::vector<uint8_t> &naluData) { m_apsMap.storePS((aps->getAPSId() << NUM_APS_TYPE_LEN) + aps->getAPSType(), aps, &naluData); };
APS* getAPS(int apsId, int apsType) { return m_apsMap.getPS((apsId << NUM_APS_TYPE_LEN) + apsType); };
bool getAPSChangedFlag(int apsId, int apsType) const { return m_apsMap.getChangedFlag((apsId << NUM_APS_TYPE_LEN) + apsType); }
void clearAPSChangedFlag(int apsId, int apsType) { m_apsMap.clearChangedFlag((apsId << NUM_APS_TYPE_LEN) + apsType); }
APS* getFirstAPS() { return m_apsMap.getFirstPS(); };
bool activateAPS(int apsId, int apsType);

Karsten Suehring
committed
const SPS* getActiveSPS()const { return m_spsMap.getPS(m_activeSPSId); };
const DPS* getActiveDPS()const { return m_dpsMap.getPS(m_activeDPSId); };

Karsten Suehring
committed
Vadim Seregin
committed
#if JVET_O0245_VPS_DPS_APS
void checkAuApsContent( APS *aps, std::vector<int>& accessUnitApsNals ) { m_apsMap.checkAuApsContent( aps, accessUnitApsNals ); }
#endif

Karsten Suehring
committed
protected:
ParameterSetMap<SPS> m_spsMap;
ParameterSetMap<PPS> m_ppsMap;
ParameterSetMap<DPS> m_dpsMap;

Karsten Suehring
committed
#if JVET_O_MAX_NUM_ALF_APS_8
APS* m_apss[ALF_CTB_MAX_NUM_APS];
#else
APS* m_apss[MAX_NUM_APS];
int m_activeDPSId; // -1 for nothing active

Karsten Suehring
committed
int m_activeSPSId; // -1 for nothing active
};
class PreCalcValues
{
public:
PreCalcValues( const SPS& sps, const PPS& pps, bool _isEncoder )
: chrFormat ( sps.getChromaFormatIdc() )

Karsten Suehring
committed
, maxCUWidth ( sps.getMaxCUWidth() )
, maxCUHeight ( sps.getMaxCUHeight() )
, maxCUWidthMask ( maxCUWidth - 1 )
, maxCUHeightMask ( maxCUHeight - 1 )
, maxCUWidthLog2 ( floorLog2( maxCUWidth ) )
, maxCUHeightLog2 ( floorLog2( maxCUHeight ) )

Karsten Suehring
committed
, minCUWidth ( sps.getMaxCUWidth() >> sps.getMaxCodingDepth() )
, minCUHeight ( sps.getMaxCUHeight() >> sps.getMaxCodingDepth() )
, minCUWidthLog2 ( floorLog2( minCUWidth ) )
, minCUHeightLog2 ( floorLog2( minCUHeight ) )

Karsten Suehring
committed
, partsInCtuWidth ( 1 << sps.getMaxCodingDepth() )
, partsInCtuHeight ( 1 << sps.getMaxCodingDepth() )
, partsInCtu ( 1 << (sps.getMaxCodingDepth() << 1) )
#if JVET_O1164_PS
, widthInCtus ( (pps.getPicWidthInLumaSamples () + sps.getMaxCUWidth () - 1) / sps.getMaxCUWidth () )
, heightInCtus ( (pps.getPicHeightInLumaSamples() + sps.getMaxCUHeight() - 1) / sps.getMaxCUHeight() )
#else

Karsten Suehring
committed
, widthInCtus ( (sps.getPicWidthInLumaSamples () + sps.getMaxCUWidth () - 1) / sps.getMaxCUWidth () )
, heightInCtus ( (sps.getPicHeightInLumaSamples() + sps.getMaxCUHeight() - 1) / sps.getMaxCUHeight() )
#endif

Karsten Suehring
committed
, sizeInCtus ( widthInCtus * heightInCtus )
#if JVET_O1164_PS
, lumaWidth ( pps.getPicWidthInLumaSamples() )
, lumaHeight ( pps.getPicHeightInLumaSamples() )
#else

Karsten Suehring
committed
, lumaWidth ( sps.getPicWidthInLumaSamples() )
, lumaHeight ( sps.getPicHeightInLumaSamples() )
#endif

Karsten Suehring
committed
, fastDeltaQPCuMaxSize( Clip3(sps.getMaxCUHeight() >> (sps.getLog2DiffMaxMinCodingBlockSize()), sps.getMaxCUHeight(), 32u) )

Karsten Suehring
committed
, isEncoder ( _isEncoder )
, ISingleTree ( !sps.getUseDualITree() )
, maxBtDepth { sps.getMaxMTTHierarchyDepthI(), sps.getMaxMTTHierarchyDepth(), sps.getMaxMTTHierarchyDepthIChroma() }
, minBtSize { 1u << sps.getLog2MinCodingBlockSize(), 1u << sps.getLog2MinCodingBlockSize(), 1u << sps.getLog2MinCodingBlockSize() }
, maxBtSize { sps.getMaxBTSizeI(), sps.getMaxBTSize(), sps.getMaxBTSizeIChroma() }
, minTtSize { 1u << sps.getLog2MinCodingBlockSize(), 1u << sps.getLog2MinCodingBlockSize(), 1u << sps.getLog2MinCodingBlockSize() }
, maxTtSize { sps.getMaxTTSizeI(), sps.getMaxTTSize(), sps.getMaxTTSizeIChroma() }
, minQtSize { sps.getMinQTSize(I_SLICE, CHANNEL_TYPE_LUMA), sps.getMinQTSize(B_SLICE, CHANNEL_TYPE_LUMA), sps.getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA) }

Karsten Suehring
committed
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
{}
const ChromaFormat chrFormat;
const bool multiBlock422;
const unsigned maxCUWidth;
const unsigned maxCUHeight;
// to get CTU position, use (x & maxCUWidthMask) rather than (x % maxCUWidth)
const unsigned maxCUWidthMask;
const unsigned maxCUHeightMask;
const unsigned maxCUWidthLog2;
const unsigned maxCUHeightLog2;
const unsigned minCUWidth;
const unsigned minCUHeight;
const unsigned minCUWidthLog2;
const unsigned minCUHeightLog2;
const unsigned partsInCtuWidth;
const unsigned partsInCtuHeight;
const unsigned partsInCtu;
const unsigned widthInCtus;
const unsigned heightInCtus;
const unsigned sizeInCtus;
const unsigned lumaWidth;
const unsigned lumaHeight;
const unsigned fastDeltaQPCuMaxSize;
const bool noChroma2x2;
const bool isEncoder;
const bool ISingleTree;
private:
const unsigned maxBtDepth[3];
const unsigned minBtSize [3];
const unsigned maxBtSize [3];
const unsigned minTtSize [3];
const unsigned maxTtSize [3];
const unsigned minQtSize [3];
unsigned getValIdx ( const Slice &slice, const ChannelType chType ) const;
public:
unsigned getMaxBtDepth( const Slice &slice, const ChannelType chType ) const;
unsigned getMinBtSize ( const Slice &slice, const ChannelType chType ) const;
unsigned getMaxBtSize ( const Slice &slice, const ChannelType chType ) const;
unsigned getMinTtSize ( const Slice &slice, const ChannelType chType ) const;
unsigned getMaxTtSize ( const Slice &slice, const ChannelType chType ) const;
unsigned getMinQtSize ( const Slice &slice, const ChannelType chType ) const;
};
#if ENABLE_TRACING
void xTraceVPSHeader();

Karsten Suehring
committed
void xTraceSPSHeader();
void xTracePPSHeader();

Karsten Suehring
committed
void xTraceSliceHeader();
void xTraceAccessUnitDelimiter();
#endif
#endif // __SLICE__