Commit 468efc41 authored by Karsten Suehring's avatar Karsten Suehring

remove macro JVET_L0664_ALF_REMOVE_LUMA_5x5

parent 76775a6a
......@@ -104,22 +104,7 @@ void AdaptiveLoopFilter::ALFProcess( CodingStructure& cs, AlfSliceParam& alfSlic
{
Area blk( xPos, yPos, width, height );
deriveClassification( m_classifier, tmpYuv.get( COMPONENT_Y ), blk );
#if JVET_L0664_ALF_REMOVE_LUMA_5x5
m_filter7x7Blk(m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, m_coeffFinal, m_clpRngs.comp[COMPONENT_Y]);
#else
if( alfSliceParam.lumaFilterType == ALF_FILTER_5 )
{
m_filter5x5Blk( m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, m_coeffFinal, m_clpRngs.comp[COMPONENT_Y] );
}
else if( alfSliceParam.lumaFilterType == ALF_FILTER_7 )
{
m_filter7x7Blk( m_classifier, recYuv, tmpYuv, blk, COMPONENT_Y, m_coeffFinal, m_clpRngs.comp[COMPONENT_Y] );
}
else
{
CHECK( 0, "Wrong ALF filter type" );
}
#endif
}
for( int compIdx = 1; compIdx < MAX_NUM_COMPONENT; compIdx++ )
......@@ -143,11 +128,7 @@ void AdaptiveLoopFilter::ALFProcess( CodingStructure& cs, AlfSliceParam& alfSlic
void AdaptiveLoopFilter::reconstructCoeff( AlfSliceParam& alfSliceParam, ChannelType channel, const bool bRedo )
{
int factor = ( 1 << ( m_NUM_BITS - 1 ) );
#if JVET_L0664_ALF_REMOVE_LUMA_5x5
AlfFilterType filterType = isLuma( channel ) ? ALF_FILTER_7 : ALF_FILTER_5;
#else
AlfFilterType filterType = isLuma( channel ) ? alfSliceParam.lumaFilterType : ALF_FILTER_5;
#endif
int numClasses = isLuma( channel ) ? MAX_NUM_ALF_CLASSES : 1;
int numCoeff = filterType == ALF_FILTER_5 ? 7 : 13;
int numCoeffMinus1 = numCoeff - 1;
......@@ -211,9 +192,6 @@ void AdaptiveLoopFilter::create( const int picWidth, const int picHeight, const
m_numCTUsInWidth = ( m_picWidth / m_maxCUWidth ) + ( ( m_picWidth % m_maxCUWidth ) ? 1 : 0 );
m_numCTUsInHeight = ( m_picHeight / m_maxCUHeight ) + ( ( m_picHeight % m_maxCUHeight ) ? 1 : 0 );
m_numCTUsInPic = m_numCTUsInHeight * m_numCTUsInWidth;
#if !JVET_L0664_ALF_REMOVE_LUMA_5x5
m_filterShapes[CHANNEL_TYPE_LUMA].push_back( AlfFilterShape( 5 ) );
#endif
m_filterShapes[CHANNEL_TYPE_LUMA].push_back( AlfFilterShape( 7 ) );
m_filterShapes[CHANNEL_TYPE_CHROMA].push_back( AlfFilterShape( 5 ) );
......
......@@ -69,7 +69,6 @@
#define JVET_L0090_PAIR_AVG 1 // Add pairwise average candidates, replace HEVC combined candidates
#define JVET_L0664_ALF_REMOVE_LUMA_5x5 1
#define JVET_L0083_ALF_FRAC_BIT 1 // Reduce number of ALF fractional bit to 7
......@@ -1478,9 +1477,6 @@ struct AlfFilterShape
struct AlfSliceParam
{
bool enabledFlag[MAX_NUM_COMPONENT]; // alf_slice_enable_flag, alf_chroma_idc
#if !JVET_L0664_ALF_REMOVE_LUMA_5x5
AlfFilterType lumaFilterType; // filter_type_flag
#endif
short lumaCoeff[MAX_NUM_ALF_CLASSES * MAX_NUM_ALF_LUMA_COEFF]; // alf_coeff_luma_delta[i][j]
short chromaCoeff[MAX_NUM_ALF_CHROMA_COEFF]; // alf_coeff_chroma[i]
short filterCoeffDeltaIdx[MAX_NUM_ALF_CLASSES]; // filter_coeff_delta[i]
......@@ -1493,9 +1489,6 @@ struct AlfSliceParam
void reset()
{
std::memset( enabledFlag, false, sizeof( enabledFlag ) );
#if !JVET_L0664_ALF_REMOVE_LUMA_5x5
lumaFilterType = ALF_FILTER_5;
#endif
std::memset( lumaCoeff, 0, sizeof( lumaCoeff ) );
std::memset( chromaCoeff, 0, sizeof( chromaCoeff ) );
std::memset( filterCoeffDeltaIdx, 0, sizeof( filterCoeffDeltaIdx ) );
......@@ -1508,9 +1501,6 @@ struct AlfSliceParam
const AlfSliceParam& operator = ( const AlfSliceParam& src )
{
std::memcpy( enabledFlag, src.enabledFlag, sizeof( enabledFlag ) );
#if !JVET_L0664_ALF_REMOVE_LUMA_5x5
lumaFilterType = src.lumaFilterType;
#endif
std::memcpy( lumaCoeff, src.lumaCoeff, sizeof( lumaCoeff ) );
std::memcpy( chromaCoeff, src.chromaCoeff, sizeof( chromaCoeff ) );
std::memcpy( filterCoeffDeltaIdx, src.filterCoeffDeltaIdx, sizeof( filterCoeffDeltaIdx ) );
......
......@@ -2516,10 +2516,6 @@ void HLSyntaxReader::alf( AlfSliceParam& alfSliceParam )
xReadTruncBinCode( code, MAX_NUM_ALF_CLASSES ); //number_of_filters_minus1
alfSliceParam.numLumaFilters = code + 1;
#if !JVET_L0664_ALF_REMOVE_LUMA_5x5
READ_FLAG( code, "filter_type_flag" );
alfSliceParam.lumaFilterType = code ? ALF_FILTER_5 : ALF_FILTER_7;
#endif
if( alfSliceParam.numLumaFilters > 1 )
{
for( int i = 0; i < MAX_NUM_ALF_CLASSES; i++ )
......@@ -2614,11 +2610,7 @@ void HLSyntaxReader::alfFilter( AlfSliceParam& alfSliceParam, const bool isChrom
}
// derive maxGolombIdx
#if JVET_L0664_ALF_REMOVE_LUMA_5x5
AlfFilterShape alfShape( isChroma ? 5 : 7 );
#else
AlfFilterShape alfShape( isChroma ? 5 : ( alfSliceParam.lumaFilterType == ALF_FILTER_5 ? 5 : 7 ) );
#endif
const int maxGolombIdx = AdaptiveLoopFilter::getMaxGolombIdx( alfShape.filterType );
READ_UVLC( code, "min_golomb_order" );
......
......@@ -364,12 +364,6 @@ void EncAdaptiveLoopFilter::alfEncoder( CodingStructure& cs, AlfSliceParam& alfS
for( int iShapeIdx = 0; iShapeIdx < alfFilterShape.size(); iShapeIdx++ )
{
m_alfSliceParamTemp = alfSliceParam;
#if !JVET_L0664_ALF_REMOVE_LUMA_5x5
if( isLuma( channel ) )
{
m_alfSliceParamTemp.lumaFilterType = alfFilterShape[iShapeIdx].filterType;
}
#endif
//1. get unfiltered distortion
double cost = getUnfilteredDistortion( m_alfCovarianceFrame[channel][iShapeIdx], channel );
cost /= 1.001; // slight preference for unfiltered choice
......@@ -399,11 +393,7 @@ void EncAdaptiveLoopFilter::alfEncoder( CodingStructure& cs, AlfSliceParam& alfS
//3. CTU decision
double distUnfilter = 0;
#if JVET_L0664_ALF_REMOVE_LUMA_5x5
const int iterNum = isLuma(channel) ? (2 * 4 + 1) : (2 * 2 + 1);
#else
const int iterNum = 2 * 2 + 1;
#endif
for( int iter = 0; iter < iterNum; iter++ )
{
......@@ -446,11 +436,7 @@ void EncAdaptiveLoopFilter::alfEncoder( CodingStructure& cs, AlfSliceParam& alfS
int ctuIdx = 0;
const int chromaScaleX = getComponentScaleX( compID, recBuf.chromaFormat );
const int chromaScaleY = getComponentScaleY( compID, recBuf.chromaFormat );
#if JVET_L0664_ALF_REMOVE_LUMA_5x5
AlfFilterType filterType = isLuma( compID ) ? ALF_FILTER_7 : ALF_FILTER_5;
#else
AlfFilterType filterType = isLuma( compID ) ? alfSliceParam.lumaFilterType : ALF_FILTER_5;
#endif
short* coeff = isLuma( compID ) ? m_coeffFinal : alfSliceParam.chromaCoeff;
for( int yPos = 0; yPos < pcv.lumaHeight; yPos += pcv.maxCUHeight )
......@@ -552,11 +538,7 @@ int EncAdaptiveLoopFilter::getCoeffRate( AlfSliceParam& alfSliceParam, bool isCh
}
memset( m_bitsCoeffScan, 0, sizeof( m_bitsCoeffScan ) );
#if JVET_L0664_ALF_REMOVE_LUMA_5x5
AlfFilterShape alfShape( isChroma ? 5 : 7 );
#else
AlfFilterShape alfShape( isChroma ? 5 : ( alfSliceParam.lumaFilterType == ALF_FILTER_5 ? 5 : 7 ) );
#endif
const int maxGolombIdx = AdaptiveLoopFilter::getMaxGolombIdx( alfShape.filterType );
const short* coeff = isChroma ? alfSliceParam.chromaCoeff : alfSliceParam.lumaCoeff;
const int numFilters = isChroma ? 1 : alfSliceParam.numLumaFilters;
......@@ -746,12 +728,7 @@ double EncAdaptiveLoopFilter::mergeFiltersAndCost( AlfSliceParam& alfSliceParam,
int EncAdaptiveLoopFilter::getNonFilterCoeffRate( AlfSliceParam& alfSliceParam )
{
#if JVET_L0664_ALF_REMOVE_LUMA_5x5
int len = 1 // alf_coefficients_delta_flag
#else
int len = 1 // filter_type
+ 1 // alf_coefficients_delta_flag
#endif
+ lengthTruncatedUnary( 0, 3 ) // chroma_idc = 0, it is signalled when ALF is enabled for luma
+ getTBlength( alfSliceParam.numLumaFilters - 1, MAX_NUM_ALF_CLASSES ); //numLumaFilters
......
......@@ -1766,9 +1766,6 @@ void HLSWriter::alf( const AlfSliceParam& alfSliceParam )
truncatedUnaryEqProb( alfChromaIdc, 3 ); // alf_chroma_idc
xWriteTruncBinCode( alfSliceParam.numLumaFilters - 1, MAX_NUM_ALF_CLASSES ); //number_of_filters_minus1
#if !JVET_L0664_ALF_REMOVE_LUMA_5x5
WRITE_FLAG( alfSliceParam.lumaFilterType == ALF_FILTER_5 ? 1 : 0, "filter_type_flag" );
#endif
if( alfSliceParam.numLumaFilters > 1 )
{
for( int i = 0; i < MAX_NUM_ALF_CLASSES; i++ )
......@@ -1828,11 +1825,7 @@ void HLSWriter::alfFilter( const AlfSliceParam& alfSliceParam, const bool isChro
static int bitsCoeffScan[EncAdaptiveLoopFilter::m_MAX_SCAN_VAL][EncAdaptiveLoopFilter::m_MAX_EXP_GOLOMB];
memset( bitsCoeffScan, 0, sizeof( bitsCoeffScan ) );
#if JVET_L0664_ALF_REMOVE_LUMA_5x5
AlfFilterShape alfShape( isChroma ? 5 : 7 );
#else
AlfFilterShape alfShape( isChroma ? 5 : ( alfSliceParam.lumaFilterType == ALF_FILTER_5 ? 5 : 7 ) );
#endif
const int maxGolombIdx = AdaptiveLoopFilter::getMaxGolombIdx( alfShape.filterType );
const short* coeff = isChroma ? alfSliceParam.chromaCoeff : alfSliceParam.lumaCoeff;
const int numFilters = isChroma ? 1 : alfSliceParam.numLumaFilters;
......
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