Commit e582c46f authored by Philipp Merkle's avatar Philipp Merkle
Browse files

JVET-O0925: simplifications of MIP

parent 017756ab
...@@ -259,6 +259,7 @@ public: ...@@ -259,6 +259,7 @@ public:
} }
}; };
#if !JVET_O0925_MIP_SIMPLIFICATIONS
struct AvailableInfo struct AvailableInfo
{ {
int maxPosTop; int maxPosTop;
...@@ -267,6 +268,7 @@ struct AvailableInfo ...@@ -267,6 +268,7 @@ struct AvailableInfo
AvailableInfo() : maxPosTop(0), maxPosLeft(0) {} AvailableInfo() : maxPosTop(0), maxPosLeft(0) {}
AvailableInfo(const int top, const int left) : maxPosTop(top), maxPosLeft(left) {} AvailableInfo(const int top, const int left) : maxPosTop(top), maxPosLeft(left) {}
}; };
#endif
#endif #endif
...@@ -176,8 +176,13 @@ static const int MAX_VPS_LAYERS = 256; ...@@ -176,8 +176,13 @@ static const int MAX_VPS_LAYERS = 256;
static const int MAXIMUM_INTRA_FILTERED_WIDTH = 16; static const int MAXIMUM_INTRA_FILTERED_WIDTH = 16;
static const int MAXIMUM_INTRA_FILTERED_HEIGHT = 16; static const int MAXIMUM_INTRA_FILTERED_HEIGHT = 16;
#if JVET_O0925_MIP_SIMPLIFICATIONS
static const int MIP_MAX_WIDTH = MAX_TB_SIZEY;
static const int MIP_MAX_HEIGHT = MAX_TB_SIZEY;
#else
static const int MIP_MAX_WIDTH = 64; static const int MIP_MAX_WIDTH = 64;
static const int MIP_MAX_HEIGHT = 64; static const int MIP_MAX_HEIGHT = 64;
#endif
#if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB #if JVET_O0090_ALF_CHROMA_FILTER_ALTERNATIVES_CTB
static const int MAX_NUM_ALF_ALTERNATIVES_CHROMA = 8; static const int MAX_NUM_ALF_ALTERNATIVES_CHROMA = 8;
......
...@@ -560,6 +560,9 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA ...@@ -560,6 +560,9 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA
if( sps.getSpsRangeExtension().getIntraSmoothingDisabledFlag() if( sps.getSpsRangeExtension().getIntraSmoothingDisabledFlag()
|| !isLuma( chType ) || !isLuma( chType )
|| useISP || useISP
#if JVET_O0925_MIP_SIMPLIFICATIONS
|| PU::isMIP( pu, chType )
#endif
|| m_ipaParam.multiRefIndex || m_ipaParam.multiRefIndex
|| DC_IDX == dirMode || DC_IDX == dirMode
) )
...@@ -2155,11 +2158,21 @@ void IntraPrediction::initIntraMip( const PredictionUnit &pu ) ...@@ -2155,11 +2158,21 @@ void IntraPrediction::initIntraMip( const PredictionUnit &pu )
CHECK( pu.lwidth() > MIP_MAX_WIDTH || pu.lheight() > MIP_MAX_HEIGHT, "Error: block size not supported for MIP" ); CHECK( pu.lwidth() > MIP_MAX_WIDTH || pu.lheight() > MIP_MAX_HEIGHT, "Error: block size not supported for MIP" );
#endif #endif
#if JVET_O0925_MIP_SIMPLIFICATIONS
// prepare input (boundary) data for prediction
CHECK(m_ipaParam.refFilterFlag, "ERROR: unfiltered refs expected for MIP");
Pel *ptrSrc = getPredictorPtr(COMPONENT_Y);
const int srcStride = m_topRefLength + 1;
const int srcHStride = m_leftRefLength + 1;
m_matrixIntraPred.prepareInputForPred(CPelBuf(ptrSrc, srcStride, srcHStride), pu.Y(), pu.cu->slice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA));
#else
// derive above and left availability // derive above and left availability
AvailableInfo availInfo = PU::getAvailableInfoLuma(pu); AvailableInfo availInfo = PU::getAvailableInfoLuma(pu);
// prepare input (boundary) data for prediction // prepare input (boundary) data for prediction
m_matrixIntraPred.prepareInputForPred(pu.cs->picture->getRecoBuf(COMPONENT_Y), pu.Y(), pu.cu->slice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), availInfo); m_matrixIntraPred.prepareInputForPred(pu.cs->picture->getRecoBuf(COMPONENT_Y), pu.Y(), pu.cu->slice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), availInfo);
#endif
} }
void IntraPrediction::predIntraMip( const ComponentID compId, PelBuf &piPred, const PredictionUnit &pu ) void IntraPrediction::predIntraMip( const ComponentID compId, PelBuf &piPred, const PredictionUnit &pu )
......
...@@ -47,19 +47,84 @@ namespace Mip ...@@ -47,19 +47,84 @@ namespace Mip
PredictorMIP::PredictorMIP(): PredictorMIP::PredictorMIP():
m_reducedBoundary (MIP_MAX_INPUT_SIZE), m_reducedBoundary (MIP_MAX_INPUT_SIZE),
m_reducedBoundaryTransposed(MIP_MAX_INPUT_SIZE), m_reducedBoundaryTransposed(MIP_MAX_INPUT_SIZE),
#if JVET_O0925_MIP_SIMPLIFICATIONS
m_inputOffset ( 0 ),
m_inputOffsetTransp( 0 ),
m_refSamplesTop (MIP_MAX_WIDTH),
m_refSamplesLeft(MIP_MAX_HEIGHT),
#else
m_boundaryForUpsamplingTop (MIP_MAX_WIDTH), m_boundaryForUpsamplingTop (MIP_MAX_WIDTH),
m_boundaryForUpsamplingLeft(MIP_MAX_HEIGHT), m_boundaryForUpsamplingLeft(MIP_MAX_HEIGHT),
#endif
m_blockSize( 0, 0 ), m_blockSize( 0, 0 ),
m_numModes( 0 ), m_numModes( 0 ),
m_reducedBoundarySize( 0, 0 ), m_reducedBoundarySize( 0, 0 ),
m_reducedPredictionSize( 0, 0 ), m_reducedPredictionSize( 0, 0 ),
#if !JVET_O0925_MIP_SIMPLIFICATIONS
m_boundarySizeForUpsampling( 0, 0 ), m_boundarySizeForUpsampling( 0, 0 ),
#endif
m_upsmpFactorHor( 0 ), m_upsmpFactorHor( 0 ),
m_upsmpFactorVer( 0 ) m_upsmpFactorVer( 0 )
{ {
} }
#if JVET_O0925_MIP_SIMPLIFICATIONS
void PredictorMIP::deriveBoundaryData(const CPelBuf &pSrc, const Area& block, const int bitDepth)
{
// Step 1: Save block size and calculate dependent values
initPredBlockParams(block);
// Step 2: Get the input data (left and top reference samples)
m_refSamplesTop.resize(block.width);
for (int x = 0; x < block.width; x++)
{
m_refSamplesTop[x] = pSrc.at(x + 1, 0);
}
m_refSamplesLeft.resize(block.height);
for (int y = 0; y < block.height; y++)
{
m_refSamplesLeft[y] = pSrc.at(0, y + 1);
}
// Step 3: Compute the reduced boundary via Haar-downsampling (input for the prediction)
m_reducedBoundary .resize( m_reducedBoundarySize.width + m_reducedBoundarySize.height );
m_reducedBoundaryTransposed.resize( m_reducedBoundarySize.width + m_reducedBoundarySize.height );
int* const topReduced = m_reducedBoundary.data();
boundaryDownsampling1D(topReduced, m_refSamplesTop.data(), block.width, m_reducedBoundarySize.width);
int* const leftReduced = m_reducedBoundary.data() + m_reducedBoundarySize.width;
boundaryDownsampling1D(leftReduced, m_refSamplesLeft.data(), block.height, m_reducedBoundarySize.height);
int* const leftReducedTransposed = m_reducedBoundaryTransposed.data();
int* const topReducedTransposed = m_reducedBoundaryTransposed.data() + m_reducedBoundarySize.height;
for( int x = 0; x < m_reducedBoundarySize.width; x++ )
{
topReducedTransposed[ x ] = topReduced[ x ];
}
for( int y = 0; y < m_reducedBoundarySize.height; y++ )
{
leftReducedTransposed[ y ] = leftReduced[ y ];
}
// Step 4: Rebase the reduced boundary
const int inputSize = m_reducedBoundarySize.width + m_reducedBoundarySize.height;
m_inputOffset = m_reducedBoundary[0];
m_inputOffsetTransp = m_reducedBoundaryTransposed[0];
const bool hasFirstCol = (m_blockSize.width <= 8 && m_blockSize.height <= 8);
m_reducedBoundary [0] = hasFirstCol ? (m_inputOffset - (1 << (bitDepth - 1))) : 0; // first column of matrix not needed for large blocks
m_reducedBoundaryTransposed[0] = hasFirstCol ? (m_inputOffsetTransp - (1 << (bitDepth - 1))) : 0;
for (int i = 1; i < inputSize; i++)
{
m_reducedBoundary [i] -= m_inputOffset;
m_reducedBoundaryTransposed[i] -= m_inputOffsetTransp;
}
}
#else
void PredictorMIP::deriveBoundaryData(const CPelBuf& src, const Area& block, const int bitDepth, const AvailableInfo &availInfo) void PredictorMIP::deriveBoundaryData(const CPelBuf& src, const Area& block, const int bitDepth, const AvailableInfo &availInfo)
{ {
// Step 1: Save block size and calculate dependent values // Step 1: Save block size and calculate dependent values
...@@ -143,12 +208,18 @@ namespace Mip ...@@ -143,12 +208,18 @@ namespace Mip
leftReducedTransposed[ y ] = leftReduced[ y ]; leftReducedTransposed[ y ] = leftReduced[ y ];
} }
} }
#endif
void PredictorMIP::getPrediction(int* const result, const int modeIdx, const int bitDepth) void PredictorMIP::getPrediction(int* const result, const int modeIdx, const int bitDepth)
{ {
const bool transpose = isTransposed( modeIdx ); const bool transpose = isTransposed( modeIdx );
const bool needUpsampling = ( m_upsmpFactorHor > 1 ) || ( m_upsmpFactorVer > 1 ); const bool needUpsampling = ( m_upsmpFactorHor > 1 ) || ( m_upsmpFactorVer > 1 );
#if JVET_O0925_MIP_SIMPLIFICATIONS
const uint8_t* matrix;
int shiftMatrix = 0, offsetMatrix = 0;
getMatrixData(matrix, shiftMatrix, offsetMatrix, modeIdx);
#else
const short* matrix; const short* matrix;
const short* bias; const short* bias;
getMatrixBias( matrix, bias, modeIdx ); getMatrixBias( matrix, bias, modeIdx );
...@@ -156,6 +227,7 @@ namespace Mip ...@@ -156,6 +227,7 @@ namespace Mip
int shiftMatrix = 0; int shiftMatrix = 0;
int shiftBias = 0; int shiftBias = 0;
getShifts(shiftMatrix, shiftBias, modeIdx, bitDepth ); getShifts(shiftMatrix, shiftBias, modeIdx, bitDepth );
#endif
bool leaveHorOut = ( m_blockSize.width == 4 && m_blockSize.height >= 16 ); bool leaveHorOut = ( m_blockSize.width == 4 && m_blockSize.height >= 16 );
bool leaveVerOut = ( m_blockSize.height == 4 && m_blockSize.width >= 16 ); bool leaveVerOut = ( m_blockSize.height == 4 && m_blockSize.width >= 16 );
...@@ -166,10 +238,15 @@ namespace Mip ...@@ -166,10 +238,15 @@ namespace Mip
static_vector<int, MIP_MAX_REDUCED_OUTPUT_SAMPLES> bufReducedPred( m_reducedPredictionSize.area() ); static_vector<int, MIP_MAX_REDUCED_OUTPUT_SAMPLES> bufReducedPred( m_reducedPredictionSize.area() );
int* const reducedPred = needUpsampling ? bufReducedPred.data() : result; int* const reducedPred = needUpsampling ? bufReducedPred.data() : result;
const int* const reducedBoundary = transpose ? m_reducedBoundaryTransposed.data() : m_reducedBoundary.data(); const int* const reducedBoundary = transpose ? m_reducedBoundaryTransposed.data() : m_reducedBoundary.data();
#if JVET_O0925_MIP_SIMPLIFICATIONS
computeReducedPred( reducedPred, reducedBoundary, matrix, leaveHorOut, leaveVerOut, shiftMatrix, offsetMatrix,
transpose, needUpsampling, bitDepth );
#else
xComputeMatrixTimesRedBndryPlusBias( reducedPred, reducedBoundary, matrix, bias, xComputeMatrixTimesRedBndryPlusBias( reducedPred, reducedBoundary, matrix, bias,
leaveHorOut, leaveVerOut, leaveHorOut, leaveVerOut,
shiftMatrix, shiftBias, shiftMatrix, shiftBias,
transpose, needUpsampling ); transpose, needUpsampling );
#endif
// Reduced prediction is transposed if ( transpose && needUpsampling ). // Reduced prediction is transposed if ( transpose && needUpsampling ).
if( needUpsampling ) if( needUpsampling )
...@@ -220,6 +297,7 @@ namespace Mip ...@@ -220,6 +297,7 @@ namespace Mip
m_reducedPredictionSize = Size(std::min<SizeType>(m_blockSize.width, 8), std::min<SizeType>(m_blockSize.height, 8)); m_reducedPredictionSize = Size(std::min<SizeType>(m_blockSize.width, 8), std::min<SizeType>(m_blockSize.height, 8));
} }
#if !JVET_O0925_MIP_SIMPLIFICATIONS
// init boundary size for upsampling // init boundary size for upsampling
if (m_blockSize.height > m_blockSize.width) if (m_blockSize.height > m_blockSize.width)
{ {
...@@ -229,6 +307,7 @@ namespace Mip ...@@ -229,6 +307,7 @@ namespace Mip
{ {
m_boundarySizeForUpsampling = Size(m_reducedPredictionSize.width, m_blockSize.height); m_boundarySizeForUpsampling = Size(m_reducedPredictionSize.width, m_blockSize.height);
} }
#endif
// init upsampling factors // init upsampling factors
m_upsmpFactorHor = m_blockSize.width / m_reducedPredictionSize.width; m_upsmpFactorHor = m_blockSize.width / m_reducedPredictionSize.width;
...@@ -242,12 +321,18 @@ namespace Mip ...@@ -242,12 +321,18 @@ namespace Mip
void PredictorMIP::doDownsampling( int* dst, const int* src, const SizeType srcLen, const SizeType dstLen ) void PredictorMIP::doDownsampling( int* dst, const int* src, const SizeType srcLen, const SizeType dstLen )
{ {
#if !JVET_O0925_MIP_SIMPLIFICATIONS
// TODO: Check if src and dst can ever be negative. If not assign unsigned type and simplify rounding. // TODO: Check if src and dst can ever be negative. If not assign unsigned type and simplify rounding.
#endif
const SizeType downsmpFactor = srcLen / dstLen; const SizeType downsmpFactor = srcLen / dstLen;
CHECKD( srcLen != dstLen * downsmpFactor, "Need integer downsampling factor." ); CHECKD( srcLen != dstLen * downsmpFactor, "Need integer downsampling factor." );
CHECKD( ( downsmpFactor & ( downsmpFactor - 1 ) ) != 0, "Need power of two downsampling factor." ); CHECKD( ( downsmpFactor & ( downsmpFactor - 1 ) ) != 0, "Need power of two downsampling factor." );
const int log2DownsmpFactor = g_aucLog2[ downsmpFactor ]; const int log2DownsmpFactor = g_aucLog2[ downsmpFactor ];
#if JVET_O0925_MIP_SIMPLIFICATIONS
const int roundingOffset = ( 1 << ( log2DownsmpFactor - 1 ) );
#else
const int roundingOffsetPositive = ( 1 << ( log2DownsmpFactor - 1 ) ); const int roundingOffsetPositive = ( 1 << ( log2DownsmpFactor - 1 ) );
#endif
for( SizeType srcIdx = 0, dstIdx = 0; dstIdx < dstLen; ++dstIdx ) for( SizeType srcIdx = 0, dstIdx = 0; dstIdx < dstLen; ++dstIdx )
{ {
...@@ -256,12 +341,32 @@ namespace Mip ...@@ -256,12 +341,32 @@ namespace Mip
{ {
sum += src[ srcIdx ]; sum += src[ srcIdx ];
} }
#if !JVET_O0925_MIP_SIMPLIFICATIONS
const int roundingOffset = roundingOffsetPositive - ( sum < 0 ? 1 : 0 ); const int roundingOffset = roundingOffsetPositive - ( sum < 0 ? 1 : 0 );
#endif
dst[ dstIdx ] = ( sum + roundingOffset ) >> log2DownsmpFactor; dst[ dstIdx ] = ( sum + roundingOffset ) >> log2DownsmpFactor;
} }
} }
#if JVET_O0925_MIP_SIMPLIFICATIONS
void PredictorMIP::boundaryDownsampling1D(int* reducedDst, const int* const fullSrc, const SizeType srcLen, const SizeType dstLen)
{
if (dstLen < srcLen)
{
// Create reduced boundary by downsampling
doDownsampling(reducedDst, fullSrc, srcLen, dstLen);
}
else
{
// Copy boundary if no downsampling is needed
for (SizeType i = 0; i < dstLen; ++i)
{
reducedDst[i] = fullSrc[i];
}
}
}
#else
void PredictorMIP::boundaryDownsampling1D( int* reducedDst, int* fullSrcAndIntermediateDst, void PredictorMIP::boundaryDownsampling1D( int* reducedDst, int* fullSrcAndIntermediateDst,
const SizeType srcLen, const SizeType dstLen, const SizeType srcLen, const SizeType dstLen,
const bool saveIntermediate, const SizeType intermediateLen ) const bool saveIntermediate, const SizeType intermediateLen )
...@@ -290,25 +395,41 @@ namespace Mip ...@@ -290,25 +395,41 @@ namespace Mip
} }
} }
} }
#endif
void PredictorMIP::predictionUpsampling1D( int* const dst, const int* const src, const int* const bndry, void PredictorMIP::predictionUpsampling1D( int* const dst, const int* const src, const int* const bndry,
const SizeType srcSizeUpsmpDim, const SizeType srcSizeOrthDim, const SizeType srcSizeUpsmpDim, const SizeType srcSizeOrthDim,
const SizeType srcStep, const SizeType srcStride, const SizeType srcStep, const SizeType srcStride,
const SizeType dstStep, const SizeType dstStride, const SizeType dstStep, const SizeType dstStride,
#if JVET_O0925_MIP_SIMPLIFICATIONS
const SizeType bndryStep,
#endif
const unsigned int upsmpFactor ) const unsigned int upsmpFactor )
{ {
#if !JVET_O0925_MIP_SIMPLIFICATIONS
// TODO: Check if src and dst can ever be negative. If not assign unsigned type and simplify rounding. // TODO: Check if src and dst can ever be negative. If not assign unsigned type and simplify rounding.
#endif
const int log2UpsmpFactor = g_aucLog2[ upsmpFactor ]; const int log2UpsmpFactor = g_aucLog2[ upsmpFactor ];
CHECKD( upsmpFactor <= 1, "Upsampling factor must be at least 2." ); CHECKD( upsmpFactor <= 1, "Upsampling factor must be at least 2." );
#if JVET_O0925_MIP_SIMPLIFICATIONS
const int roundingOffset = 1 << (log2UpsmpFactor - 1);
#endif
SizeType idxOrthDim = 0; SizeType idxOrthDim = 0;
const int* srcLine = src; const int* srcLine = src;
int* dstLine = dst; int* dstLine = dst;
#if JVET_O0925_MIP_SIMPLIFICATIONS
const int* bndryLine = bndry + bndryStep - 1;
#endif
while( idxOrthDim < srcSizeOrthDim ) while( idxOrthDim < srcSizeOrthDim )
{ {
SizeType idxUpsmpDim = 0; SizeType idxUpsmpDim = 0;
#if JVET_O0925_MIP_SIMPLIFICATIONS
const int* before = bndryLine;
#else
const int* before = bndry + idxOrthDim; const int* before = bndry + idxOrthDim;
#endif
const int* behind = srcLine; const int* behind = srcLine;
int* currDst = dstLine; int* currDst = dstLine;
while( idxUpsmpDim < srcSizeUpsmpDim ) while( idxUpsmpDim < srcSizeUpsmpDim )
...@@ -320,9 +441,13 @@ namespace Mip ...@@ -320,9 +441,13 @@ namespace Mip
{ {
scaledBefore -= *before; scaledBefore -= *before;
scaledBehind += *behind; scaledBehind += *behind;
#if JVET_O0925_MIP_SIMPLIFICATIONS
*currDst = (scaledBefore + scaledBehind + roundingOffset) >> log2UpsmpFactor;
#else
*currDst = scaledBefore + scaledBehind; *currDst = scaledBefore + scaledBehind;
*currDst = ( *currDst + ( 1 << ( log2UpsmpFactor - 1 ) ) - *currDst = ( *currDst + ( 1 << ( log2UpsmpFactor - 1 ) ) -
( *currDst < 0 ? 1 : 0 ) ) >> log2UpsmpFactor; ( *currDst < 0 ? 1 : 0 ) ) >> log2UpsmpFactor;
#endif
pos++; pos++;
currDst += dstStep; currDst += dstStep;
...@@ -336,6 +461,9 @@ namespace Mip ...@@ -336,6 +461,9 @@ namespace Mip
idxOrthDim++; idxOrthDim++;
srcLine += srcStride; srcLine += srcStride;
dstLine += dstStride; dstLine += dstStride;
#if JVET_O0925_MIP_SIMPLIFICATIONS
bndryLine += bndryStep;
#endif
} }
} }
...@@ -356,10 +484,17 @@ namespace Mip ...@@ -356,10 +484,17 @@ namespace Mip
int* const horDst = dst + ( m_upsmpFactorVer - 1 ) * m_blockSize.width; int* const horDst = dst + ( m_upsmpFactorVer - 1 ) * m_blockSize.width;
const SizeType horDstStride = m_upsmpFactorVer * m_blockSize.width; const SizeType horDstStride = m_upsmpFactorVer * m_blockSize.width;
#if JVET_O0925_MIP_SIMPLIFICATIONS
predictionUpsampling1D( horDst, src, m_refSamplesLeft.data(),
m_reducedPredictionSize.width, m_reducedPredictionSize.height,
horSrcStep, horSrcStride, 1, horDstStride,
m_upsmpFactorVer, m_upsmpFactorHor );
#else
predictionUpsampling1D( horDst, src, m_boundaryForUpsamplingLeft.data(), predictionUpsampling1D( horDst, src, m_boundaryForUpsamplingLeft.data(),
m_reducedPredictionSize.width, m_reducedPredictionSize.height, m_reducedPredictionSize.width, m_reducedPredictionSize.height,
horSrcStep, horSrcStride, 1, horDstStride, horSrcStep, horSrcStride, 1, horDstStride,
m_upsmpFactorHor ); m_upsmpFactorHor );
#endif
verSrc = horDst; verSrc = horDst;
verSrcStep = horDstStride; verSrcStep = horDstStride;
...@@ -371,10 +506,17 @@ namespace Mip ...@@ -371,10 +506,17 @@ namespace Mip
verSrcStep = transpose ? 1 : m_blockSize.width; verSrcStep = transpose ? 1 : m_blockSize.width;
verSrcStride = transpose ? m_reducedPredictionSize.height : 1; verSrcStride = transpose ? m_reducedPredictionSize.height : 1;
} }
#if JVET_O0925_MIP_SIMPLIFICATIONS
predictionUpsampling1D( dst, verSrc, m_refSamplesTop.data(),
m_reducedPredictionSize.height, m_blockSize.width,
verSrcStep, verSrcStride, m_blockSize.width, 1,
1, m_upsmpFactorVer );
#else
predictionUpsampling1D( dst, verSrc, m_boundaryForUpsamplingTop.data(), predictionUpsampling1D( dst, verSrc, m_boundaryForUpsamplingTop.data(),
m_reducedPredictionSize.height, m_blockSize.width, m_reducedPredictionSize.height, m_blockSize.width,
verSrcStep, verSrcStride, m_blockSize.width, 1, verSrcStep, verSrcStride, m_blockSize.width, 1,
m_upsmpFactorVer ); m_upsmpFactorVer );
#endif
} }
else else
{ {
...@@ -390,10 +532,17 @@ namespace Mip ...@@ -390,10 +532,17 @@ namespace Mip
const SizeType verDstStep = m_blockSize.width; const SizeType verDstStep = m_blockSize.width;
const SizeType verDstStride = m_upsmpFactorHor; const SizeType verDstStride = m_upsmpFactorHor;
#if JVET_O0925_MIP_SIMPLIFICATIONS
predictionUpsampling1D( verDst, src, m_refSamplesTop.data(),
m_reducedPredictionSize.height, m_reducedPredictionSize.width,
verSrcStep, verSrcStride, verDstStep, verDstStride,
m_upsmpFactorHor, m_upsmpFactorVer );
#else
predictionUpsampling1D( verDst, src, m_boundaryForUpsamplingTop.data(), predictionUpsampling1D( verDst, src, m_boundaryForUpsamplingTop.data(),
m_reducedPredictionSize.height, m_reducedPredictionSize.width, m_reducedPredictionSize.height, m_reducedPredictionSize.width,
verSrcStep, verSrcStride, verDstStep, verDstStride, verSrcStep, verSrcStride, verDstStep, verDstStride,
m_upsmpFactorVer ); m_upsmpFactorVer );
#endif
horSrc = verDst; horSrc = verDst;
horSrcStep = verDstStride; horSrcStep = verDstStride;
...@@ -405,13 +554,44 @@ namespace Mip ...@@ -405,13 +554,44 @@ namespace Mip
horSrcStep = transpose ? m_blockSize.height : 1; horSrcStep = transpose ? m_blockSize.height : 1;
horSrcStride = transpose ? 1 : m_reducedPredictionSize.width; horSrcStride = transpose ? 1 : m_reducedPredictionSize.width;
} }
#if JVET_O0925_MIP_SIMPLIFICATIONS
predictionUpsampling1D( dst, horSrc, m_refSamplesLeft.data(),
m_reducedPredictionSize.width, m_blockSize.height,
horSrcStep, horSrcStride, 1, m_blockSize.width,
1, m_upsmpFactorHor );
#else
predictionUpsampling1D( dst, horSrc, m_boundaryForUpsamplingLeft.data(), predictionUpsampling1D( dst, horSrc, m_boundaryForUpsamplingLeft.data(),
m_reducedPredictionSize.width, m_blockSize.height, m_reducedPredictionSize.width, m_blockSize.height,
horSrcStep, horSrcStride, 1, m_blockSize.width, horSrcStep, horSrcStride, 1, m_blockSize.width,
m_upsmpFactorHor ); m_upsmpFactorHor );
#endif
} }
} }
#if JVET_O0925_MIP_SIMPLIFICATIONS
void PredictorMIP::getMatrixData(const uint8_t*& matrix, int &shiftMatrix, int &offsetMatrix, const int modeIdx) const
{
const int idx = getWeightIdx( modeIdx );
if( m_blockSize.width == 4 && m_blockSize.height == 4 )
{
matrix = &mipMatrix4x4 [idx][0][0];
shiftMatrix = mipShiftMatrix4x4 [idx];
offsetMatrix = mipOffsetMatrix4x4[idx];
}
else if( m_blockSize.width <= 8 && m_blockSize.height <= 8 )
{
matrix = &mipMatrix8x8 [idx][0][0];
shiftMatrix = mipShiftMatrix8x8 [idx];
offsetMatrix = mipOffsetMatrix8x8[idx];
}
else
{
matrix = &mipMatrix16x16 [idx][0][0];
shiftMatrix = mipShiftMatrix16x16 [idx];
offsetMatrix = mipOffsetMatrix16x16[idx];
}
}
#else
void PredictorMIP::getMatrixBias( const short*& matrix, const short*& bias, const int modeIdx ) const void PredictorMIP::getMatrixBias( const short*& matrix, const short*& bias, const int modeIdx ) const
{ {
const int idx = getWeightIdx( modeIdx ); const int idx = getWeightIdx( modeIdx );
...@@ -453,12 +633,20 @@ namespace Mip ...@@ -453,12 +633,20 @@ namespace Mip
shiftBias = mipShiftBias16x16 [idx] + (bitDepth - 10); shiftBias = mipShiftBias16x16 [idx] + (bitDepth - 10);
} }
} }
#endif