解码图片由三部分组成:1个luma采样数组,2个chroma采样数组
Chroma Format | ChromaFormatFactor |
monochrome | 1 |
4:2:0 | 1.5 |
4:2:2 | 2 |
4:4:4 | 3 |
在monochrome采样情况下,只有一个采样数组,luma数组
在4:2:0采样情况下,chroma数组的宽和高是luma数组的一半
在4:2:2采样情况下,chroma数组的高与luma一样,宽是luma的一半
在4:4:4情况下,chroma数组的宽和高与luma一样
InverseRasterScan(a, b, c, d, e) = (a % (d / b)) * b ; e = 0
(a / (d / b)) * c ; e = 1
逆宏块的扫描过程
返回的是luma采样的左上角相对于picture采样左上角的位置
如果MbaffFrameFlag = 0
x = InverseRasterScan(mbAddr, 16, 16,PicWidthInSamples, 0)
y = InverseRasterScan(mbAddr, 16, 16,PicWidthInSamples, 1)
如果MbaffFrameFlag= 1
x0 = InverseRasterScan(mbAddr / 2, 16,32, PicWidthInSamples, 0)
y0 = InverseRasterScan(mbAddr / 2, 16,32, PicWidthSamples, 1)
如果当前的宏块是帆宏块:
x = x0
y = y0 + (mbAddr % 2) * 16
否则:
x = x0 y = y0 + (mbAddr % 2)
逆宏块分区扫描过程
输入是宏块要分区mbPartIdx的索引,输出是luma左上角采样相对于宏块左上角采样的位置
x = InverseRasterScan(mbPartIdx, MbPartWidth(mb_type),MbPartHeight(mb_type), 16, 0)
y = InverseRasterScan(mbPartIdx,MbPartWidth(mb_type), MbPartHeight(mb_type), 16, 1)
逆子宏块分区扫描过程
输入为宏块分区mbPartIdx的索引和子宏块分区subMaPartIdx索引
输出为左上角luma采样相对子宏块左上角采样的位置
如果mb_type等于P_8x8, P_8x8ref0, B_8x8:
x = InverseRasterScan(subMbPartIdx,SubMbPartWidth(sub_mb_type[mbPartIdx]),
SubMbPartHeight(sub_mb_type[mbPartIdx]), 8,0)
y = InverseRasterScan(subMbPartIdx,SubMbPartWidth(sub_mb_type[mbPartIdx]),
SubMbPartHeight(sub_mb_type[mbPartIdx]), 8,1)
否则:
x = InverseRasterScan(subMbPartIdx, 4,4, 8, 0)
y = InverseRasterScan(subMbPartIdx, 4,4, 8, 1)
逆4x4luma块扫描过程
输入为4x4luma块luma4x4BlkIdx的索引
输出为相对位置
x = InverseRasterScan(luma4x4BlkIdx / 4, 8, 8, 19, 0) +InverseRasterScan(luma4x4BlkIdx % 4, 4, 4, 8, 0)
y = InverseRasterScan(luma4x4BlkIdx /4, 8, 8, 16, 1) + InverseRasterScan(luma4x4BlkIdx % 4, 4, 4, 8, 1)
宏块可用的推断过程
输入为宏块地址mbAddr
输出为宏块地址的可用性
不可用情况有三种:
1、 mbAddr< 0
2、 mbAddr> CurrMbAddr
3、 mbAddr宏块属于另外一个片slice,与当前片slice不一样
相邻宏块地址及可用性的推导
当MbaffFrameFlag等于零时,该过程才会触发
输出为mbAddrA(左边), mbAddrB(上方), mbAddrC(右上), mbAddrD(左上)
mbAddrA =CurrMbAddr – 1
mbAddrB =CurrMbAddr – PicWidthInMbs
mbAddrC =CurrMbAddr – PicWidthInMbs + 1
mbAddrD =CurrMbAddr – PicWidthInMbs - 1
MBAFF帧下宏块地址及可用性的推导
当MbaffFrameFlag等于1,该过程会触发
输出为mbAddrA(左),mbAddrB(上),mbAddrC(右上),mbAddrD(左上)
mbAddrA= 2 * (CurrMbAddr / 2 – 1)
mbAddrB= 2 * (CurrMbAddr / 2 – PicWidthInMbs)
mbAddrC= 2 * (CurrMbAddr / 2 – PicWidthInMbs + 1)
mbAddrD= 2 * (CurrMbAddr / 2 – PicWidthInMbs – 1)