From 449aa027db7280c2eeb6f028cea694e027ec4e42 Mon Sep 17 00:00:00 2001 From: Xiaoyu Xiu <xiaoyuxiu@kwai.com> Date: Thu, 25 Jul 2019 20:29:47 +0200 Subject: [PATCH] JVET_O0594/O0252/O0506/O0615/O0624: BDOF reference sample padding using nearest integer sample positions --- source/Lib/CommonLib/InterPrediction.cpp | 14 ++++++++++++++ source/Lib/CommonLib/TypeDef.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index 07e78e337e..e785c83a72 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -737,7 +737,13 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio if (bioApplied && compID == COMPONENT_Y) { const int shift = std::max<int>(2, (IF_INTERNAL_PREC - clpRng.bd)); +#if JVET_O0594_BDOF_REF_SAMPLE_PADDING + int xOffset = (xFrac < 8) ? 1 : 0; + int yOffset = (yFrac < 8) ? 1 : 0; + const Pel* refPel = refBuf.buf - yOffset * refBuf.stride - xOffset; +#else const Pel* refPel = refBuf.buf - refBuf.stride - 1; +#endif Pel* dstPel = m_filteredBlockTmp[2 + m_iRefListIdx][compID] + dstBuf.stride + 1; for (int w = 0; w < (width - 2 * BIO_EXTEND_SIZE); w++) { @@ -745,7 +751,11 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio dstPel[w] = val - (Pel)IF_INTERNAL_OFFS; } +#if JVET_O0594_BDOF_REF_SAMPLE_PADDING + refPel = refBuf.buf + (1 - yOffset)*refBuf.stride - xOffset; +#else refPel = refBuf.buf - 1; +#endif dstPel = m_filteredBlockTmp[2 + m_iRefListIdx][compID] + 2 * dstBuf.stride + 1; for (int h = 0; h < (height - 2 * BIO_EXTEND_SIZE - 2); h++) { @@ -759,7 +769,11 @@ void InterPrediction::xPredInterBlk ( const ComponentID& compID, const Predictio dstPel += dstBuf.stride; } +#if JVET_O0594_BDOF_REF_SAMPLE_PADDING + refPel = refBuf.buf + (height - 2 * BIO_EXTEND_SIZE - 2 + 1 - yOffset)*refBuf.stride - xOffset; +#else refPel = refBuf.buf + (height - 2 * BIO_EXTEND_SIZE - 2)*refBuf.stride - 1; +#endif dstPel = m_filteredBlockTmp[2 + m_iRefListIdx][compID] + (height - 2 * BIO_EXTEND_SIZE)*dstBuf.stride + 1; for (int w = 0; w < (width - 2 * BIO_EXTEND_SIZE); w++) { diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index ad422c5019..bd2491bfc6 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -147,6 +147,8 @@ #define JVET_O0596_CBF_SIG_ALIGN_TO_SPEC 1 // JVET-O0596 align cbf signaling with specification #define JVET_O0193_REMOVE_TR_DEPTH_IN_CBF_CTX 1 // JVET-O0193/JVET-O0375: remove transform depth in cbf context modeling +#define JVET_O0594_BDOF_REF_SAMPLE_PADDING 1 // JVET-O0594/O0252/O0506/O0615/O0624: BDOF reference sample padding using the nearest integer sample position + #define FIX_DB_MAX_TRANSFORM_SIZE 1 #define MRG_SHARELIST_SHARSIZE 32 -- GitLab