Skip to content
Snippets Groups Projects
Commit 202f81b2 authored by Chris Rosewarne's avatar Chris Rosewarne
Browse files

JVET-N0103: Coefficient group size harmonization

- Harmonize coefficient group sizes of chroma TBs to those used in luma TBs
- For 2x4/4x2 chroma TBs, retain 2x2 CG size.
parent 42c0f6a3
No related branches found
No related tags found
1 merge request!452JVET-N0103: Coefficient group size harmonization
...@@ -50,8 +50,13 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp ...@@ -50,8 +50,13 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
, m_chType (toChannelType(m_compID)) , m_chType (toChannelType(m_compID))
, m_width (tu.block(m_compID).width) , m_width (tu.block(m_compID).width)
, m_height (tu.block(m_compID).height) , m_height (tu.block(m_compID).height)
#if JVET_N0103_CGSIZE_HARMONIZATION
, m_log2CGWidth ( g_log2SbbSize[ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][0] )
, m_log2CGHeight ( g_log2SbbSize[ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][1] )
#else
, m_log2CGWidth ( g_log2SbbSize[m_chType][ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][0] ) , m_log2CGWidth ( g_log2SbbSize[m_chType][ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][0] )
, m_log2CGHeight ( g_log2SbbSize[m_chType][ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][1] ) , m_log2CGHeight ( g_log2SbbSize[m_chType][ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][1] )
#endif
, m_log2CGSize (m_log2CGWidth + m_log2CGHeight) , m_log2CGSize (m_log2CGWidth + m_log2CGHeight)
, m_widthInGroups(std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, m_width) >> m_log2CGWidth) , m_widthInGroups(std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, m_width) >> m_log2CGWidth)
, m_heightInGroups(std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, m_height) >> m_log2CGHeight) , m_heightInGroups(std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, m_height) >> m_log2CGHeight)
...@@ -68,8 +73,13 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp ...@@ -68,8 +73,13 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
#else #else
, m_scanType (SCAN_DIAG) , m_scanType (SCAN_DIAG)
#endif #endif
#if JVET_N0103_CGSIZE_HARMONIZATION
, m_scan (g_scanOrder [SCAN_GROUPED_4x4][m_scanType][gp_sizeIdxInfo->idxFrom(m_width )][gp_sizeIdxInfo->idxFrom(m_height )])
, m_scanCG (g_scanOrder [SCAN_UNGROUPED ][m_scanType][gp_sizeIdxInfo->idxFrom(m_widthInGroups)][gp_sizeIdxInfo->idxFrom(m_heightInGroups)])
#else
, m_scan (g_scanOrder [m_chType][SCAN_GROUPED_4x4][m_scanType][gp_sizeIdxInfo->idxFrom(m_width )][gp_sizeIdxInfo->idxFrom(m_height )]) , m_scan (g_scanOrder [m_chType][SCAN_GROUPED_4x4][m_scanType][gp_sizeIdxInfo->idxFrom(m_width )][gp_sizeIdxInfo->idxFrom(m_height )])
, m_scanCG (g_scanOrder [m_chType][SCAN_UNGROUPED ][m_scanType][gp_sizeIdxInfo->idxFrom(m_widthInGroups)][gp_sizeIdxInfo->idxFrom(m_heightInGroups)]) , m_scanCG (g_scanOrder [m_chType][SCAN_UNGROUPED ][m_scanType][gp_sizeIdxInfo->idxFrom(m_widthInGroups)][gp_sizeIdxInfo->idxFrom(m_heightInGroups)])
#endif
, m_CtxSetLastX (Ctx::LastX[m_chType]) , m_CtxSetLastX (Ctx::LastX[m_chType])
, m_CtxSetLastY (Ctx::LastY[m_chType]) , m_CtxSetLastY (Ctx::LastY[m_chType])
, m_maxLastPosX(g_uiGroupIdx[std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, m_width) - 1]) , m_maxLastPosX(g_uiGroupIdx[std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, m_width) - 1])
......
...@@ -128,8 +128,13 @@ namespace DQIntern ...@@ -128,8 +128,13 @@ namespace DQIntern
Rom() : m_scansInitialized(false) {} Rom() : m_scansInitialized(false) {}
~Rom() { xUninitScanArrays(); } ~Rom() { xUninitScanArrays(); }
void init () { xInitScanArrays(); } void init () { xInitScanArrays(); }
#if JVET_N0103_CGSIZE_HARMONIZATION
const NbInfoSbb* getNbInfoSbb( int hd, int vd ) const { return m_scanId2NbInfoSbbArray[hd][vd]; }
const NbInfoOut* getNbInfoOut( int hd, int vd ) const { return m_scanId2NbInfoOutArray[hd][vd]; }
#else
const NbInfoSbb* getNbInfoSbb( int hd, int vd, int ch ) const { return m_scanId2NbInfoSbbArray[hd][vd][ch]; } const NbInfoSbb* getNbInfoSbb( int hd, int vd, int ch ) const { return m_scanId2NbInfoSbbArray[hd][vd][ch]; }
const NbInfoOut* getNbInfoOut( int hd, int vd, int ch ) const { return m_scanId2NbInfoOutArray[hd][vd][ch]; } const NbInfoOut* getNbInfoOut( int hd, int vd, int ch ) const { return m_scanId2NbInfoOutArray[hd][vd][ch]; }
#endif
const TUParameters* getTUPars ( const CompArea& area, const ComponentID compID ) const const TUParameters* getTUPars ( const CompArea& area, const ComponentID compID ) const
{ {
return m_tuParameters[g_aucLog2[area.width]][g_aucLog2[area.height]][toChannelType(compID)]; return m_tuParameters[g_aucLog2[area.width]][g_aucLog2[area.height]][toChannelType(compID)];
...@@ -139,8 +144,13 @@ namespace DQIntern ...@@ -139,8 +144,13 @@ namespace DQIntern
void xUninitScanArrays (); void xUninitScanArrays ();
private: private:
bool m_scansInitialized; bool m_scansInitialized;
#if JVET_N0103_CGSIZE_HARMONIZATION
NbInfoSbb* m_scanId2NbInfoSbbArray[ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ];
NbInfoOut* m_scanId2NbInfoOutArray[ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ];
#else
NbInfoSbb* m_scanId2NbInfoSbbArray[ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ][ MAX_NUM_CHANNEL_TYPE ]; NbInfoSbb* m_scanId2NbInfoSbbArray[ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ][ MAX_NUM_CHANNEL_TYPE ];
NbInfoOut* m_scanId2NbInfoOutArray[ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ][ MAX_NUM_CHANNEL_TYPE ]; NbInfoOut* m_scanId2NbInfoOutArray[ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ][ MAX_NUM_CHANNEL_TYPE ];
#endif
TUParameters* m_tuParameters [ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ][ MAX_NUM_CHANNEL_TYPE ]; TUParameters* m_tuParameters [ MAX_CU_DEPTH+1 ][ MAX_CU_DEPTH+1 ][ MAX_NUM_CHANNEL_TYPE ];
}; };
...@@ -157,8 +167,10 @@ namespace DQIntern ...@@ -157,8 +167,10 @@ namespace DQIntern
uint32_t raster2id[ MAX_CU_SIZE * MAX_CU_SIZE ]; uint32_t raster2id[ MAX_CU_SIZE * MAX_CU_SIZE ];
::memset(raster2id, 0, sizeof(raster2id)); ::memset(raster2id, 0, sizeof(raster2id));
#if !JVET_N0103_CGSIZE_HARMONIZATION
for( int ch = 0; ch < MAX_NUM_CHANNEL_TYPE; ch++ ) for( int ch = 0; ch < MAX_NUM_CHANNEL_TYPE; ch++ )
{ {
#endif
for( int hd = 0; hd <= MAX_CU_DEPTH; hd++ ) for( int hd = 0; hd <= MAX_CU_DEPTH; hd++ )
{ {
for( int vd = 0; vd <= MAX_CU_DEPTH; vd++ ) for( int vd = 0; vd <= MAX_CU_DEPTH; vd++ )
...@@ -169,17 +181,28 @@ namespace DQIntern ...@@ -169,17 +181,28 @@ namespace DQIntern
} }
const uint32_t blockWidth = (1 << hd); const uint32_t blockWidth = (1 << hd);
const uint32_t blockHeight = (1 << vd); const uint32_t blockHeight = (1 << vd);
#if JVET_N0103_CGSIZE_HARMONIZATION
const uint32_t log2CGWidth = g_log2SbbSize[hd][vd][0];
const uint32_t log2CGHeight = g_log2SbbSize[hd][vd][1];
#else
const uint32_t log2CGWidth = g_log2SbbSize[ch][hd][vd][0]; const uint32_t log2CGWidth = g_log2SbbSize[ch][hd][vd][0];
const uint32_t log2CGHeight = g_log2SbbSize[ch][hd][vd][1]; const uint32_t log2CGHeight = g_log2SbbSize[ch][hd][vd][1];
#endif
const uint32_t groupWidth = 1 << log2CGWidth; const uint32_t groupWidth = 1 << log2CGWidth;
const uint32_t groupHeight = 1 << log2CGHeight; const uint32_t groupHeight = 1 << log2CGHeight;
const uint32_t groupSize = groupWidth * groupHeight; const uint32_t groupSize = groupWidth * groupHeight;
const CoeffScanType scanType = SCAN_DIAG; const CoeffScanType scanType = SCAN_DIAG;
const SizeType blkWidthIdx = gp_sizeIdxInfo->idxFrom( blockWidth ); const SizeType blkWidthIdx = gp_sizeIdxInfo->idxFrom( blockWidth );
const SizeType blkHeightIdx = gp_sizeIdxInfo->idxFrom( blockHeight ); const SizeType blkHeightIdx = gp_sizeIdxInfo->idxFrom( blockHeight );
#if JVET_N0103_CGSIZE_HARMONIZATION
const ScanElement * scanId2RP = g_scanOrder[SCAN_GROUPED_4x4][scanType][blkWidthIdx][blkHeightIdx];
NbInfoSbb*& sId2NbSbb = m_scanId2NbInfoSbbArray[hd][vd];
NbInfoOut*& sId2NbOut = m_scanId2NbInfoOutArray[hd][vd];
#else
const ScanElement * scanId2RP = g_scanOrder[ch][SCAN_GROUPED_4x4][scanType][blkWidthIdx][blkHeightIdx]; const ScanElement * scanId2RP = g_scanOrder[ch][SCAN_GROUPED_4x4][scanType][blkWidthIdx][blkHeightIdx];
NbInfoSbb*& sId2NbSbb = m_scanId2NbInfoSbbArray[hd][vd][ch]; NbInfoSbb*& sId2NbSbb = m_scanId2NbInfoSbbArray[hd][vd][ch];
NbInfoOut*& sId2NbOut = m_scanId2NbInfoOutArray[hd][vd][ch]; NbInfoOut*& sId2NbOut = m_scanId2NbInfoOutArray[hd][vd][ch];
#endif
// consider only non-zero-out region // consider only non-zero-out region
const uint32_t blkWidthNZOut = std::min<unsigned>( JVET_C0024_ZERO_OUT_TH, blockWidth ); const uint32_t blkWidthNZOut = std::min<unsigned>( JVET_C0024_ZERO_OUT_TH, blockWidth );
const uint32_t blkHeightNZOut= std::min<unsigned>( JVET_C0024_ZERO_OUT_TH, blockHeight ); const uint32_t blkHeightNZOut= std::min<unsigned>( JVET_C0024_ZERO_OUT_TH, blockHeight );
...@@ -289,10 +312,19 @@ namespace DQIntern ...@@ -289,10 +312,19 @@ namespace DQIntern
nbOut.maxDist -= scanId; nbOut.maxDist -= scanId;
} }
#if JVET_N0103_CGSIZE_HARMONIZATION
for( int chId = 0; chId < MAX_NUM_CHANNEL_TYPE; chId++ )
{
m_tuParameters[hd][vd][chId] = new TUParameters( *this, blockWidth, blockHeight, ChannelType(chId) );
}
#else
m_tuParameters[hd][vd][ch] = new TUParameters( *this, blockWidth, blockHeight, ChannelType(ch) ); m_tuParameters[hd][vd][ch] = new TUParameters( *this, blockWidth, blockHeight, ChannelType(ch) );
#endif
} }
} }
#if !JVET_N0103_CGSIZE_HARMONIZATION
} }
#endif
m_scansInitialized = true; m_scansInitialized = true;
} }
...@@ -302,6 +334,32 @@ namespace DQIntern ...@@ -302,6 +334,32 @@ namespace DQIntern
{ {
return; return;
} }
#if JVET_N0103_CGSIZE_HARMONIZATION
for( int hd = 0; hd <= MAX_CU_DEPTH; hd++ )
{
for( int vd = 0; vd <= MAX_CU_DEPTH; vd++ )
{
NbInfoSbb*& sId2NbSbb = m_scanId2NbInfoSbbArray[hd][vd];
NbInfoOut*& sId2NbOut = m_scanId2NbInfoOutArray[hd][vd];
if( sId2NbSbb )
{
delete [] sId2NbSbb;
}
if( sId2NbOut )
{
delete [] sId2NbOut;
}
for( int chId = 0; chId < MAX_NUM_CHANNEL_TYPE; chId++ )
{
TUParameters*& tuPars = m_tuParameters[hd][vd][chId];
if( tuPars )
{
delete tuPars;
}
}
}
}
#else
for( int hd = 0; hd <= MAX_CU_DEPTH; hd++ ) for( int hd = 0; hd <= MAX_CU_DEPTH; hd++ )
{ {
for( int vd = 0; vd <= MAX_CU_DEPTH; vd++ ) for( int vd = 0; vd <= MAX_CU_DEPTH; vd++ )
...@@ -326,6 +384,7 @@ namespace DQIntern ...@@ -326,6 +384,7 @@ namespace DQIntern
} }
} }
} }
#endif
m_scansInitialized = false; m_scansInitialized = false;
} }
...@@ -341,8 +400,13 @@ namespace DQIntern ...@@ -341,8 +400,13 @@ namespace DQIntern
const uint32_t nonzeroWidth = std::min<uint32_t>(JVET_C0024_ZERO_OUT_TH, m_width); const uint32_t nonzeroWidth = std::min<uint32_t>(JVET_C0024_ZERO_OUT_TH, m_width);
const uint32_t nonzeroHeight = std::min<uint32_t>(JVET_C0024_ZERO_OUT_TH, m_height); const uint32_t nonzeroHeight = std::min<uint32_t>(JVET_C0024_ZERO_OUT_TH, m_height);
m_numCoeff = nonzeroWidth * nonzeroHeight; m_numCoeff = nonzeroWidth * nonzeroHeight;
#if JVET_N0103_CGSIZE_HARMONIZATION
m_log2SbbWidth = g_log2SbbSize[ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][0];
m_log2SbbHeight = g_log2SbbSize[ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][1];
#else
m_log2SbbWidth = g_log2SbbSize[m_chType][ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][0]; m_log2SbbWidth = g_log2SbbSize[m_chType][ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][0];
m_log2SbbHeight = g_log2SbbSize[m_chType][ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][1]; m_log2SbbHeight = g_log2SbbSize[m_chType][ g_aucLog2[m_width] ][ g_aucLog2[m_height] ][1];
#endif
m_log2SbbSize = m_log2SbbWidth + m_log2SbbHeight; m_log2SbbSize = m_log2SbbWidth + m_log2SbbHeight;
m_sbbSize = ( 1 << m_log2SbbSize ); m_sbbSize = ( 1 << m_log2SbbSize );
m_sbbMask = m_sbbSize - 1; m_sbbMask = m_sbbSize - 1;
...@@ -359,12 +423,21 @@ namespace DQIntern ...@@ -359,12 +423,21 @@ namespace DQIntern
SizeType vsbb = gp_sizeIdxInfo->idxFrom( m_heightInSbb ); SizeType vsbb = gp_sizeIdxInfo->idxFrom( m_heightInSbb );
SizeType hsId = gp_sizeIdxInfo->idxFrom( m_width ); SizeType hsId = gp_sizeIdxInfo->idxFrom( m_width );
SizeType vsId = gp_sizeIdxInfo->idxFrom( m_height ); SizeType vsId = gp_sizeIdxInfo->idxFrom( m_height );
#if JVET_N0103_CGSIZE_HARMONIZATION
m_scanSbbId2SbbPos = g_scanOrder [ SCAN_UNGROUPED ][ m_scanType ][ hsbb ][ vsbb ];
m_scanId2BlkPos = g_scanOrder [ SCAN_GROUPED_4x4 ][ m_scanType ][ hsId ][ vsId ];
int log2W = g_aucLog2[ m_width ];
int log2H = g_aucLog2[ m_height ];
m_scanId2NbInfoSbb = rom.getNbInfoSbb( log2W, log2H );
m_scanId2NbInfoOut = rom.getNbInfoOut( log2W, log2H );
#else
m_scanSbbId2SbbPos = g_scanOrder [ chType ][ SCAN_UNGROUPED ][ m_scanType ][ hsbb ][ vsbb ]; m_scanSbbId2SbbPos = g_scanOrder [ chType ][ SCAN_UNGROUPED ][ m_scanType ][ hsbb ][ vsbb ];
m_scanId2BlkPos = g_scanOrder [ chType ][ SCAN_GROUPED_4x4 ][ m_scanType ][ hsId ][ vsId ]; m_scanId2BlkPos = g_scanOrder [ chType ][ SCAN_GROUPED_4x4 ][ m_scanType ][ hsId ][ vsId ];
int log2W = g_aucLog2[ m_width ]; int log2W = g_aucLog2[ m_width ];
int log2H = g_aucLog2[ m_height ]; int log2H = g_aucLog2[ m_height ];
m_scanId2NbInfoSbb = rom.getNbInfoSbb( log2W, log2H, chType ); m_scanId2NbInfoSbb = rom.getNbInfoSbb( log2W, log2H, chType );
m_scanId2NbInfoOut = rom.getNbInfoOut( log2W, log2H, chType ); m_scanId2NbInfoOut = rom.getNbInfoOut( log2W, log2H, chType );
#endif
m_scanInfo = new ScanInfo[ m_numCoeff ]; m_scanInfo = new ScanInfo[ m_numCoeff ];
for( int scanIdx = 0; scanIdx < m_numCoeff; scanIdx++ ) for( int scanIdx = 0; scanIdx < m_numCoeff; scanIdx++ )
{ {
...@@ -736,7 +809,11 @@ namespace DQIntern ...@@ -736,7 +809,11 @@ namespace DQIntern
#else #else
const CoeffScanType scanType = SCAN_DIAG; const CoeffScanType scanType = SCAN_DIAG;
#endif #endif
#if JVET_N0103_CGSIZE_HARMONIZATION
const ScanElement *scan = g_scanOrder[SCAN_GROUPED_4x4][scanType][hsId][vsId];
#else
const ScanElement *scan = g_scanOrder[toChannelType(compID)][SCAN_GROUPED_4x4][scanType][hsId][vsId]; const ScanElement *scan = g_scanOrder[toChannelType(compID)][SCAN_GROUPED_4x4][scanType][hsId][vsId];
#endif
const TCoeff* qCoeff = tu.getCoeffs( compID ).buf; const TCoeff* qCoeff = tu.getCoeffs( compID ).buf;
TCoeff* tCoeff = recCoeff.buf; TCoeff* tCoeff = recCoeff.buf;
......
...@@ -269,6 +269,20 @@ uint32_t deriveWeightIdxBits(uint8_t gbiIdx) // Note: align this with TEncSbac:: ...@@ -269,6 +269,20 @@ uint32_t deriveWeightIdxBits(uint8_t gbiIdx) // Note: align this with TEncSbac::
return numBits; return numBits;
} }
#if JVET_N0103_CGSIZE_HARMONIZATION
uint32_t g_log2SbbSize[MAX_CU_DEPTH + 1][MAX_CU_DEPTH + 1][2] =
//===== luma/chroma =====
{
{ { 0,0 },{ 0,1 },{ 0,2 },{ 0,3 },{ 0,4 },{ 0,4 },{ 0,4 },{ 0,4 } },
{ { 1,0 },{ 1,1 },{ 1,1 },{ 1,3 },{ 1,3 },{ 1,3 },{ 1,3 },{ 1,3 } },
{ { 2,0 },{ 1,1 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 } },
{ { 3,0 },{ 3,1 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 } },
{ { 4,0 },{ 3,1 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 } },
{ { 4,0 },{ 3,1 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 } },
{ { 4,0 },{ 3,1 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 } },
{ { 4,0 },{ 3,1 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 },{ 2,2 } }
};
#else
uint32_t g_log2SbbSize[2][MAX_CU_DEPTH+1][MAX_CU_DEPTH+1][2] = uint32_t g_log2SbbSize[2][MAX_CU_DEPTH+1][MAX_CU_DEPTH+1][2] =
{ {
//===== luma ===== //===== luma =====
...@@ -294,6 +308,7 @@ uint32_t g_log2SbbSize[2][MAX_CU_DEPTH+1][MAX_CU_DEPTH+1][2] = ...@@ -294,6 +308,7 @@ uint32_t g_log2SbbSize[2][MAX_CU_DEPTH+1][MAX_CU_DEPTH+1][2] =
{ {0,0}, {1,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} } { {0,0}, {1,1}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2}, {2,2} }
}, },
}; };
#endif
// initialize ROM variables // initialize ROM variables
void initROM() void initROM()
{ {
...@@ -325,8 +340,10 @@ void initROM() ...@@ -325,8 +340,10 @@ void initROM()
SizeIndexInfoLog2 sizeInfo; SizeIndexInfoLog2 sizeInfo;
sizeInfo.init(MAX_CU_SIZE); sizeInfo.init(MAX_CU_SIZE);
#if !JVET_N0103_CGSIZE_HARMONIZATION
for( int ch = 0; ch < MAX_NUM_CHANNEL_TYPE; ch++ ) for( int ch = 0; ch < MAX_NUM_CHANNEL_TYPE; ch++ )
{ {
#endif
// initialize scan orders // initialize scan orders
for (uint32_t blockHeightIdx = 0; blockHeightIdx < sizeInfo.numAllHeights(); blockHeightIdx++) for (uint32_t blockHeightIdx = 0; blockHeightIdx < sizeInfo.numAllHeights(); blockHeightIdx++)
{ {
...@@ -350,7 +367,11 @@ void initROM() ...@@ -350,7 +367,11 @@ void initROM()
scan = new ScanElement[totalValues]; scan = new ScanElement[totalValues];
} }
#if JVET_N0103_CGSIZE_HARMONIZATION
g_scanOrder[SCAN_UNGROUPED][scanType][blockWidthIdx][blockHeightIdx] = scan;
#else
g_scanOrder[ch][SCAN_UNGROUPED][scanType][blockWidthIdx][blockHeightIdx] = scan; g_scanOrder[ch][SCAN_UNGROUPED][scanType][blockWidthIdx][blockHeightIdx] = scan;
#endif
if (scan == nullptr) if (scan == nullptr)
{ {
...@@ -374,7 +395,11 @@ void initROM() ...@@ -374,7 +395,11 @@ void initROM()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
//grouped scan orders //grouped scan orders
#if JVET_N0103_CGSIZE_HARMONIZATION
const uint32_t* log2Sbb = g_log2SbbSize[g_aucLog2[blockWidth]][g_aucLog2[blockHeight]];
#else
const uint32_t* log2Sbb = g_log2SbbSize[ch][ g_aucLog2[blockWidth] ][ g_aucLog2[blockHeight] ]; const uint32_t* log2Sbb = g_log2SbbSize[ch][ g_aucLog2[blockWidth] ][ g_aucLog2[blockHeight] ];
#endif
const uint32_t log2CGWidth = log2Sbb[0]; const uint32_t log2CGWidth = log2Sbb[0];
const uint32_t log2CGHeight = log2Sbb[1]; const uint32_t log2CGHeight = log2Sbb[1];
...@@ -392,7 +417,11 @@ void initROM() ...@@ -392,7 +417,11 @@ void initROM()
ScanElement *scan = new ScanElement[totalValues]; ScanElement *scan = new ScanElement[totalValues];
#if JVET_N0103_CGSIZE_HARMONIZATION
g_scanOrder[SCAN_GROUPED_4x4][scanType][blockWidthIdx][blockHeightIdx] = scan;
#else
g_scanOrder[ch][SCAN_GROUPED_4x4][scanType][blockWidthIdx][blockHeightIdx] = scan; g_scanOrder[ch][SCAN_GROUPED_4x4][scanType][blockWidthIdx][blockHeightIdx] = scan;
#endif
if ( blockWidth > JVET_C0024_ZERO_OUT_TH || blockHeight > JVET_C0024_ZERO_OUT_TH ) if ( blockWidth > JVET_C0024_ZERO_OUT_TH || blockHeight > JVET_C0024_ZERO_OUT_TH )
{ {
...@@ -434,7 +463,9 @@ void initROM() ...@@ -434,7 +463,9 @@ void initROM()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
} }
} }
#if !JVET_N0103_CGSIZE_HARMONIZATION
} }
#endif
for( int idxH = MAX_CU_DEPTH - MIN_CU_LOG2; idxH >= 0; --idxH ) for( int idxH = MAX_CU_DEPTH - MIN_CU_LOG2; idxH >= 0; --idxH )
{ {
...@@ -464,6 +495,22 @@ void destroyROM() ...@@ -464,6 +495,22 @@ void destroyROM()
unsigned numWidths = gp_sizeIdxInfo->numAllWidths(); unsigned numWidths = gp_sizeIdxInfo->numAllWidths();
unsigned numHeights = gp_sizeIdxInfo->numAllHeights(); unsigned numHeights = gp_sizeIdxInfo->numAllHeights();
#if JVET_N0103_CGSIZE_HARMONIZATION
for (uint32_t groupTypeIndex = 0; groupTypeIndex < SCAN_NUMBER_OF_GROUP_TYPES; groupTypeIndex++)
{
for (uint32_t scanOrderIndex = 0; scanOrderIndex < SCAN_NUMBER_OF_TYPES; scanOrderIndex++)
{
for (uint32_t blockWidthIdx = 0; blockWidthIdx <= numWidths; blockWidthIdx++)
{
for (uint32_t blockHeightIdx = 0; blockHeightIdx <= numHeights; blockHeightIdx++)
{
delete[] g_scanOrder[groupTypeIndex][scanOrderIndex][blockWidthIdx][blockHeightIdx];
g_scanOrder[groupTypeIndex][scanOrderIndex][blockWidthIdx][blockHeightIdx] = nullptr;
}
}
}
}
#else
for( uint32_t ch = 0; ch < MAX_NUM_CHANNEL_TYPE; ch++ ) for( uint32_t ch = 0; ch < MAX_NUM_CHANNEL_TYPE; ch++ )
{ {
for( uint32_t groupTypeIndex = 0; groupTypeIndex < SCAN_NUMBER_OF_GROUP_TYPES; groupTypeIndex++ ) for( uint32_t groupTypeIndex = 0; groupTypeIndex < SCAN_NUMBER_OF_GROUP_TYPES; groupTypeIndex++ )
...@@ -481,6 +528,7 @@ void destroyROM() ...@@ -481,6 +528,7 @@ void destroyROM()
} }
} }
} }
#endif
delete gp_sizeIdxInfo; delete gp_sizeIdxInfo;
gp_sizeIdxInfo = nullptr; gp_sizeIdxInfo = nullptr;
...@@ -574,7 +622,11 @@ UnitScale g_miScaling( MIN_CU_LOG2, MIN_CU_LOG2 ); ...@@ -574,7 +622,11 @@ UnitScale g_miScaling( MIN_CU_LOG2, MIN_CU_LOG2 );
// ==================================================================================================================== // ====================================================================================================================
// scanning order table // scanning order table
#if JVET_N0103_CGSIZE_HARMONIZATION
ScanElement *g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1];
#else
ScanElement *g_scanOrder[2][SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1]; ScanElement *g_scanOrder[2][SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1];
#endif
const uint32_t g_uiMinInGroup[LAST_SIGNIFICANT_GROUPS] = { 0,1,2,3,4,6,8,12,16,24,32,48,64,96 }; const uint32_t g_uiMinInGroup[LAST_SIGNIFICANT_GROUPS] = { 0,1,2,3,4,6,8,12,16,24,32,48,64,96 };
const uint32_t g_uiGroupIdx[MAX_TB_SIZEY] = { 0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11 }; const uint32_t g_uiGroupIdx[MAX_TB_SIZEY] = { 0,1,2,3,4,4,5,5,6,6,6,6,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11 };
......
...@@ -67,9 +67,15 @@ struct ScanElement ...@@ -67,9 +67,15 @@ struct ScanElement
uint16_t y; uint16_t y;
}; };
#if JVET_N0103_CGSIZE_HARMONIZATION
extern uint32_t g_log2SbbSize[MAX_CU_DEPTH + 1][MAX_CU_DEPTH + 1][2];
extern ScanElement
*g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1];
#else
extern uint32_t g_log2SbbSize [2][MAX_CU_DEPTH+1][MAX_CU_DEPTH+1][2]; extern uint32_t g_log2SbbSize [2][MAX_CU_DEPTH+1][MAX_CU_DEPTH+1][2];
extern ScanElement extern ScanElement
*g_scanOrder[2][SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1]; *g_scanOrder[2][SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1];
#endif
extern const int g_quantScales [SCALING_LIST_REM_NUM]; // Q(QP%6) extern const int g_quantScales [SCALING_LIST_REM_NUM]; // Q(QP%6)
extern const int g_invQuantScales[SCALING_LIST_REM_NUM]; // IQ(QP%6) extern const int g_invQuantScales[SCALING_LIST_REM_NUM]; // IQ(QP%6)
......
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
#include <assert.h> #include <assert.h>
#include <cassert> #include <cassert>
#define JVET_N0103_CGSIZE_HARMONIZATION 1 // Chroma CG sizes aligned to luma CG sizes
#define JVET_N0146_DMVR_BDOF_CONDITION 1 // JVET-N146/N0162/N0442/N0153/N0262/N0440/N0086 applicable condition of DMVR and BDOF #define JVET_N0146_DMVR_BDOF_CONDITION 1 // JVET-N146/N0162/N0442/N0153/N0262/N0440/N0086 applicable condition of DMVR and BDOF
#define JVET_N0470_SMVD_FIX 1 // remove mvd_l1_zero_flag condition, align to spec text. #define JVET_N0470_SMVD_FIX 1 // remove mvd_l1_zero_flag condition, align to spec text.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment