TsMux源码 之 备忘与存疑
来源:百度文库 编辑:神马文学网 时间:2024/04/29 23:26:52
=========================================================================
TsMux 中的 h264_decode_slice.h 中定义了函数 h264_decode_slice 。
static void h264_decode_slice(h264_slice_t* p_slice,
uint8_t* p_nal, int n_nal_size, int i_nal_type, const h264_sps_t* p_sps)
{
bs_t s;
bs_init(&s, p_nal, n_nal_size);
bs_read_ue( &s ); // first_mb_in_slice
p_slice->i_slice_type = bs_read_ue( &s ); // slice type
int i_pic_parameter_set_id = bs_read_ue( &s );
p_slice->i_frame_num = bs_read( &s, p_sps->log2_max_frame_num + 4 );
int i_field_pic_flag = 0;
int i_bottom_field_flag = -1;
if( !p_sps->frame_mbs_only_flag)
{
/* field_pic_flag */
i_field_pic_flag = bs_read( &s, 1 );
if( i_field_pic_flag )
i_bottom_field_flag = bs_read( &s, 1 );
}
int i_idr_pic_id;
if( i_nal_type == 5/*NAL_SLICE_IDR*/ )
i_idr_pic_id = bs_read_ue( &s );
int i_delta_pic_order_cnt_bottom = -1;
int i_delta_pic_order_cnt0 = 0;
int i_delta_pic_order_cnt1 = 0;
p_slice->i_pic_order_cnt_lsb = 0;
if( p_sps->poc_type == 0 )
{
p_slice->i_pic_order_cnt_lsb = bs_read( &s, p_sps->log2_max_poc_lsb + 4 );
//if( g_pic_order_present_flag && !i_field_pic_flag )
// i_delta_pic_order_cnt_bottom = bs_read_se( &s );
}
else if( (p_sps->poc_type == 1) &&
(!p_sps->delta_pic_order_always_zero_flag) )
{
i_delta_pic_order_cnt0 = bs_read_se( &s );
//if( g_pic_order_present_flag && !i_field_pic_flag )
// i_delta_pic_order_cnt1 = bs_read_se( &s );
}
}
--------------------------------------------------------------------------
bs_read_ue 函数 定义在 vlc_bits.h 中,其功能是从s中解码并读出一个语法元素值。---参见《x264源码阅读笔记 2》:http://www.360doc.com/showWeb/0/0/60416576.aspx。
上面函数中,第三行注释 first_mb_in_slice ,并不是指这是从流中读出第一个mb,而是指这次读出的是first_mb_in_slice这个字段。
TsMux 中的 h264_decode_slice.h 中定义了函数 h264_decode_slice 。
static void h264_decode_slice(h264_slice_t* p_slice,
uint8_t* p_nal, int n_nal_size, int i_nal_type, const h264_sps_t* p_sps)
{
bs_t s;
bs_init(&s, p_nal, n_nal_size);
bs_read_ue( &s ); // first_mb_in_slice
p_slice->i_slice_type = bs_read_ue( &s ); // slice type
int i_pic_parameter_set_id = bs_read_ue( &s );
p_slice->i_frame_num = bs_read( &s, p_sps->log2_max_frame_num + 4 );
int i_field_pic_flag = 0;
int i_bottom_field_flag = -1;
if( !p_sps->frame_mbs_only_flag)
{
/* field_pic_flag */
i_field_pic_flag = bs_read( &s, 1 );
if( i_field_pic_flag )
i_bottom_field_flag = bs_read( &s, 1 );
}
int i_idr_pic_id;
if( i_nal_type == 5/*NAL_SLICE_IDR*/ )
i_idr_pic_id = bs_read_ue( &s );
int i_delta_pic_order_cnt_bottom = -1;
int i_delta_pic_order_cnt0 = 0;
int i_delta_pic_order_cnt1 = 0;
p_slice->i_pic_order_cnt_lsb = 0;
if( p_sps->poc_type == 0 )
{
p_slice->i_pic_order_cnt_lsb = bs_read( &s, p_sps->log2_max_poc_lsb + 4 );
//if( g_pic_order_present_flag && !i_field_pic_flag )
// i_delta_pic_order_cnt_bottom = bs_read_se( &s );
}
else if( (p_sps->poc_type == 1) &&
(!p_sps->delta_pic_order_always_zero_flag) )
{
i_delta_pic_order_cnt0 = bs_read_se( &s );
//if( g_pic_order_present_flag && !i_field_pic_flag )
// i_delta_pic_order_cnt1 = bs_read_se( &s );
}
}
--------------------------------------------------------------------------
bs_read_ue 函数 定义在 vlc_bits.h 中,其功能是从s中解码并读出一个语法元素值。---参见《x264源码阅读笔记 2》:http://www.360doc.com/showWeb/0/0/60416576.aspx。
上面函数中,第三行注释 first_mb_in_slice ,并不是指这是从流中读出第一个mb,而是指这次读出的是first_mb_in_slice这个字段。
TsMux源码 之 备忘与存疑
java调用Oracle EXP备忘 - BlueDavy之技术Blog - BlogJa...
AMD与科技部签备忘 转让X86芯片核心技术
2002年中国名牌产品评价范围评点与备忘
跨过丑闻与闹剧---中国反兴奋剂20年备忘
王维军: 弘一法师致堵申甫信札存疑之考释
长安集团加速扩张 与PSA合作存疑
孕期备忘
孕期备忘
:源码
逃顶指标<源码> -股票之家
公安局政委女儿冒名顶替上学事件造假过程存疑(中国之声 2009-5-6)
pibazi.net图片上传程序 - 源码之家 - PHP源码 - 图片管理
深蓝PHP留言本 v1.1 - 源码之家 - PHP源码 - 聊天留言
DB2使用经验备忘
Unix 常用命令备忘
男士的备忘
每日操盘备忘
野外装备备忘表
室内设计尺寸备忘
未来备忘:F
拉萨游备忘
西安游备忘
找不到工作的大学生没理由不看:《决裂》——难存疑问的民族与世界趋良支点!