Commit 10c3ee7c authored by LI JINGYA's avatar LI JINGYA
parents 3d0f0acb 87e56b3d
......@@ -53,8 +53,13 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
, m_log2CGWidth ((m_width & 3) || (m_height & 3) ? 1 : 2)
, m_log2CGHeight ((m_width & 3) || (m_height & 3) ? 1 : 2)
, m_log2CGSize (m_log2CGWidth + m_log2CGHeight)
, m_widthInGroups (m_width >> m_log2CGWidth)
, m_heightInGroups (m_height >> m_log2CGHeight)
#if JVET_M0257
, 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)
#else
, m_widthInGroups(m_width >> m_log2CGWidth)
, m_heightInGroups(m_height >> m_log2CGHeight)
#endif
, m_log2BlockWidth (g_aucLog2[m_width])
, m_log2BlockHeight (g_aucLog2[m_height])
, m_log2BlockSize ((m_log2BlockWidth + m_log2BlockHeight)>>1)
......@@ -75,8 +80,13 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
, m_scanCG (g_scanOrder[SCAN_UNGROUPED ][m_scanType][gp_sizeIdxInfo->idxFrom(m_widthInGroups)][gp_sizeIdxInfo->idxFrom(m_heightInGroups)])
, m_CtxSetLastX (Ctx::LastX[m_chType])
, m_CtxSetLastY (Ctx::LastY[m_chType])
, m_maxLastPosX (g_uiGroupIdx[m_width - 1])
, m_maxLastPosY (g_uiGroupIdx[m_height - 1])
#if JVET_M0257
, m_maxLastPosX(g_uiGroupIdx[std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, m_width) - 1])
, m_maxLastPosY(g_uiGroupIdx[std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, m_height) - 1])
#else
, m_maxLastPosX(g_uiGroupIdx[m_width - 1])
, m_maxLastPosY(g_uiGroupIdx[m_height - 1])
#endif
, m_lastOffsetX (0)
, m_lastOffsetY (0)
, m_lastShiftX (0)
......
......@@ -334,8 +334,13 @@ namespace DQIntern
m_log2SbbSize = m_log2SbbWidth + m_log2SbbHeight;
m_sbbSize = ( 1 << m_log2SbbSize );
m_sbbMask = m_sbbSize - 1;
#if JVET_M0257
m_widthInSbb = std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, m_width) >> m_log2SbbWidth;
m_heightInSbb = std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, m_height) >> m_log2SbbHeight;
#else
m_widthInSbb = m_width >> m_log2SbbWidth;
m_heightInSbb = m_height >> m_log2SbbHeight;
#endif
m_numSbb = m_widthInSbb * m_heightInSbb;
#if HEVC_USE_MDCS
#error "MDCS is not supported" // use different function...
......@@ -489,7 +494,11 @@ namespace DQIntern
const unsigned lastShift = ( compID == COMPONENT_Y ? (log2Size+1)>>2 : Clip3<unsigned>(0,2,size>>3) );
const unsigned lastOffset = ( compID == COMPONENT_Y ? ( prefixCtx[log2Size] ) : 0 );
uint32_t sumFBits = 0;
#if JVET_M0257
unsigned maxCtxId = g_uiGroupIdx[std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, size) - 1];
#else
unsigned maxCtxId = g_uiGroupIdx[ size - 1 ];
#endif
for( unsigned ctxId = 0; ctxId < maxCtxId; ctxId++ )
{
const BinFracBits bits = fracBitsAccess.getFracBitsArray( ctxSetLast( lastOffset + ( ctxId >> lastShift ) ) );
......@@ -497,7 +506,11 @@ namespace DQIntern
sumFBits += bits.intBits[1];
}
ctxBits [ maxCtxId ] = sumFBits + ( maxCtxId>3 ? ((maxCtxId-2)>>1)<<SCALE_BITS : 0 ) + bitOffset;
#if JVET_M0257
for (unsigned pos = 0; pos < std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, size); pos++)
#else
for( unsigned pos = 0; pos < size; pos++ )
#endif
{
lastBits[ pos ] = ctxBits[ g_uiGroupIdx[ pos ] ];
}
......
......@@ -715,8 +715,11 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID,
double *pdCostCoeffGroupSig = m_pdCostCoeffGroupSig;
memset( pdCostCoeffGroupSig, 0, ( uiMaxNumCoeff >> cctx.log2CGSize() ) * sizeof( double ) );
#if JVET_M0257
const int iCGNum = std::min<int>(JVET_C0024_ZERO_OUT_TH, uiWidth) * std::min<int>(JVET_C0024_ZERO_OUT_TH, uiHeight) >> cctx.log2CGSize();
#else
const int iCGNum = uiWidth * uiHeight >> cctx.log2CGSize();
#endif
int iScanPos;
coeffGroupRDStats rdStats;
......@@ -1010,9 +1013,14 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID,
#if HEVC_USE_MDCS
int dim1 = ( cctx.scanType() == SCAN_VER ? uiHeight : uiWidth );
int dim2 = ( cctx.scanType() == SCAN_VER ? uiWidth : uiHeight );
#else
#if JVET_M0257
int dim1 = std::min<int>(JVET_C0024_ZERO_OUT_TH, uiWidth);
int dim2 = std::min<int>(JVET_C0024_ZERO_OUT_TH, uiHeight);
#else
int dim1 = uiWidth;
int dim2 = uiHeight;
#endif
#endif
int bitsX = 0;
int bitsY = 0;
......@@ -1123,8 +1131,11 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID,
int lastCG = -1;
int absSum = 0 ;
int n ;
#if JVET_M0257
for (int subSet = iCGNum - 1; subSet >= 0; subSet--)
#else
for( int subSet = (uiWidth*uiHeight-1) >> cctx.log2CGSize(); subSet >= 0; subSet-- )
#endif
{
int subPos = subSet << cctx.log2CGSize();
int firstNZPosInCG = iCGSizeM1 + 1, lastNZPosInCG = -1;
......
......@@ -429,8 +429,13 @@ void initROM()
const uint32_t groupWidth = 1 << log2CGWidth;
const uint32_t groupHeight = 1 << log2CGHeight;
#if JVET_M0257
const uint32_t widthInGroups = std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, blockWidth) >> log2CGWidth;
const uint32_t heightInGroups = std::min<unsigned>(JVET_C0024_ZERO_OUT_TH, blockHeight) >> log2CGHeight;
#else
const uint32_t widthInGroups = blockWidth >> log2CGWidth;
const uint32_t heightInGroups = blockHeight >> log2CGHeight;
#endif
const uint32_t groupSize = groupWidth * groupHeight;
const uint32_t totalGroups = widthInGroups * heightInGroups;
......@@ -442,7 +447,17 @@ void initROM()
g_scanOrder [SCAN_GROUPED_4x4][scanType][blockWidthIdx][blockHeightIdx] = new uint32_t[totalValues];
g_scanOrderPosXY[SCAN_GROUPED_4x4][scanType][blockWidthIdx][blockHeightIdx][0] = new uint32_t[totalValues];
g_scanOrderPosXY[SCAN_GROUPED_4x4][scanType][blockWidthIdx][blockHeightIdx][1] = new uint32_t[totalValues];
#if JVET_M0257
if ( blockWidth > JVET_C0024_ZERO_OUT_TH || blockHeight > JVET_C0024_ZERO_OUT_TH )
{
for (uint32_t i = 0; i < totalValues; i++)
{
g_scanOrder[SCAN_GROUPED_4x4][scanType][blockWidthIdx][blockHeightIdx][i] = totalValues - 1;
g_scanOrderPosXY[SCAN_GROUPED_4x4][scanType][blockWidthIdx][blockHeightIdx][0][i] = blockWidth - 1;
g_scanOrderPosXY[SCAN_GROUPED_4x4][scanType][blockWidthIdx][blockHeightIdx][1][i] = blockHeight - 1;
}
}
#endif
ScanGenerator fullBlockScan(widthInGroups, heightInGroups, groupWidth, scanType);
......
......@@ -50,6 +50,7 @@
#include <assert.h>
#include <cassert>
#define JVET_M0257 1 // Scan only non zero-out regions of large TUs
#define JVET_M0193_PAIR_AVG_REDUCTION 1 //Use only one pairwise average candidate
#define JVET_M0192_AFF_CHROMA_SIMPL 1 // Affine chroma MV derivation simplification and rounding unification
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment