Commit 1a4490d6 authored by Frederic Barbier's avatar Frederic Barbier

Align ALF trace with specification

parent 82fe8ea8
......@@ -135,7 +135,7 @@ void AdaptiveLoopFilter::reconstructCoeff( AlfSliceParam& alfSliceParam, Channel
int numFilters = isLuma( channel ) ? alfSliceParam.numLumaFilters : 1;
short* coeff = isLuma( channel ) ? alfSliceParam.lumaCoeff : alfSliceParam.chromaCoeff;
if( alfSliceParam.coeffDeltaPredModeFlag && isLuma( channel ) )
if( alfSliceParam.alfLumaCoeffDeltaPredictionFlag && isLuma( channel ) )
{
for( int i = 1; i < numFilters; i++ )
{
......@@ -167,7 +167,7 @@ void AdaptiveLoopFilter::reconstructCoeff( AlfSliceParam& alfSliceParam, Channel
memcpy( m_coeffFinal + classIdx * MAX_NUM_ALF_LUMA_COEFF, coeff + filterIdx * MAX_NUM_ALF_LUMA_COEFF, sizeof( int16_t ) * numCoeff );
}
if( bRedo && alfSliceParam.coeffDeltaPredModeFlag )
if( bRedo && alfSliceParam.alfLumaCoeffDeltaPredictionFlag )
{
for( int i = numFilters - 1; i > 0; i-- )
{
......
......@@ -1587,10 +1587,10 @@ struct AlfSliceParam
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]
bool filterCoeffFlag[MAX_NUM_ALF_CLASSES]; // filter_coefficient_flag[i]
bool alfLumaCoeffFlag[MAX_NUM_ALF_CLASSES]; // alf_luma_coeff_flag[i]
int numLumaFilters; // number_of_filters_minus1 + 1
bool coeffDeltaFlag; // alf_coefficients_delta_flag
bool coeffDeltaPredModeFlag; // coeff_delta_pred_mode_flag
bool alfLumaCoeffDeltaPredictionFlag; // alf_luma_coeff_delta_prediction_flag
std::vector<AlfFilterShape>* filterShapes;
void reset()
......@@ -1599,10 +1599,10 @@ struct AlfSliceParam
std::memset( lumaCoeff, 0, sizeof( lumaCoeff ) );
std::memset( chromaCoeff, 0, sizeof( chromaCoeff ) );
std::memset( filterCoeffDeltaIdx, 0, sizeof( filterCoeffDeltaIdx ) );
std::memset( filterCoeffFlag, true, sizeof( filterCoeffFlag ) );
std::memset( alfLumaCoeffFlag, true, sizeof( alfLumaCoeffFlag ) );
numLumaFilters = 1;
coeffDeltaFlag = false;
coeffDeltaPredModeFlag = false;
alfLumaCoeffDeltaPredictionFlag = false;
}
const AlfSliceParam& operator = ( const AlfSliceParam& src )
......@@ -1611,10 +1611,10 @@ struct AlfSliceParam
std::memcpy( lumaCoeff, src.lumaCoeff, sizeof( lumaCoeff ) );
std::memcpy( chromaCoeff, src.chromaCoeff, sizeof( chromaCoeff ) );
std::memcpy( filterCoeffDeltaIdx, src.filterCoeffDeltaIdx, sizeof( filterCoeffDeltaIdx ) );
std::memcpy( filterCoeffFlag, src.filterCoeffFlag, sizeof( filterCoeffFlag ) );
std::memcpy( alfLumaCoeffFlag, src.alfLumaCoeffFlag, sizeof( alfLumaCoeffFlag ) );
numLumaFilters = src.numLumaFilters;
coeffDeltaFlag = src.coeffDeltaFlag;
coeffDeltaPredModeFlag = src.coeffDeltaPredModeFlag;
alfLumaCoeffDeltaPredictionFlag = src.alfLumaCoeffDeltaPredictionFlag;
filterShapes = src.filterShapes;
return *this;
}
......
......@@ -2520,21 +2520,21 @@ void HLSyntaxReader::alfFilter( AlfSliceParam& alfSliceParam, const bool isChrom
if( !alfSliceParam.coeffDeltaFlag )
{
std::memset( alfSliceParam.filterCoeffFlag, true, sizeof( alfSliceParam.filterCoeffFlag ) );
std::memset( alfSliceParam.alfLumaCoeffFlag, true, sizeof( alfSliceParam.alfLumaCoeffFlag ) );
if( alfSliceParam.numLumaFilters > 1 )
{
READ_FLAG( code, "coeff_delta_pred_mode_flag" );
alfSliceParam.coeffDeltaPredModeFlag = code;
READ_FLAG( code, "alf_luma_coeff_delta_prediction_flag" );
alfSliceParam.alfLumaCoeffDeltaPredictionFlag = code;
}
else
{
alfSliceParam.coeffDeltaPredModeFlag = 0;
alfSliceParam.alfLumaCoeffDeltaPredictionFlag = 0;
}
}
else
{
alfSliceParam.coeffDeltaPredModeFlag = 0;
alfSliceParam.alfLumaCoeffDeltaPredictionFlag = 0;
}
}
......@@ -2562,8 +2562,8 @@ void HLSyntaxReader::alfFilter( AlfSliceParam& alfSliceParam, const bool isChrom
{
for( int ind = 0; ind < alfSliceParam.numLumaFilters; ++ind )
{
READ_FLAG( code, "filter_coefficient_flag[i]" );
alfSliceParam.filterCoeffFlag[ind] = code;
READ_FLAG( code, "alf_luma_coeff_flag[i]" );
alfSliceParam.alfLumaCoeffFlag[ind] = code;
}
}
}
......@@ -2571,7 +2571,7 @@ void HLSyntaxReader::alfFilter( AlfSliceParam& alfSliceParam, const bool isChrom
// Filter coefficients
for( int ind = 0; ind < numFilters; ++ind )
{
if( !isChroma && !alfSliceParam.filterCoeffFlag[ind] && alfSliceParam.coeffDeltaFlag )
if( !isChroma && !alfSliceParam.alfLumaCoeffFlag[ind] && alfSliceParam.coeffDeltaFlag )
{
memset( coeff + ind * MAX_NUM_ALF_LUMA_COEFF, 0, sizeof( *coeff ) * alfShape.numCoeff );
continue;
......
......@@ -553,7 +553,7 @@ int EncAdaptiveLoopFilter::getCoeffRate( AlfSliceParam& alfSliceParam, bool isCh
// vlc for all
for( int ind = 0; ind < numFilters; ++ind )
{
if( isChroma || !alfSliceParam.coeffDeltaFlag || alfSliceParam.filterCoeffFlag[ind] )
if( isChroma || !alfSliceParam.coeffDeltaFlag || alfSliceParam.alfLumaCoeffFlag[ind] )
{
for( int i = 0; i < alfShape.numCoeff - 1; i++ )
{
......@@ -592,7 +592,7 @@ int EncAdaptiveLoopFilter::getCoeffRate( AlfSliceParam& alfSliceParam, bool isCh
// Filter coefficients
for( int ind = 0; ind < numFilters; ++ind )
{
if( !isChroma && !alfSliceParam.filterCoeffFlag[ind] && alfSliceParam.coeffDeltaFlag )
if( !isChroma && !alfSliceParam.alfLumaCoeffFlag[ind] && alfSliceParam.coeffDeltaFlag )
{
continue;
}
......@@ -694,15 +694,15 @@ double EncAdaptiveLoopFilter::mergeFiltersAndCost( AlfSliceParam& alfSliceParam,
distReturn = dist;
alfSliceParam.coeffDeltaFlag = 0;
uiCoeffBits = coeffBits;
alfSliceParam.coeffDeltaPredModeFlag = bestPredMode;
alfSliceParam.alfLumaCoeffDeltaPredictionFlag = bestPredMode;
}
else
{
distReturn = distForce0;
alfSliceParam.coeffDeltaFlag = 1;
uiCoeffBits = coeffBitsForce0;
memcpy( alfSliceParam.filterCoeffFlag, codedVarBins, sizeof( codedVarBins ) );
alfSliceParam.coeffDeltaPredModeFlag = 0;
memcpy( alfSliceParam.alfLumaCoeffFlag, codedVarBins, sizeof( codedVarBins ) );
alfSliceParam.alfLumaCoeffDeltaPredictionFlag = 0;
for( int varInd = 0; varInd < numFiltersBest; varInd++ )
{
......@@ -717,7 +717,7 @@ double EncAdaptiveLoopFilter::mergeFiltersAndCost( AlfSliceParam& alfSliceParam,
{
for( int i = 0; i < alfShape.numCoeff; i++ )
{
if( alfSliceParam.coeffDeltaPredModeFlag )
if( alfSliceParam.alfLumaCoeffDeltaPredictionFlag )
{
alfSliceParam.lumaCoeff[ind * MAX_NUM_ALF_LUMA_COEFF + i] = m_diffFilterCoeff[ind][i];
}
......
......@@ -1793,7 +1793,7 @@ void HLSWriter::alfFilter( const AlfSliceParam& alfSliceParam, const bool isChro
{
if( alfSliceParam.numLumaFilters > 1 )
{
WRITE_FLAG( alfSliceParam.coeffDeltaPredModeFlag, "coeff_delta_pred_mode_flag" );
WRITE_FLAG( alfSliceParam.alfLumaCoeffDeltaPredictionFlag, "alf_luma_coeff_delta_prediction_flag" );
}
}
}
......@@ -1808,7 +1808,7 @@ void HLSWriter::alfFilter( const AlfSliceParam& alfSliceParam, const bool isChro
// vlc for all
for( int ind = 0; ind < numFilters; ++ind )
{
if( isChroma || !alfSliceParam.coeffDeltaFlag || alfSliceParam.filterCoeffFlag[ind] )
if( isChroma || !alfSliceParam.coeffDeltaFlag || alfSliceParam.alfLumaCoeffFlag[ind] )
{
for( int i = 0; i < alfShape.numCoeff - 1; i++ )
{
......@@ -1842,7 +1842,7 @@ void HLSWriter::alfFilter( const AlfSliceParam& alfSliceParam, const bool isChro
{
for( int ind = 0; ind < numFilters; ++ind )
{
WRITE_FLAG( alfSliceParam.filterCoeffFlag[ind], "filter_coefficient_flag[i]" );
WRITE_FLAG( alfSliceParam.alfLumaCoeffFlag[ind], "alf_luma_coeff_flag[i]" );
}
}
}
......@@ -1850,7 +1850,7 @@ void HLSWriter::alfFilter( const AlfSliceParam& alfSliceParam, const bool isChro
// Filter coefficients
for( int ind = 0; ind < numFilters; ++ind )
{
if( !isChroma && !alfSliceParam.filterCoeffFlag[ind] && alfSliceParam.coeffDeltaFlag )
if( !isChroma && !alfSliceParam.alfLumaCoeffFlag[ind] && alfSliceParam.coeffDeltaFlag )
{
continue;
}
......
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