Commit 11ca3b25 authored by Frank Bossen's avatar Frank Bossen
Browse files

Merge branch 'fix-scaling-matrix' into 'master'

Fix scaling list after JVET-O0119 integration

See merge request jvet/VVCSoftware_VTM!814
parents 39a17a6b cef5e2ce
......@@ -350,7 +350,8 @@ static const int IQUANT_SHIFT = 6;
static constexpr int SCALE_BITS = 15; // Precision for fractional bit estimates
static constexpr double FRAC_BITS_SCALE = 1.0 / (1 << SCALE_BITS);
static const int SCALING_LIST_NUM = MAX_NUM_COMPONENT * (NUMBER_OF_PREDICTION_MODES - 1); ///< list number for quantization matrix
static const int SCALING_LIST_PRED_MODES = NUMBER_OF_PREDICTION_MODES - 2;
static const int SCALING_LIST_NUM = MAX_NUM_COMPONENT * SCALING_LIST_PRED_MODES; ///< list number for quantization matrix
static const int SCALING_LIST_START_VALUE = 8; ///< start value for dpcm mode
static const int MAX_MATRIX_COEF_NUM = 64; ///< max coefficient number for quantization matrix
......
......@@ -2682,7 +2682,7 @@ void HLSyntaxReader::parseScalingList(ScalingList* scalingList)
{
for(listId = 0; listId < SCALING_LIST_NUM; listId++)
{
if (!(((sizeId == SCALING_LIST_2x2) && (listId % (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1)) == 0)) || ((sizeId > SCALING_LIST_32x32) && (listId % (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1)) != 0))))//2x2 luma
if (!(((sizeId == SCALING_LIST_2x2) && (listId % (SCALING_LIST_NUM / SCALING_LIST_PRED_MODES) == 0)) || ((sizeId > SCALING_LIST_32x32) && (listId % (SCALING_LIST_NUM / SCALING_LIST_PRED_MODES) != 0))))//2x2 luma
{
READ_FLAG( code, "scaling_list_pred_mode_flag");
scalingListPredModeFlag = (code) ? true : false;
......@@ -2693,7 +2693,7 @@ void HLSyntaxReader::parseScalingList(ScalingList* scalingList)
if (sizeId == SCALING_LIST_64x64)
{
code *= (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1)); // Adjust the decoded code for this size, to cope with the missing 32x32 chroma entries.
code *= (SCALING_LIST_NUM / SCALING_LIST_PRED_MODES); // Adjust the decoded code for this size, to cope with the missing 32x32 chroma entries.
}
scalingList->setRefMatrixId (sizeId,listId,(uint32_t)((int)(listId)-(code)));
......
......@@ -1863,11 +1863,11 @@ void HLSWriter::codeScalingList( const ScalingList &scalingList )
//for each size
for(uint32_t sizeId = SCALING_LIST_FIRST_CODED; sizeId <= SCALING_LIST_LAST_CODED; sizeId++)
{
const int predListStep = (sizeId > SCALING_LIST_32x32 ? (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1)) : 1); // if 64x64, skip over chroma entries.
const int predListStep = (sizeId > SCALING_LIST_32x32 ? (SCALING_LIST_NUM / SCALING_LIST_PRED_MODES) : 1); // if 64x64, skip over chroma entries.
for(uint32_t listId = 0; listId < SCALING_LIST_NUM; listId+=predListStep)
{
if ((sizeId == SCALING_LIST_2x2) && ((listId % (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1)) == 0)))
if ((sizeId == SCALING_LIST_2x2) && ((listId % (SCALING_LIST_NUM / SCALING_LIST_PRED_MODES) == 0)))
{
continue;
}
......@@ -1878,7 +1878,7 @@ void HLSWriter::codeScalingList( const ScalingList &scalingList )
if (sizeId > SCALING_LIST_32x32) //64x64 luma
{
// adjust the code, to cope with the missing chroma entries
WRITE_UVLC( ((int)listId - (int)scalingList.getRefMatrixId(sizeId, listId)) / (SCALING_LIST_NUM / (NUMBER_OF_PREDICTION_MODES - 1)), "scaling_list_pred_matrix_id_delta");
WRITE_UVLC( ((int)listId - (int)scalingList.getRefMatrixId(sizeId, listId)) / (SCALING_LIST_NUM / SCALING_LIST_PRED_MODES), "scaling_list_pred_matrix_id_delta");
}
else
{
......
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