今天闲来无聊,根据2011年5月的《T-REC-H.264-201106-S!!PDF-E》文档,写了个h264视频的sps和pps解析。
下载地址在http://download.csdn.net/detail/gyley2/5008185。有需要的朋友可以去download。希望能帮助需要的朋友。
顺带说一下哥伦布编码:
用来表示非负整数的k阶指数哥伦布码可用如下步骤生成:
k=0阶指数哥伦布码如下所示:
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
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)
2. se(v)