⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 umc_h264_dec_sei.cpp

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 CPP
字号:
/*////              INTEL CORPORATION PROPRIETARY INFORMATION//  This software is supplied under the terms of a license  agreement or//  nondisclosure agreement with Intel Corporation and may not be copied//  or disclosed except in  accordance  with the terms of that agreement.//        Copyright (c) 2005 Intel Corporation. All Rights Reserved.////*/#include "umc_h264_bitstream.h"namespace UMC{Ipp8u H264Bitstream::ParseSEI(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::sei_message(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    unsigned int code;    int payloadType = 0;    ippiNextBits(m_pbs, m_bitOffset, 8, code);    while( code  ==  0xFF )    {        /* fixed-pattern bit string using 8 bits written equal to 0xFF */        payloadType += 255;        ippiNextBits(m_pbs, m_bitOffset, 8, code);    }    int last_payload_type_byte;    //unsigned integer using 8 bits    ippiGetNBits(m_pbs, m_bitOffset, 8, last_payload_type_byte);    payloadType += last_payload_type_byte;    int payloadSize = 0;    ippiNextBits(m_pbs, m_bitOffset, 8, code);    while( code  ==  0xFF )    {        /* fixed-pattern bit string using 8 bits written equal to 0xFF */        ippiGetNBits(m_pbs, m_bitOffset, 8, code);        payloadSize += 255;        ippiNextBits(m_pbs, m_bitOffset, 8, code);    }    int last_payload_size_byte;    //unsigned integer using 8 bits    ippiGetNBits(m_pbs, m_bitOffset, 8, last_payload_size_byte);    payloadSize += last_payload_size_byte;    memset(spl,0,sizeof(H264SEIPayLoad));    spl->payLoadSize = payloadSize;    spl->payLoadType = payloadType;    return sei_payload(sps,current_sps,spl);}Ipp8u H264Bitstream::sei_payload(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    Ipp8u payloadType =spl->payLoadType;    switch( payloadType)    {    case 0:        return buffering_period(sps,current_sps,spl);    case 1:        return pic_timing(sps,current_sps,spl);    case 2:        return pan_scan_rect(sps,current_sps,spl);    case 3:        return filler_payload(sps,current_sps,spl);    case 4:        return user_data_registered_itu_t_t35(sps,current_sps,spl);    case 5:        return user_data_unregistered(sps,current_sps,spl);    case 6:        return recovery_point(sps,current_sps,spl);    case 7:        return dec_ref_pic_marking_repetition(sps,current_sps,spl);    case 8:        return spare_pic(sps,current_sps,spl);    case 9:        return scene_info(sps,current_sps,spl);    case 10:        return sub_seq_info(sps,current_sps,spl);    case 11:        return sub_seq_layer_characteristics(sps,current_sps,spl);    case 12:        return sub_seq_characteristics(sps,current_sps,spl);    case 13:        return full_frame_freeze(sps,current_sps,spl);    case 14:        return full_frame_freeze_release(sps,current_sps,spl);    case 15:        return full_frame_snapshot(sps,current_sps,spl);    case 16:        return progressive_refinement_segment_start(sps,current_sps,spl);    case 17:        return progressive_refinement_segment_end(sps,current_sps,spl);    case 18:        return motion_constrained_slice_group_set(sps,current_sps,spl);    default:        return reserved_sei_message(sps,current_sps,spl);    }/*    int i;    unsigned int code;    for(i = 0; i < payloadSize; i++)        ippiGetNBits(m_pbs, m_bitOffset, 8, code)*/    //if( !byte_aligned( ) )    //{    //    bit_equal_to_one;  /* equal to 1 */    //    while( !byte_aligned( ) )    //       bit_equal_to_zero;  /* equal to 0 */    //}}Ipp8u H264Bitstream::buffering_period(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    Ipp8u seq_parameter_set_id = GetVLCElement(false);    H264SeqParamSet *csps = &sps[seq_parameter_set_id];    H264SEIPayLoad::SEIMessages::BufferingPeriod *bps = &spl[seq_parameter_set_id].SEI_messages.buffering_period;    if (csps->nal_hrd_parameters_present_flag)    {        for(int i=0;i<csps->cpb_cnt;i++)        {            bps->initial_cbp_removal_delay[0][i] = GetBits(csps->cpb_removal_delay_length);            bps->initial_cbp_removal_delay_offset[0][i] = GetBits(csps->cpb_removal_delay_length);        }    }    if (csps->vcl_hrd_parameters_present_flag)    {        for(int i=0;i<csps->cpb_cnt;i++)        {            bps->initial_cbp_removal_delay[1][i] = GetBits(csps->cpb_removal_delay_length);            bps->initial_cbp_removal_delay_offset[1][i] = GetBits(csps->cpb_removal_delay_length);        }    }    ippiAlignBSPointerRight(m_pbs, m_bitOffset);    return seq_parameter_set_id;//    unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::pic_timing(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    const Ipp8u NumClockTS[]={1,1,1,2,2,3,3,2,3};    H264SeqParamSet *csps = &sps[current_sps];    H264SEIPayLoad::SEIMessages::PicTiming *pts = &spl[current_sps].SEI_messages.pic_timing;    if (csps->nal_hrd_parameters_present_flag || csps->vcl_hrd_parameters_present_flag)    {        pts->cbp_removal_delay = GetBits(csps->cpb_removal_delay_length);        pts->dpb_ouput_delay = GetBits(csps->dpb_output_delay_length);    }    if (csps->pic_struct_present_flag)    {        pts->pic_struct = GetBits(4);        for (int i=0;i<NumClockTS[spl->SEI_messages.pic_timing.pic_struct];i++)        {            pts->clock_timestamp_flag[i] = Get1Bit();            if (pts->clock_timestamp_flag[i])            {                pts->clock_timestamps[i].ct_type = GetBits(2);                pts->clock_timestamps[i].nunit_field_based_flag = Get1Bit();                pts->clock_timestamps[i].counting_type = GetBits(5);                pts->clock_timestamps[i].full_timestamp_flag = Get1Bit();                pts->clock_timestamps[i].discontinuity_flag = Get1Bit();                pts->clock_timestamps[i].cnt_dropped_flag = Get1Bit();                pts->clock_timestamps[i].n_frames = GetBits(8);                if (pts->clock_timestamps[i].full_timestamp_flag )                {                    pts->clock_timestamps[i].seconds_value = GetBits(6);                    pts->clock_timestamps[i].minutes_value = GetBits(6);                    pts->clock_timestamps[i].hours_value = GetBits(5);                }                else                {                    if (Get1Bit())                    {                        pts->clock_timestamps[i].seconds_value = GetBits(6);                        if (Get1Bit())                        {                            pts->clock_timestamps[i].minutes_value = GetBits(6);                            if (Get1Bit())                            {                                pts->clock_timestamps[i].hours_value = GetBits(5);                            }                        }                    }                }                if(csps->time_offset_length>0)                    pts->clock_timestamps[i].time_offset = GetBits(csps->time_offset_length);            }        }    }    ippiAlignBSPointerRight(m_pbs, m_bitOffset);    return current_sps;    //unparsed_sei_message(sps,spl);}Ipp8u H264Bitstream::pan_scan_rect(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::filler_payload(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::user_data_registered_itu_t_t35(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::user_data_unregistered(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::recovery_point(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::dec_ref_pic_marking_repetition(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::spare_pic(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::scene_info(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::sub_seq_info(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::sub_seq_layer_characteristics(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::sub_seq_characteristics(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::full_frame_freeze(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::full_frame_freeze_release(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::full_frame_snapshot(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::progressive_refinement_segment_start(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::progressive_refinement_segment_end(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::motion_constrained_slice_group_set(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::reserved_sei_message(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    return unparsed_sei_message(sps,current_sps,spl);}Ipp8u H264Bitstream::unparsed_sei_message(H264SeqParamSet *sps,Ipp8u current_sps,H264SEIPayLoad *spl){    //VM_ASSERT(0);    Ipp32u i;    unsigned int code;    for(i = 0; i < spl->payLoadSize; i++)        ippiGetNBits(m_pbs, m_bitOffset, 8, code)    ippiAlignBSPointerRight(m_pbs, m_bitOffset);    return current_sps;}}//namespace UMC

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -