Newer
Older
{ 101, 133, 137, 153, 139, 140, 134, 138, 139, 169, 155, 121, 153, 154, 140, 170, 152, 154, 155, 170, 186,},
{ 119, 120, 123, 153, 139, 140, 121, 153, 139, 125, 126, 152, 154, 140, 155, 141, 139, 140, 185, 171, 157,},
{ 8, 5, 10, 12, 13, 10, 9, 9, 10, 12, 10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 9, },
#else
{ 89, 132, 151, 138, 124, 125, 119, 152, 153, 154, 140, 135, 153, 139, 169, 155, 151, 168, 169, 170, 171, },
{ 118, 101, 137, 138, 139, 140, 149, 138, 139, 154, 155, 136, 153, 154, 140, 170, 152, 139, 140, 155, 186, },
{ 135, 120, 108, 153, 139, 140, 151, 153, 139, 125, 140, 123, 154, 140, 155, 126, 139, 140, 170, 156, 142, },
}),
ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 116, 164, 153, 154, 140, 140, 196, 170, 171, 157, 158,},
{ 117, 150, 153, 139, 125, 140, 167, 155, 156, 142, 173,},
{ 134, 136, 153, 154, 125, 111, 168, 170, 201, 172, 173,},
{ 6, 9, 10, 12, 12, 9, 8, 9, 8, 8, 9, },
#else
{ 102, 164, 138, 139, 154, 140, 181, 155, 171, 157, 143, },
{ 132, 136, 153, 154, 140, 155, 167, 155, 156, 142, 173, },
{ 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
#if JVET_M0102_INTRA_SUBPARTITIONS
const CtxSet ContextSetCfg::ISPMode = ContextSetCfg::addCtxSet
({
{ CNU, CNU },
{ CNU, CNU },
{ CNU, CNU },
#if JVET_M0453_CABAC_ENGINE
{ DWS, DWS },
#endif
});
#endif
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
#if JVET_M0140_SBT
const CtxSet ContextSetCfg::SbtFlag = ContextSetCfg::addCtxSet
( {
{ CNU, CNU,},
{ CNU, CNU,},
{ CNU, CNU,},
#if JVET_M0453_CABAC_ENGINE
{ DWS, DWS,},
#endif
} );
const CtxSet ContextSetCfg::SbtQuadFlag = ContextSetCfg::addCtxSet
( {
{ CNU,},
{ CNU,},
{ CNU,},
#if JVET_M0453_CABAC_ENGINE
{ DWS,},
#endif
} );
const CtxSet ContextSetCfg::SbtHorFlag = ContextSetCfg::addCtxSet
( {
{ CNU, CNU, CNU,},
{ CNU, CNU, CNU,},
{ CNU, CNU, CNU,},
#if JVET_M0453_CABAC_ENGINE
{ DWS, DWS, DWS,},
#endif
} );
const CtxSet ContextSetCfg::SbtPosFlag = ContextSetCfg::addCtxSet
( {
{ CNU,},
{ CNU,},
{ CNU,},
#if JVET_M0453_CABAC_ENGINE
{ DWS,},
#endif
} );
#endif

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_M0246_AFFINE_AMVR
{ 227, 214, 230, 195, 227, 214, },
{ 213, 229, 230, 166, 213, 229, },
{ CNU, CNU, CNU, CNU, CNU, CNU, },
{ 1, 4, 4, 5, 1, 4, },
#else
{ 227, 214, 230, 195,},
{ 213, 229, 230, 166,},
{ CNU, CNU, CNU, CNU,},
{ 1, 4, 4, 5,},
#endif
#else
Hongbin Liu
committed
#if JVET_M0246_AFFINE_AMVR
{ 212, 214, 230, 182, 212, 214 },
{ 212, 214, 230, 182, 212, 214 },
{ CNU, CNU, CNU, CNU, CNU, CNU },
{ 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
const CtxSet ContextSetCfg::IBCFlag = ContextSetCfg::addCtxSet
({
#if JVET_M0453_CABAC_ENGINE
{ 149, 137, 137, },
{ 165, 151, 137, },
{ CNU, CNU, CNU, },
#endif
});
#endif

Karsten Suehring
committed
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
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
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
}
}
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 );
}