Newer
Older
{ 165, 151, 153, 154, 125, 126, 168, 155, 186, 172, 143, },
}),
};

Karsten Suehring
committed
const CtxSet ContextSetCfg::LastX[] =
{
ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 111, 111, 110, 111, 111, 124, 111, 111, 111, 95, 126, 126, 111, 111, 169, 154, 111, 110, 110, 123, CNU, CNU, CNU, CNU, CNU,},
{ 125, 110, 109, 111, 125, 123, 111, 111, 95, 108, 126, 126, 110, 95, 183, 154, 140, 110, 124, 137, CNU, CNU, CNU, CNU, CNU,},
{ 140, 140, 124, 111, 126, 109, 111, 126, 125, 123, 126, 127, 111, 110, 93, 141, 157, 126, 125, 182, CNU, CNU, CNU, CNU, CNU,},
{ 8, 8, 5, 5, 4, 4, 5, 4, 4, 0, 5, 4, 0, 0, 0, 1, 1, 1, 0, 8, DWS, DWS, DWS, DWS, DWS, },
#else
{ 111, 125, 124, 111, 111, 109, 111, 111, 125, 109, 140, 126, 111, 111, 139, 140, 111, 125, 95, 138, CNU, CNU, CNU, CNU, CNU, },
{ 125, 110, 109, 111, 125, 123, 111, 111, 95, 123, 140, 126, 125, 95, 169, 125, 140, 110, 124, 152, CNU, CNU, CNU, CNU, CNU, },
{ 140, 140, 124, 140, 126, 109, 140, 141, 125, 94, 111, 127, 111, 140, 93, 141, 186, 141, 125, 197, CNU, CNU, CNU, CNU, CNU, },

Karsten Suehring
committed
}),
ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 137, 109, 62, CNU,},
{ 138, 123, 92, CNU,},
{ 138, 108, 61, CNU,},
{ 2, 4, 4, DWS, },
#else
{ 123, 109, 63, CNU, },
{ 138, 123, 92, CNU, },
{ 123, 108, 62, CNU, },

Karsten Suehring
committed
}),
};
const CtxSet ContextSetCfg::LastY[] =
{
ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 125, 125, 139, 111, 111, 124, 111, 111, 110, 110, 140, 126, 110, 95, 155, 154, 111, 110, 124, 180, CNU, CNU, CNU, CNU, CNU,},
{ 110, 95, 109, 125, 110, 93, 125, 111, 124, 108, 140, 111, 95, 109, 153, 125, 126, 110, 109, 181, CNU, CNU, CNU, CNU, CNU,},
{ 110, 110, 109, 125, 111, 108, 111, 126, 95, 93, 111, 127, 111, 95, 47, 155, 158, 156, 140, 137, CNU, CNU, CNU, CNU, CNU,},
{ 8, 5, 8, 5, 5, 4, 5, 5, 4, 0, 5, 5, 1, 0, 0, 1, 4, 1, 0, 8, DWS, DWS, DWS, DWS, DWS, },
#else
{ 125, 110, 139, 125, 125, 109, 111, 111, 110, 109, 140, 126, 110, 110, 154, 140, 111, 125, 109, 181, CNU, CNU, CNU, CNU, CNU, },
{ 110, 95, 94, 125, 110, 123, 140, 111, 95, 123, 125, 111, 110, 95, 154, 125, 111, 95, 94, 137, CNU, CNU, CNU, CNU, CNU, },
{ 110, 110, 109, 125, 111, 123, 111, 141, 95, 108, 111, 142, 111, 95, 63, 140, 157, 141, 110, 152, CNU, CNU, CNU, CNU, CNU, },

Karsten Suehring
committed
}),
ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 137, 109, 122, CNU,},
{ 108, 108, 136, CNU,},
{ 123, 123, 91, CNU,},
{ 2, 5, 5, DWS, },
#else
{ 108, 94, 122, CNU, },
{ 108, 93, 92, CNU, },
{ 108, 123, 77, CNU, },

Karsten Suehring
committed
}),
};
const CtxSet ContextSetCfg::MVPIdx = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 153,},
{ 168, },
{ CNU, },
{ 10,},
#else

Karsten Suehring
committed
});
#if JVET_M0444_SMVD
const CtxSet ContextSetCfg::SmvdFlag = ContextSetCfg::addCtxSet
( {
{ 154, },
{ 110, },
{ CNU, },
Daniel
committed
#if JVET_M0453_CABAC_ENGINE
{ DWS, }
#endif

Karsten Suehring
committed
const CtxSet ContextSetCfg::SaoMergeFlag = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 63,},
{ 244,},
{ 199,},
{ 0,},
#else

Karsten Suehring
committed
});
const CtxSet ContextSetCfg::SaoTypeIdx = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 63,},
{ 95,},
{ 110,},
{ 0,},
#else

Karsten Suehring
committed
});

