浅谈RBSP trailing bits syntax

H.264码流的RBSP级别,是由SODB和RBSP trailing bits构成的,由于编码后的数据要精确到位(bit)组装起来,而码流又是以字节为单位的,这样就需要补齐到字节。

参考ISO IEC 14496-10文档

7.3.2.11 RBSP trailing bits syntax

rbsp_trailing_bits( ) {
    rbsp_stop_one_bit /* equal to 1 */
    while( !byte_aligned( ) )
        rbsp_alignment_zero_bit /* equal to 0 */
}

原来文档中的解释:

An RBSP is specified as an ordered sequence of bytes as follows.
The RBSP contains an SODB as follows:
– If the SODB is empty (i.e., zero bits in length), the RBSP is also empty.
– Otherwise, the RBSP contains the SODB as follows:
1) The first byte of the RBSP contains the (most significant, left-most) eight bits of the SODB; the next byte of
the RBSP contains the next eight bits of the SODB, etc., until fewer than eight bits of the SODB remain.
2) rbsp_trailing_bits( ) are present after the SODB as follows:
i) The first (most significant, left-most) bits of the final RBSP byte contains the remaining bits of the SODB
(if any).
ii) The next bit consists of a single rbsp_stop_one_bit equal to 1.

iii) When the rbsp_stop_one_bit is not the last bit of a byte-aligned byte, one or more
rbsp_alignment_zero_bit is present to result in byte alignment.
3) One or more cabac_zero_word 16-bit syntax elements equal to 0x0000 may be present in some RBSPs after the
rbsp_trailing_bits( ) at the end of the RBSP.

主要的意思我的理解如下:

如果SODB恰好占到8的倍数个bits,这时候还是需要RBSP trailing bits,即二进制的‘10000000’

如果SODB按8位字节占据,多余7个bits,这时候的RBSP trailing bits,即二进制的‘1’,后面不用再添0了

普通的情况是后面补齐二进制1和(1-6个)0

还有一种情况是,有的RBSP最后还会出现1个或多个cabac_zero_word,即16位的0





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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值