...
 
Commits (106)
......@@ -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
......
VuiParametersPresent: 1 // enable VUI
ProgressiveSource: 1 // indicates if content is progressive
InterlacedSource: 0 // indicates if content is interlaced
NonPackedSource: 1 // indicates if content is not packed
NonProjectedConstraintFlag: 1 // indicates if content is not projected
AspectRatioInfoPresent: 1 // enable presence of sample aspect ratio information
AspectRatioIdc: 1 // sample aspect ratio pre-defined types according to Rec. ITU-T H.273 | ISO/IEC 23091-2
SarWidth: 1 // sample aspect ratio width, if AspectRatioIdc is equal to 255
SarHeight: 1 // sample aspect ratio height, if AspectRatioIdc is equal to 255
OverscanInfoPresent: 1 // enable presence of overscan information
OverscanAppropriate: 0 // indicates if the cropped decoded pictures output are suitable for display using overscan
ColourDescriptionPresent: 1 // enable presence of colour description information
ColourPrimaries: 1 // the source colour primaries according to Rec. ITU-T H.273 | ISO/IEC 23091-2
TransferCharacteristics: 1 // transfer characteristics function according to Rec. ITU-T H.273 | ISO/IEC 23091-2
MatrixCoefficients: 1 // the formulae used in deriving luma and chroma signals acc. to Rec. ITU-T H.273 | ISO/IEC 23091-2
VideoFullRange: 0 // scaling and offset values applied according to Rec. ITU-T H.273 | ISO/IEC 23091-2
ProgressiveSource: 1 // indicates if content is progressive
InterlacedSource: 0 // indicates if content is interlaced
ChromaLocInfoPresent: 1 // enable presence of chroma location information
ChromaSampleLocTypeTopField: 0 // the location of chroma sample top field
ChromaSampleLocTypeBottomField: 0 // the location of chroma sample bottom field
ChromaSampleLocType: 0 // the location of chroma sample frame
OverscanInfoPresent: 1 // enable presence of overscan information
OverscanAppropriate: 0 // indicates if the cropped decoded pictures output are suitable for display using overscan
VuiParametersPresent: 1 // enable VUI
ProgressiveSource: 1 // Indicates if content is progressive
InterlacedSource: 0 // Indicates if content is interlaced
NonPackedSource: 1 // indicates if content is not packed
NonProjectedConstraintFlag: 1 // indicates if content is not projected
AspectRatioInfoPresent: 1 // enable presence of sample aspect ratio information
AspectRatioIdc: 1 // sample aspect ratio pre-defined types according to Rec. ITU-T H.273 | ISO/IEC 23091-2
SarWidth: 1 // sample aspect ratio width, if AspectRatioIdc is equal to 255
SarHeight: 1 // sample aspect ratio height, if AspectRatioIdc is equal to 255
OverscanInfoPresent: 1 // enable presence of overscan information
OverscanAppropriate: 0 // indicates if the cropped decoded pictures output are suitable for display using overscan
ColourDescriptionPresent: 1 // enable presence of colour description information
ColourPrimaries: 9 // the source colour primaries according to Rec. ITU-T H.273 | ISO/IEC 23091-2
TransferCharacteristics: 16 // transfer characteristics function according to Rec. ITU-T H.273 | ISO/IEC 23091-2
MatrixCoefficients: 9 // the formulae used in deriving luma and chroma signals acc. to Rec. ITU-T H.273 | ISO/IEC 23091-2
VideoFullRange: 0 // scaling and offset values applied according to Rec. ITU-T H.273 | ISO/IEC 23091-2
ProgressiveSource: 1 // Indicates if content is progressive
InterlacedSource: 0 // Indicates if content is interlaced
ChromaLocInfoPresent: 1 // enable presence of chroma location information
ChromaSampleLocTypeTopField: 2 // the location of chroma sample top field
ChromaSampleLocTypeBottomField: 2 // the location of chroma sample bottom field
ChromaSampleLocType: 2 // the location of chroma sample frame
OverscanInfoPresent: 1 // enable presence of overscan information
OverscanAppropriate: 0 // indicates if the cropped decoded pictures output are suitable for display using overscan
......@@ -1018,18 +1018,6 @@ Specifies the value of general_one_picture_only_constraint_flag.
Specifies the value of general_lower_bit_constraint_flag to use for RExt profiles.
\\
\Option{NonPackedSource} &
%\ShortOption{\None} &
\Default{false} &
Specifies the value of general_non_packed_constraint_flag
\\
\Option{NonProjectedConstraintFlag} &
%\ShortOption{\None} &
\Default{false} &
Specifies the value of general_non_projected_constraint_flag
\\
\Option{NoResChangeInClvsConstraintFlag} &
%\ShortOption{\None} &
\Default{false} &
......@@ -1072,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} &
......@@ -2918,6 +2918,16 @@ Specifies the value of general_progressive_source_flag
\Default{false} &
Specifies the value of general_interlaced_source_flag
\\
\Option{NonPackedSource} &
%\ShortOption{\None} &
\Default{false} &
Specifies the value of general_non_packed_constraint_flag
\\
\Option{NonProjectedConstraintFlag} &
%\ShortOption{\None} &
\Default{false} &
Specifies the value of general_non_projected_constraint_flag
\\
\Option{ChromaLocInfoPresent} &
\Default{false} &
Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present.
......
......@@ -183,6 +183,21 @@ void BitstreamExtractorApp::xRewriteSPS (SPS &targetSPS, const SPS &sourceSPS, S
targetSPS.setSubPicId(0, subPic.getSubPicID());
targetSPS.setMaxPicWidthInLumaSamples(subPic.getSubPicWidthInLumaSample());
targetSPS.setMaxPicHeightInLumaSamples(subPic.getSubPicHeightInLumaSample());
#if JVET_R0093_SUBPICS_AND_CONF_WINDOW
// Set the new conformance window
Window& conf = targetSPS.getConformanceWindow();
int subpicConfWinLeftOffset = (subPic.getSubPicCtuTopLeftX() == 0) ? conf.getWindowLeftOffset() : 0;
int subpicConfWinRightOffset = ((subPic.getSubPicCtuTopLeftX() + subPic.getSubPicWidthInCTUs()) * sourceSPS.getCTUSize() >= sourceSPS.getMaxPicWidthInLumaSamples()) ?
conf.getWindowRightOffset() : 0;
int subpicConfWinTopOffset = (subPic.getSubPicCtuTopLeftY() == 0) ? conf.getWindowTopOffset() : 0;
int subpicConfWinBottomOffset = ((subPic.getSubPicCtuTopLeftY() + subPic.getSubPicHeightInCTUs()) * sourceSPS.getCTUSize() >= sourceSPS.getMaxPicHeightInLumaSamples()) ?
conf.getWindowBottomOffset() : 0;
conf.setWindowLeftOffset(subpicConfWinLeftOffset);
conf.setWindowRightOffset(subpicConfWinRightOffset);
conf.setWindowTopOffset(subpicConfWinTopOffset);
conf.setWindowBottomOffset(subpicConfWinBottomOffset);
#endif
}
......@@ -208,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++)
{
......@@ -215,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;
......@@ -234,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;
......@@ -280,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++)
{
......@@ -295,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);
}
}
......
......@@ -257,7 +257,11 @@ void EncApp::xInitLibCfg()
#endif
m_cEncLib.setOnePictureOnlyConstraintFlag ( m_onePictureOnlyConstraintFlag );
m_cEncLib.setIntraOnlyConstraintFlag ( m_intraConstraintFlag ); // NOTE: This setting is not used, and is confused with setIntraConstraintFlag
#if JVET_S0094_CHROMAFORMAT_BITDEPTH_CONSTRAINT
m_cEncLib.setMaxBitDepthConstraintIdc ( m_bitDepthConstraint );
#else
m_cEncLib.setMaxBitDepthConstraintIdc ( m_bitDepthConstraint - 8 );
#endif
m_cEncLib.setMaxChromaFormatConstraintIdc ( m_chromaFormatConstraint );
m_cEncLib.setFrameConstraintFlag ( m_bFrameConstraintFlag ); // NOTE: This setting is neither used nor setup, and is confused with setFrameOnlyConstraintFlag
m_cEncLib.setNoQtbttDualTreeIntraConstraintFlag ( !m_dualTree );
......@@ -304,7 +308,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
}
}
......@@ -821,8 +825,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("OnePictureOnlyConstraintFlag", m_onePictureOnlyConstraintFlag, false, "Value of general_intra_constraint_flag. Can only be used for single frame encodings. Will be set to true for still picture profiles")
("IntraConstraintFlag", m_intraConstraintFlag, false, "Value of intra_only_constraint_flag")
#if !JVET_S0266_VUI_length
("NonPackedSource", m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing")
("NonProjectedConstraintFlag", m_nonProjectedConstraintFlag, false, "Indicate that the bitstream contains projection SEI messages")
#endif
("NoResChangeInClvsConstraintFlag", m_noResChangeInClvsConstraintFlag, false, "Indicate that the picture spatial resolution does not change within any CLVS referring to the SPS")
("SingleLayerConstraintFlag", m_singleLayerConstraintFlag, false, "Indicate that the bitstream contains only one layer")
("AllLayersIndependentConstraintFlag", m_allLayersIndependentConstraintFlag, false, "Indicate that all layers are independent")
......@@ -831,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")
......@@ -1177,6 +1187,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("MatrixCoefficients", m_matrixCoefficients, 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries")
("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive")
("InterlacedSource", m_interlacedSourceFlag, false, "Indicate that source is interlaced")
#if JVET_S0266_VUI_length
("NonPackedSource", m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing")
("NonProjectedConstraintFlag", m_nonProjectedConstraintFlag, false, "Indicate that the bitstream contains projection SEI messages")
#endif
("ChromaLocInfoPresent", m_chromaLocInfoPresentFlag, false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present")
("ChromaSampleLocTypeTopField", m_chromaSampleLocTypeTopField, 0, "Specifies the location of chroma samples for top field")
("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField, 0, "Specifies the location of chroma samples for bottom field")
......@@ -1792,9 +1806,20 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
}
else // m_profile == Profile::NONE
{
#if JVET_S0094_CHROMAFORMAT_BITDEPTH_CONSTRAINT
m_bitDepthConstraint = 16; // max value - unconstrained.
#else
m_bitDepthConstraint = 8+15; // max value - unconstrained.
#endif
}
}
#if JVET_S0094_CHROMAFORMAT_BITDEPTH_CONSTRAINT
CHECK(m_bitDepthConstraint < m_internalBitDepth[CHANNEL_TYPE_LUMA], "MaxBitDepthConstraint setting does not allow the specified luma bit depth to be coded.");
CHECK(m_bitDepthConstraint < m_internalBitDepth[CHANNEL_TYPE_CHROMA], "MaxBitDepthConstraint setting does not allow the specified chroma bit depth to be coded.");
CHECK(m_chromaFormatConstraint < m_chromaFormatIDC, "MaxChromaFormatConstraint setting does not allow the specified chroma format to be coded.");
CHECK(m_chromaFormatConstraint >= NUM_CHROMA_FORMAT, "Bad value given for MaxChromaFormatConstraint setting.")
CHECK(m_bitDepthConstraint < 8 || m_bitDepthConstraint>16, "MaxBitDepthConstraint setting must be in the range 8 to 16 (inclusive)");
#endif
}
......@@ -1866,6 +1891,22 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
}
}
#if JVET_R0093_SUBPICS_AND_CONF_WINDOW
if( m_conformanceWindowMode > 0 && m_subPicInfoPresentFlag )
{
for(int i = 0; i < m_numSubPics; i++)
{
CHECK( (m_subPicCtuTopLeftX[i] * m_uiCTUSize) >= (m_iSourceWidth - m_confWinRight * SPS::getWinUnitX(m_chromaFormatIDC)),
"No subpicture can be located completely outside of the conformance cropping window");
CHECK( ((m_subPicCtuTopLeftX[i] + m_subPicWidth[i]) * m_uiCTUSize) <= (m_confWinLeft * SPS::getWinUnitX(m_chromaFormatIDC)),
"No subpicture can be located completely outside of the conformance cropping window" );
CHECK( (m_subPicCtuTopLeftY[i] * m_uiCTUSize) >= (m_iSourceHeight - m_confWinBottom * SPS::getWinUnitY(m_chromaFormatIDC)),
"No subpicture can be located completely outside of the conformance cropping window");
CHECK( ((m_subPicCtuTopLeftY[i] + m_subPicHeight[i]) * m_uiCTUSize) <= (m_confWinTop * SPS::getWinUnitY(m_chromaFormatIDC)),
"No subpicture can be located completely outside of the conformance cropping window");
}
}
#endif
if (tmpDecodedPictureHashSEIMappedType<0 || tmpDecodedPictureHashSEIMappedType>=int(NUMBER_OF_HASHTYPES))
{
......@@ -2563,6 +2604,7 @@ bool EncAppCfg::xCheckParameter()
#endif
#if SHARP_LUMA_DELTA_QP
xConfirmPara( m_lumaLevelToDeltaQPMapping.mode && m_uiDeltaQpRD > 0, "Luma-level-based Delta QP cannot be used together with slice level multiple-QP optimization\n" );
xConfirmPara( m_lumaLevelToDeltaQPMapping.mode && m_RCEnableRateControl, "Luma-level-based Delta QP cannot be used together with rate control\n" );
#endif
if (m_lumaLevelToDeltaQPMapping.mode && m_lmcsEnabled)
{
......
......@@ -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)
{
......
......@@ -221,8 +221,12 @@ static const int NUM_APS_TYPE_LEN = 3; //Curren
static const int MAX_NUM_APS_TYPE = 8; //Currently APS Type has 3 bits so the max type is 8
static const int MAX_TILE_COLS = 20; ///< Maximum number of tile columns
#if JVET_S0156_LEVEL_DEFINITION
static const int MAX_TILES = 440; ///< Maximum number of tiles
#else
static const int MAX_TILE_ROWS = 22; ///< Maximum number of tile rows
static const int MAX_TILES = MAX_TILE_COLS * MAX_TILE_ROWS; ///< Maximum number of tiles
#endif
static const int MAX_SLICES = 600; ///< Maximum number of slices per picture
static const int MLS_GRP_NUM = 1024; ///< Max number of coefficient groups, max(16, 256)
......
......@@ -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);
......
......@@ -140,7 +140,7 @@ public:
void checkAuApsContent( APS *aps, std::vector<int>& accessUnitApsNals )
{
int apsId = aps->getAPSId() + MAX_NUM_APS * aps->getAPSType();
int apsId = ( aps->getAPSId() << NUM_APS_TYPE_LEN ) + aps->getAPSType();
if( std::find( accessUnitApsNals.begin(), accessUnitApsNals.end(), apsId ) != accessUnitApsNals.end() )
{
......
......@@ -193,7 +193,9 @@ Picture::Picture()
m_spliceIdx = NULL;
m_ctuNums = 0;
layerId = NOT_VALID;
#if !JVET_S0258_SUBPIC_CONSTRAINTS
numSubpics = 1;
#endif
numSlices = 1;
}
......
......@@ -216,12 +216,17 @@ public:
int poc;
uint32_t temporalId;
int layerId;
#if JVET_S0258_SUBPIC_CONSTRAINTS
std::vector<SubPic> subPictures;
int numSlices;
#else
int numSubpics;
std::vector<int> subpicWidthInCTUs;
std::vector<int> subpicHeightInCTUs;
std::vector<int> subpicCtuTopLeftX;
std::vector<int> subpicCtuTopLeftY;
int numSlices;
#endif
std::vector<int> sliceSubpicIdx;
bool subLayerNonReferencePictureDueToSTSA;
......@@ -232,7 +237,9 @@ public:
std::vector<bool> m_lossylosslessSliceArray;
bool interLayerRefPicFlag;
#if !JVET_S0258_SUBPIC_CONSTRAINTS
std::vector<int> subPicIDs;
#endif
#if ENABLE_SPLIT_PARALLELISM
PelStorage m_bufs[PARL_SPLIT_MAX_NUM_JOBS][NUM_PIC_TYPES];
......
......@@ -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, 25, 5, 66846720ULL, { 12000, 30000 }, { 4, 4} },
{ Level::LEVEL4_1, 2228224, { 20000, 50000 }, 75, 25, 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
......
......@@ -83,7 +83,11 @@ void RdCost::setLambda( double dLambda, const BitDepths &bitDepths )
m_dLambdaMotionSAD = sqrt(m_dLambda);
}
#if JVET_S0234_ACT_CRS_FIX
void RdCost::lambdaAdjustColorTrans(bool forward, ComponentID componentID, bool applyChromaScale, int* resScaleInv)
#else
void RdCost::lambdaAdjustColorTrans(bool forward, ComponentID componentID)
#endif
{
if (m_resetStore)
{
......@@ -115,6 +119,15 @@ void RdCost::lambdaAdjustColorTrans(bool forward, ComponentID componentID)
m_dLambda = m_lambdaStore[m_pairCheck][componentID];
m_DistScale = m_DistScaleStore[m_pairCheck][componentID];
#if JVET_S0234_ACT_CRS_FIX
if (applyChromaScale)
{
CHECK(m_pairCheck == 0 || componentID == COMPONENT_Y, "wrong lambda adjustment for CS");
double cResScale = (double)(1 << CSCALE_FP_PREC) / (double)(*resScaleInv);
m_dLambda = m_dLambda / (cResScale*cResScale);
m_DistScale = double(1 << SCALE_BITS) / m_dLambda;
}
#endif
if (m_pairCheck == 0)
{
CHECK(m_DistScale != m_DistScaleUnadjusted, "lambda should be adjusted to the original value");
......
......@@ -326,7 +326,11 @@ public:
inline std::vector<double>& getLumaLevelWeightTable () { return m_lumaLevelToWeightPLUT; }
#endif
#if JVET_S0234_ACT_CRS_FIX
void lambdaAdjustColorTrans(bool forward, ComponentID compID, bool applyChromaScale = false, int* resScaleInv = NULL);
#else
void lambdaAdjustColorTrans(bool forward, ComponentID compID);
#endif
void resetStore() { m_resetStore = true; }
private:
......
This diff is collapsed.
This diff is collapsed.
......@@ -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,12 +51,29 @@
#include <cassert>
//########### place macros to be removed in next cycle below this line ###############
#define JVET_S0081_NON_REFERENCED_PIC 1 // JVET-S0081: exclude non-referenced picture to be used as prevTid0 picture
#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
#define JVET_S0266_VUI_length 1 // JVET-S0266: VUI modifications including signalling of VUI length
#define JVET_S0179_CONDITIONAL_SIGNAL_GCI 1 // JVET-S0179: Conditional signalling of GCI fields
#define JVET_S0049_ASPECT4 1 // JVET-S0049 aspect 4: Constrain the value of pps_alf_info_in_ph_flag to be equal to 0 when the PH is in the SH
#define JVET_S0258_SUBPIC_CONSTRAINTS 1 // JVET-S0258: sub-picture constraints
#define JVET_S0074_SPS_REORDER 1 // JVET-S0074: aspect 1, rearrange some syntax elements in SPS
#define JVET_S0234_ACT_CRS_FIX 1 // JVET-S0234: perform chroma residual scaling in RGB domain when ACT is on
#define JVET_S0094_CHROMAFORMAT_BITDEPTH_CONSTRAINT 1 // JVET-S0094: 0 for constraint flags for chroma format and bit depth mean unconstrained, by coding these constraints as subtractive
#define JVET_S0132_HLS_REORDER 1 // Rearrange syntax elements in SPS and PPS
#define JVET_S0221_NUM_VB_CHECK 1 // JVET_S0221: Constraints on the number of virtual boundaries
......@@ -69,15 +86,48 @@
#define JVET_S0155_EOS_NALU_CHECK 1 // JVET-S0155: Constraints on EOS NAL units
#define JVET_R0093_SUBPICS_AND_CONF_WINDOW 1 // JVET-R0093 and JVET-R0294: Constraint on subpictures and conformance cropping window, and rewriting of conformance cropping window in subpicture extraction
#define JVET_S0160_ASPECT1_ASPECT9 1 // JVET-S0160: Aspect 1 Infer the value of pps_loop_filter_across_tiles_enabled_flag to be equal to 0 (instead of 1) when not present
// Aspect 9 The value of ph_poc_msb_cycle_present_flag is required to be equal to 0 when vps_independent_layer_flag[GeneralLayerIdx[nuh_layer_id]] is equal to 0 and there is an ILRP entry in RefPicList[0] or RefPicList[1] of a slice of the current picture
#define JVET_S0048_SCALING_OFFSET 1 // JVET-S0048 Aspect2: change the constraint on the value ranges of scaling window offsets to be more flexible
#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_S0064_SEI_BUFFERING_PERIOD_CLEANUP 1 // JVET-S0064: Conditionally signal bp_sublayer_dpb_output_offsets_present_flag
#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_S0182_RPL_SIGNALLING 1 // JVET-S0182: modifications to rpl information signalling
#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
......
......@@ -127,26 +127,74 @@ bool CU::getRprScaling( const SPS* sps, const PPS* curPPS, Picture* refPic, int&
CHECK(curPicWidth > refPicWidth * 8, "curPicWidth shall be less than or equal to refPicWidth * 8");
CHECK(curPicHeight > refPicHeight * 8, "curPicHeight shall be less than or equal to refPicHeight * 8");
#if JVET_S0048_SCALING_OFFSET
int subWidthC = SPS::getWinUnitX(sps->getChromaFormatIdc());
int subHeightC = SPS::getWinUnitY(sps->getChromaFormatIdc());
CHECK(subWidthC * curScalingWindow.getWindowLeftOffset() < (-curPicWidthY) * 15, "The value of SubWidthC * pps_scaling_win_left_offset shall be greater than or equal to -pps_pic_width_in_luma_samples * 15");
CHECK(subWidthC * curScalingWindow.getWindowLeftOffset() >= curPicWidthY, "The value of SubWidthC * pps_scaling_win_left_offset shall be less than pic_width_in_luma_samples");
CHECK(subWidthC * curScalingWindow.getWindowRightOffset() < (-curPicWidthY) * 15, "The value of SubWidthC * pps_scaling_win_right_offset shall be greater than or equal to -pps_pic_width_in_luma_samples * 15");
CHECK(subWidthC * curScalingWindow.getWindowRightOffset() >= curPicWidthY, "The value of SubWidthC * pps_scaling_win_right_offset shall be less than pic_width_in_luma_samples");
CHECK(subHeightC * curScalingWindow.getWindowTopOffset() < (-curPicHeightY) * 15, "The value of SubHeightC * pps_scaling_win_top_offset shall be greater than or equal to -pps_pic_height_in_luma_samples * 15");
CHECK(subHeightC * curScalingWindow.getWindowTopOffset() >= curPicHeightY, "The value of SubHeightC * pps_scaling_win_top_offset shall be less than pps_pic_height_in_luma_samples");
CHECK(subHeightC * curScalingWindow.getWindowBottomOffset() < (-curPicHeightY) * 15, "The value of SubHeightC *pps_scaling_win_bottom_offset shall be greater than or equal to -pps_pic_height_in_luma_samples * 15");
CHECK(subHeightC * curScalingWindow.getWindowBottomOffset() >= curPicHeightY, "The value of SubHeightC *pps_scaling_win_bottom_offset shall be less than pps_pic_height_in_luma_samples");
CHECK(subWidthC * (curScalingWindow.getWindowLeftOffset() + curScalingWindow.getWindowRightOffset()) < (-curPicWidthY) * 15, "The value of SubWidthC * ( pps_scaling_win_left_offset + pps_scaling_win_right_offset ) shall be greater than or equal to -pps_pic_width_in_luma_samples * 15");
CHECK(subWidthC * (curScalingWindow.getWindowLeftOffset() + curScalingWindow.getWindowRightOffset()) >= curPicWidthY, "The value of SubWidthC * ( pps_scaling_win_left_offset + pps_scaling_win_right_offset ) shall be less than pic_width_in_luma_samples");
CHECK(subHeightC * (curScalingWindow.getWindowTopOffset() + curScalingWindow.getWindowBottomOffset()) < (-curPicHeightY) * 15, "The value of SubHeightC * ( pps_scaling_win_top_offset + pps_scaling_win_bottom_offset ) shall be greater than or equal to -pps_pic_height_in_luma_samples * 15");
CHECK(subHeightC * (curScalingWindow.getWindowTopOffset() + curScalingWindow.getWindowBottomOffset()) >= curPicHeightY, "The value of SubHeightC * ( pps_scaling_win_top_offset + pps_scaling_win_bottom_offset ) shall be less than pic_height_in_luma_samples");
#else
CHECK(SPS::getWinUnitX(sps->getChromaFormatIdc()) * (abs(curScalingWindow.getWindowLeftOffset()) + abs(curScalingWindow.getWindowRightOffset())) > curPPS->getPicWidthInLumaSamples(), "The value of SubWidthC * ( Abs(pps_scaling_win_left_offset) + Abs(pps_scaling_win_right_offset) ) shall be less than pic_width_in_luma_samples");
CHECK(SPS::getWinUnitY(sps->getChromaFormatIdc()) * (abs(curScalingWindow.getWindowTopOffset()) + abs(curScalingWindow.getWindowBottomOffset())) > curPPS->getPicHeightInLumaSamples(), "The value of SubHeightC * ( Abs(pps_scaling_win_top_offset) + Abs(pps_scaling_win_bottom_offset) ) shall be less than pic_height_in_luma_samples");
#endif
return refPic->isRefScaled( curPPS );
}
void CU::checkConformanceILRP(Slice *slice)
{
const int numRefList = (slice->getSliceType() == B_SLICE) ? (2) : (1);
const int numRefList = slice->isInterB() ? 2 : 1;
#if JVET_S0258_SUBPIC_CONSTRAINTS
int currentSubPicIdx = NOT_VALID;
// derive sub-picture index for the current slice
for( int subPicIdx = 0; subPicIdx < slice->getPic()->cs->sps->getNumSubPics(); subPicIdx++ )
{
if( slice->getPic()->cs->pps->getSubPic( subPicIdx ).getSubPicID() == slice->getSliceSubPicId() )
{
currentSubPicIdx = subPicIdx;
break;
}
}
CHECK( currentSubPicIdx == NOT_VALID, "Sub-picture was not found" );
if( !slice->getPic()->cs->sps->getSubPicTreatedAsPicFlag( currentSubPicIdx ) )
{
return;
}
#endif
//constraint 1: The picture referred to by each active entry in RefPicList[ 0 ] or RefPicList[ 1 ] has the same subpicture layout as the current picture
bool isAllRefSameSubpicLayout = true;
for (int refList = 0; refList < numRefList; refList++) // loop over l0 and l1
{
RefPicList eRefPicList = (refList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);
for (int refIdx = 0; refIdx < slice->getNumRefIdx(eRefPicList); refIdx++)
{
#if JVET_S0258_SUBPIC_CONSTRAINTS
const Picture* refPic = slice->getRefPic( eRefPicList, refIdx );
if( refPic->subPictures.size() != slice->getPic()->cs->pps->getNumSubPics() )
#else
const Picture* refPic = slice->getRefPic(eRefPicList, refIdx)->unscaledPic;
if (refPic->numSubpics != slice->getPic()->cs->pps->getNumSubPics())
#endif
{
isAllRefSameSubpicLayout = false;
refList = numRefList;
......@@ -154,12 +202,26 @@ void CU::checkConformanceILRP(Slice *slice)
}
else
{
#if JVET_S0258_SUBPIC_CONSTRAINTS
for( int i = 0; i < refPic->subPictures.size(); i++ )
{
const SubPic& refSubPic = refPic->subPictures[i];
const SubPic& curSubPic = slice->getPic()->cs->pps->getSubPic( i );
if( refSubPic.getSubPicWidthInCTUs() != curSubPic.getSubPicWidthInCTUs()
|| refSubPic.getSubPicHeightInCTUs() != curSubPic.getSubPicHeightInCTUs()
|| refSubPic.getSubPicCtuTopLeftX() != curSubPic.getSubPicCtuTopLeftX()
|| refSubPic.getSubPicCtuTopLeftY() != curSubPic.getSubPicCtuTopLeftY()
|| ( refPic->layerId != slice->getPic()->layerId && refSubPic.getSubPicID() != curSubPic.getSubPicID() )
|| refSubPic.getTreatedAsPicFlag() != curSubPic.getTreatedAsPicFlag())
#else
for (int i = 0; i < refPic->numSubpics; i++)
{
if (refPic->subpicWidthInCTUs[i] != slice->getPic()->cs->pps->getSubPic(i).getSubPicWidthInCTUs()
|| refPic->subpicHeightInCTUs[i] != slice->getPic()->cs->pps->getSubPic(i).getSubPicHeightInCTUs()
|| refPic->subpicCtuTopLeftX[i] != slice->getPic()->cs->pps->getSubPic(i).getSubPicCtuTopLeftX()
|| refPic->subpicCtuTopLeftY[i] != slice->getPic()->cs->pps->getSubPic(i).getSubPicCtuTopLeftY())
#endif
{
isAllRefSameSubpicLayout = false;
refIdx = slice->getNumRefIdx(eRefPicList);
......@@ -167,6 +229,14 @@ void CU::checkConformanceILRP(Slice *slice)
break;
}
}
#if JVET_S0258_SUBPIC_CONSTRAINTS
// A picture with different sub-picture ID of the collocated sub-picture cannot be used as an active reference picture in the same layer
if( refPic->layerId == slice->getPic()->layerId )
{
isAllRefSameSubpicLayout = isAllRefSameSubpicLayout && refPic->subPictures[currentSubPicIdx].getSubPicID() == slice->getSliceSubPicId();
}
#endif
}
}
}
......@@ -179,8 +249,13 @@ void CU::checkConformanceILRP(Slice *slice)
RefPicList eRefPicList = (refList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);
for (int refIdx = 0; refIdx < slice->getNumRefIdx(eRefPicList); refIdx++)
{
#if JVET_S0258_SUBPIC_CONSTRAINTS
const Picture* refPic = slice->getRefPic( eRefPicList, refIdx );
CHECK( refPic->layerId == slice->getPic()->layerId || refPic->subPictures.size() > 1, "The inter-layer reference shall contain a single subpicture or have same subpicture layout with the current picture" );
#else
const Picture* refPic = slice->getRefPic(eRefPicList, refIdx)->unscaledPic;
CHECK(!(refPic->layerId != slice->getPic()->layerId && refPic->numSubpics == 1), "The inter-layer reference shall contain a single subpicture or have same subpicture layout with the current picture");
#endif
}
}
}
......
......@@ -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
......
......@@ -347,7 +347,11 @@ void DecCu::xIntraRecACTBlk(TransformUnit& tu)
CHECK(pu.intraDir[CHANNEL_TYPE_CHROMA] != DM_CHROMA_IDX, "chroma should use DM mode for adaptive color transform");
bool flag = slice.getLmcsEnabledFlag() && (slice.isIntra() || (!slice.isIntra() && m_pcReshape->getCTUFlag()));
#if JVET_S0234_ACT_CRS_FIX
if (flag && slice.getPicHeader()->getLmcsChromaResidualScaleFlag())
#else
if (flag && slice.getPicHeader()->getLmcsChromaResidualScaleFlag() && (tu.cbf[COMPONENT_Cb] || tu.cbf[COMPONENT_Cr]))
#endif
{
const Area area = tu.Y().valid() ? tu.Y() : Area(recalcPosition(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].pos()), recalcSize(tu.chromaFormat, tu.chType, CHANNEL_TYPE_LUMA, tu.blocks[tu.chType].size()));
const CompArea &areaY = CompArea(COMPONENT_Y, tu.chromaFormat, area);
......@@ -407,11 +411,13 @@ void DecCu::xIntraRecACTBlk(TransformUnit& tu)
}
}
#if !JVET_S0234_ACT_CRS_FIX
flag = flag && (tu.blocks[compID].width*tu.blocks[compID].height > 4);
if (flag && (TU::getCbf(tu, compID) || tu.jointCbCr) && isChroma(compID) && slice.getPicHeader()->getLmcsChromaResidualScaleFlag())
{