Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • jvet/VVCSoftware_VTM
  • chenhuanbang/VVCSoftware_VTM
  • ezhizng/VVCSoftware_VTM
  • XZheng/VVCSoftware_VTM
  • YanZhang/VVCSoftware_VTM
  • xiaozhongxu/VVCSoftware_VTM
  • bossen/VVCSoftware_VTM
  • XiangLi/VVCSoftware_VTM
  • s.iwamura/VVCSoftware_VTM
  • yuling.hsiao/VVCSoftware_VTM
  • ccc2384823/VVCSoftware_VTM
  • yuchisu/VVCSoftware_VTM
  • schwarz/VVCSoftware_VTM
  • philippe.hanhart/VVCSoftware_VTM
  • nanh/VVCSoftware_VTM
  • guillaume.laroche/VVCSoftware_VTM
  • Kenneth/VVCSoftware_VTM
  • jonatan/VVCSoftware_VTM
  • Alexey/VVCSoftware_VTM
  • saintspear/VVCSoftware_VTM
  • xinzhao/VVCSoftware_VTM
  • Seungsoo/VVCSoftware_VTM
  • jamesxxiu/VVCSoftware_VTM
  • leolzhao/VVCSoftware_VTM
  • ywchen/VVCSoftware_VTM
  • kevin625/VVCSoftware_VTM
  • Zhang/VVCSoftware_VTM
  • zhangkai/VVCSoftware_VTM
  • YCSun/VVCSoftware_VTM
  • ksuehring/VVCSoftware_VTM
  • AbeKiyo/VVCSoftware_VTM
  • naeri.park/VVCSoftware_VTM
  • ling/VVCSoftware_VTM
  • aikiho/VVCSoftware_VTM
  • JangwonChoi/VVCSoftware_VTM
  • Shelly/VVCSoftware_VTM
  • blaeser/VVCSoftware_VTM
  • crhelmrich/VVCSoftware_VTM
  • keydel/VVCSoftware_VTM
  • adam_wieckowski/VVCSoftware_VTM
  • hashimry/VVCSoftware_VTM
  • yimingli/VVCSoftware_VTM
  • zhipin/VVCSoftware_VTM
  • chernyak/VVCSoftware_VTM
  • jvet-l-ahg-14/VVCSoftware_VTM
  • sauer/VVCSoftware_VTM
  • fbarbier/VVCSoftware_VTM
  • misrak/VVCSoftware_VTM
  • ikai/VVCSoftware_VTM
  • tlu/VVCSoftware_VTM
  • Yasugi/VVCSoftware_VTM
  • peterchuang/VVCSoftware_VTM
  • wanght99/VVCSoftware_VTM
  • yuhan/VVCSoftware_VTM
  • hongbin/VVCSoftware_VTM
  • jiahaoli/VVCSoftware_VTM
  • cfd/VVCSoftware_VTM
  • ruoyangyu/VVCSoftware_VTM
  • chujoh/VVCSoftware_VTM
  • lijingya/VVCSoftware_VTM
  • hinz/VVCSoftware_VTM
  • tamse.anish/VVCSoftware_VTM
  • mcoban/VVCSoftware_VTM
  • george/VVCSoftware_VTM
  • jeeva.raj/VVCSoftware_VTM
  • antoine/VVCSoftware_VTM
  • moonmo.koo/VVCSoftware_VTM
  • deluxan/VVCSoftware_VTM
  • bheng/VVCSoftware_VTM
  • lzz8246/VVCSoftware_VTM
  • delagrangep/VVCSoftware_VTM
  • jiechen/VVCSoftware_VTM
  • hendry197/VVCSoftware_VTM
  • LGE_VCC/VVCSoftware_VTM
  • asegall/VVCSoftware_VTM
  • pbcowan/VVCSoftware_VTM
  • forayr/VVCSoftware_VTM
  • JT/VVCSoftware_VTM
  • Zhou/VVCSoftware_VTM
  • yjpiao/VVCSoftware_VTM
  • fabrice.leleannec/VVCSoftware_VTM
  • tpoirier/VVCSoftware_VTM
  • PoHan.Lin/VVCSoftware_VTM
  • jzxu/VVCSoftware_VTM
  • junghak.nam/VVCSoftware_VTM
  • guichunli/VVCSoftware_VTM
  • xianglinwang/VVCSoftware_VTM
  • chunchic/VVCSoftware_VTM
  • chrisr12/VVCSoftware_VTM
  • ks_kashyap/VVCSoftware_VTM
  • minhua/VVCSoftware_VTM
  • Sheng-Yen.Lin/VVCSoftware_VTM
  • hegilmez/VVCSoftware_VTM
  • swongah/VVCSoftware_VTM
  • merkle/VVCSoftware_VTM
  • sunyucheng/VVCSoftware_VTM
  • kirchhoffer/VVCSoftware_VTM
  • vdrugeon/VVCSoftware_VTM
  • jennylai/VVCSoftware_VTM
  • rickxu/VVCSoftware_VTM
  • seuhong/VVCSoftware_VTM
  • chollmann/VVCSoftware_VTM
  • jvet-n-ce8-public/VVCSoftware_VTM
  • martin.m.pettersson/VVCSoftware_VTM
  • siekmann/VVCSoftware_VTM
  • aramasub/VVCSoftware_VTM
  • zhiyilin/VVCSoftware_VTM
  • EricLin/VVCSoftware_VTM
  • mengwang/VVCSoftware_VTM
  • m.sarwer/VVCSoftware_VTM
  • agnesedong/VVCSoftware_VTM
  • geonjungko/VVCSoftware_VTM
  • bray/VVCSoftware_VTM
  • yhchao/VVCSoftware_VTM
  • Zhu/VVCSoftware_VTM
  • ykato/VVCSoftware_VTM
  • ZhipinDeng/VVCSoftware_VTM
  • jasonjung/VVCSoftware_VTM
  • hanhuang/VVCSoftware_VTM
  • seregin/VVCSoftware_VTM
  • wchen1014/VVCSoftware_VTM
  • Auyeung/VVCSoftware_VTM
  • Morris/VVCSoftware_VTM
  • lphamvan/VVCSoftware_VTM
  • dmehlem/VVCSoftware_VTM
  • shih-ta.hsiang/VVCSoftware_VTM
  • ysanchez/VVCSoftware_VTM
  • baegn74/VVCSoftware_VTM
  • kazui/VVCSoftware_VTM
  • yuwenhe_vvc/VVCSoftware_VTM
  • rickard/VVCSoftware_VTM
  • wangyang.cs/VVCSoftware_VTM
  • xwmeng/VVCSoftware_VTM
  • takeshi.tsukuba/VVCSoftware_VTM
  • yixindu/VVCSoftware_VTM
  • baixiu.wz/VVCSoftware_VTM
  • hm.jang/VVCSoftware_VTM
  • Ted/VVCSoftware_VTM
  • nguyen/VVCSoftware_VTM
  • chaohsiu/VVCSoftware_VTM
  • francoise/VVCSoftware_VTM
  • Yin/VVCSoftware_VTM
  • Morigami/VVCSoftware_VTM
  • sagar.kotecha/VVCSoftware_VTM
  • hwsun/VVCSoftware_VTM
  • pierrick.bouvier/VVCSoftware_VTM
  • XiangMa/VVCSoftware_VTM
  • LouiseLee/VVCSoftware_VTM
  • chenps/VVCSoftware_VTM
  • karls/VVCSoftware_VTM
  • biaowang/VVCSoftware_VTM
  • hangao/VVCSoftware_VTM
  • Jin/VVCSoftware_VTM
  • analci/VVCSoftware_VTM
  • KuiFan/VVCSoftware_VTM
  • hobingzhang/VVCSoftware_VTM
  • audrey.turquin/VVCSoftware_VTM
  • rlliao/VVCSoftware_VTM
  • winken/VVCSoftware_VTM
  • hallapur/VVCSoftware_VTM
  • T.Hashimoto/VVCSoftware_VTM
  • AnandMeher/VVCSoftware_VTM
  • semihese/VVCSoftware_VTM
  • ouedraogo/VVCSoftware_VTM
  • arthurcerveira/VVCSoftware_VTM
  • sunmi.yoo/VVCSoftware_VTM
  • Cynthia/VVCSoftware_VTM
  • yang/VVCSoftware_VTM
  • yuyoon/VVCSoftware_VTM
  • jslee/VVCSoftware_VTM
  • weimin.zeng/VVCSoftware_VTM
  • edrthomas/VVCSoftware_VTM
  • Mitsuru.Katsumata/VVCSoftware_VTM
  • adybrowne/VVCSoftware_VTM
  • jack.enhorn/VVCSoftware_VTM
  • Palanivel/VVCSoftware_VTM
  • olena.chubach/VVCSoftware_VTM
  • juvenalluo/VVCSoftware_VTM
  • yylee/VVCSoftware_VTM
  • bross/VVCSoftware_VTM
  • jvet-ahg-nnvc/VVCSoftware_VTM
  • jacob/VVCSoftware_VTM
  • dmytro.rusanovskyy/VVCSoftware_VTM
  • karamnaser/VVCSoftware_VTM
  • milos.radosavljevic/VVCSoftware_VTM
  • Keming/VVCSoftware_VTM
  • pj/VVCSoftware_VTM
  • cwkuo/VVCSoftware_VTM
  • BD/VVCSoftware_VTM
  • bartnik/VVCSoftware_VTM
  • Fangjun.Pu/VVCSoftware_VTM
  • nikolay.shostak/VVCSoftware_VTM
  • kirill.suverov/VVCSoftware_VTM
  • Xile_Zhou/VVCSoftware_VTM
  • ksuehring/vvc-software-vtm-nnvc
  • guether/VVCSoftware_VTM
  • salmonc/VVCSoftware_VTM
  • eeehey/VVCSoftware_VTM
  • marie-pierre.gallasso/VVCSoftware_VTM
  • jvet-ahg-fgt/VTM
  • liaojq/VVCSoftware_VTM
  • axel.ricard/VVCSoftware_VTM
  • XiangLi/nnvc
  • sw.xie/VVCSoftware_VTM
  • jeeva.raj/vvc-software-vtm-tu-c
  • XiangLi/tu-c
  • msantamaria/nnvc
  • cjj490168650/VVCSoftware_VTM
  • Yun_li/VVCSoftware_VTM
  • Zhengang/vvc-software-vtm
  • lvzhuoyi/vvc-software-vtm-nnvc
  • Kenneth/vvc-software-vtm-nn
  • biatekt/vvc-software-vtm
  • jvet-ahg-gcc/VVCSoftware_VTM
  • JINGYING/VVCSoftware_VTM
  • furban/VVCSoftware_VTM
  • yanning/VVCSoftware_VTM
  • zhuochen/VVCSoftware_VTM
  • Kaifa/VVCSoftware_VTM_AJ0048
  • yueli/VVCSoftware_VTM
  • tokumo/VVCSoftware_VTM
221 results
Show changes
Commits on Source (22)
Showing
with 539 additions and 46 deletions
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
...@@ -2040,31 +2040,31 @@ If enabled use a fast ME for generalised B Low Delay slices ...@@ -2040,31 +2040,31 @@ If enabled use a fast ME for generalised B Low Delay slices
Enables use of B-Lambda for non-key low-delay pictures Enables use of B-Lambda for non-key low-delay pictures
\\ \\
\Option{TransquantBypassEnable} & %\Option{TransquantBypassEnable} &
%\ShortOption{\None} & %%\ShortOption{\None} &
\Default{false} & %\Default{false} &
Enables or disables the ability to bypass the transform, %Enables or disables the ability to bypass the transform,
quantization and filtering stages at CU level. %quantization and filtering stages at CU level.
This option corresponds to the value of %This option corresponds to the value of
transquant_bypass_enabled_flag that is transmitted in the PPS. %transquant_bypass_enabled_flag that is transmitted in the PPS.
%
See CUTransquantBypassFlagForce for further details. %See CUTransquantBypassFlagForce for further details.
\\ %\\
%
\Option{CUTransquantBypassFlagForce} & %\Option{CUTransquantBypassFlagForce} &
%\ShortOption{\None} & %%\ShortOption{\None} &
\Default{0} & %\Default{0} &
Controls the per CU transformation, quantization and filtering %Controls the per CU transformation, quantization and filtering
mode decision. %mode decision.
This option controls the value of the per CU cu_transquant_bypass_flag. %This option controls the value of the per CU cu_transquant_bypass_flag.
\par %\par
\begin{tabular}{cp{0.45\textwidth}} %\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. \\ % 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. \\ % 1 & Bypass is forced for all CUs. \\
\end{tabular} %\end{tabular}
%
This option has no effect if TransquantBypassEnable is disabled. %This option has no effect if TransquantBypassEnable is disabled.
\\ %\\
\Option{PCMEnabledFlag} & \Option{PCMEnabledFlag} &
%\ShortOption{\None} & %\ShortOption{\None} &
...@@ -2614,9 +2614,9 @@ Specifies the cost mode to use. ...@@ -2614,9 +2614,9 @@ Specifies the cost mode to use.
\par \par
\begin{tabular}{lp{0.3\textwidth}} \begin{tabular}{lp{0.3\textwidth}}
lossy & $cost=distortion+\lambda \times bits$ \\ lossy & $cost=distortion+\lambda \times bits$ \\
sequence_level_lossless & $cost=distortion / \lambda + 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) \\ 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 \\ % mixed_lossless_lossy & As with sequence_level_lossless, but QP'=4 is used for pre-estimates of transquant-bypass blocks \\
\end{tabular} \end{tabular}
\\ \\
......
...@@ -733,9 +733,17 @@ struct UnitBuf ...@@ -733,9 +733,17 @@ struct UnitBuf
const AreaBuf<T>& Cr() const { return bufs[2]; } const AreaBuf<T>& Cr() const { return bufs[2]; }
void fill ( const T &val ); 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 ); void copyFrom ( const UnitBuf<const T> &other );
#endif
void reconstruct ( const UnitBuf<const T> &pred, const UnitBuf<const T> &resi, const ClpRngs& clpRngs ); 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 ); void copyClip ( const UnitBuf<const T> &src, const ClpRngs& clpRngs );
#endif
void subtract ( const UnitBuf<const T> &other ); 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 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 addAvg ( const UnitBuf<const T> &other1, const UnitBuf<const T> &other2, const ClpRngs& clpRngs, const bool chromaOnly = false, const bool lumaOnly = false);
...@@ -768,11 +776,22 @@ void UnitBuf<T>::fill( const T &val ) ...@@ -768,11 +776,22 @@ void UnitBuf<T>::fill( const T &val )
} }
template<typename T> 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 ) void UnitBuf<T>::copyFrom( const UnitBuf<const T> &other )
#endif
{ {
CHECK( chromaFormat != other.chromaFormat, "Incompatible formats" ); 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++ ) for( unsigned i = 0; i < bufs.size(); i++ )
#endif
{ {
bufs[i].copyFrom( other.bufs[i] ); bufs[i].copyFrom( other.bufs[i] );
} }
...@@ -792,11 +811,22 @@ void UnitBuf<T>::subtract( const UnitBuf<const T> &other ) ...@@ -792,11 +811,22 @@ void UnitBuf<T>::subtract( const UnitBuf<const T> &other )
} }
template<typename T> 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) void UnitBuf<T>::copyClip(const UnitBuf<const T> &src, const ClpRngs& clpRngs)
#endif
{ {
CHECK( chromaFormat != src.chromaFormat, "Incompatible formats" ); 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++ ) for( unsigned i = 0; i < bufs.size(); i++ )
#endif
{ {
bufs[i].copyClip( src.bufs[i], clpRngs.comp[i] ); bufs[i].copyClip( src.bufs[i], clpRngs.comp[i] );
} }
......
...@@ -268,7 +268,11 @@ bool InterPrediction::xCheckIdenticalMotion( const PredictionUnit &pu ) ...@@ -268,7 +268,11 @@ bool InterPrediction::xCheckIdenticalMotion( const PredictionUnit &pu )
return false; return false;
} }
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList /*= REF_PIC_LIST_X*/, const bool luma /*= true*/, const bool chroma /*= true*/)
#else
void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList /*= REF_PIC_LIST_X*/ ) void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList /*= REF_PIC_LIST_X*/ )
#endif
{ {
// compute the location of the current PU // compute the location of the current PU
...@@ -338,7 +342,11 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R ...@@ -338,7 +342,11 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R
PelUnitBuf subPredBuf = predBuf.subBuf(UnitAreaRelative(pu, subPu)); PelUnitBuf subPredBuf = predBuf.subBuf(UnitAreaRelative(pu, subPu));
subPu.mmvdEncOptMode = 0; subPu.mmvdEncOptMode = 0;
subPu.mvRefine = false; subPu.mvRefine = false;
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
motionCompensation(subPu, subPredBuf, eRefPicList, luma, chroma);
#else
motionCompensation(subPu, subPredBuf, eRefPicList); motionCompensation(subPu, subPredBuf, eRefPicList);
#endif
secDim = later - secStep; secDim = later - secStep;
} }
} }
...@@ -443,7 +451,12 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& ...@@ -443,7 +451,12 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList&
{ {
CHECK( bioApplied, "BIO is not allowed with affine" ); CHECK( bioApplied, "BIO is not allowed with affine" );
m_iRefListIdx = eRefPicList; m_iRefListIdx = eRefPicList;
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
bool genChromaMv = (!luma && chroma && compID == COMPONENT_Cb);
xPredAffineBlk( compID, pu, pu.cu->slice->getRefPic( eRefPicList, iRefIdx )->unscaledPic, mv, pcYuvPred, bi, pu.cu->slice->clpRng( compID ), genChromaMv, pu.cu->slice->getScalingRatio( eRefPicList, iRefIdx ));
#else
xPredAffineBlk( compID, pu, pu.cu->slice->getRefPic( eRefPicList, iRefIdx )->unscaledPic, mv, pcYuvPred, bi, pu.cu->slice->clpRng( compID ), pu.cu->slice->getScalingRatio( eRefPicList, iRefIdx )); xPredAffineBlk( compID, pu, pu.cu->slice->getRefPic( eRefPicList, iRefIdx )->unscaledPic, mv, pcYuvPred, bi, pu.cu->slice->clpRng( compID ), pu.cu->slice->getScalingRatio( eRefPicList, iRefIdx ));
#endif
} }
else else
{ {
...@@ -462,7 +475,11 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& ...@@ -462,7 +475,11 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList&
} }
} }
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
void InterPrediction::xPredInterBi(PredictionUnit &pu, PelUnitBuf &pcYuvPred, const bool luma, const bool chroma, PelUnitBuf *yuvPredTmp /*= NULL*/)
#else
void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred, PelUnitBuf* yuvPredTmp /*= NULL*/) void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred, PelUnitBuf* yuvPredTmp /*= NULL*/)
#endif
{ {
const PPS &pps = *pu.cs->pps; const PPS &pps = *pu.cs->pps;
const Slice &slice = *pu.cs->slice; const Slice &slice = *pu.cs->slice;
...@@ -547,12 +564,20 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred, Pe ...@@ -547,12 +564,20 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred, Pe
if (dmvrApplied) if (dmvrApplied)
{ {
if (yuvPredTmp) if (yuvPredTmp)
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
xPredInterUni(pu, eRefPicList, pcMbBuf, true, false, luma, chroma);
#else
xPredInterUni(pu, eRefPicList, pcMbBuf, true, false, true, true); xPredInterUni(pu, eRefPicList, pcMbBuf, true, false, true, true);
#endif
continue; continue;
} }
xPredInterUni ( pu, eRefPicList, pcMbBuf, true xPredInterUni ( pu, eRefPicList, pcMbBuf, true
, bioApplied , bioApplied
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, luma, chroma
#else
, true, true , true, true
#endif
); );
} }
else else
...@@ -561,14 +586,22 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred, Pe ...@@ -561,14 +586,22 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred, Pe
{ {
xPredInterUni ( pu, eRefPicList, pcMbBuf, true xPredInterUni ( pu, eRefPicList, pcMbBuf, true
, bioApplied , bioApplied
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, luma, chroma
#else
, true, true , true, true
#endif
); );
} }
else else
{ {
xPredInterUni( pu, eRefPicList, pcMbBuf, pu.cu->triangle xPredInterUni( pu, eRefPicList, pcMbBuf, pu.cu->triangle
, bioApplied , bioApplied
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, luma, chroma
#else
, true, true , true, true
#endif
); );
} }
} }
...@@ -579,15 +612,27 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred, Pe ...@@ -579,15 +612,27 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred, Pe
CPelUnitBuf srcPred1 = ( pu.chromaFormat == CHROMA_400 ? CPelUnitBuf srcPred1 = ( pu.chromaFormat == CHROMA_400 ?
CPelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[1][0], pcYuvPred.Y())) : CPelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[1][0], pcYuvPred.Y())) :
CPelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[1][0], pcYuvPred.Y()), PelBuf(m_acYuvPred[1][1], pcYuvPred.Cb()), PelBuf(m_acYuvPred[1][2], pcYuvPred.Cr())) ); CPelUnitBuf(pu.chromaFormat, PelBuf(m_acYuvPred[1][0], pcYuvPred.Y()), PelBuf(m_acYuvPred[1][1], pcYuvPred.Cb()), PelBuf(m_acYuvPred[1][2], pcYuvPred.Cr())) );
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
const bool lumaOnly = luma && !chroma;
const bool chromaOnly = !luma && chroma;
#endif
if( !pu.cu->triangle && (!dmvrApplied) && (!bioApplied) && pps.getWPBiPred() && slice.getSliceType() == B_SLICE && pu.cu->GBiIdx==GBI_DEFAULT) if( !pu.cu->triangle && (!dmvrApplied) && (!bioApplied) && pps.getWPBiPred() && slice.getSliceType() == B_SLICE && pu.cu->GBiIdx==GBI_DEFAULT)
{ {
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
xWeightedPredictionBi( pu, srcPred0, srcPred1, pcYuvPred, m_maxCompIDToPred, lumaOnly, chromaOnly );
#else
xWeightedPredictionBi( pu, srcPred0, srcPred1, pcYuvPred, m_maxCompIDToPred ); xWeightedPredictionBi( pu, srcPred0, srcPred1, pcYuvPred, m_maxCompIDToPred );
#endif
if (yuvPredTmp) if (yuvPredTmp)
yuvPredTmp->copyFrom(pcYuvPred); yuvPredTmp->copyFrom(pcYuvPred);
} }
else if( !pu.cu->triangle && pps.getUseWP() && slice.getSliceType() == P_SLICE ) else if( !pu.cu->triangle && pps.getUseWP() && slice.getSliceType() == P_SLICE )
{ {
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
xWeightedPredictionUni( pu, srcPred0, REF_PIC_LIST_0, pcYuvPred, -1, m_maxCompIDToPred, lumaOnly, chromaOnly );
#else
xWeightedPredictionUni( pu, srcPred0, REF_PIC_LIST_0, pcYuvPred, -1, m_maxCompIDToPred ); xWeightedPredictionUni( pu, srcPred0, REF_PIC_LIST_0, pcYuvPred, -1, m_maxCompIDToPred );
#endif
if (yuvPredTmp) if (yuvPredTmp)
yuvPredTmp->copyFrom(pcYuvPred); yuvPredTmp->copyFrom(pcYuvPred);
} }
...@@ -603,7 +648,11 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred, Pe ...@@ -603,7 +648,11 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred, Pe
} }
else else
{ {
xWeightedAverage( pu, srcPred0, srcPred1, pcYuvPred, slice.getSPS()->getBitDepths(), slice.clpRngs(), bioApplied, yuvPredTmp); #if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
xWeightedAverage( pu, srcPred0, srcPred1, pcYuvPred, slice.getSPS()->getBitDepths(), slice.clpRngs(), bioApplied, lumaOnly, chromaOnly, yuvPredTmp );
#else
xWeightedAverage( pu, srcPred0, srcPred1, pcYuvPred, slice.getSPS()->getBitDepths(), slice.clpRngs(), bioApplied, yuvPredTmp );
#endif
} }
} }
} }
...@@ -800,7 +849,11 @@ bool InterPrediction::isSubblockVectorSpreadOverLimit( int a, int b, int c, int ...@@ -800,7 +849,11 @@ bool InterPrediction::isSubblockVectorSpreadOverLimit( int a, int b, int c, int
return false; return false;
} }
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
void InterPrediction::xPredAffineBlk(const ComponentID &compID, const PredictionUnit &pu, const Picture *refPic, const Mv *_mv, PelUnitBuf &dstPic, const bool &bi, const ClpRng &clpRng, bool genChromaMv, const std::pair<int, int> scalingRatio)
#else
void InterPrediction::xPredAffineBlk( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng, const std::pair<int, int> scalingRatio ) void InterPrediction::xPredAffineBlk( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng, const std::pair<int, int> scalingRatio )
#endif
{ {
JVET_J0090_SET_REF_PICTURE( refPic, compID ); JVET_J0090_SET_REF_PICTURE( refPic, compID );
...@@ -983,6 +1036,68 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio ...@@ -983,6 +1036,68 @@ void InterPrediction::xPredAffineBlk( const ComponentID& compID, const Predictio
#endif #endif
} }
} }
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
int scaleXLuma = ::getComponentScaleX(COMPONENT_Y, chFmt);
int scaleYLuma = ::getComponentScaleY(COMPONENT_Y, chFmt);
if (genChromaMv && pu.chromaFormat != CHROMA_444)
{
CHECK(compID == COMPONENT_Y, "Chroma only subblock MV calculation should not apply to Luma");
int lumaBlockWidth = AFFINE_MIN_BLOCK_SIZE;
int lumaBlockHeight = AFFINE_MIN_BLOCK_SIZE;
CHECK(lumaBlockWidth > (width >> scaleXLuma), "Sub Block width > Block width");
CHECK(lumaBlockHeight > (height >> scaleYLuma), "Sub Block height > Block height");
const int cxWidthLuma = width >> scaleXLuma;
const int cxHeightLuma = height >> scaleYLuma;
const int halfBWLuma = lumaBlockWidth >> 1;
const int halfBHLuma = lumaBlockHeight >> 1;
int dMvHorXLuma, dMvHorYLuma, dMvVerXLuma, dMvVerYLuma;
dMvHorXLuma = (mvRT - mvLT).getHor() << (iBit - floorLog2(cxWidthLuma));
dMvHorYLuma = (mvRT - mvLT).getVer() << (iBit - floorLog2(cxWidthLuma));
if (pu.cu->affineType == AFFINEMODEL_6PARAM)
{
dMvVerXLuma = (mvLB - mvLT).getHor() << (iBit - floorLog2(cxHeightLuma));
dMvVerYLuma = (mvLB - mvLT).getVer() << (iBit - floorLog2(cxHeightLuma));
}
else
{
dMvVerXLuma = -dMvHorYLuma;
dMvVerYLuma = dMvHorXLuma;
}
const bool subblkMVSpreadOverLimitLuma = isSubblockVectorSpreadOverLimit(dMvHorXLuma, dMvHorYLuma, dMvVerXLuma, dMvVerYLuma, pu.interDir);
// get luma MV block by block
for (int h = 0; h < cxHeightLuma; h += lumaBlockHeight)
{
for (int w = 0; w < cxWidthLuma; w += lumaBlockWidth)
{
int mvScaleTmpHor, mvScaleTmpVer;
if (!subblkMVSpreadOverLimitLuma)
{
mvScaleTmpHor = iMvScaleHor + dMvHorXLuma * (halfBWLuma + w) + dMvVerXLuma * (halfBHLuma + h);
mvScaleTmpVer = iMvScaleVer + dMvHorYLuma * (halfBWLuma + w) + dMvVerYLuma * (halfBHLuma + h);
}
else
{
mvScaleTmpHor = iMvScaleHor + dMvHorXLuma * (cxWidthLuma >> 1) + dMvVerXLuma * (cxHeightLuma >> 1);
mvScaleTmpVer = iMvScaleVer + dMvHorYLuma * (cxWidthLuma >> 1) + dMvVerYLuma * (cxHeightLuma >> 1);
}
roundAffineMv(mvScaleTmpHor, mvScaleTmpVer, shift);
Mv tmpMv(mvScaleTmpHor, mvScaleTmpVer);
tmpMv.clipToStorageBitDepth();
mvScaleTmpHor = tmpMv.getHor();
mvScaleTmpVer = tmpMv.getVer();
m_storedMv[h / AFFINE_MIN_BLOCK_SIZE * MVBUFFER_SIZE + w / AFFINE_MIN_BLOCK_SIZE].set(mvScaleTmpHor, mvScaleTmpVer);
}
}
}
#endif
// get prediction block by block // get prediction block by block
for ( int h = 0; h < cxHeight; h += blockHeight ) for ( int h = 0; h < cxHeight; h += blockHeight )
{ {
...@@ -1319,15 +1434,27 @@ void InterPrediction::xCalcBlkGradient(int sx, int sy, int *arraysGx2, int ...@@ -1319,15 +1434,27 @@ void InterPrediction::xCalcBlkGradient(int sx, int sy, int *arraysGx2, int
g_pelBufOP.calcBlkGradient(sx, sy, arraysGx2, arraysGxGy, arraysGxdI, arraysGy2, arraysGydI, sGx2, sGy2, sGxGy, sGxdI, sGydI, width, height, unitSize); g_pelBufOP.calcBlkGradient(sx, sy, arraysGx2, arraysGxGy, arraysGxdI, arraysGy2, arraysGydI, sGx2, sGy2, sGxGy, sGxdI, sGydI, width, height, unitSize);
} }
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied, bool lumaOnly, bool chromaOnly, PelUnitBuf* yuvDstTmp /*= NULL*/)
#else
void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied, PelUnitBuf* yuvDstTmp /*= NULL*/) void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied, PelUnitBuf* yuvDstTmp /*= NULL*/)
#endif
{ {
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
CHECK( (chromaOnly && lumaOnly), "should not happen" );
#endif
const int iRefIdx0 = pu.refIdx[0]; const int iRefIdx0 = pu.refIdx[0];
const int iRefIdx1 = pu.refIdx[1]; const int iRefIdx1 = pu.refIdx[1];
if( iRefIdx0 >= 0 && iRefIdx1 >= 0 ) if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
{ {
#if !JVET_P0154_PROF_SAMPLE_OFFSET_CLIPPING #if !JVET_P0154_PROF_SAMPLE_OFFSET_CLIPPING
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
if (!chromaOnly && pu.cu->affine && (m_applyPROF[0] || m_applyPROF[1]))
#else
if (pu.cu->affine && (m_applyPROF[0] || m_applyPROF[1])) if (pu.cu->affine && (m_applyPROF[0] || m_applyPROF[1]))
#endif
{ {
xApplyBiPROF(pu, pcYuvSrc0.bufs[COMPONENT_Y], pcYuvSrc1.bufs[COMPONENT_Y], pcYuvDst.bufs[COMPONENT_Y], clpRngs.comp[COMPONENT_Y]); xApplyBiPROF(pu, pcYuvSrc0.bufs[COMPONENT_Y], pcYuvSrc1.bufs[COMPONENT_Y], pcYuvDst.bufs[COMPONENT_Y], clpRngs.comp[COMPONENT_Y]);
pcYuvDst.addWeightedAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, pu.cu->GBiIdx, true); pcYuvDst.addWeightedAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, pu.cu->GBiIdx, true);
...@@ -1338,9 +1465,17 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB ...@@ -1338,9 +1465,17 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB
if( pu.cu->GBiIdx != GBI_DEFAULT && (yuvDstTmp || !pu.mhIntraFlag) ) if( pu.cu->GBiIdx != GBI_DEFAULT && (yuvDstTmp || !pu.mhIntraFlag) )
{ {
CHECK(bioApplied, "GBi is disallowed with BIO"); CHECK(bioApplied, "GBi is disallowed with BIO");
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
pcYuvDst.addWeightedAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, pu.cu->GBiIdx, chromaOnly, lumaOnly);
#else
pcYuvDst.addWeightedAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, pu.cu->GBiIdx); pcYuvDst.addWeightedAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, pu.cu->GBiIdx);
#endif
if (yuvDstTmp) if (yuvDstTmp)
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
yuvDstTmp->addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, chromaOnly, lumaOnly);
#else
yuvDstTmp->addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, false); yuvDstTmp->addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, false);
#endif
return; return;
} }
if (bioApplied) if (bioApplied)
...@@ -1373,13 +1508,30 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB ...@@ -1373,13 +1508,30 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB
getWpScaling(pu.cu->slice, iRefIdx0, iRefIdx1, pwp0, pwp1); getWpScaling(pu.cu->slice, iRefIdx0, iRefIdx1, pwp0, pwp1);
if (!bioApplied) if (!bioApplied)
{ {
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
if (!chromaOnly)
#endif
addWeightBiComponent(pcYuvSrc0, pcYuvSrc1, pu.cu->slice->clpRngs(), pwp0, pwp1, pcYuvDst, true, COMPONENT_Y); addWeightBiComponent(pcYuvSrc0, pcYuvSrc1, pu.cu->slice->clpRngs(), pwp0, pwp1, pcYuvDst, true, COMPONENT_Y);
} }
addWeightBiComponent(pcYuvSrc0, pcYuvSrc1, pu.cu->slice->clpRngs(), pwp0, pwp1, pcYuvDst, true, COMPONENT_Cb); #if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
addWeightBiComponent(pcYuvSrc0, pcYuvSrc1, pu.cu->slice->clpRngs(), pwp0, pwp1, pcYuvDst, true, COMPONENT_Cr); if (!lumaOnly)
{
#endif
addWeightBiComponent(pcYuvSrc0, pcYuvSrc1, pu.cu->slice->clpRngs(), pwp0, pwp1, pcYuvDst, true, COMPONENT_Cb);
addWeightBiComponent(pcYuvSrc0, pcYuvSrc1, pu.cu->slice->clpRngs(), pwp0, pwp1, pcYuvDst, true, COMPONENT_Cr);
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
}
#endif
} }
else else
{ {
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
if (!bioApplied && (lumaOnly || chromaOnly))
{
pcYuvDst.addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, chromaOnly, lumaOnly);
}
else
#endif
pcYuvDst.addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, bioApplied); pcYuvDst.addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, bioApplied);
} }
if (yuvDstTmp) if (yuvDstTmp)
...@@ -1390,7 +1542,11 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB ...@@ -1390,7 +1542,11 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB
yuvDstTmp->bufs[2].copyFrom(pcYuvDst.bufs[2]); yuvDstTmp->bufs[2].copyFrom(pcYuvDst.bufs[2]);
} }
else else
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
yuvDstTmp->copyFrom(pcYuvDst, lumaOnly, chromaOnly);
#else
yuvDstTmp->copyFrom(pcYuvDst); yuvDstTmp->copyFrom(pcYuvDst);
#endif
} }
} }
else if( iRefIdx0 >= 0 && iRefIdx1 < 0 ) else if( iRefIdx0 >= 0 && iRefIdx1 < 0 )
...@@ -1400,9 +1556,17 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB ...@@ -1400,9 +1556,17 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB
pcYuvDst.copyFrom( pcYuvSrc0 ); pcYuvDst.copyFrom( pcYuvSrc0 );
} }
else else
pcYuvDst.copyClip( pcYuvSrc0, clpRngs ); #if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
pcYuvDst.copyClip( pcYuvSrc0, clpRngs, lumaOnly, chromaOnly );
#else
pcYuvDst.copyClip( pcYuvSrc0, clpRngs );
#endif
if (yuvDstTmp) if (yuvDstTmp)
yuvDstTmp->copyFrom(pcYuvDst); #if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
yuvDstTmp->copyFrom( pcYuvDst, lumaOnly, chromaOnly );
#else
yuvDstTmp->copyFrom( pcYuvDst );
#endif
} }
else if( iRefIdx0 < 0 && iRefIdx1 >= 0 ) else if( iRefIdx0 < 0 && iRefIdx1 >= 0 )
{ {
...@@ -1411,9 +1575,17 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB ...@@ -1411,9 +1575,17 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB
pcYuvDst.copyFrom( pcYuvSrc1 ); pcYuvDst.copyFrom( pcYuvSrc1 );
} }
else else
pcYuvDst.copyClip( pcYuvSrc1, clpRngs ); #if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
pcYuvDst.copyClip( pcYuvSrc1, clpRngs, lumaOnly, chromaOnly );
#else
pcYuvDst.copyClip( pcYuvSrc1, clpRngs );
#endif
if (yuvDstTmp) if (yuvDstTmp)
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
yuvDstTmp->copyFrom(pcYuvDst, lumaOnly, chromaOnly);
#else
yuvDstTmp->copyFrom(pcYuvDst); yuvDstTmp->copyFrom(pcYuvDst);
#endif
} }
} }
...@@ -1604,15 +1776,27 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu ...@@ -1604,15 +1776,27 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
{ {
xPredInterUni ( pu, eRefPicList, predBuf, true xPredInterUni ( pu, eRefPicList, predBuf, true
, false , false
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, luma, chroma
#else
, true, true , true, true
#endif
);
xWeightedPredictionUni( pu, predBuf, eRefPicList, predBuf, -1, m_maxCompIDToPred
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, (luma && !chroma), (!luma && chroma)
#endif
); );
xWeightedPredictionUni( pu, predBuf, eRefPicList, predBuf, -1, m_maxCompIDToPred );
} }
else else
{ {
xPredInterUni( pu, eRefPicList, predBuf, false xPredInterUni( pu, eRefPicList, predBuf, false
, false , false
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, luma, chroma
#else
, true, true , true, true
#endif
); );
} }
} }
...@@ -1684,20 +1868,36 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu ...@@ -1684,20 +1868,36 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
if (pu.mergeType != MRG_TYPE_DEFAULT_N && pu.mergeType != MRG_TYPE_IBC) if (pu.mergeType != MRG_TYPE_DEFAULT_N && pu.mergeType != MRG_TYPE_IBC)
{ {
CHECK(predBufWOBIO != NULL, "the case should not happen!"); CHECK(predBufWOBIO != NULL, "the case should not happen!");
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
xSubPuMC( pu, predBuf, eRefPicList, luma, chroma );
#else
xSubPuMC( pu, predBuf, eRefPicList ); xSubPuMC( pu, predBuf, eRefPicList );
#endif
} }
else if( xCheckIdenticalMotion( pu ) ) else if( xCheckIdenticalMotion( pu ) )
{ {
xPredInterUni( pu, REF_PIC_LIST_0, predBuf, false xPredInterUni( pu, REF_PIC_LIST_0, predBuf, false
, false , false
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, luma, chroma
#else
, true, true , true, true
#endif
); );
if (predBufWOBIO) if (predBufWOBIO)
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
predBufWOBIO->copyFrom(predBuf, (luma && !chroma), (chroma && !luma));
#else
predBufWOBIO->copyFrom(predBuf); predBufWOBIO->copyFrom(predBuf);
#endif
} }
else else
{ {
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
xPredInterBi(pu, predBuf, luma, chroma, predBufWOBIO);
#else
xPredInterBi(pu, predBuf, predBufWOBIO); xPredInterBi(pu, predBuf, predBufWOBIO);
#endif
} }
} }
return; return;
......
...@@ -130,7 +130,11 @@ protected: ...@@ -130,7 +130,11 @@ protected:
, const bool& bioApplied , const bool& bioApplied
, const bool luma, const bool chroma , const bool luma, const bool chroma
); );
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
void xPredInterBi ( PredictionUnit& pu, PelUnitBuf &pcYuvPred, const bool luma = true, const bool chroma = true, PelUnitBuf* yuvPredTmp = NULL );
#else
void xPredInterBi ( PredictionUnit& pu, PelUnitBuf &pcYuvPred, PelUnitBuf* yuvPredTmp = NULL ); void xPredInterBi ( PredictionUnit& pu, PelUnitBuf &pcYuvPred, PelUnitBuf* yuvPredTmp = NULL );
#endif
void xPredInterBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv& _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng void xPredInterBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv& _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng
, const bool& bioApplied , const bool& bioApplied
, bool isIBC , bool isIBC
...@@ -146,17 +150,28 @@ protected: ...@@ -146,17 +150,28 @@ protected:
void xBioGradFilter (Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, int bitDepth); void xBioGradFilter (Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, int bitDepth);
void xCalcBIOPar (const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG, int bitDepth); void xCalcBIOPar (const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG, int bitDepth);
void xCalcBlkGradient (int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize); void xCalcBlkGradient (int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize);
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
void xWeightedAverage ( const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied, const bool lumaOnly = false, const bool chromaOnly = false, PelUnitBuf* yuvDstTmp = NULL );
#else
void xWeightedAverage ( const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied, PelUnitBuf* yuvDstTmp = NULL ); void xWeightedAverage ( const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied, PelUnitBuf* yuvDstTmp = NULL );
#endif
#if !JVET_P0154_PROF_SAMPLE_OFFSET_CLIPPING #if !JVET_P0154_PROF_SAMPLE_OFFSET_CLIPPING
void xApplyBiPROF (const PredictionUnit& pu, const CPelBuf& pcYuvSrc0, const CPelBuf& pcYuvSrc1, PelBuf& pcYuvDst, const ClpRng& clpRng); void xApplyBiPROF (const PredictionUnit& pu, const CPelBuf& pcYuvSrc0, const CPelBuf& pcYuvSrc1, PelBuf& pcYuvDst, const ClpRng& clpRng);
#endif #endif
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
void xPredAffineBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng, const bool genChromaMv = false, const std::pair<int, int> scalingRatio = SCALE_1X );
#else
void xPredAffineBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng, const std::pair<int, int> scalingRatio = SCALE_1X ); void xPredAffineBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng, const std::pair<int, int> scalingRatio = SCALE_1X );
#endif
void xWeightedTriangleBlk ( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ); void xWeightedTriangleBlk ( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 );
static bool xCheckIdenticalMotion( const PredictionUnit& pu ); static bool xCheckIdenticalMotion( const PredictionUnit& pu );
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
void xSubPuMC(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X, const bool luma = true, const bool chroma = true);
#else
void xSubPuMC(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X); void xSubPuMC(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X);
#endif
void xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X, PelUnitBuf* yuvDstTmp = NULL); void xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X, PelUnitBuf* yuvDstTmp = NULL);
void destroy(); void destroy();
......
...@@ -65,7 +65,12 @@ double RdCost::calcRdCost( uint64_t fracBits, Distortion distortion, bool useUna ...@@ -65,7 +65,12 @@ double RdCost::calcRdCost( uint64_t fracBits, Distortion distortion, bool useUna
double RdCost::calcRdCost( uint64_t fracBits, Distortion distortion ) double RdCost::calcRdCost( uint64_t fracBits, Distortion distortion )
#endif #endif
{ {
#if JVET_AHG14_LOSSLESS
if( m_costMode == COST_LOSSLESS_CODING && 0 != distortion )
{
return MAX_DOUBLE;
}
#endif
#if WCG_EXT #if WCG_EXT
return ( useUnadjustedLambda ? m_DistScaleUnadjusted : m_DistScale ) * double( distortion ) + double( fracBits ); return ( useUnadjustedLambda ? m_DistScaleUnadjusted : m_DistScale ) * double( distortion ) + double( fracBits );
#else #else
......
...@@ -710,6 +710,13 @@ void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int & ...@@ -710,6 +710,13 @@ void TrQuant::getTrTypes(const TransformUnit tu, const ComponentID compID, int &
trTypeHor = DCT2; trTypeHor = DCT2;
trTypeVer = DCT2; trTypeVer = DCT2;
#if JVET_P1026_ISP_LFNST_COMBINATION
if (isISP && tu.cu->lfnstIdx)
{
return;
}
#endif
if (!tu.cs->sps->getUseMTS()) if (!tu.cs->sps->getUseMTS())
return; return;
......
...@@ -55,19 +55,25 @@ ...@@ -55,19 +55,25 @@
#define JVET_P0371_CHROMA_SCALING_OFFSET 1 // JVET-P0371: Signalling offset for chroma residual scaling #define JVET_P0371_CHROMA_SCALING_OFFSET 1 // JVET-P0371: Signalling offset for chroma residual scaling
#define JVET_P0469_QP_OUT_VAL 1 // JVET-P0469: Coding delta_qp_diff_val instead of delta_qp_out_val
#define JVET_P0803_COMBINED_MIP_CLEANUP 1 // JVET-P0803: Several MIP cleanups #define JVET_P0803_COMBINED_MIP_CLEANUP 1 // JVET-P0803: Several MIP cleanups
#define JVET_P0199_P0289_P0303_MIP_FULLMATRIX 1 // JVET-P0199/P0289/P0303: Full matrix multiplication for all MIP block shapes #define JVET_P0199_P0289_P0303_MIP_FULLMATRIX 1 // JVET-P0199/P0289/P0303: Full matrix multiplication for all MIP block shapes
#define JVET_P0350_LFNST_IDX_CTX 1 // JVET-P0350: Add one context for LFNST idx coding #define JVET_P0350_LFNST_IDX_CTX 1 // JVET-P0350: Add one context for LFNST idx coding
#define JVET_AHG14_LOSSLESS 1 // TS with lossless support
#define JVET_P0526_PLT_ENCODER 1 // JVET-P0526: PLT encoder improvement #define JVET_P0526_PLT_ENCODER 1 // JVET-P0526: PLT encoder improvement
#define JVET_P0641_REMOVE_2xN_CHROMA_INTRA 1 // JVET-P0641: removing 2xN chroma intra blocks #define JVET_P0641_REMOVE_2xN_CHROMA_INTRA 1 // JVET-P0641: removing 2xN chroma intra blocks
#define JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP 1 // JVET-P0445: encoder speed up for sub-block based merge candidate search
#define JVET_P0206_TMVP_flags 1 // JVET-P0206: Signalling TMVP usage (remove pps TMVP idc and constraint when RPR is used) #define JVET_P0206_TMVP_flags 1 // JVET-P0206: Signalling TMVP usage (remove pps TMVP idc and constraint when RPR is used)
#define JVET_P0599_INTRA_SMOOTHING_INTERP_FILT 1 // JVET-P0599: Cleanup of interpolation filtering for intra prediction #define JVET_P0599_INTRA_SMOOTHING_INTERP_FILT 1 // JVET-P0599: Cleanup of interpolation filtering for intra prediction
#define JVET_P1026_ISP_LFNST_COMBINATION 1 // JVET-P1026: Combination of ISP and LFNST
#define JVET_P1026_MTS_SIGNALLING 1 // JVET-P1026: CU level MTS signalling #define JVET_P1026_MTS_SIGNALLING 1 // JVET-P1026: CU level MTS signalling
#define JVET_P0571_FIX_BS_BDPCM_CHROMA 1 // JVET-P0571: align boundary strength for Chroma BDPCM #define JVET_P0571_FIX_BS_BDPCM_CHROMA 1 // JVET-P0571: align boundary strength for Chroma BDPCM
...@@ -121,6 +127,9 @@ ...@@ -121,6 +127,9 @@
#define JVET_P0170_ZERO_POS_SIMPLIFICATION 1 // JVET-P0170: Simplification of deriving ZeroPos #define JVET_P0170_ZERO_POS_SIMPLIFICATION 1 // JVET-P0170: Simplification of deriving ZeroPos
#define JVET_P0058_CHROMA_TS 1 // JVET-P0058: Enable Transform skip for chroma #define JVET_P0058_CHROMA_TS 1 // JVET-P0058: Enable Transform skip for chroma
#if JVET_AHG14_LOSSLESS && !JVET_P0058_CHROMA_TS
#define JVET_P0058_CHROMA_TS 1
#endif
#if JVET_P0058_CHROMA_TS #if JVET_P0058_CHROMA_TS
#define JVET_P0058_CHROMA_TS_ENCODER_INTRA_SAD_MOD 1 // Modified cost criterion for chroma intra encoder search #define JVET_P0058_CHROMA_TS_ENCODER_INTRA_SAD_MOD 1 // Modified cost criterion for chroma intra encoder search
#endif #endif
......
...@@ -318,6 +318,30 @@ bool CU::canUseISP( const int width, const int height, const int maxTrSize ) ...@@ -318,6 +318,30 @@ bool CU::canUseISP( const int width, const int height, const int maxTrSize )
return true; return true;
} }
#if JVET_P1026_ISP_LFNST_COMBINATION
bool CU::canUseLfnstWithISP( const CompArea& cuArea, const ISPType ispSplitType )
{
if( ispSplitType == NOT_INTRA_SUBPARTITIONS )
{
return false;
}
Size tuSize = ( ispSplitType == HOR_INTRA_SUBPARTITIONS ) ? Size( cuArea.width, CU::getISPSplitDim( cuArea.width, cuArea.height, TU_1D_HORZ_SPLIT ) ) :
Size( CU::getISPSplitDim( cuArea.width, cuArea.height, TU_1D_VERT_SPLIT ), cuArea.height );
if( !( tuSize.width >= MIN_TB_SIZEY && tuSize.height >= MIN_TB_SIZEY ) )
{
return false;
}
return true;
}
bool CU::canUseLfnstWithISP( const CodingUnit& cu, const ChannelType chType )
{
CHECK( !isLuma( chType ), "Wrong ISP mode!" );
return CU::canUseLfnstWithISP( cu.blocks[chType == CHANNEL_TYPE_LUMA ? 0 : 1], (ISPType)cu.ispMode );
}
#endif
uint32_t CU::getISPSplitDim( const int width, const int height, const PartSplit ispType ) uint32_t CU::getISPSplitDim( const int width, const int height, const PartSplit ispType )
{ {
bool divideTuInRows = ispType == TU_1D_HORZ_SPLIT; bool divideTuInRows = ispType == TU_1D_HORZ_SPLIT;
......
...@@ -101,6 +101,10 @@ namespace CU ...@@ -101,6 +101,10 @@ namespace CU
bool isISPFirst ( const CodingUnit &cu, const CompArea &tuArea, const ComponentID compID ); bool isISPFirst ( const CodingUnit &cu, const CompArea &tuArea, const ComponentID compID );
bool canUseISP ( const CodingUnit &cu, const ComponentID compID ); bool canUseISP ( const CodingUnit &cu, const ComponentID compID );
bool canUseISP ( const int width, const int height, const int maxTrSize = MAX_TB_SIZEY ); bool canUseISP ( const int width, const int height, const int maxTrSize = MAX_TB_SIZEY );
#if JVET_P1026_ISP_LFNST_COMBINATION
bool canUseLfnstWithISP ( const CompArea& cuArea, const ISPType ispSplitType );
bool canUseLfnstWithISP ( const CodingUnit& cu, const ChannelType chType );
#endif
uint32_t getISPSplitDim ( const int width, const int height, const PartSplit ispType ); uint32_t getISPSplitDim ( const int width, const int height, const PartSplit ispType );
bool allLumaCBFsAreZero ( const CodingUnit& cu ); bool allLumaCBFsAreZero ( const CodingUnit& cu );
......
...@@ -161,13 +161,25 @@ void WeightPrediction::addWeightBi(const CPelUnitBuf &pcYuvSrc0, ...@@ -161,13 +161,25 @@ void WeightPrediction::addWeightBi(const CPelUnitBuf &pcYuvSrc0,
const WPScalingParam *const wp1, const WPScalingParam *const wp1,
PelUnitBuf &rpcYuvDst, PelUnitBuf &rpcYuvDst,
const bool bRoundLuma /*= true*/, const bool bRoundLuma /*= true*/,
const ComponentID maxNumComp) const ComponentID maxNumComp
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, bool lumaOnly
, bool chromaOnly
#endif
)
{ {
const bool enableRounding[MAX_NUM_COMPONENT] = { bRoundLuma, true, true }; const bool enableRounding[MAX_NUM_COMPONENT] = { bRoundLuma, true, true };
const uint32_t numValidComponent = (const uint32_t)pcYuvSrc0.bufs.size(); const uint32_t numValidComponent = (const uint32_t)pcYuvSrc0.bufs.size();
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
CHECK( lumaOnly && chromaOnly, "Not allowed to have both lumaOnly and chromaOnly selected" );
int firstComponent = chromaOnly ? 1 : 0;
int lastComponent = lumaOnly ? 0 : maxNumComp;
for (int componentIndex = firstComponent; componentIndex < numValidComponent && componentIndex <= lastComponent; componentIndex++)
#else
for (int componentIndex = 0; componentIndex < numValidComponent && componentIndex <= maxNumComp; componentIndex++) for (int componentIndex = 0; componentIndex < numValidComponent && componentIndex <= maxNumComp; componentIndex++)
#endif
{ {
const ComponentID compID = ComponentID(componentIndex); const ComponentID compID = ComponentID(componentIndex);
...@@ -275,11 +287,24 @@ void WeightPrediction::addWeightUni(const CPelUnitBuf &pcYuvSrc0, ...@@ -275,11 +287,24 @@ void WeightPrediction::addWeightUni(const CPelUnitBuf &pcYuvSrc0,
const ClpRngs &clpRngs, const ClpRngs &clpRngs,
const WPScalingParam *const wp0, const WPScalingParam *const wp0,
PelUnitBuf &rpcYuvDst, PelUnitBuf &rpcYuvDst,
const ComponentID maxNumComp) const ComponentID maxNumComp
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, bool lumaOnly
, bool chromaOnly
#endif
)
{ {
const uint32_t numValidComponent = (const uint32_t)pcYuvSrc0.bufs.size(); const uint32_t numValidComponent = (const uint32_t)pcYuvSrc0.bufs.size();
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
CHECK( lumaOnly && chromaOnly, "Not allowed to have both lumaOnly and chromaOnly selected" );
int firstComponent = chromaOnly ? 1 : 0;
int lastComponent = lumaOnly ? 0 : maxNumComp;
for (int componentIndex = firstComponent; componentIndex < numValidComponent && componentIndex <= lastComponent;
componentIndex++)
#else
for (int componentIndex = 0; componentIndex < numValidComponent && componentIndex <= maxNumComp; componentIndex++) for (int componentIndex = 0; componentIndex < numValidComponent && componentIndex <= maxNumComp; componentIndex++)
#endif
{ {
const ComponentID compID = ComponentID(componentIndex); const ComponentID compID = ComponentID(componentIndex);
...@@ -371,7 +396,12 @@ void WeightPrediction::xWeightedPredictionUni(const PredictionUnit &pu, ...@@ -371,7 +396,12 @@ void WeightPrediction::xWeightedPredictionUni(const PredictionUnit &pu,
const RefPicList &eRefPicList, const RefPicList &eRefPicList,
PelUnitBuf &pcYuvPred, PelUnitBuf &pcYuvPred,
const int iRefIdx_input/* = -1*/, const int iRefIdx_input/* = -1*/,
const ComponentID maxNumComp) const ComponentID maxNumComp
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, bool lumaOnly
, bool chromaOnly
#endif
)
{ {
WPScalingParam *pwp, *pwpTmp; WPScalingParam *pwp, *pwpTmp;
...@@ -391,14 +421,23 @@ void WeightPrediction::xWeightedPredictionUni(const PredictionUnit &pu, ...@@ -391,14 +421,23 @@ void WeightPrediction::xWeightedPredictionUni(const PredictionUnit &pu,
{ {
getWpScaling(pu.cs->slice, -1, iRefIdx, pwpTmp, pwp, maxNumComp); getWpScaling(pu.cs->slice, -1, iRefIdx, pwpTmp, pwp, maxNumComp);
} }
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
addWeightUni(pcYuvSrc, pu.cu->slice->clpRngs(), pwp, pcYuvPred, maxNumComp, lumaOnly, chromaOnly);
#else
addWeightUni(pcYuvSrc, pu.cu->slice->clpRngs(), pwp, pcYuvPred, maxNumComp); addWeightUni(pcYuvSrc, pu.cu->slice->clpRngs(), pwp, pcYuvPred, maxNumComp);
#endif
} }
void WeightPrediction::xWeightedPredictionBi(const PredictionUnit &pu, void WeightPrediction::xWeightedPredictionBi(const PredictionUnit &pu,
const CPelUnitBuf &pcYuvSrc0, const CPelUnitBuf &pcYuvSrc0,
const CPelUnitBuf &pcYuvSrc1, const CPelUnitBuf &pcYuvSrc1,
PelUnitBuf &rpcYuvDst, PelUnitBuf &rpcYuvDst,
const ComponentID maxNumComp) const ComponentID maxNumComp
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, bool lumaOnly
, bool chromaOnly
#endif
)
{ {
const int iRefIdx0 = pu.refIdx[0]; const int iRefIdx0 = pu.refIdx[0];
const int iRefIdx1 = pu.refIdx[1]; const int iRefIdx1 = pu.refIdx[1];
...@@ -413,15 +452,27 @@ void WeightPrediction::xWeightedPredictionBi(const PredictionUnit &pu, ...@@ -413,15 +452,27 @@ void WeightPrediction::xWeightedPredictionBi(const PredictionUnit &pu,
if (iRefIdx0 >= 0 && iRefIdx1 >= 0) if (iRefIdx0 >= 0 && iRefIdx1 >= 0)
{ {
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
addWeightBi(pcYuvSrc0, pcYuvSrc1, pu.cu->slice->clpRngs(), pwp0, pwp1, rpcYuvDst, true, maxNumComp, lumaOnly, chromaOnly);
#else
addWeightBi(pcYuvSrc0, pcYuvSrc1, pu.cu->slice->clpRngs(), pwp0, pwp1, rpcYuvDst, true, maxNumComp); addWeightBi(pcYuvSrc0, pcYuvSrc1, pu.cu->slice->clpRngs(), pwp0, pwp1, rpcYuvDst, true, maxNumComp);
#endif
} }
else if (iRefIdx0 >= 0 && iRefIdx1 < 0) else if (iRefIdx0 >= 0 && iRefIdx1 < 0)
{ {
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
addWeightUni(pcYuvSrc0, pu.cu->slice->clpRngs(), pwp0, rpcYuvDst, maxNumComp, lumaOnly, chromaOnly);
#else
addWeightUni(pcYuvSrc0, pu.cu->slice->clpRngs(), pwp0, rpcYuvDst, maxNumComp); addWeightUni(pcYuvSrc0, pu.cu->slice->clpRngs(), pwp0, rpcYuvDst, maxNumComp);
#endif
} }
else if (iRefIdx0 < 0 && iRefIdx1 >= 0) else if (iRefIdx0 < 0 && iRefIdx1 >= 0)
{ {
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
addWeightUni(pcYuvSrc1, pu.cu->slice->clpRngs(), pwp1, rpcYuvDst, maxNumComp, lumaOnly, chromaOnly);
#else
addWeightUni(pcYuvSrc1, pu.cu->slice->clpRngs(), pwp1, rpcYuvDst, maxNumComp); addWeightUni(pcYuvSrc1, pu.cu->slice->clpRngs(), pwp1, rpcYuvDst, maxNumComp);
#endif
} }
else else
{ {
......
...@@ -69,7 +69,12 @@ public: ...@@ -69,7 +69,12 @@ public:
const WPScalingParam *const wp1, const WPScalingParam *const wp1,
PelUnitBuf &rpcYuvDst, PelUnitBuf &rpcYuvDst,
const bool bRoundLuma = true, const bool bRoundLuma = true,
const ComponentID maxNumComp = MAX_NUM_COMPONENT ); const ComponentID maxNumComp = MAX_NUM_COMPONENT
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, bool lumaOnly = false
, bool chromaOnly = false
#endif
);
void addWeightBiComponent( const CPelUnitBuf &pcYuvSrc0, void addWeightBiComponent( const CPelUnitBuf &pcYuvSrc0,
const CPelUnitBuf &pcYuvSrc1, const CPelUnitBuf &pcYuvSrc1,
...@@ -84,20 +89,35 @@ public: ...@@ -84,20 +89,35 @@ public:
const ClpRngs &clpRngs, const ClpRngs &clpRngs,
const WPScalingParam *const wp0, const WPScalingParam *const wp0,
PelUnitBuf &rpcYuvDst, PelUnitBuf &rpcYuvDst,
const ComponentID maxNumComp = MAX_NUM_COMPONENT); const ComponentID maxNumComp = MAX_NUM_COMPONENT
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, bool lumaOnly = false
, bool chromaOnly = false
#endif
);
void xWeightedPredictionUni( const PredictionUnit &pu, void xWeightedPredictionUni( const PredictionUnit &pu,
const CPelUnitBuf &pcYuvSrc, const CPelUnitBuf &pcYuvSrc,
const RefPicList &eRefPicList, const RefPicList &eRefPicList,
PelUnitBuf &pcYuvPred, PelUnitBuf &pcYuvPred,
const int iRefIdx=-1, const int iRefIdx=-1,
const ComponentID maxNumComp = MAX_NUM_COMPONENT); const ComponentID maxNumComp = MAX_NUM_COMPONENT
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, bool lumaOnly = false
, bool chromaOnly = false
#endif
);
void xWeightedPredictionBi( const PredictionUnit &pu, void xWeightedPredictionBi( const PredictionUnit &pu,
const CPelUnitBuf &pcYuvSrc0, const CPelUnitBuf &pcYuvSrc0,
const CPelUnitBuf &pcYuvSrc1, const CPelUnitBuf &pcYuvSrc1,
PelUnitBuf &pcYuvDst, PelUnitBuf &pcYuvDst,
const ComponentID maxNumComp = MAX_NUM_COMPONENT ); const ComponentID maxNumComp = MAX_NUM_COMPONENT
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
, bool lumaOnly = false
, bool chromaOnly = false
#endif
);
}; };
#endif #endif
#if ! defined( VTM_VERSION ) #if ! defined( VTM_VERSION )
#define VTM_VERSION "6.3" #define VTM_VERSION "7.0rc1"
#endif #endif
...@@ -3503,7 +3503,11 @@ void CABACReader::explicit_rdpcm_mode( TransformUnit& tu, ComponentID compID ) ...@@ -3503,7 +3503,11 @@ void CABACReader::explicit_rdpcm_mode( TransformUnit& tu, ComponentID compID )
void CABACReader::residual_lfnst_mode( CodingUnit& cu, CUCtx& cuCtx ) void CABACReader::residual_lfnst_mode( CodingUnit& cu, CUCtx& cuCtx )
{ {
int chIdx = CS::isDualITree( *cu.cs ) && cu.chType == CHANNEL_TYPE_CHROMA ? 1 : 0; int chIdx = CS::isDualITree( *cu.cs ) && cu.chType == CHANNEL_TYPE_CHROMA ? 1 : 0;
#if JVET_P1026_ISP_LFNST_COMBINATION
if ( (cu.ispMode && !CU::canUseLfnstWithISP( cu, cu.chType ) ) ||
#else
if( cu.ispMode != NOT_INTRA_SUBPARTITIONS || if( cu.ispMode != NOT_INTRA_SUBPARTITIONS ||
#endif
(cu.cs->sps->getUseLFNST() && CU::isIntra(cu) && cu.mipFlag && !allowLfnstWithMip(cu.firstPU->lumaSize())) || (cu.cs->sps->getUseLFNST() && CU::isIntra(cu) && cu.mipFlag && !allowLfnstWithMip(cu.firstPU->lumaSize())) ||
( cu.isSepTree() && cu.chType == CHANNEL_TYPE_CHROMA && std::min( cu.blocks[ 1 ].width, cu.blocks[ 1 ].height ) < 4 ) ( cu.isSepTree() && cu.chType == CHANNEL_TYPE_CHROMA && std::min( cu.blocks[ 1 ].width, cu.blocks[ 1 ].height ) < 4 )
|| ( cu.blocks[ chIdx ].lumaSize().width > cu.cs->sps->getMaxTbSize() || cu.blocks[ chIdx ].lumaSize().height > cu.cs->sps->getMaxTbSize() ) || ( cu.blocks[ chIdx ].lumaSize().width > cu.cs->sps->getMaxTbSize() || cu.blocks[ chIdx ].lumaSize().height > cu.cs->sps->getMaxTbSize() )
...@@ -3525,14 +3529,22 @@ void CABACReader::residual_lfnst_mode( CodingUnit& cu, CUCtx& cuCtx ) ...@@ -3525,14 +3529,22 @@ void CABACReader::residual_lfnst_mode( CodingUnit& cu, CUCtx& cuCtx )
#else #else
const bool isTrSkip = TU::getCbf(*cu.firstTU, COMPONENT_Y) && cu.firstTU->mtsIdx == MTS_SKIP; const bool isTrSkip = TU::getCbf(*cu.firstTU, COMPONENT_Y) && cu.firstTU->mtsIdx == MTS_SKIP;
#endif #endif
#if JVET_P1026_ISP_LFNST_COMBINATION
if ((!cuCtx.lfnstLastScanPos && !cu.ispMode) || nonZeroCoeffNonTsCorner8x8 || isTrSkip)
#else
if( !cuCtx.lfnstLastScanPos || nonZeroCoeffNonTsCorner8x8 || isTrSkip ) if( !cuCtx.lfnstLastScanPos || nonZeroCoeffNonTsCorner8x8 || isTrSkip )
#endif
#else #else
#if JVET_P0058_CHROMA_TS #if JVET_P0058_CHROMA_TS
const bool isNonDCT2 = (TU::getCbf(*cu.firstTU, ComponentID(COMPONENT_Y)) && cu.firstTU->mtsIdx[COMPONENT_Y] != MTS_DCT2_DCT2); const bool isNonDCT2 = (TU::getCbf(*cu.firstTU, ComponentID(COMPONENT_Y)) && cu.firstTU->mtsIdx[COMPONENT_Y] != MTS_DCT2_DCT2);
#else #else
const bool isNonDCT2 = (TU::getCbf(*cu.firstTU, ComponentID(COMPONENT_Y)) && cu.firstTU->mtsIdx != MTS_DCT2_DCT2); const bool isNonDCT2 = (TU::getCbf(*cu.firstTU, ComponentID(COMPONENT_Y)) && cu.firstTU->mtsIdx != MTS_DCT2_DCT2);
#endif #endif
#if JVET_P1026_ISP_LFNST_COMBINATION
if ((!cuCtx.lfnstLastScanPos && !cu.ispMode) || nonZeroCoeffNonTsCorner8x8 || isNonDCT2)
#else
if( !cuCtx.lfnstLastScanPos || nonZeroCoeffNonTsCorner8x8 || isNonDCT2 ) if( !cuCtx.lfnstLastScanPos || nonZeroCoeffNonTsCorner8x8 || isNonDCT2 )
#endif
#endif #endif
{ {
cu.lfnstIdx = 0; cu.lfnstIdx = 0;
......
...@@ -1395,7 +1395,12 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) ...@@ -1395,7 +1395,12 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
for (int j = 0; j <= chromaQpMappingTableParams.getNumPtsInCQPTableMinus1(i); j++) for (int j = 0; j <= chromaQpMappingTableParams.getNumPtsInCQPTableMinus1(i); j++)
{ {
READ_UVLC(uiCode, "delta_qp_in_val_minus1"); deltaQpInValMinus1[j] = uiCode; READ_UVLC(uiCode, "delta_qp_in_val_minus1"); deltaQpInValMinus1[j] = uiCode;
#if JVET_P0469_QP_OUT_VAL
READ_UVLC(uiCode, "delta_qp_diff_val");
deltaQpOutVal[j] = uiCode ^ deltaQpInValMinus1[j];
#else
READ_UVLC(uiCode, "delta_qp_out_val"); deltaQpOutVal[j] = uiCode; READ_UVLC(uiCode, "delta_qp_out_val"); deltaQpOutVal[j] = uiCode;
#endif
} }
chromaQpMappingTableParams.setDeltaQpInValMinus1(i, deltaQpInValMinus1); chromaQpMappingTableParams.setDeltaQpInValMinus1(i, deltaQpInValMinus1);
chromaQpMappingTableParams.setDeltaQpOutVal(i, deltaQpOutVal); chromaQpMappingTableParams.setDeltaQpOutVal(i, deltaQpOutVal);
......
...@@ -1325,8 +1325,12 @@ void CABACWriter::cu_residual( const CodingUnit& cu, Partitioner& partitioner, C ...@@ -1325,8 +1325,12 @@ void CABACWriter::cu_residual( const CodingUnit& cu, Partitioner& partitioner, C
residual_lfnst_mode( cu, cuCtx ); residual_lfnst_mode( cu, cuCtx );
#if JVET_P1026_MTS_SIGNALLING #if JVET_P1026_MTS_SIGNALLING
#if JVET_P1026_ISP_LFNST_COMBINATION
mts_idx ( cu, &cuCtx );
#else
mts_idx ( cu, cuCtx ); mts_idx ( cu, cuCtx );
#endif #endif
#endif
} }
void CABACWriter::rqt_root_cbf( const CodingUnit& cu ) void CABACWriter::rqt_root_cbf( const CodingUnit& cu )
...@@ -3031,7 +3035,11 @@ void CABACWriter::ts_flag( const TransformUnit& tu, ComponentID compID ) ...@@ -3031,7 +3035,11 @@ void CABACWriter::ts_flag( const TransformUnit& tu, ComponentID compID )
DTRACE( g_trace_ctx, D_SYNTAX, "ts_flag() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, tu.cu->lx(), tu.cu->ly(), tsFlag ); DTRACE( g_trace_ctx, D_SYNTAX, "ts_flag() etype=%d pos=(%d,%d) mtsIdx=%d\n", COMPONENT_Y, tu.cu->lx(), tu.cu->ly(), tsFlag );
} }
#if JVET_P1026_ISP_LFNST_COMBINATION
void CABACWriter::mts_idx( const CodingUnit& cu, CUCtx* cuCtx )
#else
void CABACWriter::mts_idx( const CodingUnit& cu, CUCtx& cuCtx ) void CABACWriter::mts_idx( const CodingUnit& cu, CUCtx& cuCtx )
#endif
{ {
TransformUnit &tu = *cu.firstTU; TransformUnit &tu = *cu.firstTU;
#if JVET_P0058_CHROMA_TS #if JVET_P0058_CHROMA_TS
...@@ -3040,8 +3048,13 @@ void CABACWriter::mts_idx( const CodingUnit& cu, CUCtx& cuCtx ) ...@@ -3040,8 +3048,13 @@ void CABACWriter::mts_idx( const CodingUnit& cu, CUCtx& cuCtx )
int mtsIdx = tu.mtsIdx; int mtsIdx = tu.mtsIdx;
#endif #endif
#if JVET_P1026_ISP_LFNST_COMBINATION
if( CU::isMTSAllowed( cu, COMPONENT_Y ) && cuCtx && !cuCtx->violatesMtsCoeffConstraint &&
cu.lfnstIdx == 0 && mtsIdx != MTS_SKIP && TU::getCbf(tu, COMPONENT_Y) )
#else
if( CU::isMTSAllowed( cu, COMPONENT_Y ) && !cuCtx.violatesMtsCoeffConstraint && if( CU::isMTSAllowed( cu, COMPONENT_Y ) && !cuCtx.violatesMtsCoeffConstraint &&
cu.lfnstIdx == 0 && mtsIdx != MTS_SKIP && TU::getCbf(tu, COMPONENT_Y) ) cu.lfnstIdx == 0 && mtsIdx != MTS_SKIP && TU::getCbf(tu, COMPONENT_Y) )
#endif
{ {
int symbol = mtsIdx != MTS_DCT2_DCT2 ? 1 : 0; int symbol = mtsIdx != MTS_DCT2_DCT2 ? 1 : 0;
int ctxIdx = 0; int ctxIdx = 0;
...@@ -3184,7 +3197,11 @@ void CABACWriter::explicit_rdpcm_mode( const TransformUnit& tu, ComponentID comp ...@@ -3184,7 +3197,11 @@ void CABACWriter::explicit_rdpcm_mode( const TransformUnit& tu, ComponentID comp
void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx ) void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx )
{ {
int chIdx = CS::isDualITree( *cu.cs ) && cu.chType == CHANNEL_TYPE_CHROMA ? 1 : 0; int chIdx = CS::isDualITree( *cu.cs ) && cu.chType == CHANNEL_TYPE_CHROMA ? 1 : 0;
#if JVET_P1026_ISP_LFNST_COMBINATION
if( ( cu.ispMode && !CU::canUseLfnstWithISP( cu, cu.chType ) ) ||
#else
if( cu.ispMode != NOT_INTRA_SUBPARTITIONS || if( cu.ispMode != NOT_INTRA_SUBPARTITIONS ||
#endif
(cu.cs->sps->getUseLFNST() && CU::isIntra(cu) && cu.mipFlag && !allowLfnstWithMip(cu.firstPU->lumaSize())) || (cu.cs->sps->getUseLFNST() && CU::isIntra(cu) && cu.mipFlag && !allowLfnstWithMip(cu.firstPU->lumaSize())) ||
( cu.isSepTree() && cu.chType == CHANNEL_TYPE_CHROMA && std::min( cu.blocks[ 1 ].width, cu.blocks[ 1 ].height ) < 4 ) ( cu.isSepTree() && cu.chType == CHANNEL_TYPE_CHROMA && std::min( cu.blocks[ 1 ].width, cu.blocks[ 1 ].height ) < 4 )
|| ( cu.blocks[ chIdx ].lumaSize().width > cu.cs->sps->getMaxTbSize() || cu.blocks[ chIdx ].lumaSize().height > cu.cs->sps->getMaxTbSize() ) || ( cu.blocks[ chIdx ].lumaSize().width > cu.cs->sps->getMaxTbSize() || cu.blocks[ chIdx ].lumaSize().height > cu.cs->sps->getMaxTbSize() )
...@@ -3205,14 +3222,22 @@ void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx ) ...@@ -3205,14 +3222,22 @@ void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx )
#else #else
const bool isTrSkip = TU::getCbf(*cu.firstTU, COMPONENT_Y) && cu.firstTU->mtsIdx == MTS_SKIP; const bool isTrSkip = TU::getCbf(*cu.firstTU, COMPONENT_Y) && cu.firstTU->mtsIdx == MTS_SKIP;
#endif #endif
#if JVET_P1026_ISP_LFNST_COMBINATION
if( (!cuCtx.lfnstLastScanPos && !cu.ispMode) || nonZeroCoeffNonTsCorner8x8 || isTrSkip )
#else
if( !cuCtx.lfnstLastScanPos || nonZeroCoeffNonTsCorner8x8 || isTrSkip ) if( !cuCtx.lfnstLastScanPos || nonZeroCoeffNonTsCorner8x8 || isTrSkip )
#endif
#else #else
#if JVET_P0058_CHROMA_TS #if JVET_P0058_CHROMA_TS
const bool isNonDCT2 = (TU::getCbf(*cu.firstTU, ComponentID(COMPONENT_Y)) && cu.firstTU->mtsIdx[COMPONENT_Y] != MTS_DCT2_DCT2); const bool isNonDCT2 = (TU::getCbf(*cu.firstTU, ComponentID(COMPONENT_Y)) && cu.firstTU->mtsIdx[COMPONENT_Y] != MTS_DCT2_DCT2);
#else #else
const bool isNonDCT2 = (TU::getCbf(*cu.firstTU, ComponentID(COMPONENT_Y)) && cu.firstTU->mtsIdx != MTS_DCT2_DCT2); const bool isNonDCT2 = (TU::getCbf(*cu.firstTU, ComponentID(COMPONENT_Y)) && cu.firstTU->mtsIdx != MTS_DCT2_DCT2);
#endif #endif
#if JVET_P1026_ISP_LFNST_COMBINATION
if( (!cuCtx.lfnstLastScanPos && !cu.ispMode) || nonZeroCoeffNonTsCorner8x8 || isNonDCT2 )
#else
if( !cuCtx.lfnstLastScanPos || nonZeroCoeffNonTsCorner8x8 || isNonDCT2 ) if( !cuCtx.lfnstLastScanPos || nonZeroCoeffNonTsCorner8x8 || isNonDCT2 )
#endif
#endif #endif
{ {
return; return;
......
...@@ -149,7 +149,11 @@ public: ...@@ -149,7 +149,11 @@ public:
void residual_coding ( const TransformUnit& tu, ComponentID compID, CUCtx* cuCtx = nullptr ); void residual_coding ( const TransformUnit& tu, ComponentID compID, CUCtx* cuCtx = nullptr );
#if JVET_P1026_MTS_SIGNALLING #if JVET_P1026_MTS_SIGNALLING
void ts_flag ( const TransformUnit& tu, ComponentID compID ); void ts_flag ( const TransformUnit& tu, ComponentID compID );
#if JVET_P1026_ISP_LFNST_COMBINATION
void mts_idx ( const CodingUnit& cu, CUCtx* cuCtx );
#else
void mts_idx ( const CodingUnit& cu, CUCtx& cuCtx ); void mts_idx ( const CodingUnit& cu, CUCtx& cuCtx );
#endif
#else #else
void mts_coding ( const TransformUnit& tu, ComponentID compID ); void mts_coding ( const TransformUnit& tu, ComponentID compID );
#endif #endif
......
...@@ -1264,7 +1264,11 @@ public: ...@@ -1264,7 +1264,11 @@ public:
void setLog2MaxTransformSkipBlockSize ( uint32_t u ) { m_log2MaxTransformSkipBlockSize = u; } void setLog2MaxTransformSkipBlockSize ( uint32_t u ) { m_log2MaxTransformSkipBlockSize = u; }
bool getIntraSmoothingDisabledFlag () const { return m_intraSmoothingDisabledFlag; } bool getIntraSmoothingDisabledFlag () const { return m_intraSmoothingDisabledFlag; }
void setIntraSmoothingDisabledFlag (bool bValue) { m_intraSmoothingDisabledFlag=bValue; } void setIntraSmoothingDisabledFlag (bool bValue) { m_intraSmoothingDisabledFlag=bValue; }
#if JVET_P1026_ISP_LFNST_COMBINATION
bool getUseFastISP () const { return m_useFastISP; }
#else
bool getUseFastISP () { return m_useFastISP; } bool getUseFastISP () { return m_useFastISP; }
#endif
void setUseFastISP ( bool b ) { m_useFastISP = b; } void setUseFastISP ( bool b ) { m_useFastISP = b; }
const int* getdQPs () const { return m_aidQP; } const int* getdQPs () const { return m_aidQP; }
......
...@@ -1712,6 +1712,9 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC ...@@ -1712,6 +1712,9 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC
double dct2Cost = MAX_DOUBLE; double dct2Cost = MAX_DOUBLE;
#if JVET_P1026_ISP_LFNST_COMBINATION
double bestNonDCT2Cost = MAX_DOUBLE;
#endif
double trGrpBestCost [ 4 ] = { MAX_DOUBLE, MAX_DOUBLE, MAX_DOUBLE, MAX_DOUBLE }; double trGrpBestCost [ 4 ] = { MAX_DOUBLE, MAX_DOUBLE, MAX_DOUBLE, MAX_DOUBLE };
double globalBestCost = MAX_DOUBLE; double globalBestCost = MAX_DOUBLE;
bool bestSelFlag [ 4 ] = { false, false, false, false }; bool bestSelFlag [ 4 ] = { false, false, false, false };
...@@ -1732,6 +1735,9 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC ...@@ -1732,6 +1735,9 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC
int grpNumMax = sps.getUseLFNST() ? m_pcEncCfg->getMTSIntraMaxCand() : 1; int grpNumMax = sps.getUseLFNST() ? m_pcEncCfg->getMTSIntraMaxCand() : 1;
#else #else
int grpNumMax = sps.getUseLFNST() ? 4 : 1; int grpNumMax = sps.getUseLFNST() ? 4 : 1;
#endif
#if JVET_P1026_ISP_LFNST_COMBINATION
m_modeCtrl->setISPWasTested(false);
#endif #endif
m_pcIntraSearch->invalidateBestModeCost(); m_pcIntraSearch->invalidateBestModeCost();
for( int trGrpIdx = 0; trGrpIdx < grpNumMax; trGrpIdx++ ) for( int trGrpIdx = 0; trGrpIdx < grpNumMax; trGrpIdx++ )
...@@ -1792,6 +1798,16 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC ...@@ -1792,6 +1798,16 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC
{ {
continue; continue;
} }
#if JVET_P1026_ISP_LFNST_COMBINATION
if (m_pcEncCfg->getUseFastISP() && validCandRet && !mtsFlag && !lfnstIdx)
{
m_modeCtrl->setISPMode(cu.ispMode);
m_modeCtrl->setISPLfnstIdx(cu.lfnstIdx);
m_modeCtrl->setMIPFlagISPPass(cu.mipFlag);
m_modeCtrl->setBestISPIntraModeRelCU(cu.ispMode ? PU::getFinalIntraMode(*cu.firstPU, CHANNEL_TYPE_LUMA) : UINT8_MAX);
m_modeCtrl->setBestDCT2NonISPCostRelCU(m_modeCtrl->getMtsFirstPassNoIspCost());
}
#endif
useIntraSubPartitions = cu.ispMode != NOT_INTRA_SUBPARTITIONS; useIntraSubPartitions = cu.ispMode != NOT_INTRA_SUBPARTITIONS;
if( !partitioner.isSepTree( *tempCS ) ) if( !partitioner.isSepTree( *tempCS ) )
...@@ -1869,7 +1885,9 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC ...@@ -1869,7 +1885,9 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC
tempCS->fracBits = m_CABACEstimator->getEstFracBits(); tempCS->fracBits = m_CABACEstimator->getEstFracBits();
tempCS->cost = m_pcRdCost->calcRdCost(tempCS->fracBits, tempCS->dist); tempCS->cost = m_pcRdCost->calcRdCost(tempCS->fracBits, tempCS->dist);
#if !JVET_P1026_ISP_LFNST_COMBINATION
double bestIspCost = cu.ispMode ? cu.isSepTree() ? tempCS->cost : tempCS->lumaCost : MAX_DOUBLE; double bestIspCost = cu.ispMode ? cu.isSepTree() ? tempCS->cost : tempCS->lumaCost : MAX_DOUBLE;
#endif
const double tmpCostWithoutSplitFlags = tempCS->cost; const double tmpCostWithoutSplitFlags = tempCS->cost;
xEncodeDontSplit( *tempCS, partitioner ); xEncodeDontSplit( *tempCS, partitioner );
...@@ -1877,7 +1895,11 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC ...@@ -1877,7 +1895,11 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC
xCheckDQP( *tempCS, partitioner ); xCheckDQP( *tempCS, partitioner );
// Check if low frequency non-separable transform (LFNST) is too expensive // Check if low frequency non-separable transform (LFNST) is too expensive
#if JVET_P1026_ISP_LFNST_COMBINATION
if( lfnstIdx && !cuCtx.lfnstLastScanPos && !cu.ispMode )
#else
if( lfnstIdx && !cuCtx.lfnstLastScanPos ) if( lfnstIdx && !cuCtx.lfnstLastScanPos )
#endif
{ {
bool cbfAtZeroDepth = cu.isSepTree() ? cu.rootCbf : std::min( cu.firstTU->blocks[ 1 ].width, cu.firstTU->blocks[ 1 ].height ) < 4 ? TU::getCbfAtDepth( *cu.firstTU, COMPONENT_Y, 0 ) : cu.rootCbf; bool cbfAtZeroDepth = cu.isSepTree() ? cu.rootCbf : std::min( cu.firstTU->blocks[ 1 ].width, cu.firstTU->blocks[ 1 ].height ) < 4 ? TU::getCbfAtDepth( *cu.firstTU, COMPONENT_Y, 0 ) : cu.rootCbf;
if( cbfAtZeroDepth ) if( cbfAtZeroDepth )
...@@ -1890,6 +1912,12 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC ...@@ -1890,6 +1912,12 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC
{ {
dct2Cost = tempCS->cost; dct2Cost = tempCS->cost;
} }
#if JVET_P1026_ISP_LFNST_COMBINATION
else if (tmpCostWithoutSplitFlags < bestNonDCT2Cost)
{
bestNonDCT2Cost = tmpCostWithoutSplitFlags;
}
#endif
if( tempCS->cost < bestCS->cost ) if( tempCS->cost < bestCS->cost )
{ {
...@@ -1942,19 +1970,34 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC ...@@ -1942,19 +1970,34 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC
} }
//we decide to skip the non-DCT-II transforms and LFNST according to the ISP results //we decide to skip the non-DCT-II transforms and LFNST according to the ISP results
#if JVET_P1026_ISP_LFNST_COMBINATION
if ((endMtsFlag > 0 || endLfnstIdx > 0) && (cu.ispMode || (bestCS && bestCS->cus[0]->ispMode)) && tempCS->slice->isIntra() && m_pcEncCfg->getUseFastISP())
#else
if ((endMtsFlag > 0 || endLfnstIdx > 0) && cu.ispMode && !mtsFlag && !lfnstIdx && tempCS->slice->isIntra() && m_pcEncCfg->getUseFastISP()) if ((endMtsFlag > 0 || endLfnstIdx > 0) && cu.ispMode && !mtsFlag && !lfnstIdx && tempCS->slice->isIntra() && m_pcEncCfg->getUseFastISP())
#endif
{ {
double bestCostDct2NoIsp = m_modeCtrl->getMtsFirstPassNoIspCost(); double bestCostDct2NoIsp = m_modeCtrl->getMtsFirstPassNoIspCost();
#if JVET_P1026_ISP_LFNST_COMBINATION
double bestIspCost = m_modeCtrl->getIspCost();
#endif
CHECKD( bestCostDct2NoIsp <= bestIspCost, "wrong cost!" ); CHECKD( bestCostDct2NoIsp <= bestIspCost, "wrong cost!" );
double threshold = 1.4; double threshold = 1.4;
double lfnstThreshold = 1.01 * threshold; double lfnstThreshold = 1.01 * threshold;
#if JVET_P1026_ISP_LFNST_COMBINATION
if( m_modeCtrl->getStopNonDCT2Transforms() || bestCostDct2NoIsp > bestIspCost*lfnstThreshold )
#else
if( bestCostDct2NoIsp > bestIspCost*lfnstThreshold ) if( bestCostDct2NoIsp > bestIspCost*lfnstThreshold )
#endif
{ {
endLfnstIdx = lfnstIdx; endLfnstIdx = lfnstIdx;
} }
#if JVET_P1026_ISP_LFNST_COMBINATION
if ( m_modeCtrl->getStopNonDCT2Transforms() || bestCostDct2NoIsp > bestIspCost*threshold )
#else
if( bestCostDct2NoIsp > bestIspCost*threshold ) if( bestCostDct2NoIsp > bestIspCost*threshold )
#endif
{ {
skipSecondMtsPass = true; skipSecondMtsPass = true;
m_modeCtrl->setSkipSecondMTSPass( true ); m_modeCtrl->setSkipSecondMTSPass( true );
...@@ -1995,6 +2038,9 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC ...@@ -1995,6 +2038,9 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC
} }
} }
} //trGrpIdx } //trGrpIdx
#if JVET_P1026_ISP_LFNST_COMBINATION
m_modeCtrl->setBestNonDCT2Cost(bestNonDCT2Cost);
#endif
} }
...@@ -3183,7 +3229,11 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct ...@@ -3183,7 +3229,11 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct
distParam.cur = acMergeBuffer[uiMergeCand].Y(); distParam.cur = acMergeBuffer[uiMergeCand].Y();
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
m_pcInterSearch->motionCompensation( pu, acMergeBuffer[uiMergeCand], REF_PIC_LIST_X, true, false );
#else
m_pcInterSearch->motionCompensation( pu, acMergeBuffer[uiMergeCand] ); m_pcInterSearch->motionCompensation( pu, acMergeBuffer[uiMergeCand] );
#endif
Distortion uiSad = distParam.distFunc( distParam ); Distortion uiSad = distParam.distFunc( distParam );
uint32_t uiBitsCand = uiMergeCand + 1; uint32_t uiBitsCand = uiMergeCand + 1;
...@@ -3282,7 +3332,12 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct ...@@ -3282,7 +3332,12 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct
} }
if ( mrgTempBufSet ) if ( mrgTempBufSet )
{ {
#if JVET_P0445_SUBBLOCK_MERGE_ENC_SPEEDUP
tempCS->getPredBuf().copyFrom(acMergeBuffer[uiMergeCand], true, false); // Copy Luma Only
m_pcInterSearch->motionCompensation(pu, REF_PIC_LIST_X, false, true);
#else
tempCS->getPredBuf().copyFrom( acMergeBuffer[uiMergeCand] ); tempCS->getPredBuf().copyFrom( acMergeBuffer[uiMergeCand] );
#endif
} }
else else
{ {
......
...@@ -1925,7 +1925,11 @@ int EncCfg::getQPForPicture(const uint32_t gopIndex, const Slice *pSlice) const ...@@ -1925,7 +1925,11 @@ int EncCfg::getQPForPicture(const uint32_t gopIndex, const Slice *pSlice) const
if (getCostMode()==COST_LOSSLESS_CODING) if (getCostMode()==COST_LOSSLESS_CODING)
{ {
#if JVET_AHG14_LOSSLESS
qp = LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP - ( ( pSlice->getSPS()->getBitDepth( CHANNEL_TYPE_LUMA ) - 8 ) * 6 );
#else
qp=LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP; qp=LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP;
#endif
} }
else else
{ {
......