int HevcSpsUnit::scaling_list_data()
{
    for (int sizeId = 0; sizeId < 4; sizeId++)
    {
        for (int matrixId = 0; matrixId < 6; matrixId += (sizeId == 3) ? 3 : 1)
        {
            bool flag = m_reader.getBit();
            if (!flag)
            {
                unsigned scaling_list_pred_matrix_id_delta = extractUEGolombCode();
                if (scaling_list_pred_matrix_id_delta > 5)
                    return 1;
            }
            else
            {
                int nextCoef = 8;
                int coefNum = FFMIN(64, (1 << (4 + (sizeId << 1))));
                if (sizeId > 1)
                {
                    int scaling_list_dc_coef_minus8 = extractSEGolombCode();
                    nextCoef = scaling_list_dc_coef_minus8 + 8;
                    if (nextCoef < 1 || nextCoef > 255)
                        return 1;
                }
                for (int i = 0; i < coefNum; i++)
                {
                    int scaling_list_delta_coef = extractSEGolombCode();
                    if (scaling_list_delta_coef < -128 || scaling_list_delta_coef > 127)
                        return 1;
                    nextCoef = (nextCoef + scaling_list_delta_coef + 256) % 256;
                    // ScalingList[ sizeId ][ matrixId ][ i ] = nextCoef;
                }
            }
        }
    }
    return 0;
}
int HevcSpsUnit::scaling_list_data()
{
    for (int sizeId = 0; sizeId < 4; sizeId++)
    {
        for (int matrixId = 0; matrixId < 6; matrixId += (sizeId == 3) ? 3 : 1)
        {
            bool flag = m_reader.getBit();
            if (!flag)
            {
                unsigned scaling_list_pred_matrix_id_delta = extractUEGolombCode();
                if (scaling_list_pred_matrix_id_delta > 5)
                    return 1;
            }
            else
            {
                int nextCoef = 8;
                int coefNum = FFMIN(64, (1 << (4 + (sizeId << 1))));
                if (sizeId > 1)
                {
                    int scaling_list_dc_coef_minus8 = extractSEGolombCode();
                    nextCoef = scaling_list_dc_coef_minus8 + 8;
                    if (nextCoef < 1 || nextCoef > 255)
                        return 1;
                }
                for (int i = 0; i < coefNum; i++)
                {
                    int scaling_list_delta_coef = extractSEGolombCode();
                    if (scaling_list_delta_coef < -128 || scaling_list_delta_coef > 127)
                        return 1;
                    nextCoef = (nextCoef + scaling_list_delta_coef + 256) % 256;
                     
                }
            }
        }
    }
    return 0;
}