Karsten Suehring
committed
const CtxSet ContextSetCfg::TransformSkipFlag = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 154, 13,},
{ 152, 57,},
{ 139, 0,},
{ 4, 1,},
#else
{ 124, 61, },
{ 138, 46, },
{ 109, 42, },

Karsten Suehring
committed
});

Karsten Suehring
committed
const CtxSet ContextSetCfg::TransquantBypassFlag = ContextSetCfg::addCtxSet
({
{ 154,},
{ 154,},
{ 154,},
#if JVET_M0453_CABAC_ENGINE
{ DWS, }
#endif

Karsten Suehring
committed
});
const CtxSet ContextSetCfg::RdpcmFlag = ContextSetCfg::addCtxSet
({
{ 139, 139,},
{ 139, 139,},
{ CNU, CNU,},
#if JVET_M0453_CABAC_ENGINE
{ DWS, DWS, }
#endif

Karsten Suehring
committed
});
const CtxSet ContextSetCfg::RdpcmDir = ContextSetCfg::addCtxSet
({
{ 139, 139,},
{ 139, 139,},
{ CNU, CNU,},
#if JVET_M0453_CABAC_ENGINE
{ DWS, DWS, }
#endif

Karsten Suehring
committed
});
#if JVET_M0464_UNI_MTS
const CtxSet ContextSetCfg::MTSIndex = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, },
{ CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, },
{ CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, },
{ DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, },
#else
{ CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, },
{ CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, },
{ CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, },
#endif
});
#else

Karsten Suehring
committed
const CtxSet ContextSetCfg::EMTTuIndex = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 122, 136, CNU, CNU,},
{ 151, 150, CNU, CNU,},
{ 121, 136, CNU, CNU,},
{ 9, 9, DWS, DWS,},
#else
{ 153, 138, CNU, CNU, },
{ 138, 167, CNU, CNU, },
{ 167, 123, CNU, CNU, },

Karsten Suehring
committed
});
const CtxSet ContextSetCfg::EMTCuFlag = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 216, 158, 172, 201, 200, CNU,},
{ 202, 158, 158, 158, 187, CNU,},
{ CNU, CNU, 141, 171, 171, CNU,},
{ 9, 8, 9, 8, 8, DWS,},
#else
{ 155, 141, 155, 155, 140, CNU, },
{ 141, 141, 141, 126, 155, CNU, },
{ CNU, CNU, 140, 155, 155, CNU, },

Karsten Suehring
committed
});

Karsten Suehring
committed
const CtxSet ContextSetCfg::CrossCompPred = ContextSetCfg::addCtxSet
({
{ 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,},
{ 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,},
{ 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,},
#if JVET_M0453_CABAC_ENGINE
{ DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, DWS, }
#endif

Karsten Suehring
committed
});
const CtxSet ContextSetCfg::ChromaQpAdjFlag = ContextSetCfg::addCtxSet
({
{ 154,},
{ 154,},
{ 154,},
#if JVET_M0453_CABAC_ENGINE
{ DWS, }
#endif

Karsten Suehring
committed
});
const CtxSet ContextSetCfg::ChromaQpAdjIdc = ContextSetCfg::addCtxSet
({
{ 154,},
{ 154,},
{ 154,},
#if JVET_M0453_CABAC_ENGINE
{ DWS, }
#endif

Karsten Suehring
committed
});
const CtxSet ContextSetCfg::ImvFlag = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 227, 214, 230, 195,},
{ 213, 229, 230, 166,},
{ CNU, CNU, CNU, CNU,},
{ 1, 4, 4, 5,},
#else
{ 212, 214, 230, 182, },
{ 212, 214, 230, 182, },
{ CNU, CNU, CNU, CNU, },

Karsten Suehring
committed
});
const CtxSet ContextSetCfg::ctbAlfFlag =
{
ContextSetCfg::addCtxSet
( {
#if JVET_M0453_CABAC_ENGINE
{ 154, 201, 203, 168, 247, 249, 168, 248, 235,},
{ 139, 186, 203, 168, 247, 249, 168, 247, 234,},
{ 219, 237, 253, 187, 234, 235, 216, 219, 250,},
{ 0, 0, 4, 0, 0, 0, 0, 0, 0, },
#else
{ 138, 141, 173, 122, 170, 203, 151, 170, 203, },
{ 153, 156, 188, 137, 185, 218, 152, 185, 218, },
{ 155, 205, 253, 168, 187, 234, 168, 187, 220, },

Karsten Suehring
committed
};
const CtxSet ContextSetCfg::MHIntraFlag = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 240,},
{ 197,},
{ CNU,},
{ 1,},
#else
});
const CtxSet ContextSetCfg::MHIntraPredMode = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 156, CNU, CNU, CNU,},
{ 156, CNU, CNU, CNU,},
{ CNU, CNU, CNU, CNU,},
{ 9, DWS, DWS, DWS,},
#else
{ 155, CNU, CNU, CNU, },
{ 141, CNU, CNU, CNU, },
{ CNU, CNU, CNU, CNU, },

