Index: Lib/CommonLib/UnitTools.cpp
===================================================================
--- Lib/CommonLib/UnitTools.cpp	(vtm 3.0)
+++ Lib/CommonLib/UnitTools.cpp	(modified quantization)
@@ -5547,6 +5547,14 @@
   return count;
 }
 
+#if MODIFIED_QUANTSCALES
+int TU::getQpModAdjustment(const TransformUnit &tu, const ComponentID &compID)
+{
+  assert(!isNonLog2BlockSize( tu.blocks[compID] ));
+  return (!tu.transformSkip[compID] && ( ( ( g_aucLog2[tu.blocks[compID].width] + g_aucLog2[tu.blocks[compID].height] ) & 1 ) == 1 )) ? 0 : 3;
+}
+#else
+
 bool TU::needsSqrt2Scale( const Size& size )
 {
   return (((g_aucLog2[size.width] + g_aucLog2[size.height]) & 1) == 1);
@@ -5568,7 +5576,7 @@
   return false;
 }
 #endif
-
+#endif
 
 
 
Index: Lib/CommonLib/UnitTools.h
===================================================================
--- Lib/CommonLib/UnitTools.h	(vtm 3.0)
+++ Lib/CommonLib/UnitTools.h	(modified quantization)
@@ -216,12 +216,17 @@
 #endif
   bool hasCrossCompPredInfo           (const TransformUnit &tu, const ComponentID &compID);
 
+#if MODIFIED_QUANTSCALES
+  int getQpModAdjustment(const TransformUnit &tu, const ComponentID &compID);
+#else
   bool needsSqrt2Scale                ( const Size& size );
 #if HM_QTBT_AS_IN_JEM_QUANT
   bool needsBlockSizeTrafoScale       ( const Size& size );
 #else
   bool needsQP3Offset                 (const TransformUnit &tu, const ComponentID &compID);
 #endif
+#endif
+
 }
 
 uint32_t getCtuAddr        (const Position& pos, const PreCalcValues &pcv);
@@ -373,4 +378,4 @@
 #endif
 
 
-#endif
\ No newline at end of file
+#endif
Index: Lib/CommonLib/QuantRDOQ.cpp
===================================================================
--- Lib/CommonLib/QuantRDOQ.cpp	(vtm 3.0)
+++ Lib/CommonLib/QuantRDOQ.cpp	(modified quantization)
@@ -430,15 +430,26 @@
 #endif
 #else
 
+#if MODIFIED_QUANTSCALES
+double QuantRDOQ::xGetErrScaleCoeff( const int qpModAdjustment, SizeType width, SizeType height, int qp, const int maxLog2TrDynamicRange, const int channelBitDepth )
+#else
 double QuantRDOQ::xGetErrScaleCoeff( SizeType width, SizeType height, int qp, const int maxLog2TrDynamicRange, const int channelBitDepth )
+#endif
 {
   const int iTransformShift = getTransformShift(channelBitDepth, Size(width, height), maxLog2TrDynamicRange);
 #if HM_QTBT_AS_IN_JEM_QUANT
   double    dErrScale       = (double)( 1 << SCALE_BITS );                                // Compensate for scaling of bitcount in Lagrange cost function
+#if MODIFIED_QUANTSCALES
+  bool      needsSrqt2      = qpModAdjustment!=3;
+  double    dTransShift     = (double)iTransformShift + ( needsSrqt2 ? -0.5 : 0.0 );
+  dErrScale                 = dErrScale*pow( 2.0, ( -2.0*dTransShift ) );                     // Compensate for scaling through forward transform
+  int       QStep           = g_quantScales_mod[qp+qpModAdjustment];
+#else
   bool      needsSrqt2      = TU::needsBlockSizeTrafoScale( Size(width, height) );// ( ( (sizeX+sizeY) & 1 ) !=0 );
   double    dTransShift     = (double)iTransformShift + ( needsSrqt2 ? -0.5 : 0.0 );
   dErrScale                 = dErrScale*pow( 2.0, ( -2.0*dTransShift ) );                     // Compensate for scaling through forward transform
   int       QStep           = ( needsSrqt2 ? ( ( g_quantScales[qp] * 181 ) >> 7 ) : g_quantScales[qp] );
+#endif
   double    finalErrScale = dErrScale / QStep / QStep / (1 << (DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth) << 1));
 #else
   int errShift = SCALE_BITS - ((iTransformShift + DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth)) << 1);
