...
 
Commits (275)
stages:
- build
.build_template:
stage: build
script:
- make realclean
- make all
only:
refs:
- master
- merge_requests
variables:
- $CI_PROJECT_URL == 'https://vcgit.hhi.fraunhofer.de/jvet/VVCSoftware_VTM'
- $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'master'
.build_template_linux:
extends: .build_template
script:
- make realclean
- make all
- make realclean
- make linuxbuild enable-tracing=true
build_macos:
extends: .build_template
tags:
- macos
build_ubuntu1604:
extends: .build_template_linux
tags:
- ubuntu1604
build_ubuntu1804:
extends: .build_template_linux
tags:
- ubuntu1804
build_ubuntu1804-gcc8:
extends: .build_template_linux
script:
- make realclean
- make all toolset=gcc-8
- make realclean
- make linuxbuild enable-tracing=true toolset=gcc-8
tags:
- ubuntu1804-gcc8
build_vc191x:
extends: .build_template
tags:
- vc191x
build_vc192x:
extends: .build_template
tags:
- vc192x
......@@ -111,6 +111,7 @@ LMCSSignalType : 0 # Input signal type: 0:SDR, 1:HDR-PQ, 2:HD
LMCSUpdateCtrl : 1 # LMCS model update control: 0:RA, 1:AI, 2:LDB/LDP
MIP : 1
JointCbCr : 1 # joint coding of chroma residuals (if available): 0: disable, 1: enable
ChromaTS : 1
# Fast tools
PBIntraFast : 1
......
......@@ -13,15 +13,19 @@ MaxPartitionDepth : 4 # Maximum coding unit depth
#======== Coding Structure =============
IntraPeriod : -1 # Period of I-Frame ( -1 = only first)
DecodingRefreshType : 0 # Random Accesss 0:none, 1:CRA, 2:IDR, 3:Recovery Point SEI
GOPSize : 4 # GOP Size (number of B slice = GOPSize-1)
GOPSize : 8 # GOP Size (number of B slice = GOPSize-1)
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_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
Frame1: P 1 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 9 17 25 0 0
Frame2: P 2 4 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 2 10 18 0 0
Frame3: P 3 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 3 11 19 0 0
Frame4: P 4 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 4 12 20 0 0
Frame5: P 5 4 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 5 13 21 0 0
Frame6: P 6 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 6 14 22 0 0
Frame7: P 7 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 7 15 23 0 0
Frame8: P 8 1 0.0 0.0 0 0 1.0 0 0 0 4 4 1 8 16 24 0 0
#=========== Motion Search =============
FastSearch : 1 # 0:Full search 1:TZ search
......@@ -56,6 +60,11 @@ TransformSkipFast : 1 # Fast Transform skipping (0: OFF, 1
TransformSkipLog2MaxSize : 5
SAOLcuBoundary : 0 # SAOLcuBoundary using non-deblocked pixels (0: OFF, 1: ON)
#=========== TemporalFilter =================
TemporalFilter : 0 # Enable/disable GOP Based Temporal Filter
TemporalFilterFutureReference : 0 # Enable/disable reading future frames
TemporalFilterStrengthFrame4 : 0.4 # Enable filter at every 4th frame with strength
#============ Slices ================
SliceMode : 0 # 0: Disable all slice options.
# 1: Enforce maximum number of LCU in an slice,
......@@ -124,10 +133,11 @@ AffineAmvr : 0
LMCSEnable : 1 # LMCS: 0: disable, 1:enable
LMCSSignalType : 0 # Input signal type: 0:SDR, 1:HDR-PQ, 2:HDR-HLG
LMCSUpdateCtrl : 2 # LMCS model update control: 0:RA, 1:AI, 2:LDB/LDP
MIP : 1
MIP : 0
JointCbCr : 1 # joint coding of chroma residuals (if available): 0: disable, 1: enable
PROF : 1
PPSorSliceMode : 3
ChromaTS : 1
# Fast tools
PBIntraFast : 1
......
......@@ -13,15 +13,19 @@ MaxPartitionDepth : 4 # Maximum coding unit depth
#======== Coding Structure =============
IntraPeriod : -1 # Period of I-Frame ( -1 = only first)
DecodingRefreshType : 0 # Random Accesss 0:none, 1:CRA, 2:IDR, 3:Recovery Point SEI
GOPSize : 4 # GOP Size (number of B slice = GOPSize-1)
GOPSize : 8 # GOP Size (number of B slice = GOPSize-1)
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_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
Frame1: B 1 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 9 17 25 4 4 1 9 17 25
Frame2: B 2 4 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 2 10 18 4 4 1 2 10 18
Frame3: B 3 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 3 11 19 4 4 1 3 11 19
Frame4: B 4 4 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 4 12 20 4 4 1 4 12 20
Frame5: B 5 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 5 13 21 4 4 1 5 13 21
Frame6: B 6 4 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 6 14 22 4 4 1 6 14 22
Frame7: B 7 5 -6.5 0.2590 0 0 1.0 0 0 0 4 4 1 7 15 23 4 4 1 7 15 23
Frame8: B 8 1 0.0 0.0 0 0 1.0 0 0 0 4 4 1 8 16 24 4 4 1 8 16 24
#=========== Motion Search =============
FastSearch : 1 # 0:Full search 1:TZ search
......@@ -56,6 +60,11 @@ TransformSkipFast : 1 # Fast Transform skipping (0: OFF, 1
TransformSkipLog2MaxSize : 5
SAOLcuBoundary : 0 # SAOLcuBoundary using non-deblocked pixels (0: OFF, 1: ON)
#=========== TemporalFilter =================
TemporalFilter : 0 # Enable/disable GOP Based Temporal Filter
TemporalFilterFutureReference : 0 # Enable/disable reading future frames
TemporalFilterStrengthFrame4 : 0.4 # Enable filter at every 4th frame with strength
#============ Slices ================
SliceMode : 0 # 0: Disable all slice options.
# 1: Enforce maximum number of LCU in an slice,
......@@ -128,10 +137,11 @@ AffineAmvr : 0
LMCSEnable : 1 # LMCS: 0: disable, 1:enable
LMCSSignalType : 0 # Input signal type: 0:SDR, 1:HDR-PQ, 2:HDR-HLG
LMCSUpdateCtrl : 2 # LMCS model update control: 0:RA, 1:AI, 2:LDB/LDP
MIP : 1
MIP : 0
JointCbCr : 1 # joint coding of chroma residuals (if available): 0: disable, 1: enable
PROF : 1
PPSorSliceMode : 2
ChromaTS : 1
# Fast tools
PBIntraFast : 1
......
......@@ -70,6 +70,12 @@ TransformSkipFast : 1 # Fast Transform skipping (0: OFF, 1
TransformSkipLog2MaxSize : 5
SAOLcuBoundary : 0 # SAOLcuBoundary using non-deblocked pixels (0: OFF, 1: ON)
#=========== TemporalFilter =================
TemporalFilter : 0 # Enable/disable GOP Based Temporal Filter
TemporalFilterFutureReference : 1 # Enable/disable reading future frames
TemporalFilterStrengthFrame8 : 0.95 # Enable filter at every 8th frame with given strength
TemporalFilterStrengthFrame16 : 1.5 # Enable filter at every 16th frame with given strength, longer intervals has higher priority
#============ Slices ================
SliceMode : 0 # 0: Disable all slice options.
# 1: Enforce maximum number of LCU in an slice,
......@@ -144,6 +150,7 @@ AffineAmvr : 1
LMCSEnable : 1 # LMCS: 0: disable, 1:enable
LMCSSignalType : 0 # Input signal type: 0:SDR, 1:HDR-PQ, 2:HDR-HLG
LMCSUpdateCtrl : 0 # LMCS model update control: 0:RA, 1:AI, 2:LDB/LDP
LMCSOffset : 6 # chroma residual scaling offset
MIP : 1
DMVR : 1
SMVD : 1
......@@ -159,6 +166,7 @@ AMaxBT : 1
FastMIP : 0
FastLFNST : 0
FastLocalDualTreeMode : 1
ChromaTS : 1
# Encoder optimization tools
AffineAmvrEncOpt : 1
......
CostMode : lossless
ChromaTS : 1
DepQuant : 0
RDOQ : 0
RDOQTS : 0
SBT : 0
LMCSEnable : 0
ISP : 0
MTS : 0
LFNST : 0
JointCbCr : 0
LoopFilterDisable : 1
SAO : 0
ALF : 0
DMVR : 0
BIO : 0
PROF : 0
Log2MaxTbSize : 5
InternalBitDepth : 0
\ No newline at end of file
# ======== Luma adaptive QP ==========
LumaLevelToDeltaQPMode : 1 # Change luma delta QP based on average luma
LumaLevelToDeltaQPMode : 0 # Change luma delta QP based on average luma
isSDR : 0 # 1: SDR in PQ container, 0: HDR
# ======= LMCS =======================
LMCSEnable : 0 # turned off in HDR CTC
LMCSEnable : 1 # turned on in HDR CTC
LMCSSignalType : 1 # Input signal type: 0:SDR, 1:HDR-PQ, 2:HDR-HLG
LMCSOffset : 1 # chroma residual scaling offset
#======== 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
WCGPPSEnable : 0 # enable WCG Chroma scale
CbQpOffset : 0
CrQpOffset : 0
SameCQPTablesForAllChroma : 1
QpInValCb : 9 23 33 42
QpOutValCb : 9 24 33 37
CbQpOffset : 0
CrQpOffset : 0
SameCQPTablesForAllChroma : 0
QpInValCb : 13 20 36 38 43 54
QpOutValCb : 13 21 29 29 32 37
QpInValCr : 13 20 37 41 44 54
QpOutValCr : 13 21 27 29 32 37
QpInValCbCr : 12 21 41 43 54
QpOutValCbCr : 12 22 30 32 37
CclmCollocatedChroma : 1
#======== HDR Metrics ============
CalculateHdrMetrics : 1 # Calculate HDR metrics for Class H1 (PQ) content
\ No newline at end of file
CalculateHdrMetrics : 1 # Calculate HDR metrics for Class H1 (PQ) content
......@@ -4,6 +4,7 @@ LumaLevelToDeltaQPMode : 0 # Change luma delta QP based on aver
# ======= LMCS =======================
LMCSEnable : 1 # turned on in HLG CTC
LMCSSignalType : 2 # Input signal type: 0:SDR, 1:HDR-PQ, 2:HDR-HLG
LMCSOffset : 0 # chroma residual scaling offset
#======== Chroma QP scale ============
WCGPPSEnable : 0 # enable WCG Chroma scale
......
No preview for this file type
......@@ -205,7 +205,7 @@ fontsize=\footnotesize}
\maketitle
\begin{abstract}
This document is a user manual describing usage of the VTM reference software
for the VVC project. It applies to version 6.2 of the software.
for the VVC project. It applies to version 7.0 of the software.
\end{abstract}
\tableofcontents
......@@ -257,8 +257,8 @@ be available in older compilers.
\thead{Compiler environment} &
\thead{Versions} \\
\hline
MS Visual Studio & 2015 and 2017 \\
GCC & 5.4 and 7.3 \\
MS Visual Studio & 2017 and 2019 \\
GCC & 5.4, 7.3 and 8.3\\
Xcode/clang & latest \\
\hline
\end{tabular}
......@@ -380,7 +380,7 @@ pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchai
\section{Using the encoder}
\begin{minted}{bash}
TAppEncoder [--help] [-c config.cfg] [--parameter=value]
TAppEncoder [--help] [-li -c config.cfg] [-li --parameter=value]
\end{minted}
\begin{table}[ht]
......@@ -392,6 +392,7 @@ TAppEncoder [--help] [-c config.cfg] [--parameter=value]
\thead{Description} \\
\hline
\texttt{--help} & Prints parameter usage. \\
\texttt{-li} & Applies to its next config file or command line parameter only to define i-th layer encoding option. If empty, the configuration file applies to all layers\\
\texttt{-c} & Defines configuration file to use. Multiple configuration files
may be used with repeated --c options. \\
\texttt{--}\emph{parameter}\texttt{=}\emph{value}
......@@ -890,6 +891,32 @@ Picture output options: output upscaled (2), decoded but in full resolution buff
\end{OptionTableNoShorthand}
%%
%% GOP based temporal filter parameters
%%
\begin{OptionTableNoShorthand}{GOP based temporal filter paramters}{tab:gop-based-temporal-filter}
\Option{TemporalFilter} &
%\ShortOption{\None} &
\Default{false} &
Enables or disables GOP based temporal filter.
\\
\Option{TemporalFilterFutureReference} &
%\ShortOption{\None} &
\Default{true} &
Enables or disable referencing future frames in the GOP based temporal filter. Can be used to disable future referencing for
low delay configurations.
\\
\Option{TemporalFilterStrengthFrame*} &
%\ShortOption{\None} &
\Default{} &
Strength for every * frame in GOP based temporal filter, where * is an integer. E.g. --TemporalFilterStrengthFrame8 0.95 will
enable GOP based temporal filter at every 8th frame with strength 0.95. Longer intervals overrides shorter when there are
multiple matches.
\\
\end{OptionTableNoShorthand}
%%
%% profile, level and conformance options
%%
......@@ -1000,6 +1027,20 @@ Specifies the value of general_frame_only_constraint_flag
\end{OptionTableNoShorthand}
%%
%% Layer parameters
%%
\begin{OptionTableNoShorthand}{Layer parameters}{tab:unit}
\Option{MaxLayers} &
%\ShortOption{\None} &
\Default{1} &
Specifies the value to use to derive the vps_max_layers_minus1 for layered coding
\\
\end{OptionTableNoShorthand}
%%
%% Unit definition parameters
%%
......@@ -1316,6 +1357,12 @@ candidate is not evaluated if the merge skip mode was the best merge
mode for one of the previous candidates.
\\
\Option{SBTFast64WidthTh} &
%\ShortOption{\None} &
\Default{1920} &
Picture width threshold for testing size-64 SBT in RDO (now for HD and above sequences).
\\
\Option{RDpenalty} &
%\ShortOption{\None} &
\Default{0} &
......@@ -1936,9 +1983,7 @@ Enables or disables the Intra Sub-Partitions coding mode.
\Option{ISPFast} &
%\ShortOption{\None} &
\Default{false} &
Enables or disables reduced testing of non-DCT-II transforms if ISP is likely to become the best mode for a given CU.
\par
This option has no effect if either ISP or MTS are disabled.
Enables or disables fast encoder methods for ISP.
\\
\Option{JointCbCr} &
......@@ -2010,31 +2055,31 @@ If enabled use a fast ME for generalised B Low Delay slices
Enables use of B-Lambda for non-key low-delay pictures
\\
\Option{TransquantBypassEnable} &
%\ShortOption{\None} &
\Default{false} &
Enables or disables the ability to bypass the transform,
quantization and filtering stages at CU level.
This option corresponds to the value of
transquant_bypass_enabled_flag that is transmitted in the PPS.
See CUTransquantBypassFlagForce for further details.
\\
\Option{CUTransquantBypassFlagForce} &
%\ShortOption{\None} &
\Default{0} &
Controls the per CU transformation, quantization and filtering
mode decision.
This option controls the value of the per CU cu_transquant_bypass_flag.
\par
\begin{tabular}{cp{0.45\textwidth}}
0 & Bypass is searched on a CU-by-CU basis and will be used if the cost is lower than not bypassing. \\
1 & Bypass is forced for all CUs. \\
\end{tabular}
This option has no effect if TransquantBypassEnable is disabled.
\\
%\Option{TransquantBypassEnable} &
%%\ShortOption{\None} &
%\Default{false} &
%Enables or disables the ability to bypass the transform,
%quantization and filtering stages at CU level.
%This option corresponds to the value of
%transquant_bypass_enabled_flag that is transmitted in the PPS.
%
%See CUTransquantBypassFlagForce for further details.
%\\
%
%\Option{CUTransquantBypassFlagForce} &
%%\ShortOption{\None} &
%\Default{0} &
%Controls the per CU transformation, quantization and filtering
%mode decision.
%This option controls the value of the per CU cu_transquant_bypass_flag.
%\par
%\begin{tabular}{cp{0.45\textwidth}}
% 0 & Bypass is searched on a CU-by-CU basis and will be used if the cost is lower than not bypassing. \\
% 1 & Bypass is forced for all CUs. \\
%\end{tabular}
%
%This option has no effect if TransquantBypassEnable is disabled.
%\\
\Option{PCMEnabledFlag} &
%\ShortOption{\None} &
......@@ -2188,6 +2233,16 @@ luma TUs are also skipped.
This option has no effect if TransformSkip is disabled.
\\
\Option{ChromaTS} &
%\ShortOption{\None} &
\Default{false} &
Enables or disables reduced testing of the transform-skipping mode
decision for chroma TUs. When disabled, no RDO search is performed for
chroma TUs.
\par
This option has no effect if TransformSkip is disabled.
\\
\Option{UseNonLinearAlfLuma} &
%\ShortOption{\None} &
\Default{true} &
......@@ -2216,8 +2271,14 @@ Enables or disables symmetric MVD mode.
\Option{BDPCM} &
%\ShortOption{\None} &
\Default{false} &
\Default{0} &
Enables or disables the use of intra block differential pulse code modulation mode.
\par
\begin{tabular}{cp{0.45\textwidth}}
0 & Disable BDPCM for luma and chroma.\\
1 & Enable BDPCM for luma.\\
2 & Enable BDPCM for luma and chroma. BDPCM for chroma is avaialble for 444. \\
\end{tabular}
\\
\Option{LFNST} &
......@@ -2568,9 +2629,9 @@ Specifies the cost mode to use.
\par
\begin{tabular}{lp{0.3\textwidth}}
lossy & $cost=distortion+\lambda \times bits$ \\
sequence_level_lossless & $cost=distortion / \lambda + bits$. \\
lossless & As with sequence_level_lossless, but QP is also set to 0 (this will be deprecated in the future) \\
mixed_lossless_lossy & As with sequence_level_lossless, but QP'=4 is used for pre-estimates of transquant-bypass blocks \\
% sequence_level_lossless & $cost=distortion / \lambda + bits$. \\
lossless & $cost = bits$, QP'=0 is used for all transform blocks and the only allowed encoder result is either an empty transform block or an transform skipped block. \\
% mixed_lossless_lossy & As with sequence_level_lossless, but QP'=4 is used for pre-estimates of transquant-bypass blocks \\
\end{tabular}
\\
......@@ -3393,7 +3454,7 @@ Defines the input bit stream file name.
\Option{ReconFile (-o)} &
%\ShortOption{-o} &
\Default{\NotSet} &
Defines reconstructed YUV file name. If empty, no file is generated.
Defines reconstructed YUV file name. If empty, no file is generated. For layered coding bitstream, each layer reconstructed YUV file name is formed by adding the layer index suffix to ReconFile.
\\
\Option{SkipFrames (-s)} &
......
This diff is collapsed.
......@@ -61,7 +61,11 @@ class DecApp : public DecAppCfg
private:
// class interface
DecLib m_cDecLib; ///< decoder class
#if JVET_N0278_FIXES
std::unordered_map<int, VideoIOYuv> m_cVideoIOYuvReconFile; ///< reconstruction YUV class
#else
VideoIOYuv m_cVideoIOYuvReconFile; ///< reconstruction YUV class
#endif
// for output control
int m_iPOCLastDisplay; ///< last POC in display order
......@@ -80,7 +84,11 @@ private:
void xCreateDecLib (); ///< create internal classes
void xDestroyDecLib (); ///< destroy internal classes
void xWriteOutput ( PicList* pcListPic , uint32_t tId); ///< write YUV to file
#if JVET_N0278_FIXES
void xFlushOutput( PicList* pcListPic, const int layerId = NOT_VALID ); ///< flush all remaining decoded pictures to file
#else
void xFlushOutput ( PicList* pcListPic ); ///< flush all remaining decoded pictures to file
#endif
bool isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet
bool isNaluTheTargetLayer(InputNALUnit* nalu); ///< check whether given Nalu is within targetDecLayerIdSet
};
......
This diff is collapsed.
......@@ -45,11 +45,23 @@
#include "Utilities/VideoIOYuv.h"
#include "CommonLib/NAL.h"
#include "EncAppCfg.h"
#if JVET_N0278_FIXES
#if EXTENSION_360_VIDEO
#include "AppEncHelper360/TExt360AppEncTop.h"
#endif
#if JVET_O0549_ENCODER_ONLY_FILTER
#include "EncoderLib/EncTemporalFilter.h"
#endif
#endif
#if JVET_O0756_CALCULATE_HDRMETRICS
#include <chrono>
#endif
#if JVET_N0278_FIXES
class EncAppCommon;
#endif
//! \ingroup EncoderApp
//! \{
......@@ -66,17 +78,24 @@ private:
VideoIOYuv m_cVideoIOYuvInputFile; ///< input YUV file
VideoIOYuv m_cVideoIOYuvReconFile; ///< output reconstruction file
int m_iFrameRcvd; ///< number of received frames
uint32_t m_essentialBytes;
uint32_t m_totalBytes;
uint32_t m_essentialBytes;
uint32_t m_totalBytes;
#if JVET_N0278_FIXES
fstream& m_bitstream;
#else
fstream m_bitstream;
#endif
#if JVET_O0756_CALCULATE_HDRMETRICS
std::chrono::duration<long long, ratio<1, 1000000000>> m_metricTime;
#endif
private:
// initialization
void xCreateLib ( std::list<PelUnitBuf*>& recBufList
); ///< create files & encoder class
#if JVET_N0278_FIXES
void xCreateLib( std::list<PelUnitBuf*>& recBufList, const int layerId ); ///< create files & encoder class
#else
void xCreateLib ( std::list<PelUnitBuf*>& recBufList ); ///< create files & encoder class
#endif
void xInitLibCfg (); ///< initialize internal variables
void xInitLib (bool isFieldCoding); ///< initialize encoder class
void xDestroyLib (); ///< destroy encoder class
......@@ -88,11 +107,37 @@ private:
void printRateSummary ();
void printChromaFormat();
#if JVET_N0278_FIXES
std::list<PelUnitBuf*> m_recBufList;
int m_numEncoded;
PelStorage* m_trueOrgPic;
PelStorage* m_orgPic;
#if EXTENSION_360_VIDEO
TExt360AppEncTop* m_ext360;
#endif
#if JVET_O0549_ENCODER_ONLY_FILTER
EncTemporalFilter m_temporalFilter;
#endif
bool m_flush;
#endif
public:
#if JVET_N0278_FIXES
EncApp( fstream& bitStream, EncLibCommon* encLibCommon );
#else
EncApp();
#endif
virtual ~EncApp();
#if JVET_N0278_FIXES
int getMaxLayers() const { return m_maxLayers; }
void createLib( int layerId );
void destroyLib();
bool encodePrep( bool& eos );
bool encode(); ///< main encoding function
#else
void encode(); ///< main encoding function
#endif
void outputAU( const AccessUnit& au );
......
This diff is collapsed.
......@@ -39,6 +39,14 @@
#define __ENCAPPCFG__
#include "CommonLib/CommonDef.h"
#if JVET_O0549_ENCODER_ONLY_FILTER
#include <map>
template <class T1, class T2>
static inline std::istream& operator >> (std::istream &in, std::map<T1, T2> &map);
#include "Utilities/program_options_lite.h"
#endif
#include "EncoderLib/EncCfg.h"
#if EXTENSION_360_VIDEO
......@@ -48,6 +56,9 @@
#if JVET_O0756_CALCULATE_HDRMETRICS
#include "HDRLib/inc/DistortionMetric.H"
#endif
#if JVET_O0549_ENCODER_ONLY_FILTER
namespace po = df::program_options_lite;
#endif
#include <sstream>
#include <vector>
......@@ -188,7 +199,11 @@ protected:
uint32_t m_log2SaoOffsetScale[MAX_NUM_CHANNEL_TYPE]; ///< number of bits for the upward bit shift operation on the decoded SAO offsets
bool m_useTransformSkip; ///< flag for enabling intra transform skipping
bool m_useTransformSkipFast; ///< flag for enabling fast intra transform skipping
#if JVET_P0059_CHROMA_BDPCM
int m_useBDPCM;
#else
bool m_useBDPCM;
#endif
uint32_t m_log2MaxTransformSkipBlockSize; ///< transform-skip maximum size (minimum of 2)
bool m_transformSkipRotationEnabledFlag; ///< control flag for transform-skip/transquant-bypass residual rotation
bool m_transformSkipContextEnabledFlag; ///< control flag for transform-skip/transquant-bypass single significance map context
......@@ -269,7 +284,9 @@ protected:
int m_MTSInterMaxCand; ///< XZ: Number of additional candidates to test
int m_MTSImplicit;
bool m_SBT; ///< Sub-Block Transform for inter blocks
#if JVET_P0983_REMOVE_SPS_SBT_MAX_SIZE_FLAG
int m_SBTFast64WidthTh;
#endif
bool m_SMVD;
bool m_compositeRefEnabled;
bool m_GBi;
......@@ -292,6 +309,9 @@ protected:
int m_MmvdDisNum;
unsigned m_PLTMode;
bool m_JointCbCrMode;
#if JVET_P0058_CHROMA_TS
bool m_useChromaTS;
#endif
unsigned m_IBCMode;
unsigned m_IBCLocalSearchRangeX;
unsigned m_IBCLocalSearchRangeY;
......@@ -316,6 +336,9 @@ protected:
int m_updateCtrl;
int m_adpOption;
uint32_t m_initialCW;
#if JVET_P0371_CHROMA_SCALING_OFFSET
int m_CSoffset;
#endif
bool m_encDbOpt;
unsigned m_uiMaxCUWidth; ///< max. CU width in pixel
unsigned m_uiMaxCUHeight; ///< max. CU height in pixel
......@@ -525,11 +548,15 @@ protected:
int m_PPSDepQuantEnabledIdc;
int m_PPSRefPicListSPSIdc0;
int m_PPSRefPicListSPSIdc1;
#if !JVET_P0206_TMVP_flags
int m_PPSTemporalMVPEnabledIdc;
#endif
int m_PPSMvdL1ZeroIdc;
int m_PPSCollocatedFromL0Idc;
uint32_t m_PPSSixMinusMaxNumMergeCandPlus1;
#if !JVET_P0152_REMOVE_PPS_NUM_SUBBLOCK_MERGE_CAND
uint32_t m_PPSFiveMinusMaxNumSubblockMergeCandPlus1;
#endif
uint32_t m_PPSMaxNumMergeCandMinusMaxNumTriangleCandPlus1;
bool m_depQuantEnabledFlag;
bool m_signDataHidingEnabledFlag;
......@@ -605,6 +632,16 @@ protected:
int m_switchPocPeriod;
int m_upscaledOutput; ////< Output upscaled (2), decoded cropped but in full resolution buffer (1) or decoded cropped (0, default) picture for RPR.
#if JVET_O0549_ENCODER_ONLY_FILTER
bool m_gopBasedTemporalFilterEnabled; ///< GOP-based Temporal Filter enable/disable
bool m_gopBasedTemporalFilterFutureReference; ///< Enable/disable future frame references in the GOP-based Temporal Filter
std::map<int, double> m_gopBasedTemporalFilterStrengths; ///< Filter strength per frame for the GOP-based Temporal Filter
#endif
#if JVET_N0278_FIXES
int m_maxLayers;
#endif
#if EXTENSION_360_VIDEO
TExt360AppEncCfg m_ext360;
friend class TExt360AppEncCfg;
......
......@@ -40,6 +40,7 @@
#include <chrono>
#include <ctime>
#include "EncoderLib/EncLibCommon.h"
#include "EncApp.h"
#include "Utilities/program_options_lite.h"
......@@ -116,6 +117,74 @@ int main(int argc, char* argv[])
#endif
fprintf( stdout, "\n" );
#if JVET_N0278_FIXES
std::fstream bitstream;
EncLibCommon encLibCommon;
std::vector<EncApp*> pcEncApp(1);
bool resized = false;
int layerIdx = 0;
initROM();
TComHash::initBlockSizeToIndex();
char** layerArgv = new char*[argc];
do
{
pcEncApp[layerIdx] = new EncApp( bitstream, &encLibCommon );
// create application encoder class per layer
pcEncApp[layerIdx]->create();
// parse configuration per layer
try
{
int j = 0;
for( int i = 0; i < argc; i++ )
{
if( argv[i][0] == '-' && argv[i][1] == 'l' )
{
if( argv[i][2] == std::to_string( layerIdx ).c_str()[0] )
{
layerArgv[j] = argv[i + 1];
layerArgv[j + 1] = argv[i + 2];
j += 2;
}
i += 2;
}
else
{
layerArgv[j] = argv[i];
j++;
}
}
if( !pcEncApp[layerIdx]->parseCfg( j, layerArgv ) )
{
pcEncApp[layerIdx]->destroy();
return 1;
}
}
catch( df::program_options_lite::ParseFailure &e )
{
std::cerr << "Error parsing option \"" << e.arg << "\" with argument \"" << e.val << "\"." << std::endl;
return 1;
}
int layerId = layerIdx; //VS: layerIdx should be converted to layerId after VPS is implemented
pcEncApp[layerIdx]->createLib( layerId );
if( !resized )
{
pcEncApp.resize( pcEncApp[layerIdx]->getMaxLayers() );
resized = true;
}
layerIdx++;
} while( layerIdx < pcEncApp.size() );
delete[] layerArgv;
#else
EncApp* pcEncApp = new EncApp;
// create application encoder class
pcEncApp->create();
......@@ -134,6 +203,7 @@ int main(int argc, char* argv[])
std::cerr << "Error parsing option \""<< e.arg <<"\" with argument \""<< e.val <<"\"." << std::endl;
return 1;
}
#endif
#if PRINT_MACRO_VALUES
printMacroSettings();
......@@ -145,6 +215,67 @@ int main(int argc, char* argv[])
fprintf(stdout, " started @ %s", std::ctime(&startTime2) );
clock_t startClock = clock();
#if JVET_N0278_FIXES
// call encoding function per layer
bool eos = false;
while( !eos )
{
// read GOP
bool keepLoop = true;
while( keepLoop )
{
for( auto & encApp : pcEncApp )
{
#ifndef _DEBUG
try
{
#endif
keepLoop = encApp->encodePrep( eos );
#ifndef _DEBUG
}
catch( Exception &e )
{
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}
catch( const std::bad_alloc &e )
{
std::cout << "Memory allocation failed: " << e.what() << std::endl;
return EXIT_FAILURE;
}
#endif
}
}
// encode GOP
keepLoop = true;
while( keepLoop )
{
for( auto & encApp : pcEncApp )
{
#ifndef _DEBUG
try
{
#endif
keepLoop = encApp->encode();
#ifndef _DEBUG
}
catch( Exception &e )
{
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}
catch( const std::bad_alloc &e )
{
std::cout << "Memory allocation failed: " << e.what() << std::endl;
return EXIT_FAILURE;
}
#endif
}
}
}
#else
// call encoding function
#ifndef _DEBUG
try
......@@ -163,23 +294,51 @@ int main(int argc, char* argv[])
std::cout << "Memory allocation failed: " << e.what() << std::endl;
return EXIT_FAILURE;
}
#endif
#endif
// ending time
clock_t endClock = clock();
auto endTime = std::chrono::steady_clock::now();
std::time_t endTime2 = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
#if JVET_O0756_CALCULATE_HDRMETRICS
#if JVET_N0278_FIXES
auto metricTime = pcEncApp[0]->getMetricTime();
for( int layerIdx = 1; layerIdx < pcEncApp.size(); layerIdx++ )
{
metricTime += pcEncApp[layerIdx]->getMetricTime();
}
#else
auto metricTime = pcEncApp->getMetricTime();
#endif
auto totalTime = std::chrono::duration_cast<std::chrono::milliseconds>( endTime - startTime ).count();
auto encTime = std::chrono::duration_cast<std::chrono::milliseconds>( endTime - startTime - metricTime ).count();
auto metricTimeuser = std::chrono::duration_cast<std::chrono::milliseconds>( metricTime ).count();
#else
auto encTime = std::chrono::duration_cast<std::chrono::milliseconds>( endTime - startTime).count();
#endif
#if JVET_N0278_FIXES
for( auto & encApp : pcEncApp )
{
encApp->destroyLib();
// destroy application encoder class per layer
encApp->destroy();
delete encApp;
}
// destroy ROM
destroyROM();
pcEncApp.clear();
#else
// destroy application encoder class
pcEncApp->destroy();
delete pcEncApp;
#endif
printf( "\n finished @ %s", std::ctime(&endTime2) );
......
......@@ -180,6 +180,42 @@ int find_nal_unit(const uint8_t* buf, int size, int* nal_start, int* nal_end)
const bool verbose = false;
#if JVET_P0363_CLEANUP_NUT_TABLE
const char * NALU_TYPE[] =
{
"NAL_UNIT_CODED_SLICE_TRAIL",
"NAL_UNIT_CODED_SLICE_STSA",
"NAL_UNIT_CODED_SLICE_RADL",
"NAL_UNIT_CODED_SLICE_RASL",
"NAL_UNIT_RESERVED_VCL_4",
"NAL_UNIT_RESERVED_VCL_5",
"NAL_UNIT_RESERVED_VCL_6",
"NAL_UNIT_CODED_SLICE_IDR_W_RADL",
"NAL_UNIT_CODED_SLICE_IDR_N_LP",
"NAL_UNIT_CODED_SLICE_CRA",
"NAL_UNIT_CODED_SLICE_GDR",
"NAL_UNIT_RESERVED_IRAP_VCL11",
"NAL_UNIT_RESERVED_IRAP_VCL12",
"NAL_UNIT_DPS",
"NAL_UNIT_VPS",
"NAL_UNIT_SPS",
"NAL_UNIT_PPS",
"NAL_UNIT_APS",
"NAL_UNIT_PH",
"NAL_UNIT_ACCESS_UNIT_DELIMITER",
"NAL_UNIT_EOS",
"NAL_UNIT_EOB",
"NAL_UNIT_PREFIX_SEI",
"NAL_UNIT_SUFFIX_SEI",
"NAL_UNIT_FD",
"NAL_UNIT_RESERVED_NVCL26",
"NAL_UNIT_RESERVED_NVCL27",
"NAL_UNIT_UNSPECIFIED_28",
"NAL_UNIT_UNSPECIFIED_29",
"NAL_UNIT_UNSPECIFIED_30",
"NAL_UNIT_UNSPECIFIED_31"
};
#else
const char * NALU_TYPE[] =
{
"NAL_UNIT_CODED_SLICE_TRAIL",
......@@ -215,6 +251,7 @@ const char * NALU_TYPE[] =
"NAL_UNIT_UNSPECIFIED_30",
"NAL_UNIT_UNSPECIFIED_31"
};
#endif
int calc_poc(int iPOClsb, int prevTid0POC, int getBitsForPOC, int nalu_type)
{
......@@ -306,7 +343,11 @@ std::vector<uint8_t> filter_segment(const std::vector<uint8_t> & v, int idx, int
poc = 0;
new_poc = *poc_base + poc;
}
#if JVET_P0363_CLEANUP_NUT_TABLE
if((nalu_type < NAL_UNIT_CODED_SLICE_IDR_W_RADL) || (nalu_type > NAL_UNIT_CODED_SLICE_IDR_N_LP && nalu_type < NAL_UNIT_RESERVED_IRAP_VCL_12) )
#else
if((nalu_type < 7) || (nalu_type > 9 && nalu_type < 15) )
#endif
{
parcatHLSReader.setBitstream( &inp_nalu.getBitstream() );
bool isRapPic =
......
......@@ -42,7 +42,11 @@
#include "Buffer.h"
#include "InterpolationFilter.h"
#if JVET_P0154_PROF_SAMPLE_OFFSET_CLIPPING
void applyPROFCore(Pel* dst, int dstStride, const Pel* src, int srcStride, int width, int height, const Pel* gradX, const Pel* gradY, int gradStride, const int* dMvX, const int* dMvY, int dMvStride, const bool& bi, int shiftNum, Pel offset, const ClpRng& clpRng)
#else
void applyPROFCore(Pel* dst, int dstStride, const Pel* src, int srcStride, int width, int height, const Pel* gradX, const Pel* gradY, int gradStride, const int* dMvX, const int* dMvY, int dMvStride, int shiftNum, Pel offset, const ClpRng& clpRng)
#endif
{
int idx = 0;
#if !JVET_P0057_BDOF_PROF_HARMONIZATION
......@@ -63,10 +67,16 @@ void applyPROFCore(Pel* dst, int dstStride, const Pel* src, int srcStride, int w
#endif
#if JVET_P0154_PROF_SAMPLE_OFFSET_CLIPPING
dI = Clip3(-dILimit, dILimit - 1, dI);
#endif
dst[w] = src[w] + dI;
if (!bi)
{
dst[w] = (dst[w] + offset) >> shiftNum;
dst[w] = ClipPel(dst[w], clpRng);
}
#else
dI = (src[w] + dI + offset) >> shiftNum;
dst[w] = (Pel)ClipPel(dI, clpRng);
#endif
idx++;
}
......@@ -77,6 +87,7 @@ void applyPROFCore(Pel* dst, int dstStride, const Pel* src, int srcStride, int w
}
}
#if !JVET_P0154_PROF_SAMPLE_OFFSET_CLIPPING
template<bool l1PROFEnabled = true>
void applyBiPROFCore (Pel* dst, int dstStride, const Pel* src0, const Pel* src1, int srcStride, int width, int height, const Pel* gradX0, const Pel* gradY0, const Pel* gradX1, const Pel* gradY1, int gradStride, const int* dMvX0, const int* dMvY0, const int* dMvX1, const int* dMvY1, int dMvStride, const int8_t w0, const ClpRng& clpRng)
{
......@@ -142,6 +153,7 @@ void applyBiPROFCore (Pel* dst, int dstStride, const Pel* src0, const Pel* src1,
src1 += srcStride;
}
}
#endif
template< typename T >
void addAvgCore( const T* src1, int src1Stride, const T* src2, int src2Stride, T* dest, int dstStride, int width, int height, int rshift, int offset, const ClpRng& clpRng )
......@@ -433,8 +445,10 @@ PelBufferOps::PelBufferOps()
profGradFilter = gradFilterCore <false>;
applyPROF = applyPROFCore;
#if !JVET_P0154_PROF_SAMPLE_OFFSET_CLIPPING
applyBiPROF[1] = applyBiPROFCore;
applyBiPROF[0] = applyBiPROFCore <false>;
#endif
roundIntVector = nullptr;
}
......
......@@ -81,8 +81,12 @@ struct PelBufferOps
void ( *removeHighFreq4) ( Pel* src0, int src0Stride, const Pel* src1, int src1Stride, int width, int height);
#endif
void (*profGradFilter) (Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, const int bitDepth);
#if JVET_P0154_PROF_SAMPLE_OFFSET_CLIPPING
void (*applyPROF) (Pel* dst, int dstStride, const Pel* src, int srcStride, int width, int height, const Pel* gradX, const Pel* gradY, int gradStride, const int* dMvX, const int* dMvY, int dMvStride, const bool& bi, int shiftNum, Pel offset, const ClpRng& clpRng);
#else
void (*applyPROF) (Pel* dst, int dstStride, const Pel* src, int srcStride, int width, int height, const Pel* gradX, const Pel* gradY, int gradStride, const int* dMvX, const int* dMvY, int dMvStride, int shiftNum, Pel offset, const ClpRng& clpRng);
void (*applyBiPROF[2]) (Pel* dst, int dstStride, const Pel* src0, const Pel* src1, int srcStride, int width, int height, const Pel* gradX0, const Pel* gradY0, const Pel* gradX1, const Pel* gradY1, int gradStride, const int* dMvX0, const int* dMvY0, const int* dMvX1, const int* dMvY1, int dMvStride, const int8_t gbiWeightL0, const ClpRng& clpRng);
#endif
void (*roundIntVector) (int* v, int size, unsigned int nShift, const int dmvLimit);
};
......@@ -118,6 +122,9 @@ struct AreaBuf : public Size
void subtract ( const AreaBuf<const T> &other );
void extendSingleBorderPel();
void extendBorderPel ( unsigned margin );
#if JVET_O0549_ENCODER_ONLY_FILTER
void extendBorderPel(unsigned marginX, unsigned marginY);
#endif
void addWeightedAvg ( const AreaBuf<const T> &other1, const AreaBuf<const T> &other2, const ClpRng& clpRng, const int8_t gbiIdx);
void removeWeightHighFreq ( const AreaBuf<T>& other, const bool bClip, const ClpRng& clpRng, const int8_t iGbiWeight);
void addAvg ( const AreaBuf<const T> &other1, const AreaBuf<const T> &other2, const ClpRng& clpRng );
......@@ -526,6 +533,46 @@ void AreaBuf<T>::updateHistogram( std::vector<int32_t>& hist ) const
}
}
#if JVET_O0549_ENCODER_ONLY_FILTER
template<typename T>
void AreaBuf<T>::extendBorderPel(unsigned marginX, unsigned marginY)
{
T* p = buf;
int h = height;
int w = width;
int s = stride;
CHECK((w + 2 * marginX) > s, "Size of buffer too small to extend");
// do left and right margins
for (int y = 0; y < h; y++)
{
for (int x = 0; x < marginX; x++)
{
*(p - marginX + x) = p[0];
p[w + x] = p[w - 1];
}
p += s;
}
// p is now the (0,height) (bottom left of image within bigger picture
p -= (s + marginX);
// p is now the (-margin, height-1)
for (int y = 0; y < marginY; y++)
{
::memcpy(p + (y + 1) * s, p, sizeof(T) * (w + (marginX << 1)));
}
// p is still (-marginX, height-1)
p -= ((h - 1) * s);
// p is now (-marginX, 0)
for (int y = 0; y < marginY; y++)
{
::memcpy(p - (y + 1) * s, p, sizeof(T) * (w + (marginX << 1)));
}
}
#endif
template<typename T>
void AreaBuf<T>::extendBorderPel( unsigned margin )
{
......@@ -686,13 +733,24 @@ struct UnitBuf
const AreaBuf<T>& Cr() const { return bufs[2]; }
void fill ( const T &val );
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
void copyFrom ( const UnitBuf<const T> &other, const bool lumaOnly = false, const bool chromaOnly = false );
#else
void copyFrom ( const UnitBuf<const T> &other );
#endif
void reconstruct ( const UnitBuf<const T> &pred, const UnitBuf<const T> &resi, const ClpRngs& clpRngs );
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
void copyClip ( const UnitBuf<const T> &src, const ClpRngs& clpRngs, const bool lumaOnly = false, const bool chromaOnly = false );
#else
void copyClip ( const UnitBuf<const T> &src, const ClpRngs& clpRngs );
#endif
void subtract ( const UnitBuf<const T> &other );
void addWeightedAvg ( const UnitBuf<const T> &other1, const UnitBuf<const T> &other2, const ClpRngs& clpRngs, const uint8_t gbiIdx = GBI_DEFAULT, const bool chromaOnly = false, const bool lumaOnly = false);
void addAvg ( const UnitBuf<const T> &other1, const UnitBuf<const T> &other2, const ClpRngs& clpRngs, const bool chromaOnly = false, const bool lumaOnly = false);
void extendSingleBorderPel();
#if JVET_O0549_ENCODER_ONLY_FILTER
void extendBorderPel(unsigned marginX, unsigned marginY);
#endif
void extendBorderPel ( unsigned margin );
void removeHighFreq ( const UnitBuf<T>& other, const bool bClip, const ClpRngs& clpRngs
, const int8_t gbiWeight = g_GbiWeights[GBI_DEFAULT]
......@@ -718,11 +776,22 @@ void UnitBuf<T>::fill( const T &val )
}
template<typename T>
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
void UnitBuf<T>::copyFrom(const UnitBuf<const T> &other, const bool lumaOnly, const bool chromaOnly )
#else
void UnitBuf<T>::copyFrom( const UnitBuf<const T> &other )
#endif
{
CHECK( chromaFormat != other.chromaFormat, "Incompatible formats" );
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
CHECK( lumaOnly && chromaOnly, "Not allowed to have both lumaOnly and chromaOnly selected" );
const size_t compStart = chromaOnly ? 1 : 0;
const size_t compEnd = lumaOnly ? 1 : (unsigned) bufs.size();
for( size_t i = compStart; i < compEnd; i++ )
#else
for( unsigned i = 0; i < bufs.size(); i++ )
#endif
{
bufs[i].copyFrom( other.bufs[i] );
}
......@@ -742,11 +811,22 @@ void UnitBuf<T>::subtract( const UnitBuf<const T> &other )
}
template<typename T>
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
void UnitBuf<T>::copyClip(const UnitBuf<const T> &src, const ClpRngs &clpRngs, const bool lumaOnly, const bool chromaOnly )
#else
void UnitBuf<T>::copyClip(const UnitBuf<const T> &src, const ClpRngs& clpRngs)
#endif
{
CHECK( chromaFormat != src.chromaFormat, "Incompatible formats" );
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
CHECK( lumaOnly && chromaOnly, "Not allowed to have both lumaOnly and chromaOnly selected" );
const size_t compStart = chromaOnly ? 1 : 0;
const size_t compEnd = lumaOnly ? 1 : bufs.size();
for( size_t i = compStart; i < compEnd; i++ )
#else
for( unsigned i = 0; i < bufs.size(); i++ )
#endif
{
bufs[i].copyClip( src.bufs[i], clpRngs.comp[i] );
}
......@@ -802,6 +882,17 @@ void UnitBuf<T>::extendSingleBorderPel()
}
}
#if JVET_O0549_ENCODER_ONLY_FILTER
template<typename T>
void UnitBuf<T>::extendBorderPel(unsigned marginX, unsigned marginY)
{
for (unsigned i = 0; i < bufs.size(); i++)
{
bufs[i].extendBorderPel(marginX >> getComponentScaleX(ComponentID(i), chromaFormat), marginY >> getComponentScaleY(ComponentID(i), chromaFormat));
}
}
#endif
template<typename T>
void UnitBuf<T>::extendBorderPel( unsigned margin )
{
......
......@@ -75,8 +75,9 @@ CodingStructure::CodingStructure(CUCache& cuCache, PUCache& puCache, TUCache& tu
m_coeffs[ i ] = nullptr;
m_pcmbuf[ i ] = nullptr;
m_runType[i] = nullptr;
#if !JVET_P0077_LINE_CG_PALETTE
m_runLength[i] = nullptr;
#endif
m_offsets[ i ] = 0;
}
......@@ -190,9 +191,30 @@ void CodingStructure::setDecomp(const UnitArea &_area, const bool _isCoded /*= t
const int CodingStructure::signalModeCons( const PartSplit split, Partitioner &partitioner, const ModeType modeTypeParent ) const
{
if( CS::isDualITree( *this ) || modeTypeParent != MODE_TYPE_ALL || partitioner.currArea().chromaFormat == CHROMA_444 )
#if JVET_P0406_YUV_FMT_GENERALIZATION_LDT
if (CS::isDualITree(*this) || modeTypeParent != MODE_TYPE_ALL || partitioner.currArea().chromaFormat == CHROMA_444 || partitioner.currArea().chromaFormat == CHROMA_400 )
#else
if (CS::isDualITree(*this) || modeTypeParent != MODE_TYPE_ALL || partitioner.currArea().chromaFormat == CHROMA_444 )
#endif
return LDT_MODE_TYPE_INHERIT;
#if JVET_P0406_YUV_FMT_GENERALIZATION_LDT
int minLumaArea = partitioner.currArea().lumaSize().area();
if (split == CU_QUAD_SPLIT || split == CU_TRIH_SPLIT || split == CU_TRIV_SPLIT) // the area is split into 3 or 4 parts
{
minLumaArea = minLumaArea >> 2;
}
else if (split == CU_VERT_SPLIT || split == CU_HORZ_SPLIT) // the area is split into 2 parts
{
minLumaArea = minLumaArea >> 1;
}
int minChromaBlock = minLumaArea >> (getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, partitioner.currArea().chromaFormat) + getChannelTypeScaleY(CHANNEL_TYPE_CHROMA, partitioner.currArea().chromaFormat));
#if JVET_P0641_REMOVE_2xN_CHROMA_INTRA
bool is2xNChroma = (partitioner.currArea().chromaSize().width == 4 && split == CU_VERT_SPLIT) || (partitioner.currArea().chromaSize().width == 8 && split == CU_TRIV_SPLIT);
return minChromaBlock >= 16 && !is2xNChroma ? LDT_MODE_TYPE_INHERIT : ((minLumaArea < 32) || slice->isIntra()) ? LDT_MODE_TYPE_INFER : LDT_MODE_TYPE_SIGNAL;
#else
return minChromaBlock >= 16 ? LDT_MODE_TYPE_INHERIT : ((minLumaArea < 32) || slice->isIntra()) ? LDT_MODE_TYPE_INFER : LDT_MODE_TYPE_SIGNAL;
#endif
#else
int width = partitioner.currArea().lwidth();
int height = partitioner.currArea().lheight();
......@@ -203,17 +225,25 @@ const int CodingStructure::signalModeCons( const PartSplit split, Partitioner &p
else // bt
return slice->isIntra() ? LDT_MODE_TYPE_INFER : LDT_MODE_TYPE_SIGNAL;
}
else if( width * height == 128 )
#if JVET_P0641_REMOVE_2xN_CHROMA_INTRA
else if (((width * height == 128) && (split == CU_TRIH_SPLIT || split == CU_TRIV_SPLIT)) || (width == 8 && split == CU_VERT_SPLIT) || (width == 16 && split == CU_TRIV_SPLIT))
{
return slice->isIntra() ? LDT_MODE_TYPE_INFER : LDT_MODE_TYPE_SIGNAL;
}
#else
else if (width * height == 128)
{
if( split == CU_TRIH_SPLIT || split == CU_TRIV_SPLIT ) // tt
if (split == CU_TRIH_SPLIT || split == CU_TRIV_SPLIT) // tt
return slice->isIntra() ? LDT_MODE_TYPE_INFER : LDT_MODE_TYPE_SIGNAL;
else // bt
return LDT_MODE_TYPE_INHERIT;
}
#endif
else
{
return LDT_MODE_TYPE_INHERIT;
}
#endif
}
void CodingStructure::clearCuPuTuIdxMap( const UnitArea &_area, uint32_t numCu, uint32_t numPu, uint32_t numTu, uint32_t* pOffset )
......@@ -610,7 +640,9 @@ TransformUnit& CodingStructure::addTU( const UnitArea &unit, const ChannelType c
TCoeff *coeffs[5] = { nullptr, nullptr, nullptr, nullptr, nullptr };
Pel *pcmbuf[5] = { nullptr, nullptr, nullptr, nullptr, nullptr };
bool *runType[5] = { nullptr, nullptr, nullptr, nullptr, nullptr };
#if !JVET_P0077_LINE_CG_PALETTE
Pel *runLength[5] = { nullptr, nullptr, nullptr, nullptr, nullptr };
#endif
uint32_t numCh = ::getNumberValidComponents( area.chromaFormat );
......@@ -648,13 +680,17 @@ TransformUnit& CodingStructure::addTU( const UnitArea &unit, const ChannelType c
coeffs[i] = m_coeffs[i] + m_offsets[i];
pcmbuf[i] = m_pcmbuf[i] + m_offsets[i];
runType[i] = m_runType[i] + m_offsets[i];
#if !JVET_P0077_LINE_CG_PALETTE
runLength[i] = m_runLength[i] + m_offsets[i];
#endif
unsigned areaSize = tu->blocks[i].area();
m_offsets[i] += areaSize;
}
#if JVET_P0077_LINE_CG_PALETTE
tu->init(coeffs, pcmbuf, runType);
#else
tu->init( coeffs, pcmbuf, runLength, runType);
#endif
return *tu;
}
......@@ -934,7 +970,9 @@ void CodingStructure::createCoeffs()
m_coeffs[i] = _area > 0 ? ( TCoeff* ) xMalloc( TCoeff, _area ) : nullptr;
m_pcmbuf[i] = _area > 0 ? ( Pel* ) xMalloc( Pel, _area ) : nullptr;
m_runType[i] = _area > 0 ? ( bool* ) xMalloc( bool, _area ) : nullptr;
#if !JVET_P0077_LINE_CG_PALETTE
m_runLength[i] = _area > 0 ? ( Pel* ) xMalloc( Pel, _area ) : nullptr;
#endif
}
}
......@@ -945,7 +983,9 @@ void CodingStructure::destroyCoeffs()
if( m_coeffs[i] ) { xFree( m_coeffs[i] ); m_coeffs[i] = nullptr; }
if( m_pcmbuf[i] ) { xFree( m_pcmbuf[i] ); m_pcmbuf[i] = nullptr; }
if (m_runType[i]) { xFree(m_runType[i]); m_runType[i] = nullptr; }
#if !JVET_P0077_LINE_CG_PALETTE
if (m_runLength[i]) { xFree(m_runLength[i]); m_runLength[i] = nullptr; }
#endif
}
}
......
......@@ -231,7 +231,9 @@ private:
TCoeff *m_coeffs [ MAX_NUM_COMPONENT ];
Pel *m_pcmbuf [ MAX_NUM_COMPONENT ];
bool *m_runType [MAX_NUM_COMPONENT];
#if !JVET_P0077_LINE_CG_PALETTE
Pel *m_runLength[MAX_NUM_COMPONENT];
#endif
int m_offsets[ MAX_NUM_COMPONENT ];
MotionInfo *m_motionBuf;
......
......@@ -259,7 +259,11 @@ static const uint32_t MTS_INTER_MAX_CU_SIZE = 32; ///<
static const int NUM_MOST_PROBABLE_MODES = 6;
static const int LM_SYMBOL_NUM = (1 + NUM_LMC_MODE);
#if JVET_P0803_COMBINED_MIP_CLEANUP
static const int MAX_NUM_MIP_MODE = 32; ///< maximum number of MIP pred. modes
#else
static const int MAX_NUM_MIP_MODE = 35; ///< maximum number of MIP modes
#endif
static const int FAST_UDI_MAX_RDMODE_NUM = (NUM_LUMA_MODE + MAX_NUM_MIP_MODE); ///< maximum number of RD comparison in fast-UDI estimation loop
static const int MAX_LFNST_COEF_NUM = 16;
......@@ -463,12 +467,24 @@ static const int FP_PREC = 11;
static const int CSCALE_FP_PREC = 11;
static const int NEIG_NUM_LOG = 6;
static const int NEIG_NUM = 1 << NEIG_NUM_LOG;
#if JVET_P0077_LINE_CG_PALETTE
static const int LOG2_PALETTE_CG_SIZE = 4;
static const int RUN_IDX_THRE = 4;
static const int MAX_CU_BLKSIZE_PLT = 64;
static const int NUM_TRELLIS_STATE = 3;
static const double ENC_CHROMA_WEIGHTING = 0.8;
#endif
static const int MAXPLTPREDSIZE = 63;
static const int MAXPLTSIZE = 31;
#if JVET_P0526_PLT_ENCODER
static const double PLT_CHROMA_WEIGHTING = 0.8;
#endif
static const int PLT_ENCBITDEPTH = 8;
#if !JVET_P0077_LINE_CG_PALETTE
static const int PLT_RUN_MSB_IDX_CABAC_BYPASS_THRE = 4;
static const int PLT_RUN_MSB_IDX_CTX_T1 = 1;
static const int PLT_RUN_MSB_IDX_CTX_T2 = 3;
#endif
static const int PLT_FAST_RATIO = 100;
#if RExt__DECODER_DEBUG_TOOL_MAX_FRAME_STATS
static const int EPBIN_WEIGHT_FACTOR = 4;
......