Karsten Suehring
committed
const CtxSet ContextSetCfg::TriangleFlag = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 149, 137, 137,},
{ 165, 151, 137,},
{ CNU, CNU, CNU,},
{ 9, 13, 10,},
#else
{ 165, 137, 153, },
{ 106, 122, 138, },
{ CNU, CNU, CNU, },
});
const CtxSet ContextSetCfg::TriangleIdx = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 141,},
{ 141,},
{ CNU,},
{ 8,},
#else

Karsten Suehring
committed
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
const unsigned ContextSetCfg::NumberOfContexts = (unsigned)ContextSetCfg::sm_InitTables[0].size();
// combined sets
const CtxSet ContextSetCfg::Sao = { ContextSetCfg::SaoMergeFlag, ContextSetCfg::SaoTypeIdx };
template <class BinProbModel>
CtxStore<BinProbModel>::CtxStore()
: m_CtxBuffer ()
, m_Ctx ( nullptr )
{}
template <class BinProbModel>
CtxStore<BinProbModel>::CtxStore( bool dummy )
: m_CtxBuffer ( ContextSetCfg::NumberOfContexts )
, m_Ctx ( m_CtxBuffer.data() )
{}
template <class BinProbModel>
CtxStore<BinProbModel>::CtxStore( const CtxStore<BinProbModel>& ctxStore )
: m_CtxBuffer ( ctxStore.m_CtxBuffer )
, m_Ctx ( m_CtxBuffer.data() )
{}
template <class BinProbModel>
void CtxStore<BinProbModel>::init( int qp, int initId )
{
const std::vector<uint8_t>& initTable = ContextSetCfg::getInitTable( initId );
CHECK( m_CtxBuffer.size() != initTable.size(),
"Size of init table (" << initTable.size() << ") does not match size of context buffer (" << m_CtxBuffer.size() << ")." );
#if JVET_M0453_CABAC_ENGINE
const std::vector<uint8_t> &rateInitTable = ContextSetCfg::getInitTable(NUMBER_OF_SLICE_TYPES);
CHECK(m_CtxBuffer.size() != rateInitTable.size(),
"Size of rate init table (" << rateInitTable.size() << ") does not match size of context buffer ("
<< m_CtxBuffer.size() << ").");
#endif
int clippedQP = Clip3( 0, MAX_QP, qp );

Karsten Suehring
committed
for( std::size_t k = 0; k < m_CtxBuffer.size(); k++ )
{
m_CtxBuffer[k].init( clippedQP, initTable[k] );
#if JVET_M0453_CABAC_ENGINE
m_CtxBuffer[k].setLog2WindowSize(rateInitTable[k]);
#endif

Karsten Suehring
committed
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
}
}
template <class BinProbModel>
void CtxStore<BinProbModel>::setWinSizes( const std::vector<uint8_t>& log2WindowSizes )
{
CHECK( m_CtxBuffer.size() != log2WindowSizes.size(),
"Size of window size table (" << log2WindowSizes.size() << ") does not match size of context buffer (" << m_CtxBuffer.size() << ")." );
for( std::size_t k = 0; k < m_CtxBuffer.size(); k++ )
{
m_CtxBuffer[k].setLog2WindowSize( log2WindowSizes[k] );
}
}
template <class BinProbModel>
void CtxStore<BinProbModel>::loadPStates( const std::vector<uint16_t>& probStates )
{
CHECK( m_CtxBuffer.size() != probStates.size(),
"Size of prob states table (" << probStates.size() << ") does not match size of context buffer (" << m_CtxBuffer.size() << ")." );
for( std::size_t k = 0; k < m_CtxBuffer.size(); k++ )
{
m_CtxBuffer[k].setState( probStates[k] );
}
}
template <class BinProbModel>
void CtxStore<BinProbModel>::savePStates( std::vector<uint16_t>& probStates ) const
{
probStates.resize( m_CtxBuffer.size(), uint16_t(0) );
for( std::size_t k = 0; k < m_CtxBuffer.size(); k++ )
{
probStates[k] = m_CtxBuffer[k].getState();
}
}
template class CtxStore<BinProbModel_Std>;
Ctx::Ctx() : m_BPMType( BPM_Undefined ) {}
Ctx::Ctx( const BinProbModel_Std* dummy ) : m_BPMType( BPM_Std ), m_CtxStore_Std ( true ) {}
Ctx::Ctx( const Ctx& ctx )
: m_BPMType ( ctx.m_BPMType )
, m_CtxStore_Std ( ctx.m_CtxStore_Std )
{
::memcpy( m_GRAdaptStats, ctx.m_GRAdaptStats, sizeof( unsigned ) * RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS );
}