diff --git a/source/Lib/CommonLib/Buffer.cpp b/source/Lib/CommonLib/Buffer.cpp index 6dd8562fe8119f8c48776a16c1431f44f1e53140..e8f8593c35fc4a9e8163d61d931981d965b7e8ff 100644 --- a/source/Lib/CommonLib/Buffer.cpp +++ b/source/Lib/CommonLib/Buffer.cpp @@ -96,7 +96,11 @@ void gradFilterCore(Pel* pSrc, int srcStride, int width, int height, int gradStr Pel* srcTmp = pSrc + srcStride + 1; Pel* gradXTmp = gradX + gradStride + 1; Pel* gradYTmp = gradY + gradStride + 1; +#if JVET_N0325_BDOF + int shift1 = std::max<int>(6, (bitDepth - 6)); +#else int shift1 = std::max<int>(2, (IF_INTERNAL_PREC - bitDepth)); +#endif for (int y = 0; y < (height - 2 * BIO_EXTEND_SIZE); y++) { @@ -133,8 +137,13 @@ void gradFilterCore(Pel* pSrc, int srcStride, int width, int height, int gradStr void calcBIOParCore(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, const int bitDepth) { +#if JVET_N0325_BDOF + int shift4 = std::max<int>(4, (bitDepth - 8)); + int shift5 = std::max<int>(1, (bitDepth - 11)); +#else int shift4 = std::min<int>(8, (bitDepth - 4)); int shift5 = std::min<int>(5, (bitDepth - 7)); +#endif for (int y = 0; y < heightG; y++) { for (int x = 0; x < widthG; x++) diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index aea57502c0c09f7c2daa9148f3f3206322391796..ac3e9785b12989d190a39c5fc154737b0faa3ae1 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -938,7 +938,11 @@ void InterPrediction::applyBiOptFlow(const PredictionUnit &pu, const CPelUnitBuf const int bitDepth = clipBitDepths.recon[toChannelType(COMPONENT_Y)]; const int shiftNum = IF_INTERNAL_PREC + 1 - bitDepth; const int offset = (1 << (shiftNum - 1)) + 2 * IF_INTERNAL_OFFS; +#if JVET_N0325_BDOF + const int limit = (1<<(std::max<int>(5, bitDepth - 7))); +#else const int limit = (bitDepth>12)? 2 : ((int)1 << (4 + IF_INTERNAL_PREC - bitDepth - 5)); +#endif int* dotProductTemp1 = m_dotProduct1; int* dotProductTemp2 = m_dotProduct2; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index e48fe55d6354f88383537a2fe81f19c94866d5ed..f6eb34388407e4adad90ebcbd53e0fbd18830771 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -58,6 +58,8 @@ #define JVET_N0242_NON_LINEAR_ALF 1 // enable CE5-3.2, Non-linear ALF based on clipping function +#define JVET_N0325_BDOF 1 // unified right-shifts for BDOF derivation + #define JVET_N0449_MMVD_SIMP 1 // Configurable number of mmvd distance entries used #define JVET_N0137_DUALTREE_CHROMA_SIZE 1 diff --git a/source/Lib/CommonLib/x86/BufferX86.h b/source/Lib/CommonLib/x86/BufferX86.h index 00399014c56ec3d9e68b860ab55618e549f06238..41e97b1086ece7c73e5e42eb609a339546e86ef6 100644 --- a/source/Lib/CommonLib/x86/BufferX86.h +++ b/source/Lib/CommonLib/x86/BufferX86.h @@ -288,8 +288,11 @@ void gradFilter_SSE(Pel* src, int srcStride, int width, int height, int gradStri int widthInside = width - 2 * BIO_EXTEND_SIZE; int heightInside = height - 2 * BIO_EXTEND_SIZE; +#if JVET_N0325_BDOF + int shift1 = std::max<int>(6, bitDepth - 6); +#else int shift1 = std::max<int>(2, (14 - bitDepth)); - +#endif assert((widthInside & 3) == 0); @@ -341,8 +344,13 @@ void gradFilter_SSE(Pel* src, int srcStride, int width, int height, int gradStri template< X86_VEXT vext > void calcBIOPar_SSE(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, const int bitDepth) { +#if JVET_N0325_BDOF + int shift4 = std::max<int>(4, (bitDepth - 8)); + int shift5 = std::max<int>(1, (bitDepth - 11)); +#else int shift4 = std::min<int>(8, (bitDepth - 4)); int shift5 = std::min<int>(5, (bitDepth - 7)); +#endif for (int y = 0; y < heightG; y++) { int x = 0;