@@ -705,8 +716,14 @@
 #endif
 #else //HEVC_USE_SCALING_LISTS
 #if HM_QTBT_AS_IN_JEM_QUANT
+#if MODIFIED_QUANTSCALES
+  const int    qpModAdjustment         = TU::getQpModAdjustment(tu, compID);
+  const int    quantisationCoefficient = g_quantScales_mod[cQP.rem + qpModAdjustment];
+  const double errorScale              = xGetErrScaleCoeff( qpModAdjustment, uiWidth, uiHeight, cQP.rem, maxLog2TrDynamicRange, channelBitDepth );
+#else
   const int    quantisationCoefficient = ( TU::needsSqrt2Scale( rect ) ? ( g_quantScales[cQP.rem] * 181 ) >> 7 : g_quantScales[cQP.rem] );
   const double errorScale              = xGetErrScaleCoeff( uiWidth, uiHeight, cQP.rem, maxLog2TrDynamicRange, channelBitDepth );
+#endif
 #else
   const double blkErrScale             = ( TU::needsQP3Offset( tu, compID ) ? 2.0 : 1.0 );
   const int    quantisationCoefficient = g_quantScales[cQP.rem];
@@ -1139,7 +1156,11 @@
 #if HEVC_USE_SIGN_HIDING
   if( cctx.signHiding() && uiAbsSum>=2)
   {
+#if MODIFIED_QUANTSCALES
+    const double inverseQuantScale = double(g_invQuantScales_mod[cQP.rem+3]);
+#else
     const double inverseQuantScale = double(g_invQuantScales[cQP.rem]);
+#endif
     int64_t rdFactor = (int64_t)(inverseQuantScale * inverseQuantScale * (1 << (2 * cQP.per)) / m_dLambda / 16
                                / (1 << (2 * DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth)))
 #if HM_QTBT_AS_IN_JEM_QUANT
Index: Lib/CommonLib/DepQuant.cpp
===================================================================
--- Lib/CommonLib/DepQuant.cpp	(vtm 3.0)
+++ Lib/CommonLib/DepQuant.cpp	(modified quantization)
@@ -1175,8 +1175,13 @@
     m_QShift                    = QUANT_SHIFT  - 1 + qpPer + transformShift;
     m_QAdd                      = -( ( 3 << m_QShift ) >> 1 );
 #if HM_QTBT_AS_IN_JEM_QUANT
+#if MODIFIED_QUANTSCALES
+    Intermediate_Int  invShift  = IQUANT_SHIFT + 1 - qpPer - transformShift;
+    m_QScale                    = g_quantScales_mod[ qpRem + TU::getQpModAdjustment( tu, compID) ];
+#else
     Intermediate_Int  invShift  = IQUANT_SHIFT + 1 - qpPer - transformShift + ( TU::needsBlockSizeTrafoScale( area ) ? ADJ_DEQUANT_SHIFT : 0 );
     m_QScale                    = ( TU::needsSqrt2Scale( area ) ? ( g_quantScales[ qpRem ] * 181 ) >> 7 : g_quantScales[ qpRem ] );
+#endif
 #else
     Intermediate_Int  invShift  = IQUANT_SHIFT + 1 - qpPer - transformShift;
     m_QScale                    = g_quantScales   [ qpRem ];
@@ -1187,7 +1192,11 @@
     m_thresSSbb                 = TCoeff( ( int64_t(3) << m_QShift ) / ( 4 * m_QScale ) );
 
     // distortion calculation parameters
+#if MODIFIED_QUANTSCALES
+    const int64_t qScale        = g_quantScales_mod[ qpRem + 3 ]; // don't include factor of sqrt(2), as that's not part of the quantiser itself.
+#else
     const int64_t qScale        = g_quantScales[ qpRem ];
+#endif
 #if HM_QTBT_AS_IN_JEM_QUANT
     const int nomDShift =
       SCALE_BITS - 2 * (nomTransformShift + DISTORTION_PRECISION_ADJUSTMENT(channelBitDepth)) + m_QShift;
@@ -1255,8 +1264,14 @@
     const bool        clipTransformShift    = ( tu.transformSkip[ compID ] && sps.getSpsRangeExtension().getExtendedPrecisionProcessingFlag() );
     const int         transformShift        = ( clipTransformShift ? std::max<int>( 0, nomTransformShift ) : nomTransformShift );
 #if HM_QTBT_AS_IN_JEM_QUANT
+#if MODIFIED_QUANTSCALES
+    Intermediate_Int  shift                 = IQUANT_SHIFT + 1 - qpPer - transformShift;
+    Intermediate_Int  invQScale             = g_invQuantScales_mod[ qpRem + TU::getQpModAdjustment( tu, compID)];
+    assert(!isNonLog2BlockSize( area ));
+#else
     Intermediate_Int  shift                 = IQUANT_SHIFT + 1 - qpPer - transformShift + ( TU::needsBlockSizeTrafoScale( area ) ? ADJ_DEQUANT_SHIFT : 0 );
     Intermediate_Int  invQScale             = g_invQuantScales[ qpRem ] * ( TU::needsSqrt2Scale( area ) ? 181 : 1 );
+#endif
 #else
     Intermediate_Int  shift                 = IQUANT_SHIFT + 1 - qpPer - transformShift;
     Intermediate_Int  invQScale             = g_invQuantScales[ qpRem ];
Index: Lib/CommonLib/QuantRDOQ.h
===================================================================
--- Lib/CommonLib/QuantRDOQ.h	(vtm 3.0)
+++ Lib/CommonLib/QuantRDOQ.h	(modified quantization)
@@ -76,8 +76,12 @@
   void    xDestroyScalingList            ();
   void    xSetErrScaleCoeff              ( uint32_t list, uint32_t sizeX, uint32_t sizeY, int qp, const int maxLog2TrDynamicRange[MAX_NUM_CHANNEL_TYPE], const BitDepths &bitDepths );
 #else
+#if MODIFIED_QUANTSCALES
+  double  xGetErrScaleCoeff              ( const int qpModAdjustment, SizeType width, SizeType height, int qp, const int maxLog2TrDynamicRange, const int channelBitDepth);
+#else
   double  xGetErrScaleCoeff              ( SizeType width, SizeType height, int qp, const int maxLog2TrDynamicRange, const int channelBitDepth);
 #endif
+#endif
 
   // RDOQ functions
   void xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf &pSrc, TCoeff &uiAbsSum, const QpParam &cQP, const Ctx &ctx);
