返回AV1专栏目录
AV1中的Smooth帧内预测模式通过对左边和上方的参考像素值进行线性插值滤波来生成smooth像素值。
Smooth Intra Prediction
smooth intra prediction 其实一共包含三种模式,分别为
intra_frame_y_mode | Name of intra_frame_y_mode |
---|---|
9 | SMOOTH_PRED |
10 | SMOOTH_V_PRED |
11 | SMOOTH_H_PRED |
这三种模式分别对垂直方向、水平方向、以及综合垂直和水平方向进行滤波。
Smooth Vertical Prediction
垂直预测采用上方一条参考像素以及左边一列的最下面的一个像素来生成预测值。每一个像素会采用最左下角的像素以及上方参考像素对应横坐标的那个像素来进行预测。
相应的示意代码为
代码语言:javascript复制smoothPred = smWeights[i] * AboveRow[j] (256-smWeights[i]) * LeftCol[h-1]
pred[i][j] = Round2(smoothPred, 8)
Smooth Horizontal Prediction
若是水平预测的话,则是采用上方参考像素的最右边那个与左边一列与当前像素纵坐标对应的那个像素一同生成预测像素。
相应的示意代码为
代码语言:javascript复制smoothPred = smWeights[j] * LeftCol[i] (256-smWeights[j]) * AboveRow[w-1]
pred[i][j] = Round2(smoothPred, 8)
Smooth Prediction
smooth prediction即可以看作是上述两种smooth prediction的综合。先分别求出垂直与水平,然后取其平均。
示意代码如下
代码语言:javascript复制smoothPred = smWeights[i] * AboveRow[j] (256-smWeights[i]) * LeftCol[h-1]
smWeights[j] * LeftCol[i] (256-smWeights[j]) * AboveRow[w-1]
pred[i][j] = Round2(smoothPred, 9)
至于smweights是怎么来的,可以参考标准文档 9.3节
代码语言:javascript复制Sm_Weights_Tx_4x4 [ 4 ] = { 255, 149, 85, 64 }
Sm_Weights_Tx_8x8 [ 8 ] = { 255, 197, 146, 105, 73, 50, 37, 32 }
Sm_Weights_Tx_16x16[ 16 ] = { 255, 225, 196, 170, 145, 123, 102, 84, 68, 54, 43, 33, 26, 20, 17, 16 }
Sm_Weights_Tx_32x32[ 32 ] = { 255, 240, 225, 210, 196, 182, 169, 157, 145, 133, 122, 111, 101, 92, 83, 74, 66, 59, 52, 45, 39, 34, 29, 25, 21, 17, 14, 12, 10, 9, 8, 8 }
Sm_Weights_Tx_64x64[ 64 ] = { 255, 248, 240, 233, 225, 218, 210, 203, 196, 189, 182, 176, 169, 163, 156, 150, 144, 138, 133, 127, 121, 116, 111, 106, 101, 96, 91, 86, 82, 77, 73, 69, 65, 61, 57, 54, 50, 47, 44, 41, 38, 35, 32, 29, 27, 25, 22, 20, 18, 16, 15, 13, 12, 10, 9, 8, 7, 6, 6, 5, 5, 4, 4, 4 }