Commit 8de020f2 authored by Hongbin Liu's avatar Hongbin Liu

JVET-O0625/O654/O0662: Unified padding method in ALF.

parent bb993c36
Pipeline #2673 passed with stage
This diff is collapsed.
......@@ -87,25 +87,52 @@ public:
void ALFProcess(CodingStructure& cs);
void create( const int picWidth, const int picHeight, const ChromaFormat format, const int maxCUWidth, const int maxCUHeight, const int maxCUDepth, const int inputBitDepth[MAX_NUM_CHANNEL_TYPE] );
void destroy();
#if JVET_O0625_ALF_PADDING
static void deriveClassificationBlk( AlfClassifier **classifier, int **laplacian[NUM_DIRECTIONS],
const CPelBuf &srcLuma, const Area &blkDst, const Area &blk, const int shift,
const int vbCTUHeight, int vbPos, const int alfBryList[4] );
void deriveClassification( AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blkDst, const Area& blk, const int alfBryList[4] );
#else
static void deriveClassificationBlk(AlfClassifier **classifier, int **laplacian[NUM_DIRECTIONS],
const CPelBuf &srcLuma, const Area &blkDst, const Area &blk, const int shift,
const int vbCTUHeight, int vbPos);
void deriveClassification( AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blkDst, const Area& blk );
#endif
#if !JVET_O0525_REMOVE_PCM
void resetPCMBlkClassInfo(CodingStructure & cs, AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blk);
#endif
template<AlfFilterType filtType>
#if JVET_O0625_ALF_PADDING
static void filterBlk( AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc,
const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet,
const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, const int vbCTUHeight,
int vbPos, const int alfBryList[4] );
#else
static void filterBlk(AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc,
const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet,
const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, const int vbCTUHeight,
int vbPos);
#endif
#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING
inline static int getMaxGolombIdx( AlfFilterType filterType )
{
return filterType == ALF_FILTER_5 ? 2 : 3;
}
#endif
#if JVET_O0625_ALF_PADDING
void getAlfBoundary( const CodingStructure& cs, int posX, int posY, int &topBry, int &botBry, int &leftBry, int &rightBry );
void (*m_deriveClassificationBlk)( AlfClassifier **classifier, int **laplacian[NUM_DIRECTIONS], const CPelBuf &srcLuma,
const Area &blkDst, const Area &blk, const int shift, const int vbCTUHeight,
int vbPos, const int alfBryList[4] );
void (*m_filter5x5Blk)( AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc,
const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet,
const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, const int vbCTUHeight,
int vbPos, const int alfBryList[4] );
void (*m_filter7x7Blk)( AlfClassifier **classifier, const PelUnitBuf &recDst, const CPelUnitBuf &recSrc,
const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet,
const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, const int vbCTUHeight,
int vbPos, const int alfBryList[4] );
#else
void (*m_deriveClassificationBlk)(AlfClassifier **classifier, int **laplacian[NUM_DIRECTIONS], const CPelBuf &srcLuma,
const Area &blkDst, const Area &blk, const int shift, const int vbCTUHeight,
int vbPos);
......@@ -118,6 +145,7 @@ public:
const Area &blkDst, const Area &blk, const ComponentID compId, const short *filterSet,
const short *fClipSet, const ClpRng &clpRng, CodingStructure &cs, const int vbCTUHeight,
int vbPos);
#endif
#ifdef TARGET_SIMD_X86
void initAdaptiveLoopFilterX86();
......@@ -126,7 +154,11 @@ public:
#endif
protected:
#if JVET_O0625_ALF_PADDING
bool isCrossedByVirtualBoundaries( const CodingStructure& cs, const int xPos, const int yPos, const int width, const int height, int &topBry, int &botBry, int &leftBry, int &rightBry, int& numHorVirBndry, int& numVerVirBndry, int horVirBndryPos[], int verVirBndryPos[], const PPS* pps );
#else
bool isCrossedByVirtualBoundaries( const int xPos, const int yPos, const int width, const int height, bool& clipTop, bool& clipBottom, bool& clipLeft, bool& clipRight, int& numHorVirBndry, int& numVerVirBndry, int horVirBndryPos[], int verVirBndryPos[], const PPS* pps );
#endif
static const int m_classToFilterMapping[NUM_FIXED_FILTER_SETS][MAX_NUM_ALF_CLASSES];
static const int m_fixedFilterSetCoeff[ALF_FIXED_FILTER_NUM][MAX_NUM_ALF_LUMA_COEFF];
short m_fixedFilterSetCoeffDec[NUM_FIXED_FILTER_SETS][MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF];
......
......@@ -205,6 +205,10 @@ static const int ALF_CTB_MAX_NUM_APS = 6;
static const int NUM_FIXED_FILTER_SETS = 16;
static const int NUM_TOTAL_FILTER_SETS = NUM_FIXED_FILTER_SETS + ALF_CTB_MAX_NUM_APS;
#if JVET_O0625_ALF_PADDING
static const int ALF_NONE_BOUNDARY = -128;
#endif
static const int MAX_BDOF_APPLICATION_REGION = 16;
static const int MAX_CPB_CNT = 32; ///< Upper bound of (cpb_cnt_minus1 + 1)
......
......@@ -60,6 +60,8 @@
#define RPR_CONF_WINDOW 1
#endif
#define JVET_O0625_ALF_PADDING 1 // JVET-O0625/O0654/O0662: Unified padding method in ALF
#define JVET_O0238_PPS_OR_SLICE 1 // JVET-O0238: Signal certain parameters either in PPS or per slice
#define SUPPORT_FOR_RECT_SLICES_WITH_VARYING_NUMBER_OF_TILES 1
......
......@@ -170,6 +170,18 @@ bool CU::isSameTile(const CodingUnit& cu, const CodingUnit& cu2)
return cu.tileIdx == cu2.tileIdx;
}
#if JVET_O0625_ALF_PADDING
bool CU::isSameBrick( const CodingUnit& cu, const CodingUnit& cu2 )
{
const Picture& pcPic = *( cu.cs->picture );
const BrickMap& tileMap = *( pcPic.brickMap );
const uint32_t brickIdx = tileMap.getBrickIdxRsMap( cu.lumaPos() );
const uint32_t brickIdx2 = tileMap.getBrickIdxRsMap( cu2.lumaPos() );
return brickIdx == brickIdx2;
}
#endif
bool CU::isSameSliceAndTile(const CodingUnit& cu, const CodingUnit& cu2)
{
return ( cu.slice->getIndependentSliceIdx() == cu2.slice->getIndependentSliceIdx() ) && ( cu.tileIdx == cu2.tileIdx );
......
......@@ -71,7 +71,9 @@ namespace CU
bool isSameSliceAndTile (const CodingUnit &cu, const CodingUnit &cu2);
bool isLastSubCUOfCtu (const CodingUnit &cu);
uint32_t getCtuAddr (const CodingUnit &cu);
#if JVET_O0625_ALF_PADDING
bool isSameBrick ( const CodingUnit& cu, const CodingUnit& cu2 );
#endif
int predictQP (const CodingUnit& cu, const int prevQP );
uint32_t getNumPUs (const CodingUnit& cu);
......
......@@ -315,8 +315,15 @@ private:
void getFrameStat( AlfCovariance* frameCov, AlfCovariance** ctbCov, uint8_t* ctbEnableFlags, const int numClasses );
#endif
void deriveStatsForFiltering( PelUnitBuf& orgYuv, PelUnitBuf& recYuv, CodingStructure& cs );
#if JVET_O0625_ALF_PADDING
void getBlkStats( AlfCovariance* alfCovariace, const AlfFilterShape& shape, AlfClassifier** classifier, Pel* org, const int orgStride, Pel* rec,
const int recStride, const CompArea& areaDst, const CompArea& area, const ChannelType channel, int vbCTUHeight, int vbPos, const int alfBryList[4] );
void calcCovariance( int ELocal[MAX_NUM_ALF_LUMA_COEFF][MaxAlfNumClippingValues], const Pel *rec, const int stride,
const AlfFilterShape& shape, const int transposeIdx, const ChannelType channel, int vbDistance, const int alfBryList[4] );
#else
void getBlkStats(AlfCovariance* alfCovariace, const AlfFilterShape& shape, AlfClassifier** classifier, Pel* org, const int orgStride, Pel* rec, const int recStride, const CompArea& areaDst, const CompArea& area, const ChannelType channel, int vbCTUHeight, int vbPos);
void calcCovariance(int ELocal[MAX_NUM_ALF_LUMA_COEFF][MaxAlfNumClippingValues], const Pel *rec, const int stride, const AlfFilterShape& shape, const int transposeIdx, const ChannelType channel, int vbDistance);
#endif
void mergeClasses(const AlfFilterShape& alfShape, AlfCovariance* cov, AlfCovariance* covMerged, int clipMerged[MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_LUMA_COEFF], const int numClasses, short filterIndices[MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_CLASSES]);
......
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