Commit 29160fa2 authored by Xiang Li's avatar Xiang Li

Merge branch 'JVET-N0325-BDOF' into 'master'

JVET-N0325: BDOF improvement

See merge request !419
parents c08b54ad dd59f4d3
Pipeline #1200 passed with stage
......@@ -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++)
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment