打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
TsMux源码 之 备忘与存疑

=========================================================================
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这个字段。
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
slice header
如何在H264 ES数据中获取PTS?
分析一段H264视频数据 - vc - IT博客网
x264中的NAL流程
H.26L中的Access unit结构分析(ZZ)
h264 sps pps
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服