...
 
Commits (693)
......@@ -146,6 +146,7 @@ add_subdirectory( "source/App/DecoderApp" )
add_subdirectory( "source/App/EncoderApp" )
add_subdirectory( "source/App/SEIRemovalApp" )
add_subdirectory( "source/App/Parcat" )
add_subdirectory( "source/App/StreamMergeApp" )
if( EXTENSION_360_VIDEO )
add_subdirectory( "source/App/utils/360ConvertApp" )
endif()
......@@ -17,7 +17,7 @@ BUILD_SCRIPT := $(CURDIR)/cmake/CMakeBuild/bin/cmake.py
#
TARGETS := CommonLib DecoderAnalyserApp DecoderAnalyserLib DecoderApp DecoderLib
TARGETS += EncoderApp EncoderLib Utilities SEIRemovalApp
TARGETS += EncoderApp EncoderLib Utilities SEIRemovalApp StreamMergeApp
ifeq ($(OS),Windows_NT)
ifneq ($(MSYSTEM),)
......
CacheEnable : 1
CacheLineSize : 256
NumCacheLine : 64
NumWay : 4
CacheAddrMode : 0
FrameReport :
CacheEnable : 1
CacheLineSize : 256
NumCacheLine : 64
NumWay : 4
CacheAddrMode : 1
BlkWidth : 16
BlkHeight : 16
FrameReport : 0
......@@ -9,11 +9,6 @@ Profile : next
MaxCUWidth : 64 # Maximum coding unit width in pixel
MaxCUHeight : 64 # Maximum coding unit height in pixel
MaxPartitionDepth : 4 # Maximum coding unit depth
# obsoleted by TULog2MaxSize
#QuadtreeTULog2MinSize : 2 # Log2 of minimum transform size for
# # quadtree-based TU coding (2...6)
QuadtreeTUMaxDepthInter : 3
QuadtreeTUMaxDepthIntra : 3
#======== Coding Structure =============
IntraPeriod : 1 # Period of I-Frame ( -1 = only first)
......@@ -31,7 +26,7 @@ FDM : 1 # Fast Decision for Merge RD cost
#======== Quantization =============
QP : 32 # Quantization parameter(0-51)
MaxDeltaQP : 0 # CU-based multi-QP optimization
MaxCuDQPDepth : 0 # Max depth of a minimum CuDQP for sub-LCU-level delta QP
MaxCuDQPSubdiv : 0 # Maximum subdiv for CU luma Qp adjustment
DeltaQpRD : 0 # Slice-based multi-QP optimization
RDOQ : 1 # RDOQ
RDOQTS : 1 # RDOQ for transform skip
......@@ -84,12 +79,12 @@ CbQpOffset : 1
CrQpOffset : 1
TemporalSubsampleRatio : 8
ReWriteParamSets : 1
#============ NEXT ====================
# General
CTUSize : 128
LCTUFast : 1
QuadtreeTULog2MaxSize : 6
DualITree : 1 # separate partitioning of luma and chroma channels for I-slices
MinQTLumaISlice : 8
......@@ -103,6 +98,8 @@ MTS : 1
MTSIntraMaxCand : 3
MTSInterMaxCand : 4
SBT : 1
LFNST : 1
ISP : 1
Affine : 1
SubPuMvp : 1
MaxNumMergeCand : 6
......@@ -114,12 +111,15 @@ IBC : 0 # turned off in CTC
AllowDisFracMMVD : 1
AffineAmvr : 0
LumaReshapeEnable : 1 # luma reshaping. 0: disable 1:enable
MIP : 1
# Fast tools
PBIntraFast : 1
ISPFast : 1
FastMrg : 1
AMaxBT : 1
FastMIP : 1
FastLFNST : 1
# Encoder optimization tools
AffineAmvrEncOpt : 0
......
......@@ -9,11 +9,6 @@ Profile : next
MaxCUWidth : 64 # Maximum coding unit width in pixel
MaxCUHeight : 64 # Maximum coding unit height in pixel
MaxPartitionDepth : 4 # Maximum coding unit depth
# obsoleted by TULog2MaxSize
#QuadtreeTULog2MinSize : 2 # Log2 of minimum transform size for
# # quadtree-based TU coding (2...6)
QuadtreeTUMaxDepthInter : 3
QuadtreeTUMaxDepthIntra : 3
#======== Coding Structure =============
IntraPeriod : -1 # Period of I-Frame ( -1 = only first)
......@@ -22,11 +17,11 @@ GOPSize : 4 # GOP Size (number of B slice = GOPS
IntraQPOffset : -1
LambdaFromQpEnable : 1 # see JCTVC-X0038 for suitable parameters for IntraQPOffset, QPoffset, QPOffsetModelOff, QPOffsetModelScale when enabled
# Type POC QPoffset QPOffsetModelOff QPOffsetModelScale CbQPoffset CrQPoffset QPfactor tcOffsetDiv2 betaOffsetDiv2 temporal_id #ref_pics_active #ref_pics reference pictures predict deltaRPS #ref_idcs reference idcs
Frame1: P 1 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 -1 -5 -9 -13 0
Frame2: P 2 4 -6.5 0.2590 0 0 1.0 0 0 0 4 4 -1 -2 -6 -10 1 -1 5 1 1 1 0 1
Frame3: P 3 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 -1 -3 -7 -11 1 -1 5 0 1 1 1 1
Frame4: P 4 1 0.0 0.0 0 0 1.0 0 0 0 4 4 -1 -4 -8 -12 1 -1 5 0 1 1 1 1
# Type POC QPoffset QPOffsetModelOff QPOffsetModelScale CbQPoffset CrQPoffset QPfactor tcOffsetDiv2 betaOffsetDiv2 temporal_id #ref_pics_active_L0 #ref_pics_L0 reference_pictures_L0 #ref_pics_active_L1 #ref_pics_L1 reference_pictures_L1
Frame1: P 1 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 5 9 13 0 0
Frame2: P 2 4 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 2 6 10 0 0
Frame3: P 3 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 3 7 11 0 0
Frame4: P 4 1 0.0 0.0 0 0 1.0 0 0 0 4 4 1 4 8 12 0 0
#=========== Motion Search =============
FastSearch : 1 # 0:Full search 1:TZ search
......@@ -39,7 +34,7 @@ FDM : 1 # Fast Decision for Merge RD cost
#======== Quantization =============
QP : 32 # Quantization parameter(0-51)
MaxDeltaQP : 0 # CU-based multi-QP optimization
MaxCuDQPDepth : 0 # Max depth of a minimum CuDQP for sub-LCU-level delta QP
MaxCuDQPSubdiv : 0 # Maximum subdiv for CU luma Qp adjustment
DeltaQpRD : 0 # Slice-based multi-QP optimization
RDOQ : 1 # RDOQ
RDOQTS : 1 # RDOQ for transform skip
......@@ -100,12 +95,12 @@ SEIDecodedPictureHash : 0
CbQpOffset : 1
CrQpOffset : 1
ReWriteParamSets : 1
#============ NEXT ====================
# General
CTUSize : 128
LCTUFast : 1
QuadtreeTULog2MaxSize : 6
DualITree : 1 # separate partitioning of luma and chroma channels for I-slices
MinQTLumaISlice : 8
......@@ -119,6 +114,7 @@ MTS : 1
MTSIntraMaxCand : 3
MTSInterMaxCand : 4
SBT : 1
ISP : 1
Affine : 1
SubPuMvp : 1
MaxNumMergeCand : 6
......@@ -131,17 +127,20 @@ IBC : 0 # turned off in CTC
AllowDisFracMMVD : 1
AffineAmvr : 0
LumaReshapeEnable : 1 # luma reshaping. 0: disable 1:enable
MIP : 1
# Fast tools
PBIntraFast : 1
ISPFast : 1
FastMrg : 1
AMaxBT : 1
FastMIP : 0
# Encoder optimization tools
AffineAmvrEncOpt : 0
MmvdDisNum : 6
### DO NOT ADD ANYTHING BELOW THIS LINE ###
### DO NOT DELETE THE EMPTY LINE BELOW ###
......@@ -9,11 +9,6 @@ Profile : next
MaxCUWidth : 64 # Maximum coding unit width in pixel
MaxCUHeight : 64 # Maximum coding unit height in pixel
MaxPartitionDepth : 4 # Maximum coding unit depth
# obsoleted by TULog2MaxSize
#QuadtreeTULog2MinSize : 2 # Log2 of minimum transform size for
# # quadtree-based TU coding (2...6)
QuadtreeTUMaxDepthInter : 3
QuadtreeTUMaxDepthIntra : 3
#======== Coding Structure =============
IntraPeriod : -1 # Period of I-Frame ( -1 = only first)
......@@ -22,11 +17,11 @@ GOPSize : 4 # GOP Size (number of B slice = GOPS
IntraQPOffset : -1
LambdaFromQpEnable : 1 # see JCTVC-X0038 for suitable parameters for IntraQPOffset, QPoffset, QPOffsetModelOff, QPOffsetModelScale when enabled
# Type POC QPoffset QPOffsetModelOff QPOffsetModelScale CbQPoffset CrQPoffset QPfactor tcOffsetDiv2 betaOffsetDiv2 temporal_id #ref_pics_active #ref_pics reference pictures predict deltaRPS #ref_idcs reference idcs
Frame1: B 1 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 -1 -5 -9 -13 0
Frame2: B 2 4 -6.5 0.2590 0 0 1.0 0 0 0 4 4 -1 -2 -6 -10 1 -1 5 1 1 1 0 1
Frame3: B 3 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 -1 -3 -7 -11 1 -1 5 0 1 1 1 1
Frame4: B 4 1 0.0 0.0 0 0 1.0 0 0 0 4 4 -1 -4 -8 -12 1 -1 5 0 1 1 1 1
# Type POC QPoffset QPOffsetModelOff QPOffsetModelScale CbQPoffset CrQPoffset QPfactor tcOffsetDiv2 betaOffsetDiv2 temporal_id #ref_pics_active_L0 #ref_pics_L0 reference_pictures_L0 #ref_pics_active_L1 #ref_pics_L1 reference_pictures_L1
Frame1: B 1 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 5 9 13 4 4 1 5 9 13
Frame2: B 2 4 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 2 6 10 4 4 1 2 6 10
Frame3: B 3 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 3 7 11 4 4 1 3 7 11
Frame4: B 4 1 0.0 0.0 0 0 1.0 0 0 0 4 4 1 4 8 12 4 4 1 4 8 12
#=========== Motion Search =============
FastSearch : 1 # 0:Full search 1:TZ search
......@@ -39,7 +34,7 @@ FDM : 1 # Fast Decision for Merge RD cost
#======== Quantization =============
QP : 32 # Quantization parameter(0-51)
MaxDeltaQP : 0 # CU-based multi-QP optimization
MaxCuDQPDepth : 0 # Max depth of a minimum CuDQP for sub-LCU-level delta QP
MaxCuDQPSubdiv : 0 # Maximum subdiv for CU luma Qp adjustment
DeltaQpRD : 0 # Slice-based multi-QP optimization
RDOQ : 1 # RDOQ
RDOQTS : 1 # RDOQ for transform skip
......@@ -100,12 +95,12 @@ SEIDecodedPictureHash : 0
CbQpOffset : 1
CrQpOffset : 1
ReWriteParamSets : 1
#============ NEXT ====================
# General
CTUSize : 128
LCTUFast : 1
QuadtreeTULog2MaxSize : 6
DualITree : 1 # separate partitioning of luma and chroma channels for I-slices
MinQTLumaISlice : 8
......@@ -119,6 +114,8 @@ MTS : 1
MTSIntraMaxCand : 3
MTSInterMaxCand : 4
SBT : 1
ISP : 1
MMVD : 1
Affine : 1
SubPuMvp : 1
MaxNumMergeCand : 6
......@@ -134,17 +131,20 @@ IBC : 0 # turned off in CTC
AllowDisFracMMVD : 1
AffineAmvr : 0
LumaReshapeEnable : 1 # luma reshaping. 0: disable 1:enable
MIP : 1
# Fast tools
PBIntraFast : 1
ISPFast : 1
FastMrg : 1
AMaxBT : 1
FastMIP : 0
# Encoder optimization tools
AffineAmvrEncOpt : 0
MmvdDisNum : 6
### DO NOT ADD ANYTHING BELOW THIS LINE ###
### DO NOT DELETE THE EMPTY LINE BELOW ###
This diff is collapsed.
# ======== Luma adaptive QP ==========
LumaLevelToDeltaQPMode : 1 # Change luma delta QP based on average luma
isSDR : 0 # 1: SDR in PQ container, 0: HDR
# ======= LMCS =======================
LumaReshapeEnable : 0 # turned off in HDR CTC
#======== Chroma QP scale ============
WCGPPSEnable : 1 # enable WCG Chroma scale
WCGPPSChromaQpScale : -0.46 # Linear chroma QP offset mapping (scale) based on QP
WCGPPSChromaQpOffset : 9.26 # Linear chroma QP offset mapping (offset) based on QP
WCGPPSCbQpScale : 1.14 # Scale factor depending on capture and representation color space
WCGPPSCrQpScale : 1.79 # Scale factor depending on capture and representation color space
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 0 # Change luma delta QP based on average luma
# ======= LMCS =======================
LumaReshapeEnable : 0 # turned off in HDR CTC
ReshapeSignalType : 2 # set signal type to HLG if enabled
#======== Chroma QP scale ============
WCGPPSEnable : 0 # enable WCG Chroma scale
......@@ -9,15 +9,3 @@ SourceHeight : 1080 # Input frame height
FramesToBeEncoded : 240 # Number of frames to be coded
Level : 4.1
#======== Chroma QP scale =============
WCGPPSEnable : 1 # enable WCG Chroma scale
WCGPPSEnable : 1 # enable WCG Chroma scale
WCGPPSChromaQpScale : -0.46 # Linear chroma QP offset mapping (scale) based on QP
WCGPPSChromaQpOffset : 9.26 # Linear chroma QP offset mapping (offset) based on QP
WCGPPSCbQpScale : 1.14 # Scale factor depending on capture and representation color space
WCGPPSCrQpScale : 1.79 # Scale factor depending on capture and representation color space
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 1 # Change luma delta QP based on average luma
isSDR : 0 # 1: SDR in PQ container, 0: HDR
......@@ -11,12 +11,5 @@ FramesToBeEncoded : 240 # Number of frames to be coded
Level : 4.1
#======== Chroma QP scale =============
WCGPPSEnable : 1 # enable WCG Chroma scale
WCGPPSChromaQpScale : -0.46 # Linear chroma QP offset mapping (scale) based on QP
WCGPPSChromaQpOffset : 9.26 # Linear chroma QP offset mapping (offset) based on QP
WCGPPSCbQpScale : 1.04 # Scale factor depending on capture and representation color space
WCGPPSCrQpScale : 1.39 # Scale factor depending on capture and representation color space
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 1 # Change luma delta QP based on average luma
isSDR : 0 # 1: SDR in PQ container, 0: HDR
......@@ -9,14 +9,3 @@ SourceHeight : 1080 # Input frame height
FramesToBeEncoded : 500 # Number of frames to be coded
Level : 4.1
#======== Chroma QP scale =============
WCGPPSEnable : 1 # enable WCG Chroma scale
WCGPPSChromaQpScale : -0.46 # Linear chroma QP offset mapping (scale) based on QP
WCGPPSChromaQpOffset : 9.26 # Linear chroma QP offset mapping (offset) based on QP
WCGPPSCbQpScale : 1.14 # Scale factor depending on capture and representation color space
WCGPPSCrQpScale : 1.79 # Scale factor depending on capture and representation color space
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 1 # Change luma delta QP based on average luma
isSDR : 0 # 1: SDR in PQ container, 0: HDR
......@@ -9,14 +9,3 @@ SourceHeight : 1080 # Input frame height
FramesToBeEncoded : 500 # Number of frames to be coded
Level : 4.1
#======== Chroma QP scale =============
WCGPPSEnable : 1 # enable WCG Chroma scale
WCGPPSChromaQpScale : -0.46 # Linear chroma QP offset mapping (scale) based on QP
WCGPPSChromaQpOffset : 9.26 # Linear chroma QP offset mapping (offset) based on QP
WCGPPSCbQpScale : 1.14 # Scale factor depending on capture and representation color space
WCGPPSCrQpScale : 1.79 # Scale factor depending on capture and representation color space
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 1 # Change luma delta QP based on average luma
isSDR : 0 # 1: SDR in PQ container, 0: HDR
......@@ -9,14 +9,3 @@ SourceHeight : 1080 # Input frame height
FramesToBeEncoded : 400 # Number of frames to be coded
Level : 4.1
#======== Chroma QP scale =============
WCGPPSEnable : 1 # enable WCG Chroma scale
WCGPPSChromaQpScale : -0.46 # Linear chroma QP offset mapping (scale) based on QP
WCGPPSChromaQpOffset : 9.26 # Linear chroma QP offset mapping (offset) based on QP
WCGPPSCbQpScale : 1.14 # Scale factor depending on capture and representation color space
WCGPPSCrQpScale : 1.79 # Scale factor depending on capture and representation color space
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 1 # Change luma delta QP based on average luma
isSDR : 0 # 1: SDR in PQ container, 0: HDR
......@@ -11,12 +11,5 @@ FramesToBeEncoded : 339 # Number of frames to be coded
Level : 4.1
#======== Chroma QP scale =============
WCGPPSEnable : 1 # enable WCG Chroma scale
WCGPPSChromaQpScale : -0.46 # Linear chroma QP offset mapping (scale) based on QP
WCGPPSChromaQpOffset : 9.26 # Linear chroma QP offset mapping (offset) based on QP
WCGPPSCbQpScale : 1.04 # Scale factor depending on capture and representation color space
WCGPPSCrQpScale : 1.39 # Scale factor depending on capture and representation color space
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 1 # Change luma delta QP based on average luma
isSDR : 0 # 1: SDR in PQ container, 0: HDR
......@@ -9,14 +9,3 @@ SourceHeight : 1080 # Input frame height
FramesToBeEncoded : 200 # Number of frames to be coded
Level : 4.1
#======== Chroma QP scale =============
WCGPPSEnable : 1 # enable WCG Chroma scale
WCGPPSChromaQpScale : -0.46 # Linear chroma QP offset mapping (scale) based on QP
WCGPPSChromaQpOffset : 9.26 # Linear chroma QP offset mapping (offset) based on QP
WCGPPSCbQpScale : 1.14 # Scale factor depending on capture and representation color space
WCGPPSCrQpScale : 1.79 # Scale factor depending on capture and representation color space
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 1 # Change luma delta QP based on average luma
isSDR : 0 # 1: SDR in PQ container, 0: HDR
......@@ -9,10 +9,3 @@ SourceHeight : 2160 # Input frame height
FramesToBeEncoded : 300 # Number of frames to be coded
Level : 5.1
#======== Chroma QP scale =============
WCGPPSEnable : 0 # enable WCG Chroma scale
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 0 # Change luma delta QP based on average luma
#======== File I/O ===============
InputFile : DayStreet_3840x2160_60p_10bit_420_hlg.yuv
InputBitDepth : 10 # Input bitdepth
InputChromaFormat : 420 # Ratio of luminance to chrominance samples
FrameRate : 60 # Frame Rate per second
FrameSkip : 0 # Number of frames to be skipped in input
SourceWidth : 3840 # Input frame width
SourceHeight : 2160 # Input frame height
FramesToBeEncoded : 600 # Number of frames to be coded
Level : 5.1
#======== Chroma QP scale =============
WCGPPSEnable : 0 # enable WCG Chroma scale
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 0 # Change luma delta QP based on average luma
......@@ -9,10 +9,3 @@ SourceHeight : 2160 # Input frame height
FramesToBeEncoded : 300 # Number of frames to be coded
Level : 5.1
#======== Chroma QP scale =============
WCGPPSEnable : 0 # enable WCG Chroma scale
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 0 # Change luma delta QP based on average luma
......@@ -9,10 +9,3 @@ SourceHeight : 2160 # Input frame height
FramesToBeEncoded : 300 # Number of frames to be coded
Level : 5.1
#======== Chroma QP scale =============
WCGPPSEnable : 0 # enable WCG Chroma scale
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 0 # Change luma delta QP based on average luma
#======== File I/O ===============
InputFile : PeopleInShoppingCenter_3840x2160_60p_10bit_420_hlg.yuv
InputBitDepth : 10 # Input bitdepth
InputChromaFormat : 420 # Ratio of luminance to chrominance samples
FrameRate : 60 # Frame Rate per second
FrameSkip : 0 # Number of frames to be skipped in input
SourceWidth : 3840 # Input frame width
SourceHeight : 2160 # Input frame height
FramesToBeEncoded : 600 # Number of frames to be coded
Level : 5.1
#======== Chroma QP scale =============
WCGPPSEnable : 0 # enable WCG Chroma scale
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 0 # Change luma delta QP based on average luma
......@@ -9,9 +9,3 @@ SourceHeight : 2160 # Input frame height
FramesToBeEncoded : 300 # Number of frames to be coded
Level : 5.1
#======== Chroma QP scale =============
WCGPPSEnable : 0 # enable WCG Chroma scale
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 0 # Change luma delta QP based on average luma
\ No newline at end of file
#======== File I/O ===============
InputFile : SunsetBeach2_3840x2160p_60_10b_HLG_420.yuv
InputBitDepth : 10 # Input bitdepth
InputChromaFormat : 420 # Ratio of luminance to chrominance samples
FrameRate : 60 # Frame Rate per second
FrameSkip : 0 # Number of frames to be skipped in input
SourceWidth : 3840 # Input frame width
SourceHeight : 2160 # Input frame height
FramesToBeEncoded : 600 # Number of frames to be coded
Level : 5.1
#======== Chroma QP scale =============
WCGPPSEnable : 0 # enable WCG Chroma scale
# ======== Luma adaptive QP ========
LumaLevelToDeltaQPMode : 0 # Change luma delta QP based on average luma
No preview for this file type
This diff is collapsed.
......@@ -153,7 +153,7 @@ uint32_t DecApp::decode()
{
read(nalu);
if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) )
if ((m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) || !isNaluTheTargetLayer(&nalu))
{
bNewPicture = false;
}
......@@ -233,11 +233,8 @@ uint32_t DecApp::decode()
m_cDecLib.setNoOutputPriorPicsFlag (false);
}
if ( bNewPicture &&
( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
|| nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
|| nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP
|| nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL
|| nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ) )
( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
|| nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP) )
{
xFlushOutput( pcListPic );
}
......@@ -247,7 +244,8 @@ uint32_t DecApp::decode()
m_cDecLib.setFirstSliceInPicture (false);
}
// write reconstruction to file -- for additional bumping as defined in C.5.2.3
if(!bNewPicture && nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL_N && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL31)
if (!bNewPicture && ((nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL_15)
|| (nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_IDR_W_RADL && nalu.m_nalUnitType <= NAL_UNIT_CODED_SLICE_GRA)))
{
xWriteOutput( pcListPic, nalu.m_temporalId );
}
......@@ -294,6 +292,9 @@ void DecApp::xCreateDecLib()
#endif
);
m_cDecLib.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
m_cDecLib.setTargetDecLayer(m_iTargetLayer);
if (!m_outputDecodedSEIMessagesFilename.empty())
{
std::ostream &os=m_seiMessageFileStream.is_open() ? m_seiMessageFileStream : std::cout;
......@@ -386,7 +387,6 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId )
if ( !m_reconFileName.empty() )
{
const Window &conf = pcPicTop->cs->sps->getConformanceWindow();
const Window defDisp = (m_respectDefDispWindow && pcPicTop->cs->sps->getVuiParametersPresentFlag()) ? pcPicTop->cs->sps->getVuiParameters()->getDefaultDisplayWindow() : Window();
const bool isTff = pcPicTop->topField;
bool display = true;
......@@ -405,10 +405,10 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId )
m_cVideoIOYuvReconFile.write( pcPicTop->getRecoBuf(), pcPicBottom->getRecoBuf(),
m_outputColourSpaceConvert,
false, // TODO: m_packedYUVMode,
conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(),
conf.getWindowLeftOffset(),
conf.getWindowRightOffset(),
conf.getWindowTopOffset(),
conf.getWindowBottomOffset(),
NUM_CHROMA_FORMAT, isTff );
}
}
......@@ -452,15 +452,14 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId )
if (!m_reconFileName.empty())
{
const Window &conf = pcPic->cs->sps->getConformanceWindow();
const Window defDisp = (m_respectDefDispWindow && pcPic->cs->sps->getVuiParametersPresentFlag()) ? pcPic->cs->sps->getVuiParameters()->getDefaultDisplayWindow() : Window();
m_cVideoIOYuvReconFile.write( pcPic->getRecoBuf(),
m_outputColourSpaceConvert,
m_packedYUVMode,
conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(),
conf.getWindowLeftOffset(),
conf.getWindowRightOffset(),
conf.getWindowTopOffset(),
conf.getWindowBottomOffset(),
NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range );
}
......@@ -515,16 +514,15 @@ void DecApp::xFlushOutput( PicList* pcListPic )
if ( !m_reconFileName.empty() )
{
const Window &conf = pcPicTop->cs->sps->getConformanceWindow();
const Window defDisp = (m_respectDefDispWindow && pcPicTop->cs->sps->getVuiParametersPresentFlag()) ? pcPicTop->cs->sps->getVuiParameters()->getDefaultDisplayWindow() : Window();
const bool isTff = pcPicTop->topField;
m_cVideoIOYuvReconFile.write( pcPicTop->getRecoBuf(), pcPicBottom->getRecoBuf(),
m_outputColourSpaceConvert,
false, // TODO: m_packedYUVMode,
conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(),
conf.getWindowLeftOffset(),
conf.getWindowRightOffset(),
conf.getWindowTopOffset(),
conf.getWindowBottomOffset(),
NUM_CHROMA_FORMAT, isTff );
}
......@@ -571,15 +569,14 @@ void DecApp::xFlushOutput( PicList* pcListPic )
if (!m_reconFileName.empty())
{
const Window &conf = pcPic->cs->sps->getConformanceWindow();
const Window defDisp = (m_respectDefDispWindow && pcPic->cs->sps->getVuiParametersPresentFlag()) ? pcPic->cs->sps->getVuiParameters()->getDefaultDisplayWindow() : Window();
m_cVideoIOYuvReconFile.write( pcPic->getRecoBuf(),
m_outputColourSpaceConvert,
m_packedYUVMode,
conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(),
conf.getWindowLeftOffset(),
conf.getWindowRightOffset(),
conf.getWindowTopOffset(),
conf.getWindowBottomOffset(),
NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range );
}
......@@ -629,4 +626,14 @@ bool DecApp::isNaluWithinTargetDecLayerIdSet( InputNALUnit* nalu )
return false;
}
/** \param nalu Input nalu to check whether its LayerId is the specified target layer
*/
bool DecApp::isNaluTheTargetLayer(InputNALUnit* nalu)
{
if (nalu->m_nuhLayerId == m_iTargetLayer || m_iTargetLayer < 0)
return true;
return false;
}
//! \}
......@@ -81,6 +81,7 @@ private:
void xWriteOutput ( PicList* pcListPic , uint32_t tId); ///< write YUV to file
void xFlushOutput ( PicList* pcListPic ); ///< flush all remaining decoded pictures to file
bool isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet
bool isNaluTheTargetLayer(InputNALUnit* nalu); ///< check whether given Nalu is within targetDecLayerIdSet
};
//! \}
......
......@@ -87,6 +87,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] )
("OutputBitDepthC,d", m_outputBitDepth[CHANNEL_TYPE_CHROMA], 0, "bit depth of YUV output chroma component (default: use luma output bit-depth)")
("OutputColourSpaceConvert", outputColourSpaceConvert, string(""), "Colour space conversion to apply to input 444 video. Permitted values are (empty string=UNCHANGED) " + getListOfColourSpaceConverts(false))
("MaxTemporalLayer,t", m_iMaxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers")
("TargetLayer,p", m_iTargetLayer, -1, "Target bitstream Layer to be decoded.")
("SEIDecodedPictureHash,-dph",m_decodedPictureHashSEIEnabled, 1, "Control handling of decoded picture hash SEI messages\n"
"\t1: check hash in SEI messages if available in the bitstream\n"
"\t0: ignore SEI message")
......@@ -112,9 +113,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] )
"\t2: enable tool statistic\n"
"\t3: enable bit and tool statistic\n")
#endif
#if JVET_M0445_MCTS_DEC_CHECK
("MCTSCheck", m_mctsCheck, false, "If enabled, the decoder checks for violations of mc_exact_sample_value_match_flag in Temporal MCTS ")
#endif
;
po::setDefaults(opts);
......@@ -151,9 +150,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] )
}
#endif
#if JVET_M0445_MCTS_DEC_CHECK
g_mctsDecCheckEnabled = m_mctsCheck;
#endif
// Chroma output bit-depth
if( m_outputBitDepth[CHANNEL_TYPE_LUMA] != 0 && m_outputBitDepth[CHANNEL_TYPE_CHROMA] == 0 )
{
......@@ -226,6 +223,7 @@ DecAppCfg::DecAppCfg()
, m_iSkipFrame(0)
// m_outputBitDepth array initialised below
, m_outputColourSpaceConvert(IPCOLOURSPACE_UNCHANGED)
, m_iTargetLayer(0)
, m_iMaxTemporalLayer(-1)
, m_decodedPictureHashSEIEnabled(0)
, m_decodedNoDisplaySEIEnabled(false)
......@@ -236,9 +234,7 @@ DecAppCfg::DecAppCfg()
, m_bClipOutputVideoToRec709Range(false)
, m_packedYUVMode(false)
, m_statMode(0)
#if JVET_M0445_MCTS_DEC_CHECK
, m_mctsCheck(false)
#endif
{
for (uint32_t channelTypeIndex = 0; channelTypeIndex < MAX_NUM_CHANNEL_TYPE; channelTypeIndex++)
{
......
......@@ -61,6 +61,7 @@ protected:
int m_iSkipFrame; ///< counter for frames prior to the random access point to skip
int m_outputBitDepth[MAX_NUM_CHANNEL_TYPE]; ///< bit depth used for writing output
InputColourSpaceConversion m_outputColourSpaceConvert;
int m_iTargetLayer; ///< target stream layer to be decoded
int m_iMaxTemporalLayer; ///< maximum temporal layer to be decoded
int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
......@@ -73,9 +74,7 @@ protected:
bool m_packedYUVMode; ///< If true, output 10-bit and 12-bit YUV data as 5-byte and 3-byte (respectively) packed YUV data
std::string m_cacheCfgFile; ///< Config file of cache model
int m_statMode; ///< Config statistic mode (0 - bit stat, 1 - tool stat, 3 - both)
#if JVET_M0445_MCTS_DEC_CHECK
bool m_mctsCheck;
#endif
public:
DecAppCfg();
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -10,11 +10,13 @@ file( GLOB INC_FILES "*.h" )
# add executable
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} )
target_link_libraries( ${EXE_NAME} Threads::Threads ${ADDITIONAL_LIBS} )
target_link_libraries( ${EXE_NAME} CommonLib DecoderLib Utilities Threads::Threads ${ADDITIONAL_LIBS} )
# include the output directory, where the svnrevision.h file is generated
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR}/source/Lib)
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
add_custom_command( TARGET ${EXE_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
$<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}/parcat>
......
This diff is collapsed.
......@@ -72,11 +72,22 @@ void read2(InputNALUnit& nalu)
{
InputBitstream& bs = nalu.getBitstream();
bool forbidden_zero_bit = bs.read(1); // forbidden_zero_bit
if(forbidden_zero_bit != 0) { THROW( "Forbidden zero-bit not '0'" );}
nalu.m_nalUnitType = (NalUnitType) bs.read(6); // nal_unit_type
nalu.m_nuhLayerId = bs.read(6); // nuh_layer_id
nalu.m_temporalId = bs.read(3) - 1; // nuh_temporal_id_plus1
bool zeroTidRequiredFlag = bs.read(1); // zero_tid_required_flag
nalu.m_temporalId = bs.read(3) - 1; // nuh_temporal_id_plus1
CHECK(nalu.m_temporalId < 0, "Temporal ID is negative.");
//When zero_tid_required_flag is equal to 1, the value of nuh_temporal_id_plus1 shall be equal to 1.
CHECK((zeroTidRequiredFlag == 1) && (nalu.m_temporalId != 0), "Temporal ID is not '0' when zero tid is required.");
uint32_t nalUnitTypeLsb = bs.read(4); // nal_unit_type_lsb
nalu.m_nalUnitType = (NalUnitType) ((zeroTidRequiredFlag << 4) + nalUnitTypeLsb);
nalu.m_nuhLayerId = bs.read(7); // nuh_layer_id
#if EMULATION_PREVENTION_FIX
CHECK(nalu.m_nuhLayerId == 0, "nuh_layer_id_plus1 must be greater than zero");
nalu.m_nuhLayerId--;
CHECK(nalu.m_nuhLayerId > 125, "Layer ID out of range");
#endif
CHECK((nalu.m_nuhLayerId < 0) || (nalu.m_nuhLayerId > 126), "Layer ID out of range");
uint32_t nuh_reserved_zero_bit = bs.read(1); // nuh_reserved_zero_bit
CHECK(nuh_reserved_zero_bit != 0, "Reserved zero bit is not '0'");
}
uint32_t SEIRemovalApp::decode()
......@@ -129,7 +140,7 @@ uint32_t SEIRemovalApp::decode()
// just kick out all suffix SEIS
bWrite &= (( !m_discardSuffixSEIs || nalu.m_nalUnitType != NAL_UNIT_SUFFIX_SEI ) && ( !m_discardPrefixSEIs || nalu.m_nalUnitType != NAL_UNIT_PREFIX_SEI ));
bWrite &= unitCnt >= m_numNALUnitsToSkip;
bWrite &= m_numNALUnitsToWrite > 0 && unitCnt <= m_numNALUnitsToWrite;
bWrite &= m_numNALUnitsToWrite < 0 || unitCnt <= m_numNALUnitsToWrite;
if( bWrite )
{
......
# executable
set( EXE_NAME StreamMergeApp )
# get source files
file( GLOB SRC_FILES "*.cpp" )
# get include files
file( GLOB INC_FILES "*.h" )
# get additional libs for gcc on Ubuntu systems
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
if( USE_ADDRESS_SANITIZER )
set( ADDITIONAL_LIBS asan )
endif()
endif()
endif()
# NATVIS files for Visual Studio
if( MSVC )
file( GLOB NATVIS_FILES "../../VisualStudio/*.natvis" )
endif()
# add executable
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${NATVIS_FILES} )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
if( SET_ENABLE_TRACING )
if( ENABLE_TRACING )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_TRACING=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_TRACING=0 )
endif()
endif()
if( OpenMP_FOUND )
if( SET_ENABLE_SPLIT_PARALLELISM )
if( ENABLE_SPLIT_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
endif()
endif()
if( SET_ENABLE_WPP_PARALLELISM )
if( ENABLE_WPP_PARALLELISM )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=1 )
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
endif()
else()
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_SPLIT_PARALLELISM=0 )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_PARALLELISM=0 )
endif()
if( CMAKE_COMPILER_IS_GNUCC AND BUILD_STATIC )
set( ADDITIONAL_LIBS ${ADDITIONAL_LIBS} -static -static-libgcc -static-libstdc++ )
target_compile_definitions( ${EXE_NAME} PUBLIC ENABLE_WPP_STATIC_LINK=1 )
endif()
target_link_libraries( ${EXE_NAME} CommonLib EncoderLib DecoderLib Utilities Threads::Threads ${ADDITIONAL_LIBS} )
# lldb custom data formatters
if( XCODE )
add_dependencies( ${EXE_NAME} Install${PROJECT_NAME}LldbFiles )
endif()
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
add_custom_command( TARGET ${EXE_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy
$<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}/StreamMergeApp>
$<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}/StreamMergeApp>
$<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}/StreamMergeApp>
$<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}/StreamMergeApp>
$<$<CONFIG:Debug>:${CMAKE_SOURCE_DIR}/bin/StreamMergeAppStaticd>
$<$<CONFIG:Release>:${CMAKE_SOURCE_DIR}/bin/StreamMergeAppStatic>
$<$<CONFIG:RelWithDebInfo>:${CMAKE_SOURCE_DIR}/bin/StreamMergeAppStaticp>
$<$<CONFIG:MinSizeRel>:${CMAKE_SOURCE_DIR}/bin/StreamMergeAppStaticm> )
endif()
# example: place header files in different folders
source_group( "Natvis Files" FILES ${NATVIS_FILES} )
# set the folder where to place the projects
set_target_properties( ${EXE_NAME} PROPERTIES FOLDER app LINKER_LANGUAGE CXX )
This diff is collapsed.
/* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2010-2019, ITU/ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/** \file SEIRemovalApp.h
\brief Decoder application class (header)
*/
#ifndef __STREAMMERGEAPP__
#define __STREAMMERGEAPP__
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <stdio.h>
#include <fstream>
#include <iostream>
#include "CommonLib/CommonDef.h"
#include "VLCWriter.h"
#include "CABACWriter.h"
#include "AnnexBread.h"
#include "StreamMergeAppCfg.h"
using namespace std;
// ====================================================================================================================
// Class definition
// ====================================================================================================================
/// decoder application class
class StreamMergeApp : public StreamMergeAppCfg
{
public:
StreamMergeApp();
virtual ~StreamMergeApp () {}
VPS vps;
uint32_t mergeStreams (); ///< main stream merging function
void writeNewVPS (ostream& out, int nNumLayers, int nTemporalId);
};
class SingleLayerStream
{
public:
/**
* Create a bytestream reader that will extract bytes from
* istream.
*
* NB, it isn't safe to access istream while in use by a
* InputByteStream.
*
* Side-effects: the exception mask of istream is set to eofbit
*/
SingleLayerStream()
: m_numFutureBytes(0)
, m_futureBytes(0)
{
}
/**
* Reset the internal state. Must be called if input stream is
* modified externally to this class
*/
void reset()
{
m_numFutureBytes = 0;
m_futureBytes = 0;
}
void init(std::istream& istream)
{
istream.exceptions(std::istream::eofbit | std::istream::badbit);
}
/**
* returns true if an EOF will be encountered within the next
* n bytes.
*/
bool eofBeforeNBytes(uint32_t n, std::istream& m_Input)
{
CHECK(n > 4, "Unsupported look-ahead value");
if (m_numFutureBytes >= n)
{
return false;
}
n -= m_numFutureBytes;
try
{
for (uint32_t i = 0; i < n; i++)
{
m_futureBytes = (m_futureBytes << 8) | m_Input.get();
m_numFutureBytes++;
}
}
catch (...)
{
return true;
}
return false;
}
/**
* return the next n bytes in the stream without advancing
* the stream pointer.
*
* Returns: an unsigned integer representing an n byte bigendian
* word.
*
* If an attempt is made to read past EOF, an n-byte word is
* returned, but the portion that required input bytes beyond EOF
* is undefined.
*
*/
uint32_t peekBytes(uint32_t n, std::istream& m_Input)
{
eofBeforeNBytes(n, m_Input);
return m_futureBytes >> 8 * (m_numFutureBytes - n);
}
/**
* consume and return one byte from the input.
*
* If bytestream is already at EOF prior to a call to readByte(),
* an exception std::ios_base::failure is thrown.
*/
uint8_t readByte(std::istream& m_Input)
{
if (!m_numFutureBytes)
{
uint8_t byte = m_Input.get();
return byte;
}
m_numFutureBytes--;
uint8_t wanted_byte = m_futureBytes >> 8 * m_numFutureBytes;
m_futureBytes &= ~(0xff << 8 * m_numFutureBytes);
return wanted_byte;
}
/**
* consume and return n bytes from the input. n bytes from
* bytestream are interpreted as bigendian when assembling
* the return value.
*/
uint32_t readBytes(uint32_t n, std::istream& m_Input)
{
uint32_t val = 0;
for (uint32_t i = 0; i < n; i++)
{
val = (val << 8) | readByte(m_Input);
}
return val;
}
private:
uint32_t m_numFutureBytes; /* number of valid bytes in m_futureBytes */
uint32_t m_futureBytes; /* bytes that have been peeked */
};
bool byteStreamNALUnit(SingleLayerStream& bs, std::istream& istream, vector<uint8_t>& nalUnit, AnnexBStats& stats);
#endif // __STREAMMERGEAPP__
......@@ -31,68 +31,56 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/** \file BinaryDecisionTree.h
* \brief declares a binary decision tree that can be used for automated optimal coding of multi-level cascaded decisions
/** \file StreamMergeAppCfg.cpp
\brief Decoder configuration class
*/
#ifndef __BINARYDECISIONTREE__
#define __BINARYDECISIONTREE__
#include <cstdio>
#include <cstring>
#include <string>
#include "StreamMergeAppCfg.h"
#include "Utilities/program_options_lite.h"
#include "CommonDef.h"
using namespace std;
namespace po = df::program_options_lite;
#if !REMOVE_BIN_DECISION_TREE
//! \ingroup DecoderApp
//! \{
#define MAX_DEPTH_DECISION_TREE 5
#define MAX_NODES_DECISION_TREE ( 2 * ( 1 << MAX_DEPTH_DECISION_TREE ) )
// ====================================================================================================================
// Public member functions
// ====================================================================================================================
// decision tree template describes the trees and contains mappings between node ids and their in-tree positions
struct DecisionTreeTemplate
{
DecisionTreeTemplate( unsigned _depth );
unsigned depth;
unsigned ids [MAX_NODES_DECISION_TREE]; // maps the in-tree position to node-id
bool hasSub [MAX_NODES_DECISION_TREE]; // stores, for each in-tree position, the information if the node is an end-node ('false'), or a decision-node ('true')
unsigned mapping[MAX_NODES_DECISION_TREE]; // maps the node-ids to the in-tree positions
};
// decision tree contains sparsity information (node availability) and the context ids needed to encode a decision
// the tree topology described by the decision tree template 'dtt' is used for the tree structure
struct DecisionTree
/** \param argc number of arguments
\param argv array of arguments
*/
bool StreamMergeAppCfg::parseCfg(int argc, char* argv[])
{
DecisionTree( const DecisionTreeTemplate& _dtt );
int i;
const DecisionTreeTemplate &dtt;
bool isAvail[MAX_NODES_DECISION_TREE];
unsigned ctxId [MAX_NODES_DECISION_TREE];
m_numInputStreams = argc - 2;
// if an end-node is not available, some coding bins can be skipped - availability of the end-nodes can be set using this function
void setAvail( unsigned id, bool _isAvail );
// for decision nodes, the context for decision encoding can be set here. don't set any context to code as a EP bin
void setCtxId( unsigned id, unsigned _ctxId );
// propagate the end-nodes availability across decision nodes (call with default parameters for correct results)
void reduce ( unsigned offset = 0, int depth = -1 );
};
for (i = 0; i < m_numInputStreams; i++)
{
m_bitstreamFileNameIn[i] = argv[i + 1];
}
struct DecisionTreeBuilder;
m_bitstreamFileNameOut = argv[i + 1];
// use this function to easily create decision trees from the output of decision(...) functions (allows for nice human-readable form)
DecisionTreeTemplate compile( DecisionTreeBuilder *dtb );
return true;
}
// parameter naming
// id: name of the node
// id0: name of a direct outcome for the '0'-case
// id1: name of a direct outcome for the '1'-case
StreamMergeAppCfg::StreamMergeAppCfg()
: m_bitstreamFileNameOut()
, m_numInputStreams(0)
{
for (int i = 0; i < MAX_VPS_LAYERS; i++)
m_bitstreamFileNameIn[i] = "";
}
// a simple decision node with two direct outcomes
DecisionTreeBuilder* decision( unsigned id, unsigned id0, unsigned id1 );
// a decision node with decision sub-tree on the left side (the '0'-case) and a direct outcome on the right (the '1'-case)
DecisionTreeBuilder* decision( unsigned id, DecisionTreeBuilder* sub0, unsigned id1 );
// a decision node with direct outcome on the left side and a decision sub-tree on the right
DecisionTreeBuilder* decision( unsigned id, DecisionTreeBuilder* sub0, DecisionTreeBuilder* sub1 );
// a decision with two decision sub-trees
DecisionTreeBuilder* decision( unsigned id, unsigned id0, DecisionTreeBuilder* sub1 );
StreamMergeAppCfg::~StreamMergeAppCfg()
{
#endif
}
#endif
//! \}
/* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2010-2019, ITU/ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/** \file StreamMergeAppCfg.h
\brief Stream merge app configuration class (header)
*/
#ifndef __STREAMMERGEAPPCFG__
#define __STREAMMERGEAPPCFG__
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "CommonLib/CommonDef.h"
#include <vector>
//! \ingroup DecoderApp
//! \{
// ====================================================================================================================
// Class definition
// ====================================================================================================================
/// Decoder configuration class
class StreamMergeAppCfg
{
protected:
std::string m_bitstreamFileNameIn[MAX_VPS_LAYERS]; ///< output bitstream file name
std::string m_bitstreamFileNameOut; ///< input bitstream file name
int m_numInputStreams; ///< number of input bitstreams
public:
StreamMergeAppCfg();
virtual ~StreamMergeAppCfg();
bool parseCfg ( int argc, char* argv[] ); ///< initialize option class from configuration
};
//! \}
#endif // __STREAMMERGEAPPCFG__
/* The copyright in this software is being made available under the BSD
* License, included below. This software may be subject to other third party
* and contributor rights, including patent rights, and no such rights are
* granted under this license.
*
* Copyright (c) 2010-2019, ITU/ISO/IEC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/** \file StreamMergeMain.cpp
\brief Stream merge application main
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "StreamMergeApp.h"
#include "program_options_lite.h"
//! \ingroup DecoderApp
//! \{
// ====================================================================================================================
// Main function
// ====================================================================================================================
int main(int argc, char* argv[])
{
int returnCode = EXIT_SUCCESS;
if (argc < 4)
{
printf("usage: %s <bitstream1> <bitstream2> [<bitstream3> ...] <outfile>\n", argv[0]);
return -1;
}
// print information
fprintf(stdout, "\n");
fprintf(stdout, "VVCSoftware: VTM Version %s ", VTM_VERSION);
fprintf(stdout, "\n");
StreamMergeApp *pStrMergeApp = new StreamMergeApp;
// parse configuration
if (!pStrMergeApp->parseCfg(argc, argv))
{
returnCode = EXIT_FAILURE;
return returnCode;
}