H264解码的学习笔记

解码图片由三部分组成: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)

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

kgduu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值