在VTM5中,最大QP變爲63(HEVC中最大QP爲51),且初始QP傳輸方式也相應改變。當slice segment layer裏slice_qp_delta非零時SliceQpY 初值也要改變。 init_qp_minus26的範圍變爲( − 26 + QpBdOffsetY ) ~ +37。
在VTM5中,當變換塊不是4的冪次時,在處理變換系數的同時修改QP或QP levelScale table而不是乘以√2(181/256或181/128)以補償變換過程中的隱式縮放。
QP%6 | 0 | 1 | 2 | 3 | 4 | 3 | |
---|---|---|---|---|---|---|---|
Qscale | Normal blocks | 26214 | 23302 | 20560 | 18396 | 16384 | 14564 |
invQScale | 40 | 45 | 51 | 57 | 64 | 72 | |
Qscale | Compensating blocks | 18396 | 16384 | 14564 | 13107 | 11651 | 10280 |
invQScale | 57 | 64 | 72 | 80 | 90 | 102 |
const int g_quantScales[2][SCALING_LIST_REM_NUM] = // can be represented as a 9 element table
{
{ 26214,23302,20560,18396,16384,14564 }, //!<量化縮放MF
{ 18396,16384,14564,13107,11651,10280 } // Note: last 3 values of second row == half of the first 3 values of the first row
};
const int g_invQuantScales[2][SCALING_LIST_REM_NUM] = // can be represented as a 9 element table
{
{ 40,45,51,57,64,72 }, //!<反量化縮放MF
{ 57,64,72,80,90,102 } // Note: last 3 values of second row == double of the first 3 values of the first row
};
// for blocks that where width*height != 4^N, the effective scaling applied during transformation cannot be
// compensated by a bit-shift (the quantised result will be sqrt(2) * larger than required).
// The quantScale table and shift is used to compensate for this.
const bool needSqrtAdjustment= TU::needsBlockSizeTrafoScale( tu, compID );
const int defaultQuantisationCoefficient = g_quantScales[needSqrtAdjustment?1:0][cQP.rem];
int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange) + ( needSqrtAdjustment?-1:0);
此外,和HEVC中標量量化一樣VVC提出了一個新概念依賴標量量化(Dependent scalar quantization)。依賴標量量化是指變換系數的一組可容許的重構值依賴於重建順序在當前變換系數級(transform coefficient level)之前的變換系數級的值。該方法的主要影響是相比於HEVC中非依賴標量量化,它的可允許的重建向量在N維向量空間(N表示變換塊中變換系數的數量)中密度更大。這意味着,對於給定的每n維單位體積內可允許的重構向量的平均數目,輸入向量與最近的重構向量之間的平均失真減少了。
依賴標量量化實現過程爲:(a)定義兩個不同重建水平的標量量化器;(b)定義兩個標量量化器間的轉換方式。
兩個標量量化器分別表示爲Q0和Q1,如上圖所示。重建水平的位置由量化步長delta唯一確定。標量量化器(Q0或Q1)不在碼流中顯示傳輸。使用的量化器由編碼/重建順序在當前變換系數之前的變化係數層級的奇偶性決定。
如上圖所示,兩個標量量化器(Q0和Q1)間的轉換由一個有4個狀態的狀態機實現。狀態可以取4個不同的值:0,1,2,3。它由編碼/重建順序在當前變換系數之前的變化係數層級的奇偶性唯一決定。在變換塊反量化的初始階段狀態設置爲0。變換系數按掃描順序(例如和熵解碼順序相同)重建。噹噹前變換系數重建後,它的狀態按上圖更新,k表示變換系數層級值。
VVC也支持傳輸默認的或用戶定義的縮放矩陣。默認模式的縮放矩陣都是平的對所有尺寸的TB都等於16。目前IBC和幀內編碼模式使用相同的縮放矩陣。對於用戶定義的矩陣,MatrixType 和MatrixType_DC的數量按下面步驟更新:
-
MatrixType :30 = 2 (2 for intra&IBC/inter) x 3 (Y/Cb/Cr components) x 5(square TB size: from 4×4 to 64×64 for luma, from 2×2 to 32×32 for chroma)
-
MatrixType_DC : 14 = 2(2 for intra&IBC/inter × 1 for Y component) x 3 (TB size: 16×16, 32×32, 64×64) + 4(2 for intra&IBC/inter × 2 for Cb/Cr components) x 2(TB size: 16×16, 32×32)
默認縮放矩陣定義了4x4和8x8兩種形式,16x16、32x32、64x64矩陣都是由8x8上採樣得到。
//!<4x4
const int g_quantTSDefault4x4[4 * 4] =
{
16,16,16,16,
16,16,16,16,
16,16,16,16,
16,16,16,16
};
//!<幀內8x8
const int g_quantIntraDefault8x8[8 * 8] =
{
16,16,16,16,17,18,21,24,
16,16,16,16,17,19,22,25,
16,16,17,18,20,22,25,29,
16,16,18,21,24,27,31,36,
17,17,20,24,30,35,41,47,
18,19,22,27,35,44,54,65,
21,22,25,31,41,54,70,88,
24,25,29,36,47,65,88,115
};
//!<幀間8x8
const int g_quantInterDefault8x8[8 * 8] =
{
16,16,16,16,17,18,20,24,
16,16,16,17,18,20,24,25,
16,16,17,18,20,24,25,28,
16,17,18,20,24,25,28,33,
17,18,20,24,25,28,33,41,
18,20,24,25,28,33,41,54,
20,24,25,28,33,41,54,71,
24,25,28,33,41,54,71,91
};
當變換使用了高頻置零操作時,縮放矩陣也要高頻置零。
參考
JVET-N0246
JVET-N0847
感興趣的請關注微信公衆號Video Coding