...
 
Commits (39)
......@@ -14,3 +14,5 @@ CrQpOffset : 0
SameCQPTablesForAllChroma : 1
QpInValCb : 9 23 33 42
QpOutValCb : 9 24 33 37
VerCollocatedChroma : 1
#======== File I/O ===============
InputFile : DayStreet_3840x2160_60p_10bit_420_hlg.yuv
InputFile : DayStreet2_3840x2160_60p_10bit_420_hlg_type2.yuv
InputBitDepth : 10 # Input bitdepth
InputChromaFormat : 420 # Ratio of luminance to chrominance samples
FrameRate : 60 # Frame Rate per second
......
#======== File I/O ===============
InputFile : FlyingBirds2_3840x2160p_60_10b_HLG_420.yuv
InputFile : FlyingBirds3_3840x2160p_60_10b_HLG_420_type2.yuv
InputBitDepth : 10 # Input bitdepth
InputChromaFormat : 420 # Ratio of luminance to chrominance samples
FrameRate : 60 # Frame Rate per second
......
#======== File I/O ===============
InputFile : PeopleInShoppingCenter_3840x2160_60p_10bit_420_hlg.yuv
InputFile : PeopleInShoppingCenter2_3840x2160_60p_10bit_420_hlg_type2.yuv
InputBitDepth : 10 # Input bitdepth
InputChromaFormat : 420 # Ratio of luminance to chrominance samples
FrameRate : 60 # Frame Rate per second
......
#======== File I/O ===============
InputFile : SunsetBeach2_3840x2160p_60_10b_HLG_420.yuv
InputFile : SunsetBeach3_3840x2160p_60_10b_HLG_420_type2.yuv
InputBitDepth : 10 # Input bitdepth
InputChromaFormat : 420 # Ratio of luminance to chrominance samples
FrameRate : 60 # Frame Rate per second
......
......@@ -1060,6 +1060,18 @@ Specifies the value of one_slice_per_pic_constraint_flag
Specifies the value of one_subpic_per_pic_constraint_flag
\\
\Option{ExplicitScaleListConstraintFlag} &
%\ShortOption{\None} &
\Default{false} &
Specifies the value of gci_no_explicit_scaling_list_constraint_flag
\\
\Option{VirtualBoundaryConstraintFlag} &
%\ShortOption{\None} &
\Default{false} &
Specifies the value of gci_no_virtual_boundaries_constraint_flag
\\
\Option{FrameOnly} &
%\ShortOption{\None} &
\Default{false} &
......
......@@ -223,6 +223,8 @@ void BitstreamExtractorApp::xRewritePPS (PPS &targetPPS, const PPS &sourcePPS, S
std::vector<uint32_t> tileRowHeight;
std::vector<uint32_t> tileColBd;
std::vector<uint32_t> tileRowBd;
int subpicTopLeftTileX = -1;
int subpicTopLeftTileY = -1;
for (int i=0; i<= sourcePPS.getNumTileColumns(); i++)
{
......@@ -230,6 +232,10 @@ void BitstreamExtractorApp::xRewritePPS (PPS &targetPPS, const PPS &sourcePPS, S
if ((currentColBd >= subPic.getSubPicCtuTopLeftX()) && (currentColBd <= (subPic.getSubPicCtuTopLeftX() + subPic.getSubPicWidthInCTUs())))
{
tileColBd.push_back(currentColBd - subPic.getSubPicCtuTopLeftX());
if (subpicTopLeftTileX == -1)
{
subpicTopLeftTileX = i;
}
}
}
numTileCols=(int)tileColBd.size() - 1;
......@@ -249,6 +255,10 @@ void BitstreamExtractorApp::xRewritePPS (PPS &targetPPS, const PPS &sourcePPS, S
if ((currentRowBd >= subPic.getSubPicCtuTopLeftY()) && (currentRowBd <= (subPic.getSubPicCtuTopLeftY() + subPic.getSubPicHeightInCTUs())))
{
tileRowBd.push_back(currentRowBd - subPic.getSubPicCtuTopLeftY());
if(subpicTopLeftTileY == -1)
{
subpicTopLeftTileY = i;
}
}
}
numTileRows=(int)tileRowBd.size() - 1;
......@@ -295,6 +305,11 @@ void BitstreamExtractorApp::xRewritePPS (PPS &targetPPS, const PPS &sourcePPS, S
{
int targetNumSlices = subPic.getNumSlicesInSubPic();
targetPPS.setNumSlicesInPic(targetNumSlices);
// To avoid the bitstream writer writing tile_idx_delta in the bitstream
if ( (targetPPS.getNumSlicesInPic() - 1) <= 1)
{
targetPPS.setTileIdxDeltaPresentFlag(0);
}
for (int i=0, cnt=0; i<sourcePPS.getNumSlicesInPic(); i++)
{
......@@ -310,23 +325,14 @@ void BitstreamExtractorApp::xRewritePPS (PPS &targetPPS, const PPS &sourcePPS, S
cnt++;
}
}
// renumber tiles to close gaps
// Find out new slices tile index after removal of some tiles
for (int i=0; i<targetPPS.getNumSlicesInPic(); i++)
{
int minVal = MAX_INT;
int minPos = -1;
for (int j=0; j<targetPPS.getNumSlicesInPic(); j++)
{
if ((targetPPS.getSliceTileIdx(j) < minVal) && (targetPPS.getSliceTileIdx(j) >= i))
{
minVal = targetPPS.getSliceTileIdx(j);
minPos = j;
}
}
if ( minPos != -1)
{
targetPPS.setSliceTileIdx(minPos, i);
}
int tileInPicX = targetPPS.getSliceTileIdx(i) % sourcePPS.getNumTileColumns();
int tileInPicY = targetPPS.getSliceTileIdx(i) / sourcePPS.getNumTileColumns();
int tileInSubpicX = tileInPicX - subpicTopLeftTileX;
int tileInSubpicY = tileInPicY - subpicTopLeftTileY;
targetPPS.setSliceTileIdx(i, tileInSubpicY * numTileCols + tileInSubpicX);
}
}
......
......@@ -304,7 +304,12 @@ void EncApp::xInitLibCfg()
m_cEncLib.setNoPaletteConstraintFlag ( m_PLTMode == 1 ? false : true );
m_cEncLib.setNoActConstraintFlag ( !m_useColorTrans );
m_cEncLib.setNoLmcsConstraintFlag ( !m_lmcsEnabled );
#if JVET_S0050_GCI
m_cEncLib.setNoExplicitScaleListConstraintFlag ( m_noExplicitScaleListConstraintFlag );
CHECK( m_noExplicitScaleListConstraintFlag && m_useScalingListId != SCALING_LIST_OFF, "Explicit scaling list shall be deactivated when m_noExplicitScaleListConstraintFlag is equal to 1");
m_cEncLib.setNoVirtualBoundaryConstraintFlag ( m_noVirtualBoundaryConstraintFlag );
CHECK( m_noVirtualBoundaryConstraintFlag && m_virtualBoundariesEnabledFlag, "Virtuall boundaries shall be deactivated when m_noVirtualBoundaryConstraintFlag is equal to 1");
#endif
//====== Coding Structure ========
m_cEncLib.setIntraPeriod ( m_iIntraPeriod );
......
......@@ -558,7 +558,11 @@ static uint32_t getMaxTileRowsByLevel( Level::Name level )
case Level::LEVEL6_1:
case Level::LEVEL6_2:
default:
#if JVET_S0156_LEVEL_DEFINITION
return 22;
#else
return 21;
#endif
}
}
......@@ -833,6 +837,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("OneSlicePerPicConstraintFlag", m_oneSlicePerPicConstraintFlag, false, "Indicate that each picture shall contain only one slice")
("OneSubpicPerPicConstraintFlag", m_oneSubpicPerPicConstraintFlag, false, "Indicate that each picture shall contain only one subpicture")
("FrameOnly", m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames")
#if JVET_S0050_GCI
("ExplicitScaleListConstraintFlag", m_noExplicitScaleListConstraintFlag, false, "Indicate that explicit scaling list is deactivated")
("VirtualBoundaryConstraintFlag", m_noVirtualBoundaryConstraintFlag, false, "Indicate that virtual boundary is deactivated")
#endif
("CTUSize", m_uiCTUSize, 128u, "CTUSize (specifies the CTU size if QTBT is on) [default: 128]")
("Log2MinCuSize", m_log2MinCuSize, 2u, "Log2 min CU size")
("SubPicInfoPresentFlag", m_subPicInfoPresentFlag, false, "equal to 1 specifies that subpicture parameters are present in in the SPS RBSP syntax")
......
......@@ -150,6 +150,10 @@ protected:
bool m_noPaletteConstraintFlag;
bool m_noActConstraintFlag;
bool m_noLmcsConstraintFlag;
#if JVET_S0050_GCI
bool m_noExplicitScaleListConstraintFlag;
bool m_noVirtualBoundaryConstraintFlag;
#endif
bool m_bNoQtbttDualTreeIntraConstraintFlag;
bool m_noPartitionConstraintsOverrideConstraintFlag;
bool m_bNoSaoConstraintFlag;
......
......@@ -65,17 +65,30 @@ void ParcatHLSyntaxReader::parsePictureHeaderUpToPoc ( ParameterSetManager *para
uint32_t uiCode;
PPS* pps = NULL;
SPS* sps = NULL;
READ_FLAG(uiCode, "gdr_or_irap_pic_flag");
#if JVET_S0076_ASPECT1
uint32_t uiTmp;
READ_FLAG(uiTmp, "gdr_or_irap_pic_flag");
READ_FLAG(uiCode, "ph_non_ref_pic_flag");
if( uiTmp )
{
READ_FLAG( uiCode, "gdr_pic_flag" );
}
#else
READ_FLAG( uiCode, "gdr_or_irap_pic_flag" );
if (uiCode)
{
READ_FLAG(uiCode, "gdr_pic_flag");
}
#endif
READ_FLAG(uiCode, "ph_inter_slice_allowed_flag");
if (uiCode)
{
READ_FLAG(uiCode, "ph_intra_slice_allowed_flag");
}
#if !JVET_S0076_ASPECT1
READ_FLAG(uiCode, "non_reference_picture_flag");
#endif
// parameter sets
READ_UVLC(uiCode, "ph_pic_parameter_set_id");
pps = parameterSetManager->getPPS(uiCode);
......
......@@ -439,7 +439,11 @@ void AreaBuf<T>::removeWeightHighFreq(const AreaBuf<T>& other, const bool bClip,
else
{
#endif
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
Intermediate_Int normalizer = ((1 << 16) + (bcwWeight > 0 ? (bcwWeight >> 1) : -(bcwWeight >> 1))) / bcwWeight;
#else
int normalizer = ((1 << 16) + (bcwWeight > 0 ? (bcwWeight >> 1) : -(bcwWeight >> 1))) / bcwWeight;
#endif
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT
Intermediate_Int weight0 = normalizer << log2WeightBase;
Intermediate_Int weight1 = bcwWeightOther * normalizer;
......@@ -451,8 +455,13 @@ void AreaBuf<T>::removeWeightHighFreq(const AreaBuf<T>& other, const bool bClip,
src += srcStride; \
dst += dstStride; \
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
#define REM_HF_OP_CLIP( ADDR ) dst[ADDR] = ClipPel<T>( T((dst[ADDR]*weight0 - src[ADDR]*weight1 + (1<<15))>>16), clpRng )
#define REM_HF_OP( ADDR ) dst[ADDR] = T((dst[ADDR]*weight0 - src[ADDR]*weight1 + (1<<15))>>16)
#else
#define REM_HF_OP_CLIP( ADDR ) dst[ADDR] = ClipPel<T>( (dst[ADDR]*weight0 - src[ADDR]*weight1 + (1<<15))>>16, clpRng )
#define REM_HF_OP( ADDR ) dst[ADDR] = (dst[ADDR]*weight0 - src[ADDR]*weight1 + (1<<15))>>16
#endif
if(bClip)
{
......
......@@ -114,8 +114,13 @@ public:
const TCoeff* pData = coeff + posX + posY * m_width;
const int diag = posX + posY;
int numPos = 0;
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff sumAbs = 0;
#define UPDATE(x) {TCoeff a=abs(x);sumAbs+=std::min(4+(a&1),a);numPos+=int(!!a);}
#else
int sumAbs = 0;
#define UPDATE(x) {int a=abs(x);sumAbs+=std::min(4+(a&1),a);numPos+=!!a;}
#endif
if( posX < m_width-1 )
{
UPDATE( pData[1] );
......@@ -139,7 +144,11 @@ public:
#undef UPDATE
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
int ctxOfs = int(std::min<TCoeff>((sumAbs+1)>>1, 3)) + ( diag < 2 ? 4 : 0 );
#else
int ctxOfs = std::min((sumAbs+1)>>1, 3) + ( diag < 2 ? 4 : 0 );
#endif
if( m_chType == CHANNEL_TYPE_LUMA )
{
......@@ -156,7 +165,11 @@ public:
int offset = 0;
if( m_tmplCpDiag != -1 )
{
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
offset = int(std::min<TCoeff>( m_tmplCpSum1, 4 )) + 1;
#else
offset = std::min( m_tmplCpSum1, 4 ) + 1;
#endif
offset += ( !m_tmplCpDiag ? ( m_chType == CHANNEL_TYPE_LUMA ? 15 : 5 ) : m_chType == CHANNEL_TYPE_LUMA ? m_tmplCpDiag < 3 ? 10 : ( m_tmplCpDiag < 10 ? 5 : 0 ) : 0 );
}
return uint8_t(offset);
......@@ -170,7 +183,11 @@ public:
const uint32_t posY = m_scan[scanPos].y;
const uint32_t posX = m_scan[scanPos].x;
const TCoeff* pData = coeff + posX + posY * m_width;
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff sum = 0;
#else
int sum = 0;
#endif
if (posX < m_width - 1)
{
sum += abs(pData[1]);
......@@ -191,7 +208,11 @@ public:
sum += abs(pData[m_width << 1]);
}
}
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
return unsigned(std::max<TCoeff>(std::min<TCoeff>(sum - 5 * baseLevel, 31), 0));
#else
return std::max(std::min(sum - 5 * baseLevel, 31), 0);
#endif
}
unsigned sigCtxIdAbsTS( int scanPos, const TCoeff* coeff )
......@@ -200,7 +221,11 @@ public:
const uint32_t posX = m_scan[scanPos].x;
const TCoeff* posC = coeff + posX + posY * m_width;
int numPos = 0;
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
#define UPDATE(x) {TCoeff a=abs(x);numPos+=int(!!a);}
#else
#define UPDATE(x) {int a=abs(x);numPos+=!!a;}
#endif
if( posX > 0 )
{
UPDATE( posC[-1] );
......@@ -224,7 +249,11 @@ public:
const TCoeff* posC = coeff + posX + posY * m_width;
int numPos = 0;
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
#define UPDATE(x) {TCoeff a=abs(x);numPos+=int(!!a);}
#else
#define UPDATE(x) {int a=abs(x);numPos+=!!a;}
#endif
if (bdpcm)
{
......@@ -308,41 +337,69 @@ public:
if (posX > 0)
{
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
rightPixel = int(data[-1]);
#else
rightPixel = data[-1];
#endif
}
if (posY > 0)
{
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
belowPixel = int(data[-(int)m_width]);
#else
belowPixel = data[-(int)m_width];
#endif
}
}
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
int deriveModCoeff(int rightPixel, int belowPixel, TCoeff absCoeff, int bdpcm = 0)
#else
int deriveModCoeff(int rightPixel, int belowPixel, int absCoeff, int bdpcm = 0)
#endif
{
if (absCoeff == 0)
return 0;
int pred1, absBelow = abs(belowPixel), absRight = abs(rightPixel);
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
int absCoeffMod = int(absCoeff);
#else
int absCoeffMod = absCoeff;
#endif
if (bdpcm == 0)
{
pred1 = std::max(absBelow, absRight);
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
if (absCoeffMod == pred1)
#else
if (absCoeff == pred1)
#endif
{
absCoeffMod = 1;
}
else
{
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
absCoeffMod = absCoeffMod < pred1 ? absCoeffMod + 1 : absCoeffMod;
#else
absCoeffMod = absCoeff < pred1 ? absCoeff + 1 : absCoeff;
#endif
}
}
return(absCoeffMod);
}
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff decDeriveModCoeff(int rightPixel, int belowPixel, TCoeff absCoeff)
#else
int decDeriveModCoeff(int rightPixel, int belowPixel, int absCoeff)
#endif
{
if (absCoeff == 0)
......@@ -351,7 +408,11 @@ public:
int pred1, absBelow = abs(belowPixel), absRight = abs(rightPixel);
pred1 = std::max(absBelow, absRight);
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff absCoeffMod;
#else
int absCoeffMod;
#endif
if (absCoeff == 1 && pred1 > 0)
{
......@@ -413,7 +474,11 @@ private:
int m_minSubPos;
int m_maxSubPos;
unsigned m_sigGroupCtxId;
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff m_tmplCpSum1;
#else
int m_tmplCpSum1;
#endif
int m_tmplCpDiag;
CtxSet m_sigFlagCtxSet[3];
CtxSet m_parFlagCtxSet;
......
......@@ -629,7 +629,11 @@ namespace DQIntern
Quantizer() {}
void dequantBlock ( const TransformUnit& tu, const ComponentID compID, const QpParam& cQP, CoeffBuf& recCoeff, bool enableScalingLists, int* piDequantCoef ) const;
void initQuantBlock ( const TransformUnit& tu, const ComponentID compID, const QpParam& cQP, const double lambda, int gValue );
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
inline void preQuantCoeff( const TCoeff absCoeff, PQData *pqData, TCoeff quanCoeff ) const;
#else
inline void preQuantCoeff( const TCoeff absCoeff, PQData *pqData, int quanCoeff ) const;
#endif
inline TCoeff getLastThreshold() const { return m_thresLast; }
inline TCoeff getSSbbThreshold() const { return m_thresSSbb; }
......@@ -682,7 +686,11 @@ namespace DQIntern
// quant parameters
m_QShift = QUANT_SHIFT - 1 + qpPer + transformShift;
m_QAdd = -( ( 3 << m_QShift ) >> 1 );
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
int invShift = IQUANT_SHIFT + 1 - qpPer - transformShift;
#else
Intermediate_Int invShift = IQUANT_SHIFT + 1 - qpPer - transformShift;
#endif
m_QScale = g_quantScales[needsSqrt2ScaleAdjustment?1:0][ qpRem ];
const unsigned qIdxBD = std::min<unsigned>( maxLog2TrDynamicRange + 1, 8*sizeof(Intermediate_Int) + invShift - IQUANT_SHIFT - 1 );
m_maxQIdx = ( 1 << (qIdxBD-1) ) - 4;
......@@ -769,7 +777,11 @@ namespace DQIntern
}
}
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
inline void Quantizer::preQuantCoeff(const TCoeff absCoeff, PQData *pqData, TCoeff quanCoeff) const
#else
inline void Quantizer::preQuantCoeff(const TCoeff absCoeff, PQData *pqData, int quanCoeff) const
#endif
{
int64_t scaledOrg = int64_t( absCoeff ) * quanCoeff;
TCoeff qIdx = std::max<TCoeff>( 1, std::min<TCoeff>( m_maxQIdx, TCoeff( ( scaledOrg + m_QAdd ) >> m_QShift ) ) );
......@@ -886,14 +898,22 @@ namespace DQIntern
rdCostA += m_coeffFracBits.bits[ pqDataA.absLevel ];
else
{
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
const TCoeff value = ( pqDataA.absLevel - 4 ) >> 1;
#else
const unsigned value = ( pqDataA.absLevel - 4 ) >> 1;
#endif
rdCostA += m_coeffFracBits.bits[ pqDataA.absLevel - ( value << 1 ) ] + goRiceTab[ value < RICEMAX ? value : RICEMAX - 1 ];
}
if( pqDataB.absLevel < 4 )
rdCostB += m_coeffFracBits.bits[ pqDataB.absLevel ];
else
{
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
const TCoeff value = ( pqDataB.absLevel - 4 ) >> 1;
#else
const unsigned value = ( pqDataB.absLevel - 4 ) >> 1;
#endif
rdCostB += m_coeffFracBits.bits[ pqDataB.absLevel - ( value << 1 ) ] + goRiceTab[ value < RICEMAX ? value : RICEMAX - 1 ];
}
if( spt == SCAN_ISCSBB )
......@@ -954,7 +974,11 @@ namespace DQIntern
}
else
{
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
const TCoeff value = (pqData.absLevel - 4) >> 1;
#else
const unsigned value = (pqData.absLevel - 4) >> 1;
#endif
rdCost += m_coeffFracBits.bits[pqData.absLevel - (value << 1)] + g_goRiceBits[m_goRicePar][value < RICEMAX ? value : RICEMAX-1];
}
if( rdCost < decision.rdCost )
......@@ -1030,7 +1054,11 @@ namespace DQIntern
m_goRicePar = prvState->m_goRicePar;
if( m_remRegBins >= 4 )
{
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
m_remRegBins -= (decision.absLevel < 2 ? (unsigned)decision.absLevel : 3);
#else
m_remRegBins -= (decision.absLevel < 2 ? decision.absLevel : 3);
#endif
}
::memcpy( m_absLevelsAndCtxInit, prvState->m_absLevelsAndCtxInit, 48*sizeof(uint8_t) );
}
......@@ -1039,7 +1067,11 @@ namespace DQIntern
m_numSigSbb = 1;
m_refSbbCtxId = -1;
int ctxBinSampleRatio = (scanInfo.chType == CHANNEL_TYPE_LUMA) ? MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_LUMA : MAX_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT_CHROMA;
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
m_remRegBins = (effWidth * effHeight *ctxBinSampleRatio) / 16 - (decision.absLevel < 2 ? (unsigned)decision.absLevel : 3);
#else
m_remRegBins = (effWidth * effHeight *ctxBinSampleRatio) / 16 - (decision.absLevel < 2 ? decision.absLevel : 3);
#endif
::memset( m_absLevelsAndCtxInit, 0, 48*sizeof(uint8_t) );
}
......@@ -1299,8 +1331,13 @@ namespace DQIntern
void dequant ( const TransformUnit& tu, CoeffBuf& recCoeff, const ComponentID compID, const QpParam& cQP, bool enableScalingLists, int* quantCoeff );
private:
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
void xDecideAndUpdate ( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut, TCoeff quantCoeff);
void xDecide ( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions, bool zeroOut, TCoeff quantCoeff );
#else
void xDecideAndUpdate ( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut, int quantCoeff);
void xDecide ( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions, bool zeroOut, int quantCoeff );
#endif
private:
CommonCtx m_commonCtx;
......@@ -1338,7 +1375,11 @@ namespace DQIntern
#undef DINIT
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
void DepQuant::xDecide( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions, bool zeroOut, TCoeff quanCoeff)
#else
void DepQuant::xDecide( const ScanPosType spt, const TCoeff absCoeff, const int lastOffset, Decision* decisions, bool zeroOut, int quanCoeff)
#endif
{
::memcpy( decisions, startDec, 8*sizeof(Decision) );
......@@ -1372,7 +1413,11 @@ namespace DQIntern
m_startState.checkRdCostStart( lastOffset, pqData[2], decisions[2] );
}
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
void DepQuant::xDecideAndUpdate( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut, TCoeff quantCoeff )
#else
void DepQuant::xDecideAndUpdate( const TCoeff absCoeff, const ScanInfo& scanInfo, bool zeroOut, int quantCoeff )
#endif
{
Decision* decisions = m_trellis[ scanInfo.scanIdx ];
......
......@@ -303,11 +303,13 @@ void IntraPrediction::xPredIntraPlanar( const CPelBuf &pSrc, PelBuf &pDst )
const uint32_t offset = 1 << (log2W + log2H);
// Get left and above reference column and row
CHECK(width > MAX_CU_SIZE, "width greater than limit");
for( int k = 0; k < width + 1; k++ )
{
topRow[k] = pSrc.at( k + 1, 0 );
}
CHECK(height > MAX_CU_SIZE, "height greater than limit");
for( int k = 0; k < height + 1; k++ )
{
leftColumn[k] = pSrc.at(k + 1, 1);
......
......@@ -56,6 +56,24 @@ static const uint64_t MAX_CNFUINT64 = std::numeric_limits<uint64_t>::max();
static const LevelTierFeatures mainLevelTierInfo[] =
{
#if JVET_S0156_LEVEL_DEFINITION
// level, maxlumaps, maxcpb[tier],, maxSlicesPerAu,maxTilesPerAu,cols, maxLumaSr, maxBr[tier],, minCr[tier],,
{ Level::LEVEL1 , 36864, { 350, 0 }, 16, 1, 1, 552960ULL, { 128, 0 }, { 2, 2} },
{ Level::LEVEL2 , 122880, { 1500, 0 }, 16, 1, 1, 3686400ULL, { 1500, 0 }, { 2, 2} },
{ Level::LEVEL2_1, 245760, { 3000, 0 }, 20, 1, 1, 7372800ULL, { 3000, 0 }, { 2, 2} },
{ Level::LEVEL3 , 552960, { 6000, 0 }, 30, 4, 2, 16588800ULL, { 6000, 0 }, { 2, 2} },
{ Level::LEVEL3_1, 983040, { 10000, 0 }, 40, 9, 3, 33177600ULL, { 10000, 0 }, { 2, 2} },
{ Level::LEVEL4 , 2228224, { 12000, 30000 }, 75, 2, 5, 66846720ULL, { 12000, 30000 }, { 4, 4} },
{ Level::LEVEL4_1, 2228224, { 20000, 50000 }, 75, 2, 5, 133693440ULL, { 20000, 50000 }, { 4, 4} },
{ Level::LEVEL5 , 8912896, { 25000, 100000 }, 200, 110, 10, 267386880ULL, { 25000, 100000 }, { 6, 4} },
{ Level::LEVEL5_1, 8912896, { 40000, 160000 }, 200, 110, 10, 534773760ULL, { 40000, 160000 }, { 8, 4} },
{ Level::LEVEL5_2, 8912896, { 60000, 240000 }, 200, 110, 10, 1069547520ULL, { 60000, 240000 }, { 8, 4} },
{ Level::LEVEL6 , 35651584, { 80000, 240000 }, 600, 440, 20, 1069547520ULL, { 60000, 240000 }, { 8, 4} },
{ Level::LEVEL6_1, 35651584, { 120000, 480000 }, 600, 440, 20, 2139095040ULL, { 120000, 480000 }, { 8, 4} },
{ Level::LEVEL6_2, 35651584, { 180000, 800000 }, 600, 440, 20, 4278190080ULL, { 240000, 800000 }, { 8, 4} },
{ Level::LEVEL15_5, MAX_UINT,{ MAX_UINT, MAX_UINT }, MAX_UINT, MAX_UINT, MAX_UINT, MAX_CNFUINT64, {MAX_UINT, MAX_UINT }, { 0, 0} },
{ Level::NONE }
#else
// level , maxlumaps, maxcpb[tier],, maxSlice, tile rows, cols, maxLumaSr, maxBr[tier],, , minCr[tier],,
{ Level::LEVEL1 , 36864, { 350, 0 }, 16, 1, 1, 552960ULL, { 128, 0 }, { 2, 2} },
{ Level::LEVEL2 , 122880, { 1500, 0 }, 16, 1, 1, 3686400ULL, { 1500, 0 }, { 2, 2} },
......@@ -72,6 +90,7 @@ static const LevelTierFeatures mainLevelTierInfo[] =
{ Level::LEVEL6_2, 35651584, { 180000, 800000 }, 600, 22, 20, 4278190080ULL, { 240000, 800000 }, { 8, 4} },
{ Level::LEVEL15_5, MAX_UINT, { MAX_UINT, MAX_UINT }, MAX_UINT, MAX_UINT, MAX_UINT, MAX_CNFUINT64, {MAX_UINT, MAX_UINT }, { 0, 0} },
{ Level::NONE }
#endif
};
static const ProfileFeatures validProfiles[] =
......
......@@ -52,8 +52,13 @@ struct LevelTierFeatures
Level::Name level;
uint32_t maxLumaPs;
uint32_t maxCpb[Level::NUMBER_OF_TIERS]; // in units of CpbVclFactor or CpbNalFactor bits
#if JVET_S0156_LEVEL_DEFINITION
uint32_t maxSlicesPerAu;
uint32_t maxTilesPerAu;
#else
uint32_t maxSliceSegmentsPerPicture;
uint32_t maxTileRows;
#endif
uint32_t maxTileCols;
uint64_t maxLumaSr;
uint32_t maxBr[Level::NUMBER_OF_TIERS]; // in units of BrVclFactor or BrNalFactor bits/s
......
......@@ -4357,7 +4357,10 @@ bool operator == (const ConstraintInfo& op1, const ConstraintInfo& o
if (op1.m_noPaletteConstraintFlag != op2.m_noPaletteConstraintFlag ) return false;
if (op1.m_noActConstraintFlag != op2.m_noActConstraintFlag ) return false;
if (op1.m_noLmcsConstraintFlag != op2.m_noLmcsConstraintFlag ) return false;
#if JVET_S0050_GCI
if (op1.m_noExplicitScaleListConstraintFlag != op2.m_noExplicitScaleListConstraintFlag ) return false;
if (op1.m_noVirtualBoundaryConstraintFlag != op2.m_noVirtualBoundaryConstraintFlag ) return false;
#endif
if( op1.m_noQtbttDualTreeIntraConstraintFlag != op2.m_noQtbttDualTreeIntraConstraintFlag ) return false;
if( op1.m_noPartitionConstraintsOverrideConstraintFlag != op2.m_noPartitionConstraintsOverrideConstraintFlag ) return false;
if( op1.m_noSaoConstraintFlag != op2.m_noSaoConstraintFlag ) return false;
......@@ -4428,6 +4431,29 @@ bool operator != (const ProfileTierLevel& op1, const ProfileTierLeve
return !(op1 == op2);
}
#if JVET_Q0406_CABAC_ZERO
bool Slice::isLastSliceInSubpic()
{
CHECK(m_pcPPS == NULL, "PPS pointer not initialized");
int lastCTUAddrInSlice = m_sliceMap.getCtuAddrList().back();
if (m_pcPPS->getNumSubPics() > 1)
{
const SubPic& subpic = m_pcPPS->getSubPic(m_pcPPS->getSubPicIdxFromSubPicId(getSliceSubPicId()));
return subpic.isLastCTUinSubPic(lastCTUAddrInSlice);
}
else
{
const CodingStructure *cs = m_pcPic->cs;
const PreCalcValues* pcv = cs->pcv;
const uint32_t picSizeInCtus = pcv->heightInCtus * pcv->widthInCtus;
return lastCTUAddrInSlice == (picSizeInCtus-1);
}
}
#endif
#if ENABLE_TRACING
void xTraceVPSHeader()
{
......
......@@ -267,6 +267,10 @@ class ConstraintInfo
bool m_noActConstraintFlag;
bool m_noLmcsConstraintFlag;
#if JVET_S0050_GCI
bool m_noExplicitScaleListConstraintFlag;
bool m_noVirtualBoundaryConstraintFlag;
#endif
bool m_noQtbttDualTreeIntraConstraintFlag;
bool m_noPartitionConstraintsOverrideConstraintFlag;
bool m_noSaoConstraintFlag;
......@@ -314,8 +318,8 @@ public:
#else
: m_nonPackedConstraintFlag (false)
, m_nonProjectedConstraintFlag(false)
, m_noResChangeInClvsConstraintFlag(false)
#endif
, m_noResChangeInClvsConstraintFlag(false)
, m_oneTilePerPicConstraintFlag(false)
, m_picHeaderInSliceHeaderConstraintFlag(false)
, m_oneSlicePerPicConstraintFlag(false)
......@@ -339,7 +343,10 @@ public:
, m_noPaletteConstraintFlag(false)
, m_noActConstraintFlag(false)
, m_noLmcsConstraintFlag(false)
#if JVET_S0050_GCI
, m_noExplicitScaleListConstraintFlag(false)
, m_noVirtualBoundaryConstraintFlag(false)
#endif
, m_noQtbttDualTreeIntraConstraintFlag(false)
, m_noPartitionConstraintsOverrideConstraintFlag(false)
, m_noSaoConstraintFlag (false)
......@@ -450,7 +457,12 @@ public:
void setNoActConstraintFlag(bool b) { m_noActConstraintFlag = b; }
bool getNoLmcsConstraintFlag() const { return m_noLmcsConstraintFlag; }
void setNoLmcsConstraintFlag(bool b) { m_noLmcsConstraintFlag = b; }
#if JVET_S0050_GCI
bool getNoExplicitScaleListConstraintFlag() const { return m_noExplicitScaleListConstraintFlag; }
void setNoExplicitScaleListConstraintFlag(bool b) { m_noExplicitScaleListConstraintFlag = b; }
bool getNoVirtualBoundaryConstraintFlag() const { return m_noVirtualBoundaryConstraintFlag; }
void setNoVirtualBoundaryConstraintFlag(bool b) { m_noVirtualBoundaryConstraintFlag = b; }
#endif
bool getNoQtbttDualTreeIntraConstraintFlag() const { return m_noQtbttDualTreeIntraConstraintFlag; }
void setNoQtbttDualTreeIntraConstraintFlag(bool bVal) { m_noQtbttDualTreeIntraConstraintFlag = bVal; }
bool getNoPartitionConstraintsOverrideConstraintFlag() const { return m_noPartitionConstraintsOverrideConstraintFlag; }
......@@ -860,8 +872,8 @@ public:
void setloopFilterAcrossEnabledFlag(bool u) { m_loopFilterAcrossSubPicEnabledFlag = u; }
bool getloopFilterAcrossEnabledFlag() const { return m_loopFilterAcrossSubPicEnabledFlag; }
bool isFirstCTUinSubPic(uint32_t ctuAddr) { return ctuAddr == m_firstCtuInSubPic; }
bool isLastCTUinSubPic(uint32_t ctuAddr) { return ctuAddr == m_lastCtuInSubPic; }
bool isFirstCTUinSubPic(uint32_t ctuAddr) const { return ctuAddr == m_firstCtuInSubPic; }
bool isLastCTUinSubPic(uint32_t ctuAddr) const { return ctuAddr == m_lastCtuInSubPic; }
void setNumSlicesInSubPic( uint32_t val ) { m_numSlicesInSubPic = val; }
uint32_t getNumSlicesInSubPic() const { return m_numSlicesInSubPic; }
bool containsCtu(const Position& pos) const
......@@ -2288,6 +2300,9 @@ public:
CcAlfFilterParam& getCcAlfAPSParam() { return m_ccAlfAPSParam; }
void setHasPrefixNalUnitType( bool b ) { m_hasPrefixNalUnitType = b; }
bool getHasPrefixNalUnitType() const { return m_hasPrefixNalUnitType; }
#if JVET_R0433
bool chromaPresentFlag;
#endif
};
struct WPScalingParam
......@@ -3021,6 +3036,9 @@ public:
void setNumSubstream( const SPS *sps, const PPS *pps );
void setNumEntryPoints( const SPS *sps, const PPS *pps );
uint32_t getNumEntryPoints( ) const { return m_numEntryPoints; }
#if JVET_Q0406_CABAC_ZERO
bool isLastSliceInSubpic();
#endif
CcAlfFilterParam m_ccAlfFilterParam;
uint8_t* m_ccAlfFilterControl[2];
......
......@@ -983,7 +983,11 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const
xT( tu, compID, resiBuf, tempCoeff, width, height );
}
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff sumAbs = 0;
#else
int sumAbs = 0;
#endif
for( int pos = 0; pos < width*height; pos++ )
{
sumAbs += abs( tempCoeff.buf[pos] );
......@@ -1000,7 +1004,11 @@ void TrQuant::transformNxN( TransformUnit& tu, const ComponentID& compID, const
scaleSAD *= pow(2, trShift);
}
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
trCosts.push_back( TrCost( int(std::min<double>(sumAbs*scaleSAD, std::numeric_limits<int>::max())), pos++ ) );
#else
trCosts.push_back( TrCost( int(sumAbs*scaleSAD), pos++ ) );
#endif
it++;
}
......
......@@ -91,7 +91,11 @@ void fastInverseDCT2_B2(const TCoeff *src, TCoeff *dst, int shift, int line, int
int j;
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT
TCoeff E, O;
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff add = TCoeff(1) << (shift - 1);
#else
TCoeff add = 1 << (shift - 1);
#endif
#else
int E, O;
int add = 1 << (shift - 1);
......@@ -192,7 +196,11 @@ void fastInverseDCT2_B4( const TCoeff *src, TCoeff *dst, int shift, int line, in
int j;
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT
TCoeff E[2], O[2];
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff add = TCoeff(1) << ( shift - 1 );
#else
TCoeff add = 1 << ( shift - 1 );
#endif
#else
int E[2], O[2];
int add = 1 << ( shift - 1 );
......@@ -236,7 +244,11 @@ template< int uiTrSize >
inline void _fastInverseMM( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TCoeff outputMinimum, const TCoeff outputMaximum, const TMatrixCoeff* iT )
{
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
const TCoeff rnd_factor = TCoeff(1) << (shift - 1);
#else
const TCoeff rnd_factor = 1 << (shift - 1);
#endif
#else
const int rnd_factor = 1 << (shift - 1);
#endif
......@@ -275,7 +287,11 @@ template< int uiTrSize >
inline void _fastForwardMM( const TCoeff *src, TCoeff *dst, int shift, int line, int iSkipLine, int iSkipLine2, const TMatrixCoeff* tc )
{
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
const TCoeff rnd_factor = TCoeff(1) << (shift - 1);
#else
const TCoeff rnd_factor = 1 << (shift - 1);
#endif
#else
const int rnd_factor = 1 << (shift - 1);
#endif
......@@ -393,7 +409,11 @@ void fastInverseDCT2_B8(const TCoeff *src, TCoeff *dst, int shift, int line, int
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT
TCoeff E[4], O[4];
TCoeff EE[2], EO[2];
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff add = TCoeff(1) << (shift - 1);
#else
TCoeff add = 1 << (shift - 1);
#endif
#else
int E[4], O[4];
int EE[2], EO[2];
......@@ -526,7 +546,11 @@ void fastInverseDCT2_B16( const TCoeff *src, TCoeff *dst, int shift, int line, i
TCoeff E [8], O [8];
TCoeff EE [4], EO [4];
TCoeff EEE[2], EEO[2];
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff add = TCoeff(1) << ( shift - 1 );
#else
TCoeff add = 1 << ( shift - 1 );
#endif
#else
int E [8], O [8];
int EE [4], EO [4];
......@@ -682,7 +706,11 @@ void fastInverseDCT2_B32(const TCoeff *src, TCoeff *dst, int shift, int line, in
TCoeff EE[8], EO[8];
TCoeff EEE[4], EEO[4];
TCoeff EEEE[2], EEEO[2];
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff add = TCoeff(1) << (shift - 1);
#else
TCoeff add = 1 << (shift - 1);
#endif
#else
int j, k;
int E[16], O[16];
......
......@@ -51,6 +51,8 @@
#include <cassert>
//########### place macros to be removed in next cycle below this line ###############
#define JVET_R0433 1 // JVET-R0433: APS signaling and semantics cleanup
#define JVET_S0076_ASPECT1 1 // JVET-S0076: aspect 1: Move ph_non_ref_pic_flag to earlier position
#define JVET_S0133_PH_SYNTAX_OVERRIDE_ENC_FIX 1 // JVET-S0133: Encoder-only fix on the override of partition constriants in PH
......@@ -87,20 +89,35 @@
#define JVET_S0248_HRD_CLEANUP 1 // JVET-S0248 Aspect7: When bp_alt_cpb_params_present_flag is equal to 1, the value of bp_du_hrd_params_present_flag shall be equal to 0.
#define JVET_S0156_LEVEL_DEFINITION 1 // JVET-S0156: On level definitions
#define JVET_S0185_PROPOSAL2_SEI_CLEANUP 1 // JVET-S0185_PROPOSAL2: Move signalling of syntax element bp_alt_cpb_params_present_flag
#define JVET_S0181_PROPOSAL1 1 // JVET-0181_Proposal1: Conditionally signal bp_sublayer_initial_cpb_removal_delay_present_flag
#define JVET_Q0406_CABAC_ZERO 1 // JVET-Q0406: signal cabac_zero_words per sub-picture
#define JVET_S0177_SCALABLE_NESTING_SEI 1 // JVET-S0177: Constraints on the scalable nesting SEI message
#define JVET_R0068_ASPECT6_ENC_RESTRICTION 1 // encoder restriction for JVET-R0068 apsect 6
#define JVET_S0178_GENERAL_SEI_CHECK 1 // JVET-S0178: General SEI semantics and constraints
#define JVET_S0186_SPS_CLEANUP 1 // JVET-S0186: Proposal 1, move sps_chroma_format_idc and sps_log2_ctu_size_minus5 to take place sps_reserved_zero_4bits
#define JVET_S0181_PROPOSAL2_BUFFERING_PERIOD_CLEANUP 1 // JVET-S0181 Proposal2: Move signalling of bp_max_sublayers_minus1 and conditionally signal bp_cpb_removal_delay_deltas_present_flag, bp_num_cpb_removal_delay_deltas_minus1, and bp_cpb_removal_delay
#define JVET_S0050_GCI 1 // JVET-S0050: Signal new GCI flags no_virtual_boundaries_constraint_flag and no_explicit_scaling_list_constraint_flag
// Constrain the value of one_subpic_per_pic_constraint_flag, one_slice_per_pic_constraint_flag and no_aps_constraint_flag
// Remove all constraints that require GCI fields to be equal to a value that imposes a constraint
#define JVET_S0185_PROPOSAl1_PICTURE_TIMING_CLEANUP 1 // JVET-S0185: Proposal 1, put syntax element pt_cpb_removal_delay_minus1[] first, followed by similar information for sub-layers, followed by pt_dpb_output_delay
//########### place macros to be be kept below this line ###############
#define JVET_S0257_DUMP_360SEI_MESSAGE 1 // Software support of 360 SEI messages
#define JVET_R0351_HIGH_BIT_DEPTH_SUPPORT 1 // JVET-R0351: high bit depth coding support (syntax changes, no mathematical differences for CTCs)
#define JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS 1 // JVET-R0351: high bit depth coding support (syntax changes for Visual Studio)
#define JVET_R0351_HIGH_BIT_DEPTH_ENABLED 0 // JVET-R0351: high bit depth coding enabled (increases accuracies of some calculations, e.g. transforms)
#define JVET_R0164_MEAN_SCALED_SATD 1 // JVET-R0164: Use a mean scaled version of SATD in encoder decisions
......
......@@ -1895,7 +1895,11 @@ void CABACReader::cuPaletteSubblockInfo(CodingUnit& cu, ComponentID compBegin, u
if (compID == COMPONENT_Y || compBegin != COMPONENT_Y)
{
escapeValue.at(posx, posy) = exp_golomb_eqprob(5);
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
assert(escapeValue.at(posx, posy) < (TCoeff(1) << (cu.cs->sps->getBitDepth(toChannelType((ComponentID)comp)) + 1)));
#else
assert(escapeValue.at(posx, posy) < (1 << (cu.cs->sps->getBitDepth(toChannelType((ComponentID)comp)) + 1)));
#endif
DTRACE(g_trace_ctx, D_SYNTAX, "plt_escape_val() value=%d etype=%d sp=%d\n", escapeValue.at(posx, posy), comp, curPos);
}
if (compBegin == COMPONENT_Y && compID != COMPONENT_Y && posy % (1 << scaleY) == 0 && posx % (1 << scaleX) == 0)
......@@ -1903,7 +1907,11 @@ void CABACReader::cuPaletteSubblockInfo(CodingUnit& cu, ComponentID compBegin, u
uint32_t posxC = posx >> scaleX;
uint32_t posyC = posy >> scaleY;
escapeValue.at(posxC, posyC) = exp_golomb_eqprob(5);
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
assert(escapeValue.at(posxC, posyC) < (TCoeff(1) << (cu.cs->sps->getBitDepth(toChannelType(compID)) + 1)));
#else
assert(escapeValue.at(posxC, posyC) < (1 << (cu.cs->sps->getBitDepth(toChannelType(compID)) + 1)));
#endif
DTRACE(g_trace_ctx, D_SYNTAX, "plt_escape_val() value=%d etype=%d sp=%d\n", escapeValue.at(posx, posy), comp, curPos);
}
}
......@@ -3328,10 +3336,18 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
unsigned signPattern = m_BinDecoder.decodeBinsEP( numSigns ) << ( 32 - numSigns );
//===== set final coefficents =====
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff sumAbs = 0;
#else
int sumAbs = 0;
#endif
for( unsigned k = 0; k < numSigns; k++ )
{
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff AbsCoeff = coeff[ sigBlkPos[ k ] ];
#else
int AbsCoeff = coeff[ sigBlkPos[ k ] ];
#endif
sumAbs += AbsCoeff;
coeff[ sigBlkPos[k] ] = ( signPattern & ( 1u << 31 ) ? -AbsCoeff : AbsCoeff );
signPattern <<= 1;
......@@ -3344,7 +3360,11 @@ void CABACReader::residual_coding_subblock( CoeffCodingContext& cctx, TCoeff* co
if( numNonZero > numSigns )
{
int k = numSigns;
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff AbsCoeff = coeff[ sigBlkPos[ k ] ];
#else
int AbsCoeff = coeff[ sigBlkPos[ k ] ];
#endif
sumAbs += AbsCoeff;
coeff[ sigBlkPos[k] ] = ( sumAbs & 1 ? -AbsCoeff : AbsCoeff );
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT
......@@ -3543,7 +3563,11 @@ void CABACReader::residual_coding_subblockTS( CoeffCodingContext& cctx, TCoeff*
//===== set final coefficents =====
for( unsigned k = 0; k < numNonZero; k++ )
{
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff AbsCoeff = coeff[ sigBlkPos[ k ] ];
#else
int AbsCoeff = coeff[ sigBlkPos[ k ] ];
#endif
coeff[ sigBlkPos[k] ] = ( signPattern & 1 ? -AbsCoeff : AbsCoeff );
signPattern >>= 1;
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT
......
......@@ -536,7 +536,11 @@ void DecCu::xReconPLT(CodingUnit &cu, ComponentID compBegin, uint32_t numComp)
PLTescapeBuf escapeValue = tu.getescapeValue((ComponentID)compID);
if (curPLTIdx.at(x, y) == cu.curPLTSize[compBegin])
{
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff value;
#else
Pel value;
#endif
QpParam cQP(tu, (ComponentID)compID);
int qp = cQP.Qp(true);
int qpRem = qp % 6;
......@@ -546,8 +550,13 @@ void DecCu::xReconPLT(CodingUnit &cu, ComponentID compBegin, uint32_t numComp)
int invquantiserRightShift = IQUANT_SHIFT;
int add = 1 << (invquantiserRightShift - 1);
value = ((((escapeValue.at(x, y)*g_invQuantScales[0][qpRem]) << qpPer) + add) >> invquantiserRightShift);
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
value = ClipBD<TCoeff>(value, channelBitDepth);
picReco.at(x, y) = Pel(value);
#else
value = Pel(ClipBD<int>(value, channelBitDepth));
picReco.at(x, y) = value;
#endif
}
else if (compBegin == COMPONENT_Y && compID != COMPONENT_Y && y % (1 << scaleY) == 0 && x % (1 << scaleX) == 0)
{
......@@ -556,8 +565,13 @@ void DecCu::xReconPLT(CodingUnit &cu, ComponentID compBegin, uint32_t numComp)
int invquantiserRightShift = IQUANT_SHIFT;
int add = 1 << (invquantiserRightShift - 1);
value = ((((escapeValue.at(posXC, posYC)*g_invQuantScales[0][qpRem]) << qpPer) + add) >> invquantiserRightShift);
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
value = ClipBD<TCoeff>(value, channelBitDepth);
picReco.at(posXC, posYC) = Pel(value);
#else
value = Pel(ClipBD<int>(value, channelBitDepth));
picReco.at(posXC, posYC) = value;
#endif
}
}
......
......@@ -1040,8 +1040,40 @@ void DecLib::checkSEIInAccessUnit()
for (auto &sei : m_accessUnitSeiPayLoadTypes)
{
enum NalUnitType naluType = std::get<0>(sei);
#if !JVET_S0178_GENERAL_SEI_CHECK
int nuhLayerId = std::get<1>(sei);
#endif
enum SEI::PayloadType payloadType = std::get<2>(sei);
#if JVET_S0178_GENERAL_SEI_CHECK
if (m_vps != nullptr && naluType == NAL_UNIT_PREFIX_SEI && ((payloadType == SEI::BUFFERING_PERIOD || payloadType == SEI::PICTURE_TIMING || payloadType == SEI::DECODING_UNIT_INFO || payloadType == SEI::SUBPICTURE_LEVEL_INFO)))
{
bool olsIncludeAllLayersFind = false;
for (int i = 0; i < m_vps->getNumOutputLayerSets(); i++)
{
for (auto pic = m_firstAccessUnitPicInfo.begin(); pic != m_firstAccessUnitPicInfo.end(); pic++)
{
int targetLayerId = pic->m_nuhLayerId;
for (int j = 0; j < m_vps->getNumLayersInOls(i); j++)
{
olsIncludeAllLayersFind = m_vps->getLayerIdInOls(i, j) == targetLayerId ? true : false;
if (olsIncludeAllLayersFind)
{
break;
}
}
if (!olsIncludeAllLayersFind)
{
break;
}
}
if (olsIncludeAllLayersFind)
{
break;
}
}
CHECK(!olsIncludeAllLayersFind, "When there is no OLS that includes all layers in the current CVS in the entire bitstream, there shall be no non-scalable-nested SEI message with payloadType equal to 0 (BP), 1 (PT), 130 (DUI), or 203 (SLI)");
}
#else
if (m_vps != nullptr && naluType == NAL_UNIT_PREFIX_SEI && ((payloadType == SEI::BUFFERING_PERIOD || payloadType == SEI::PICTURE_TIMING || payloadType == SEI::DECODING_UNIT_INFO)))
{
int numlayersInZeroOls = m_vps->getNumLayersInOls(0);
......@@ -1059,6 +1091,7 @@ void DecLib::checkSEIInAccessUnit()
int layerId = m_vps->getLayerId(0);
CHECK(nuhLayerId != layerId, "the nuh_layer_id of non-scalable-nested timing related SEI shall be equal to vps_layer_id[0]");
}
#endif
}
}
......@@ -1073,7 +1106,7 @@ void DecLib::checkSeiInPictureUnit()
// payload types subject to constrained SEI repetition
int picUnitRepConSeiList[SEI_REPETITION_CONSTRAINT_LIST_SIZE] = { 0, 1, 19, 45, 129, 132, 133, 137, 144, 145, 147, 148, 149, 150, 153, 154, 155, 156, 168, 203, 204};
// extract SEI messages from NAL units
for (auto &sei : m_pictureSeiNalus)
{
......@@ -1254,6 +1287,10 @@ void activateAPS(PicHeader* picHeader, Slice* pSlice, ParameterSetManager& param
CHECK( aps->getTemporalId() > pSlice->getTLayer(), "TemporalId shall be less than or equal to the TemporalId of the coded slice NAL unit" );
//ToDO: APS NAL unit containing the APS RBSP shall have nuh_layer_id either equal to the nuh_layer_id of a coded slice NAL unit that referrs it, or equal to the nuh_layer_id of a direct dependent layer of the layer containing a coded slice NAL unit that referrs it.
#if JVET_R0433
CHECK( sps->getChromaFormatIdc() == CHROMA_400 && aps->chromaPresentFlag, "When ChromaArrayType is equal to 0, the value of aps_chroma_present_flag of an ALF_APS shall be equal to 0" );
#endif
CHECK(((sps->getCCALFEnabledFlag() == false) && (aps->getCcAlfAPSParam().newCcAlfFilter[0] || aps->getCcAlfAPSParam().newCcAlfFilter[1])), "When sps_ccalf_enabled_flag is 0, the values of alf_cc_cb_filter_signal_flag and alf_cc_cr_filter_signal_flag shall be equal to 0");
}
}
......@@ -1356,6 +1393,12 @@ void activateAPS(PicHeader* picHeader, Slice* pSlice, ParameterSetManager& param
THROW("LMCS APS activation failed!");
}
#if JVET_R0433
CHECK( sps->getChromaFormatIdc() == CHROMA_400 && lmcsAPS->chromaPresentFlag, "When ChromaArrayType is equal to 0, the value of aps_chroma_present_flag of an LMCS_APS shall be equal to 0");
CHECK( lmcsAPS->getReshaperAPSInfo().maxNbitsNeededDeltaCW - 1 < 0 || lmcsAPS->getReshaperAPSInfo().maxNbitsNeededDeltaCW - 1 > sps->getBitDepth(CHANNEL_TYPE_LUMA) - 2, "The value of lmcs_delta_cw_prec_minus1 of an LMCS_APS shall be in the range of 0 to BitDepth 2, inclusive" );
#endif
CHECK( lmcsAPS->getTemporalId() > pSlice->getTLayer(), "TemporalId shall be less than or equal to the TemporalId of the coded slice NAL unit" );
//ToDO: APS NAL unit containing the APS RBSP shall have nuh_layer_id either equal to the nuh_layer_id of a coded slice NAL unit that referrs it, or equal to the nuh_layer_id of a direct dependent layer of the layer containing a coded slice NAL unit that referrs it.
}
......@@ -1374,6 +1417,11 @@ void activateAPS(PicHeader* picHeader, Slice* pSlice, ParameterSetManager& param
THROW( "SCALING LIST APS activation failed!" );
}
#if JVET_R0433
CHECK( (sps->getChromaFormatIdc() == CHROMA_400 && scalingListAPS->chromaPresentFlag) || (sps->getChromaFormatIdc() != CHROMA_400 && !scalingListAPS->chromaPresentFlag),
"The value of aps_chroma_present_flag of the APS NAL unit having aps_params_type equal to SCALING_APS and adaptation_parameter_set_id equal to ph_scaling_list_aps_id shall be equal to ChromaArrayType = = 0 ? 0 : 1" );
#endif
CHECK( scalingListAPS->getTemporalId() > pSlice->getTLayer(), "TemporalId shall be less than or equal to the TemporalId of the coded slice NAL unit" );
//ToDO: APS NAL unit containing the APS RBSP shall have nuh_layer_id either equal to the nuh_layer_id of a coded slice NAL unit that referrs it, or equal to the nuh_layer_id of a direct dependent layer of the layer containing a coded slice NAL unit that referrs it.
}
......@@ -1757,11 +1805,23 @@ void DecLib::xCheckParameterSetConstraints(const int layerId)
{
CHECK(pps->getNumTiles() != 1, "When one_tile_per_pic_constraint_flag is equal to 1, each picture shall contain only one tile");
}
if (sps->getProfileTierLevel()->getConstraintInfo()->getOneSlicePerPicConstraintFlag())
{
#if JVET_S0050_GCI
CHECK( pps->getRectSliceFlag() && pps->getNumSlicesInPic() != 1, "When one_slice_per_pic_constraint_flag is equal to 1 and if pps_rect_slice_flag is equal to 1, the value of num_slices_in_pic_minus1 shall be equal to 0");
#else
CHECK( pps->getNumSlicesInPic() != 1, "When one_slice_per_pic_constraint_flag is equal to 1, each picture shall contain only one slice");
#endif
}
#if JVET_S0050_GCI
if (sps->getProfileTierLevel()->getConstraintInfo()->getOneSubpicPerPicConstraintFlag())
{
CHECK(sps->getNumSubPics() != 1, "When one_subpic_per_pic_constraint_flag is equal to 1, the value of sps_num_subpics_minus1 shall be equal to 0")
}
#endif
if (sps->getMaxPicWidthInLumaSamples() == pps->getPicWidthInLumaSamples() &&
sps->getMaxPicHeightInLumaSamples() == pps->getPicHeightInLumaSamples())
{
......@@ -2167,6 +2227,13 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
m_pcPic->layerId = nalu.m_nuhLayerId;
m_pcPic->subLayerNonReferencePictureDueToSTSA = false;
#if JVET_S0050_GCI
if (pcSlice->getSPS()->getProfileTierLevel()->getConstraintInfo()->getNoApsConstraintFlag())
{
bool flag = pcSlice->getSPS()->getCCALFEnabledFlag() || pcSlice->getPicHeader()->getNumAlfAps() || pcSlice->getPicHeader()->getAlfEnabledFlag(COMPONENT_Cb) || pcSlice->getPicHeader()->getAlfEnabledFlag(COMPONENT_Cr);
CHECK(flag, "When no_aps_constraint_flag is equal to 1, the values of ph_num_alf_aps_ids_luma, sh_num_alf_aps_ids_luma, ph_alf_cb_flag, ph_alf_cr_flag, sh_alf_cb_flag, sh_alf_cr_flag, and sps_ccalf_enabled_flag shall all be equal to 0")
}
#endif
if( pcSlice->getNalUnitLayerId() != pcSlice->getSPS()->getLayerId() )
{
CHECK( pcSlice->getSPS()->getLayerId() > pcSlice->getNalUnitLayerId(), "Layer Id of SPS cannot be greater than layer Id of VCL NAL unit the refer to it" );
......
......@@ -117,19 +117,29 @@ static inline void output_sei_message_header(SEI &sei, std::ostream *pDecodedMes
// note: for independent parsing no parameter set should not be required here
void SEIReader::parseSEImessage(InputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const uint32_t nuh_layer_id, const uint32_t temporalId, const VPS *vps, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream)
{
#if JVET_S0178_GENERAL_SEI_CHECK
SEIMessages seiListInCurNalu;
#endif
setBitstream(bs);
CHECK(m_pcBitstream->getNumBitsUntilByteAligned(), "Bitstream not aligned");
do
{
xReadSEImessage(seis, nalUnitType, nuh_layer_id, temporalId, vps, sps, hrd, pDecodedMessageOutputStream);
#if JVET_S0178_GENERAL_SEI_CHECK
seiListInCurNalu.push_back(seis.back());
#endif
/* SEI messages are an integer number of bytes, something has failed
* in the parsing if bitstream not byte-aligned */
CHECK(m_pcBitstream->getNumBitsUntilByteAligned(), "Bitstream not aligned");
}
while (m_pcBitstream->getNumBitsLeft() > 8);
#if JVET_S0178_GENERAL_SEI_CHECK
SEIMessages fillerData = getSeisByType(seiListInCurNalu, SEI::FILLER_PAYLOAD);
CHECK(fillerData.size() > 0 && fillerData.size() != seiListInCurNalu.size(), "When an SEI NAL unit contains an SEI message with payloadType equal to filler payload, the SEI NAL unit shall not contain any other SEI message with payloadType not equal to filler payload");
#endif
xReadRbspTrailingBits();
}
......@@ -588,6 +598,9 @@ void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitT
bool containNoBPorPTorDUI = false;
for (auto nestedsei : sei.m_nestedSEIs)
{
#if JVET_S0178_GENERAL_SEI_CHECK
CHECK(vps->getGeneralHrdParameters()->getGeneralSamePicTimingInAllOlsFlag() && nestedsei->payloadType() == SEI::PICTURE_TIMING, "When general_same_pic_timing_in_all_ols_flag is equal to 1, there shall be no SEI NAL unit that contain a scalable-nested SEI message with payloadType equal to PT");
#endif
if (nestedsei->payloadType() == SEI::BUFFERING_PERIOD || nestedsei->payloadType() == SEI::PICTURE_TIMING || nestedsei->payloadType() == SEI::DECODING_UNIT_INFO)
{
containBPorPTorDUI = true;
......@@ -707,7 +720,21 @@ void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t paylo
sei_read_code( pDecodedMessageOutputStream, ( sei.m_cpbRemovalDelayLength ), code, "au_cpb_removal_delay_delta_minus1" );
sei.m_auCpbRemovalDelayDelta = code + 1;
#if JVET_S0181_PROPOSAL2_BUFFERING_PERIOD_CLEANUP
sei_read_code(pDecodedMessageOutputStream, 3, code, "bp_max_sub_layers_minus1");
sei.m_bpMaxSubLayers = code + 1;
if (sei.m_bpMaxSubLayers - 1 > 0)
{
sei_read_flag(pDecodedMessageOutputStream, code, "cpb_removal_delay_deltas_present_flag");
sei.m_cpbRemovalDelayDeltasPresentFlag = code;
}
else
{
sei.m_cpbRemovalDelayDeltasPresentFlag = false;
}
#else
sei_read_flag( pDecodedMessageOutputStream, code, "cpb_removal_delay_deltas_present_flag" ); sei.m_cpbRemovalDelayDeltasPresentFlag = code;
#endif
if (sei.m_cpbRemovalDelayDeltasPresentFlag)
{
sei_read_uvlc( pDecodedMessageOutputStream, code, "num_cpb_removal_delay_deltas_minus1" ); sei.m_numCpbRemovalDelayDeltas = code + 1;
......@@ -717,8 +744,10 @@ void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t paylo
sei.m_cpbRemovalDelayDelta[ i ] = code;
}
}
#if !JVET_S0181_PROPOSAL2_BUFFERING_PERIOD_CLEANUP
sei_read_code( pDecodedMessageOutputStream, 3, code, "bp_max_sub_layers_minus1" ); sei.m_bpMaxSubLayers = code + 1;
sei_read_uvlc( pDecodedMessageOutputStream, code, "bp_cpb_cnt_minus1" ); sei.m_bpCpbCnt = code + 1;
#endif
#if JVET_S0181_PROPOSAL1
if (sei.m_bpMaxSubLayers - 1 > 0)
{
......@@ -778,8 +807,49 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi
output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
uint32_t symbol;
#if JVET_S0185_PROPOSAl1_PICTURE_TIMING_CLEANUP
sei_read_code( pDecodedMessageOutputStream, bp.m_cpbRemovalDelayLength, symbol, "pt_cpb_removal_delay_minus1[bp_max_sub_layers_minus1]" );
sei.m_auCpbRemovalDelay[bp.m_bpMaxSubLayers - 1] = symbol + 1;
for (int i = temporalId; i < bp.m_bpMaxSubLayers - 1; i++)
{
sei_read_flag(pDecodedMessageOutputStream, symbol, "pt_sub_layer_delays_present_flag[i]");
sei.m_ptSubLayerDelaysPresentFlag[i] = (symbol == 1);
if (sei.m_ptSubLayerDelaysPresentFlag[i])
{
if (bp.m_cpbRemovalDelayDeltasPresentFlag)
{
sei_read_flag(pDecodedMessageOutputStream, symbol, "pt_cpb_removal_delay_delta_enabled_flag[i]");
sei.m_cpbRemovalDelayDeltaEnabledFlag[i] = (symbol == 1);
}
else
{
sei.m_cpbRemovalDelayDeltaEnabledFlag[i] = false;
}
if (sei.m_cpbRemovalDelayDeltaEnabledFlag[i])
{
if ((bp.m_numCpbRemovalDelayDeltas - 1) > 0)
{
sei_read_code(pDecodedMessageOutputStream, ceilLog2(bp.m_numCpbRemovalDelayDeltas), symbol, "pt_cpb_removal_delay_delta_idx[i]");
sei.m_cpbRemovalDelayDeltaIdx[i] = symbol;
}
else
{
sei.m_cpbRemovalDelayDeltaIdx[i] = 0;
}
}
else
{
sei_read_code(pDecodedMessageOutputStream, bp.m_cpbRemovalDelayLength, symbol, "pt_cpb_removal_delay_minus1[i]");
sei.m_auCpbRemovalDelay[i] = symbol + 1;
}
}
}
sei_read_code(pDecodedMessageOutputStream, bp.m_dpbOutputDelayLength, symbol, "pt_dpb_output_delay");
sei.m_picDpbOutputDelay = symbol;
#else
sei_read_code( pDecodedMessageOutputStream, bp.m_cpbRemovalDelayLength, symbol, "cpb_removal_delay_minus1[bp_max_sub_layers_minus1]" );
sei.m_auCpbRemovalDelay[bp.m_bpMaxSubLayers - 1] = symbol + 1;
#endif
if( bp.m_altCpbParamsPresentFlag )
{
......@@ -873,6 +943,7 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi
}
}
#if !JVET_S0185_PROPOSAl1_PICTURE_TIMING_CLEANUP
for( int i = temporalId; i < bp.m_bpMaxSubLayers - 1; i ++ )
{
sei_read_flag( pDecodedMessageOutputStream, symbol, "pt_sub_layer_delays_present_flag[i]" ); sei.m_ptSubLayerDelaysPresentFlag[i] = (symbol == 1);
......@@ -908,6 +979,7 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi
}
sei_read_code( pDecodedMessageOutputStream, bp.m_dpbOutputDelayLength, symbol, "dpb_output_delay" );
sei.m_picDpbOutputDelay = symbol;
#endif
if ( bp.m_bpDecodingUnitHrdParamsPresentFlag && bp.m_decodingUnitDpbDuParamsInPicTimingSeiFlag )
{
sei_read_code( pDecodedMessageOutputStream, bp.getDpbOutputDelayDuLength(), symbol, "pic_dpb_output_du_delay" );
......
This diff is collapsed.
......@@ -178,7 +178,11 @@ public:
void parsePredWeightTable( Slice* pcSlice, const SPS *sps );
void parsePredWeightTable ( PicHeader *picHeader, const SPS *sps );
void parseScalingList ( ScalingList* scalingList );
#if JVET_R0433
void parseScalingList ( ScalingList *scalingList, bool aps_chromaPresentFlag );
#else
void parseScalingList ( ScalingList *scalingList );
#endif
void decodeScalingList ( ScalingList *scalingList, uint32_t scalingListId, bool isPredictor);
void parseReshaper ( SliceReshapeInfo& sliceReshaperInfo, const SPS* pcSPS, const bool isIntra );
void alfFilter( AlfParam& alfParam, const bool isChroma, const int altIdx );
......
......@@ -2944,7 +2944,11 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
const int inferSigPos = nextSigPos != cctx.scanPosLast() ? ( cctx.isNotFirst() ? minSubPos : -1 ) : nextSigPos;
int firstNZPos = nextSigPos;
int lastNZPos = -1;
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
TCoeff remAbsLevel = -1;
#else
int remAbsLevel = -1;
#endif
int numNonZero = 0;
unsigned signPattern = 0;
int remRegBins = cctx.regBinLimit;
......@@ -3010,7 +3014,11 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe
{
int sumAll = cctx.templateAbsSum(scanPos, coeff, 4);
ricePar = g_auiGoRiceParsCoeff[sumAll];
#if JVET_R0351_HIGH_BIT_DEPTH_SUPPORT_VS
unsigned absLevel = (unsigned) abs( coeff[ cctx.blockPos( scanPos ) ] );
#else
unsigned absLevel = abs( coeff[ cctx.blockPos( scanPos ) ] );
#endif
if( absLevel >= 4 )
{
unsigned rem = ( absLevel - 4 ) >> 1;
......@@ -3023,7 +3031,11 @@ void CABACWriter::residual_coding_subblock( CoeffCodingContext& cctx, const TCoe