Commit 20a68e16 authored by Frank Bossen's avatar Frank Bossen

Merge branch 'master' into 'master'

K0248 GBI: remove unused variables/fix bugs

See merge request jvet/VVCSoftware_BMS!94
parents 3e9de471 833cd21b
Pipeline #72 passed with stage
......@@ -126,6 +126,26 @@ void addBIOAvgCoreGBI(const Pel* src0, int src0Stride, const Pel* src1, int src1
pGradX0 += gradStride; pGradX1 += gradStride; pGradY0 += gradStride; pGradY1 += gradStride;
}
}
void addAvgCoreGBI(const Pel* src1, int src1Stride, const Pel* src2, int src2Stride, Pel* dest, int dstStride, int width, int height, int rshift, int offset, const ClpRng& clpRng, uint8_t gbiIdx)
{
const int8_t w0 = getGbiWeight(gbiIdx, REF_PIC_LIST_0);
const int8_t w1 = getGbiWeight(gbiIdx, REF_PIC_LIST_1);
int32_t(*pMulW0)(Pel) = GET_INT_MULTIPLIER(w0);
int32_t(*pMulW1)(Pel) = GET_INT_MULTIPLIER(w1);
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x += 4)
{
dest[x ] = ClipPel((int16_t)rightShift(((int64_t)pMulW0(src1[x] ) + (int64_t)pMulW1(src2[x ]) + (int64_t)offset), rshift), clpRng);
dest[x+1] = ClipPel((int16_t)rightShift(((int64_t)pMulW0(src1[x+1]) + (int64_t)pMulW1(src2[x+1]) + (int64_t)offset), rshift), clpRng);
dest[x+2] = ClipPel((int16_t)rightShift(((int64_t)pMulW0(src1[x+2]) + (int64_t)pMulW1(src2[x+2]) + (int64_t)offset), rshift), clpRng);
dest[x+3] = ClipPel((int16_t)rightShift(((int64_t)pMulW0(src1[x+3]) + (int64_t)pMulW1(src2[x+3]) + (int64_t)offset), rshift), clpRng);
}
dest += dstStride; src1 += src1Stride; src2 += src2Stride;
}
}
#endif
#endif
......@@ -167,6 +187,7 @@ PelBufferOps::PelBufferOps()
addBIOAvg4 = addBIOAvgCore;
#if JVET_K0248_GBI
addBIOAvg4GBI = addBIOAvgCoreGBI;
addAvg4GBI = addAvgCoreGBI;
#endif
#endif
......
......@@ -69,9 +69,10 @@ struct PelBufferOps
void ( *linTf4 ) ( const Pel* src0, int src0Stride, Pel *dst, int dstStride, int width, int height, int scale, int shift, int offset, const ClpRng& clpRng, bool bClip );
void ( *linTf8 ) ( const Pel* src0, int src0Stride, Pel *dst, int dstStride, int width, int height, int scale, int shift, int offset, const ClpRng& clpRng, bool bClip );
#if JVET_K0485_BIO
void(*addBIOAvg4) (const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, const Pel *pGradX0, const Pel *pGradX1, const Pel *pGradY0, const Pel*pGradY1, int gradStride, int width, int height, int tmpx, int tmpy, int shift, int offset, const ClpRng& clpRng);
void ( *addBIOAvg4 ) ( const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, const Pel *pGradX0, const Pel *pGradX1, const Pel *pGradY0, const Pel*pGradY1, int gradStride, int width, int height, int tmpx, int tmpy, int shift, int offset, const ClpRng& clpRng);
#if JVET_K0248_GBI
void(*addBIOAvg4GBI) (const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, const Pel *pGradX0, const Pel *pGradX1, const Pel *pGradY0, const Pel*pGradY1, int gradStride, int width, int height, int tmpx, int tmpy, int shift, int offset, const ClpRng& clpRng, const uint8_t gbiIdx);
void ( *addBIOAvg4GBI ) ( const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, const Pel *pGradX0, const Pel *pGradX1, const Pel *pGradY0, const Pel*pGradY1, int gradStride, int width, int height, int tmpx, int tmpy, int shift, int offset, const ClpRng& clpRng, uint8_t gbiIdx);
void ( *addAvg4GBI ) ( const Pel* src0, int src0Stride, const Pel* src1, int src1Stride, Pel *dst, int dstStride, int width, int height, int shift, int offset, const ClpRng& clpRng, uint8_t gbiIdx);
#endif
#endif
};
......
......@@ -1619,14 +1619,14 @@ void InterPrediction::applyBiOptFlow( const PredictionUnit &pu, const CPelUnitBu
}
}
#endif
const ClpRng& clpRng = pu.cu->cs->slice->clpRng(COMPONENT_Y);
const int bitDepth = clipBitDepths.recon[ toChannelType(COMPONENT_Y) ];
#if JVET_K0248_GBI
const uint8_t gbiIdx = pu.cu->GBiIdx;
const int iLog2WeightBase = g_GbiLog2WeightBase;
const int shiftNum = IF_INTERNAL_PREC + ((gbiIdx != GBI_DEFAULT) ? iLog2WeightBase : 1) - bitDepth;
const int offset = (1 << (shiftNum - 1)) + ((gbiIdx != GBI_DEFAULT) ? (IF_INTERNAL_OFFS << iLog2WeightBase) : 2 * IF_INTERNAL_OFFS);
const int offset = (1 << (shiftNum - 1)) + ((gbiIdx != GBI_DEFAULT) ? (IF_INTERNAL_OFFS << iLog2WeightBase) : 2 * IF_INTERNAL_OFFS);
#else
const int shiftNum = IF_INTERNAL_PREC + 1 - bitDepth;
const int offset = ( 1 << ( shiftNum - 1 ) ) + 2 * IF_INTERNAL_OFFS;
......@@ -1700,10 +1700,10 @@ void InterPrediction::applyBiOptFlow( const PredictionUnit &pu, const CPelUnitBu
pDstY0 = pDstY + ((yu*iDstStride + xu) << 2);
#if JVET_K0248_GBI
if( gbiIdx != GBI_DEFAULT )
pcYuvDst.bufs[0].addWeightedAvg(CPelBuf(pSrcY0Temp, iSrc0Stride, pu.lumaSize()), CPelBuf(pSrcY1Temp, iSrc1Stride, pu.lumaSize()), clpRng, gbiIdx);
g_pelBufOP.addAvg4GBI(pSrcY0Temp, iSrc0Stride, pSrcY1Temp, iSrc1Stride, pDstY0, iDstStride, (1 << 2), (1 << 2), shiftNum, offset, clpRng, gbiIdx);
else
#endif
g_pelBufOP.addAvg4(pSrcY0Temp, iSrc0Stride, pSrcY1Temp, iSrc1Stride, pDstY0, iDstStride, (1 << 2), (1 << 2), shiftNum, offset, clpRng);
g_pelBufOP.addAvg4(pSrcY0Temp, iSrc0Stride, pSrcY1Temp, iSrc1Stride, pDstY0, iDstStride, (1 << 2), (1 << 2), shiftNum, offset, clpRng);
continue;
}
#endif
......@@ -1877,7 +1877,7 @@ void InterPrediction::xWeightedAverage( const PredictionUnit& pu, const CPelUnit
applyBiOptFlow( pu, pcYuvSrc0, pcYuvSrc1, iRefIdx0, iRefIdx1, pcYuvDst, clipBitDepths );
#if JVET_K0485_BIO
else
#if JVET_K0248_GBI
#if JVET_K0248_GBI
{
if (pu.cu->GBiIdx != GBI_DEFAULT)
pcYuvDst.bufs[0].addWeightedAvg(CPelBuf(pSrcY0, src0Stride, pu.lumaSize()), CPelBuf(pSrcY1, src1Stride, pu.lumaSize()), clpRngs.comp[0], pu.cu->GBiIdx);
......
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