[x265] [PATCH 1/2] Add flag to enable/disable temporal MVP
Steve Borho
steve at borho.org
Thu Oct 23 16:46:40 CEST 2014
On 10/23, Nicolas Morey-Chaisemartin wrote:
> ---
> source/Lib/TLibCommon/TComDataCU.cpp | 5 +++--
> source/common/param.cpp | 2 ++
> source/common/slice.h | 1 +
> source/encoder/encoder.cpp | 1 +
> source/encoder/entropy.cpp | 9 +++++----
> source/x265.h | 3 +++
> 6 files changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/source/Lib/TLibCommon/TComDataCU.cpp b/source/Lib/TLibCommon/TComDataCU.cpp
> index 799b88a..38b5eed 100644
> --- a/source/Lib/TLibCommon/TComDataCU.cpp
> +++ b/source/Lib/TLibCommon/TComDataCU.cpp
> @@ -1823,7 +1823,8 @@ void TComDataCU::getInterMergeCandidates(uint32_t absPartIdx, uint32_t puIdx, TC
> return;
> }
> }
TComDataCU.cpp no longer exists (nor does the rest of Lib/ now), sorry
for all the churn. It should be trivial to apply these to cudata.cpp
> - // TMVP always enabled
> +
> + if (m_slice->m_sps->bTemporalMVPEnabled)
> {
> //>> MTK colocated-RightBottom
> uint32_t partIdxRB;
> @@ -2092,7 +2093,7 @@ int TComDataCU::fillMvpCand(uint32_t partIdx, uint32_t partAddr, int picList, in
> return numMvc;
> }
> - // TMVP always enabled
> + if (m_slice->m_sps->bTemporalMVPEnabled)
> {
> // Get Temporal Motion Predictor
> int refIdxCol = refIdx;
> diff --git a/source/common/param.cpp b/source/common/param.cpp
> index 004f5a8..ce3f56e 100644
> --- a/source/common/param.cpp
> +++ b/source/common/param.cpp
> @@ -150,6 +150,7 @@ void x265_param_default(x265_param *param)
> param->bEnableTransformSkip = 0;
> param->bEnableTSkipFast = 0;
> param->maxNumReferences = 3;
> + param->bEnableTemporalMvp = 1;
> /* Loop Filter */
> param->bEnableLoopFilter = 1;
> @@ -1174,6 +1175,7 @@ void x265_print_params(x265_param *param)
> TOOLOPT(param->bEnableSignHiding, "signhide");
> TOOLOPT(param->bCULossless, "cu-lossless");
> TOOLOPT(param->bEnableFastIntra, "fast-intra");
> + TOOLOPT(param->bEnableTemporalMvp, "tmvp");
> if (param->bEnableTransformSkip)
> {
> if (param->bEnableTSkipFast)
> diff --git a/source/common/slice.h b/source/common/slice.h
> index 59487f6..394e02a 100644
> --- a/source/common/slice.h
> +++ b/source/common/slice.h
> @@ -211,6 +211,7 @@ struct SPS
> int numReorderPics;
> bool bUseStrongIntraSmoothing; // use param
> + bool bTemporalMVPEnabled;
> Window conformanceWindow;
> VUI vuiParameters;
> diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
> index b2fbc44..6560dbe 100644
> --- a/source/encoder/encoder.cpp
> +++ b/source/encoder/encoder.cpp
> @@ -1115,6 +1115,7 @@ void Encoder::initSPS(SPS *sps)
> sps->numReorderPics = m_vps.numReorderPics;
> sps->bUseStrongIntraSmoothing = m_param->bEnableStrongIntraSmoothing;
> + sps->bTemporalMVPEnabled = m_param->bEnableTemporalMvp;
there's a tab-stop here
> VUI& vui = sps->vuiParameters;
> vui.aspectRatioInfoPresentFlag = !!m_param->vui.aspectRatioIdc;
> diff --git a/source/encoder/entropy.cpp b/source/encoder/entropy.cpp
> index 7085c14..ee89a5b 100644
> --- a/source/encoder/entropy.cpp
> +++ b/source/encoder/entropy.cpp
> @@ -117,7 +117,7 @@ void Entropy::codeSPS(SPS* sps, ScalingList *scalingList, ProfileTierLevel *ptl)
> WRITE_UVLC(0, "num_short_term_ref_pic_sets");
> WRITE_FLAG(0, "long_term_ref_pics_present_flag");
> - WRITE_FLAG(1, "sps_temporal_mvp_enable_flag");
> + WRITE_FLAG(sps->bTemporalMVPEnabled, "sps_temporal_mvp_enable_flag");
> WRITE_FLAG(sps->bUseStrongIntraSmoothing, "sps_strong_intra_smoothing_enable_flag");
> WRITE_FLAG(1, "vui_parameters_present_flag");
> @@ -377,7 +377,8 @@ void Entropy::codeSliceHeader(Slice* slice)
> WRITE_FLAG(0, "short_term_ref_pic_set_sps_flag");
> codeShortTermRefPicSet(&slice->m_rps);
> - WRITE_FLAG(1, "slice_temporal_mvp_enable_flag");
> + if(slice->m_sps->bTemporalMVPEnabled)
> + WRITE_FLAG(1, "slice_temporal_mvp_enable_flag");
> }
> SAOParam *saoParam = slice->m_pic->getPicSym()->getSaoParam();
> if (slice->m_sps->bUseSAO)
> @@ -412,8 +413,8 @@ void Entropy::codeSliceHeader(Slice* slice)
> if (slice->isInterB())
> WRITE_FLAG(0, "mvd_l1_zero_flag");
> - // TMVP always enabled
> - {
> + if(slice->m_sps->bTemporalMVPEnabled)
> + {
and another here, mind the space between if and (
> if (slice->m_sliceType == B_SLICE)
> WRITE_FLAG(slice->m_colFromL0Flag, "collocated_from_l0_flag");
> diff --git a/source/x265.h b/source/x265.h
> index 2c40ee7..bd2c578 100644
> --- a/source/x265.h
> +++ b/source/x265.h
> @@ -568,6 +568,9 @@ typedef struct x265_param
> * the performance but the less compression efficiency. Default is 3 */
> uint32_t maxNumMergeCand;
> + /* Disable availability of temporal motion vector for AMVP */
> + int bEnableTemporalMvp;
any API change to x265.h needs to be accompanied by a bump in X265_BUILD
in the main CMakeLists.txt.
> /* Enable weighted prediction in P slices. This enables weighting analysis
> * in the lookahead, which influences slice decisions, and enables weighting
> * analysis in the main encoder which allows P reference samples to have a
ignoring the white-space and rebase issues, I'm fine with the patch. I
was actually considering doing this myself just this week.
--
Steve Borho
More information about the x265-devel
mailing list