Index: Lib/CommonLib/Quant.cpp
===================================================================
--- Lib/CommonLib/Quant.cpp	(vtm 3.0)
+++ Lib/CommonLib/Quant.cpp	(modified quantization)
@@ -305,10 +305,21 @@
   const int  originalTransformShift = getTransformShift(channelBitDepth, area.size(), maxLog2TrDynamicRange);
   const int  iTransformShift        = bClipTransformShiftTo0 ? std::max<int>(0, originalTransformShift) : originalTransformShift;
 
+#if !MODIFIED_QUANTSCALES
   const int QP_per = cQP.per;
   const int QP_rem = cQP.rem;
+#endif
 
 #if HM_QTBT_AS_IN_JEM_QUANT
+#if MODIFIED_QUANTSCALES
+  const int QP_per = cQP.per;
+  const int QP_rem_adj = cQP.rem + TU::getQpModAdjustment( tu, compID);
+#if HEVC_USE_SCALING_LISTS
+  const int  rightShift = (IQUANT_SHIFT - (iTransformShift + QP_per)) + (enableScalingLists ? LOG2_SCALING_LIST_NEUTRAL_VALUE : 0);
+#else
+  const int  rightShift = (IQUANT_SHIFT - (iTransformShift + QP_per));
+#endif
+#else
   const bool needsScalingCorrection = TU::needsBlockSizeTrafoScale( tu.block( compID ) );
   const int  NEScale    = TU::needsSqrt2Scale( tu.blocks[compID] ) ? 181 : 1;
 #if HEVC_USE_SCALING_LISTS
