H264视频的sps和pps解析和哥伦布编码
来源:互联网 发布:网络黄牛是什么意思 编辑:程序博客网 时间:2024/06/06 02:41
</pre><pre name="code" class="html">
</pre></div></div><div class="bct fc05 fc11 nbw-blog ztag" style="line-height:28px; word-wrap:break-word; margin:15px 0px; padding:5px 0px; overflow:hidden; font-family:'Hiragino Sans GB W3','Hiragino Sans GB',Arial,Helvetica,simsun,u5b8bu4f53"><ol style="font-size:14px; font-family:Arial; line-height:22px; margin-top:0.3em; margin-bottom:0px; margin-left:3.2em"><li style="margin-bottom:0.1em"><span style="font-family:SimSun; font-size:12px">将数字以<a target=_blank target="_blank" title="二进制" rel="nofollow" href="http://zh.wikipedia.org/wiki/%E4%BA%8C%E8%BF%9B%E5%88%B6" style="color:rgb(11,0,128); text-decoration:none">二进制</a>形式写出,去掉最低的k个比特位,之后加1</span></li><li style="margin-bottom:0.1em"><span style="font-family:SimSun; font-size:12px">计算留下的<a target=_blank target="_blank" title="比特数(页面不存在)" rel="nofollow" href="http://zh.wikipedia.org/w/index.php?title=%E6%AF%94%E7%89%B9%E6%95%B0&action=edit&redlink=1" style="color:rgb(165,88,88); text-decoration:none">比特数</a>,将此数减一,即是需要增加的前导零个数</span></li><li style="margin-bottom:0.1em"><span style="font-family:SimSun; font-size:12px">将第一步中去掉的最低k个比特位补回比特串尾部</span></li></ol><p style="margin-top:0.4em; margin-bottom:0.5em; padding-top:0px; padding-bottom:0px; font-family:Arial; line-height:22px"><span style="font-family:SimSun"><strong><span style="font-size:18px; color:#000099">一、k=0阶指数哥伦布码如下所示:</span></strong></span></p><p style="margin-top:0.4em; margin-bottom:0.5em; padding-top:0px; padding-bottom:0px; font-family:Arial; line-height:22px"><span style="font-family:SimSun"><strong><span style="font-size:18px; color:#000099"></span></strong></span></p><pre style="white-space:pre-wrap; word-wrap:break-word; font-size:14px; background-color:rgb(255,255,255); padding:1em; border:1px dashed rgb(47,111,171); line-height:1.3em"><span style="font-family:SimSun; font-size:12px"> 0 => 1 => 1 1 => 10 => 010 2 => 11 => 011 3 => 100 => 00100 4 => 101 => 00101 5 => 110 => 00110 6 => 111 => 00111 7 => 1000 => 0001000 8 => 1001 => 0001001</span>
具体过程如下所示
-----------------------------------------------------------------------------------------------------
比特串格式为“前缀1后缀”。
1)1后缀=codeNum+1,如codeNum = 3,则1后缀=4,即为100,后缀为00;
2)前缀与后缀的比特数相同,且前缀的各位比特为0,
下例为对不同codeNum进行的编码结果:
H.264的一个重要特色就是采用UVLC(Universal Variable Length coding, 统一可变长编码)编码,提高了编码效率。
UVLC编码中有一种编码方式就是指数哥伦布编码。程序实现该编码时需要计算编码长度len及其value,下面分别对无符号和有符号两种指数哥伦布编码进行分析。
设编码值为code_val。
static const int i_size0_255[256] =
{
1,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
};
void bs_write( bs_t *s, int bit_len, int value);
1. ue(v)
{
int i_size = 0;
{
bs_write( s, 1, 1);
}
else
{
unsigned int tmp = ++code_val;
{
i_size += 16;
tmp >>= 16;
}
if( tmp >= 0x100 )
{
i_size += 8;
tmp >>= 8;
}
i_size += i_size0_255[tmp];
}
}
2. se(v)
{
ue_v( s, code_val <= 0 ? -code_val * 2 : code_val * 2 - 1);
}
如下示例:
二进制比特数
1001
001 1001
01 1010
010
000 1011
- H264视频的sps和pps解析和哥伦布编码
- 关于h264视频的sps和pps解析和哥伦布编码
- H264 sps pps 解析
- RTP传输H264时的sps和pps的获取
- RTP传输H264时的sps和pps的获取
- RTP传输H264时的sps和pps的获取
- RTP传输H264时的sps和pps的获取
- RTP传输H264时的sps和pps的获取
- H264时的sps和pps的获取
- RTP传输H264时的sps和pps的获取
- RTP传输H264时的sps和pps的获取
- RTP传输H264时的sps和pps的获取
- live555组播H264及sps和pps的问题
- live555 H264及sps和pps
- h264流中提取sps和pps
- H264中提取sps和pps
- 通过sps和pps得到视频的width和height
- DSS中的RTP打包传输h264时获取h264的sps和pps信息
- 【玩转cocos2d-x之二十】从CCObject看cocos2d-x的内存管理机制
- 栈 poj1068 Parencodings
- CentOS 7.0关闭默认防火墙firewalld,使用iptables
- 【玩转cocos2d-x之二十一】多线程和同步01-pthread库
- android类之Pattern
- H264视频的sps和pps解析和哥伦布编码
- hdu 1022 Train Problem I
- 杭电 2026 首字母变大写
- 【玩转cocos2d-x之二十二】多线程和同步02-售票
- System.ComponentModel.DataAnnotations.Schema 冲突
- ADO.NET (二)—— ADO和ADO .NET对比
- Zookeeper在hbase集群的作用
- 【第四篇章-android平台MediaCodec】解决Observer died. Quickly, do something, ... anything...
- 模拟iOS网络环境