@@ -316,6 +327,7 @@
 #else
   const int  rightShift = (needsScalingCorrection ?   8 : 0 ) + (IQUANT_SHIFT - (iTransformShift + QP_per));
 #endif
+#endif
 #else
 #if HEVC_USE_SCALING_LISTS
   const int  rightShift = (IQUANT_SHIFT - (iTransformShift + QP_per)) + (enableScalingLists ? LOG2_SCALING_LIST_NEUTRAL_VALUE : 0);
@@ -377,7 +389,11 @@
   {
 #endif
 #if HM_QTBT_AS_IN_JEM_QUANT
+#if MODIFIED_QUANTSCALES
+    const int scale     = g_invQuantScales_mod[QP_rem_adj];
+#else
     const int scale     = g_invQuantScales[QP_rem] * NEScale;
+#endif
 #else
     const int scale     = g_invQuantScales[QP_rem];
 #endif
@@ -742,8 +758,11 @@
 
     const bool enableScalingLists             = getUseScalingList(uiWidth, uiHeight, useTransformSkip);
 #endif
+#if MODIFIED_QUANTSCALES
+    const int  defaultQuantisationCoefficient = g_quantScales_mod[cQP.rem+TU::getQpModAdjustment( tu, compID )];
+#else
     const int  defaultQuantisationCoefficient = g_quantScales[cQP.rem];
-
+#endif
     /* for 422 chroma blocks, the effective scaling applied during transformation is not a power of 2, hence it cannot be
      * implemented as a bit-shift (the quantised result will be sqrt(2) * larger than required). Alternatively, adjust the
      * uiLog2TrSize applied in iTransformShift, such that the result is 1/sqrt(2) the required result (i.e. smaller)
@@ -756,7 +775,7 @@
     {
       iTransformShift = std::max<int>(0, iTransformShift);
     }
-
+#if !MODIFIED_QUANTSCALES
     int iWHScale = 1;
 #if HM_QTBT_AS_IN_JEM_QUANT
     if( TU::needsBlockSizeTrafoScale( rect ) )
@@ -765,7 +784,7 @@
       iWHScale = 181;
     }
 #endif
-
+#endif
     const int iQBits = QUANT_SHIFT + cQP.per + iTransformShift;
     // QBits will be OK for any internal bit depth as the reduction in transform shift is balanced by an increase in Qp_per due to QpBDOffset
 
@@ -785,10 +804,17 @@
       const int64_t  tmpLevel = (int64_t)abs(iLevel) * defaultQuantisationCoefficient;
 #endif
 
+#if MODIFIED_QUANTSCALES
+      const TCoeff quantisedMagnitude = TCoeff((tmpLevel + iAdd ) >> iQBits);
+#if HEVC_USE_SIGN_HIDING
+      deltaU[uiBlockPos] = (TCoeff)((tmpLevel - ((int64_t)quantisedMagnitude<<iQBits) )>> qBits8);
+#endif
+#else
       const TCoeff quantisedMagnitude = TCoeff((tmpLevel * iWHScale + iAdd ) >> iQBits);
 #if HEVC_USE_SIGN_HIDING
       deltaU[uiBlockPos] = (TCoeff)((tmpLevel * iWHScale - ((int64_t)quantisedMagnitude<<iQBits) )>> qBits8);
 #endif
+#endif
 
       uiAbsSum += quantisedMagnitude;
       const TCoeff quantisedCoefficient = quantisedMagnitude * iSign;
@@ -833,7 +859,11 @@
 
   const bool enableScalingLists             = getUseScalingList(uiWidth, uiHeight, (useTransformSkip != 0));
 #endif
+#if MODIFIED_QUANTSCALES
+  const int  defaultQuantisationCoefficient = g_quantScales_mod[cQP.rem+ TU::getQpModAdjustment(tu, compID)];
+#else
   const int  defaultQuantisationCoefficient = g_quantScales[cQP.rem];
+#endif
 
   /* for 422 chroma blocks, the effective scaling applied during transformation is not a power of 2, hence it cannot be
     * implemented as a bit-shift (the quantised result will be sqrt(2) * larger than required). Alternatively, adjust the
@@ -849,6 +879,7 @@
     iTransformShift = std::max<int>(0, iTransformShift);
   }
 
+#if !MODIFIED_QUANTSCALES
   int iWHScale = 1;
 #if HM_QTBT_AS_IN_JEM_QUANT
   if( TU::needsBlockSizeTrafoScale( rect ) )
@@ -857,6 +888,7 @@
     iWHScale = 181;
   }
 #endif
+#endif
 
   const int iQBits = QUANT_SHIFT + cQP.per + iTransformShift;
   // QBits will be OK for any internal bit depth as the reduction in transform shift is balanced by an increase in Qp_per due to QpBDOffset
@@ -872,7 +904,11 @@
 #else
     const int64_t  tmpLevel = (int64_t)abs(iLevel) * defaultQuantisationCoefficient;
 #endif
+#if MODIFIED_QUANTSCALES
+    const TCoeff quantisedMagnitude = TCoeff((tmpLevel + iAdd ) >> iQBits);
+#else
     const TCoeff quantisedMagnitude = TCoeff((tmpLevel * iWHScale + iAdd ) >> iQBits);
+#endif
 
     if (quantisedMagnitude != 0)
     {
@@ -898,8 +934,11 @@
   const int            scalingListType                = getScalingListType(tu.cu->predMode, compID);
   const bool           enableScalingLists             = getUseScalingList(uiWidth, uiHeight, true);
 #endif
+#if MODIFIED_QUANTSCALES
+  const int            defaultQuantisationCoefficient = g_quantScales_mod[cQP.rem+ TU::getQpModAdjustment(tu, compID)];
+#else
   const int            defaultQuantisationCoefficient = g_quantScales[cQP.rem];
-
+#endif
 #if HEVC_USE_SCALING_LISTS
   CHECK( scalingListType >= SCALING_LIST_NUM, "Invalid scaling list" );
 
@@ -1017,7 +1056,11 @@
   else
   {
 #endif
+#if MODIFIED_QUANTSCALES
+    const int scale = g_invQuantScales_mod[QP_rem+ TU::getQpModAdjustment(tu, compID)];
+#else
     const int scale = g_invQuantScales[QP_rem];
+#endif
     const int scaleBits = (IQUANT_SHIFT + 1);
 
     const uint32_t             targetInputBitDepth = std::min<uint32_t>((maxLog2TrDynamicRange + 1), (((sizeof(Intermediate_Int) * 8) + rightShift) - scaleBits));
Index: Lib/CommonLib/TrQuant.cpp
===================================================================
--- Lib/CommonLib/TrQuant.cpp	(vtm 3.0)
+++ Lib/CommonLib/TrQuant.cpp	(modified quantization)
@@ -484,6 +484,7 @@
     iTransformShift = std::max<int>( 0, iTransformShift );
   }
 
+#if !MODIFIED_QUANTSCALES
   int iWHScale = 1;
 #if HM_QTBT_AS_IN_JEM_QUANT
   if( TU::needsBlockSizeTrafoScale( area ) )
@@ -492,6 +493,7 @@
     iWHScale = 181;
   }
 #endif
+#endif
 
   const bool rotateResidual = TU::isNonTransformedResidualRotated( tu, compID );
 
@@ -503,7 +505,11 @@
     {
       for( uint32_t x = 0; x < width; x++ )
       {
+#if MODIFIED_QUANTSCALES
+        pResidual.at( x, y ) = Pel( ( ( rotateResidual ? pCoeff.at( pCoeff.width - x - 1, pCoeff.height - y - 1 ) : pCoeff.at( x, y ) ) + offset ) >> iTransformShift );
+#else
         pResidual.at( x, y ) = Pel( ( ( rotateResidual ? pCoeff.at( pCoeff.width - x - 1, pCoeff.height - y - 1 ) : pCoeff.at( x, y ) ) * iWHScale + offset ) >> iTransformShift );
+#endif
       }
     }
   }
@@ -515,7 +521,11 @@
     {
       for( uint32_t x = 0; x < width; x++ )
       {
+#if MODIFIED_QUANTSCALES
+        pResidual.at( x, y ) = Pel( ( rotateResidual ? pCoeff.at( pCoeff.width - x - 1, pCoeff.height - y - 1 ) : pCoeff.at( x, y ) ) << iTransformShift );
+#else
         pResidual.at( x, y ) = Pel( ( rotateResidual ? pCoeff.at( pCoeff.width - x - 1, pCoeff.height - y - 1 ) : pCoeff.at( x, y ) )  * iWHScale << iTransformShift );
+#endif
       }
     }
   }
@@ -786,6 +796,7 @@
     iTransformShift = std::max<int>( 0, iTransformShift );
   }
 
+#if !MODIFIED_QUANTSCALES
   int iWHScale = 1;
 #if HM_QTBT_AS_IN_JEM_QUANT
   if( TU::needsBlockSizeTrafoScale( rect ) )
@@ -794,6 +805,7 @@
     iWHScale = 181;
   }
 #endif
+#endif
 
   const bool rotateResidual = TU::isNonTransformedResidualRotated( tu, compID );
   const uint32_t uiSizeMinus1 = ( width * height ) - 1;
@@ -804,7 +816,11 @@
     {
       for( uint32_t x = 0; x < width; x++, coefficientIndex++ )
       {
+#if MODIFIED_QUANTSCALES
+        psCoeff[rotateResidual ? uiSizeMinus1 - coefficientIndex : coefficientIndex] = ( TCoeff( resi.at( x, y ) ) ) << iTransformShift;
+#else
         psCoeff[rotateResidual ? uiSizeMinus1 - coefficientIndex : coefficientIndex] = ( TCoeff( resi.at( x, y ) ) * iWHScale ) << iTransformShift;
+#endif
       }
     }
   }
@@ -817,7 +833,11 @@
     {
       for( uint32_t x = 0; x < width; x++, coefficientIndex++ )
       {
+#if MODIFIED_QUANTSCALES
+        psCoeff[rotateResidual ? uiSizeMinus1 - coefficientIndex : coefficientIndex] = ( TCoeff( resi.at( x, y ) ) + offset ) >> iTransformShift;
+#else
         psCoeff[rotateResidual ? uiSizeMinus1 - coefficientIndex : coefficientIndex] = ( TCoeff( resi.at( x, y ) ) * iWHScale + offset ) >> iTransformShift;
+#endif
       }
     }
   }
Index: Lib/CommonLib/Rom.h
===================================================================
--- Lib/CommonLib/Rom.h	(vtm 3.0)
+++ Lib/CommonLib/Rom.h	(modified quantization)
@@ -67,8 +67,13 @@
 extern       uint32_t*  g_scanOrder     [SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1];
 extern       uint32_t*  g_scanOrderPosXY[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_SIZE / 2 + 1][MAX_CU_SIZE / 2 + 1][2];
 
+#if MODIFIED_QUANTSCALES
+extern const int g_quantScales_mod   [3+SCALING_LIST_REM_NUM];          // Q(QP%6 + 3),  with [0], [1], [2] representing Q[n+3]/sqrt2
+extern const int g_invQuantScales_mod[3+SCALING_LIST_REM_NUM];          // IQ(QP%6 + 3), with [0], [1], [2] representing IQ[n+3]/sqrt2
+#else
 extern const int g_quantScales   [SCALING_LIST_REM_NUM];          // Q(QP%6)
 extern const int g_invQuantScales[SCALING_LIST_REM_NUM];          // IQ(QP%6)
+#endif
 
 static const int g_numTransformMatrixSizes = 6;
 static const int g_transformMatrixShift[TRANSFORM_NUMBER_OF_DIRECTIONS] = {  6, 6 };
Index: Lib/CommonLib/TypeDef.h
===================================================================
--- Lib/CommonLib/TypeDef.h	(vtm 3.0)
+++ Lib/CommonLib/TypeDef.h	(modified quantization)
@@ -233,6 +233,12 @@
 #define HM_JEM_MERGE_CANDS                                1   // ***
 #endif
 
+#if HM_QTBT_AS_IN_JEM_QUANT
+#define MODIFIED_QUANTSCALES 1
+#else
+#define MODIFIED_QUANTSCALES 0 // MUST BE 0
+#endif
+
 #endif//JEM_COMP
 
 // ====================================================================================================================
Index: Lib/CommonLib/Rom.cpp
===================================================================
--- Lib/CommonLib/Rom.cpp	(vtm 3.0)
+++ Lib/CommonLib/Rom.cpp	(modified quantization)
@@ -606,6 +606,19 @@
 // ====================================================================================================================
 // Data structure related table & variable
 // ====================================================================================================================
+#if MODIFIED_QUANTSCALES
+
+const int g_quantScales_mod[3+SCALING_LIST_REM_NUM] =
+{
+  36158, 32768, 29127, 26214, 23302, 20560, 18396, 16384, 14564
+};
+
+const int g_invQuantScales_mod[3+SCALING_LIST_REM_NUM] =
+{
+  29, 32, 36, 40, 45, 51, 57, 64, 72
+};
+
+#else
 
 const int g_quantScales[SCALING_LIST_REM_NUM] =
 {
@@ -617,6 +630,8 @@
   40,45,51,57,64,72
 };
 
+#endif
+
 //--------------------------------------------------------------------------------------------------
 //structures
 //EMT transform sets
Index: Lib/EncoderLib/EncSlice.cpp
===================================================================
--- Lib/EncoderLib/EncSlice.cpp	(vtm 3.0)
+++ Lib/EncoderLib/EncSlice.cpp	(modified quantization)
@@ -908,7 +908,11 @@
         }
 
 #endif
+#if MODIFIED_QUANTSCALES
+        const uint32_t uRefScale  = g_invQuantScales_mod[(iQPAdapt % 6)+3] << ((iQPAdapt / 6) + iBitDepth - 4);
+#else
         const uint32_t uRefScale  = g_invQuantScales[iQPAdapt % 6] << ((iQPAdapt / 6) + iBitDepth - 4);
+#endif
         const CompArea subArea    = clipArea (CompArea (COMPONENT_Y, pcPic->chromaFormat, Area ((ctuRsAddr % pcv.widthInCtus) * pcv.maxCUWidth, (ctuRsAddr / pcv.widthInCtus) * pcv.maxCUHeight, pcv.maxCUWidth, pcv.maxCUHeight)), pcPic->Y());
         const Pel*     pSrc       = pcPic->getOrigBuf (subArea).buf;
         const SizeType iSrcStride = pcPic->getOrigBuf (subArea).stride;
