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

📄 umc_h264_pub.h

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 H
📖 第 1 页 / 共 3 页
字号:
#define IS_INTER_MBTYPE(mbtype) ((mbtype) >= MBTYPE_INTER)    // 8x8 Macroblock subblock type definitionstypedef enum {    NAL_UT_RESERVED  = 0x00, // Reserved    NAL_UT_SLICE     = 0x01, // Coded Slice - slice_layer_no_partioning_rbsp    NAL_UT_DPA       = 0x02, // Coded Data partition A - dpa_layer_rbsp    NAL_UT_DPB       = 0x03, // Coded Data partition A - dpa_layer_rbsp    NAL_UT_DPC       = 0x04, // Coded Data partition A - dpa_layer_rbsp    NAL_UT_IDR_SLICE = 0x05, // Coded Slice of a IDR Picture - slice_layer_no_partioning_rbsp    NAL_UT_SEI       = 0x06, // Supplemental Enhancement Information - sei_rbsp    NAL_UT_SPS       = 0x07, // Sequence Parameter Set - seq_parameter_set_rbsp    NAL_UT_PPS       = 0x08, // Picture Parameter Set - pic_parameter_set_rbsp    NAL_UT_PD        = 0x09, // Picture Delimiter - pic_delimiter_rbsp    NAL_UT_FD        = 0x0a  // Filler Data - filler_data_rbsp} NAL_Unit_Type;#endif /*SHARED_ENCDEC_STRUCTURES_DEFS*/    // Define constants representing the pixel aspect ratio codes from table 5    // of the H.263+ standard.#define PARC_FORBIDDEN              0#define PARC_SQUARE                 1#define PARC_CIF                    2#define PARC_10_11                  3#define PARC_16_11                  4#define PARC_40_33                  5    // values between 6 and 14 are reserved#define PARC_EXTENDED              15    enum FrameSize      {   FORBIDDEN   = 0, Reserved000    = 0,        SQCIF       = 1,        QCIF        = 2,        CIF         = 3,        fCIF        = 4,        ssCIF       = 5,        CUSTOM      = 6, Reserved110    = 6,        EPTYPE      = 7, Reserved111    = 7};    //    //  This enumeration is used within the core encoder to flag the class    //  of picture that the a slice belongs to.    //    enum EnumPicClass    {        DISPOSABLE_PIC = 0, // No references to this picture from others, need not be decoded        REFERENCE_PIC = 1,  // Other pictures may refer to this one, must be decoded        IDR_PIC = 2         // Instantaneous Decoder Refresh.  All previous references discarded.    };    // Note!  The Picture Code Type values below are no longer used in the    // core encoder.   It only knows about slice types, and whether or not    // the frame is IDR, Reference or Disposable.  See enum above.    /* structure of a fpicture being encoded.*/    typedef enum {        FRAME_PICTURE = 0,        TOP_FIELD     = 1,        BOTTOM_FIELD  = 2    } PictureStructure;    // Macros to determine if a given PicCodType is key, P, or B#ifndef IS_INTRA_SLICE#define IS_INTRA_SLICE(SliceType) ((SliceType) == INTRASLICE)#endif#ifndef IS_P_SLICE#define IS_P_SLICE(SliceType) ((SliceType) == PREDSLICE)#endif#ifndef IS_B_SLICE#define IS_B_SLICE(SliceType) ((SliceType) == BPREDSLICE)#endif    // Slice Group definitions#define MAX_NUM_SLICE_GROUPS 8#define MAX_SLICE_GROUP_MAP_TYPE 6    struct SliceGroupInfoStruct    {        Ipp8u       slice_group_map_type;               // 0..6        // The additional slice group data depends upon map type        union        {            // type 0            Ipp32u  run_length[MAX_NUM_SLICE_GROUPS];            // type 2            struct            {                Ipp32u top_left[MAX_NUM_SLICE_GROUPS-1];                Ipp32u bottom_right[MAX_NUM_SLICE_GROUPS-1];            } t1;            // types 3-5            struct            {                Ipp8u   slice_group_change_direction_flag;                Ipp32u  slice_group_change_rate;            } t2;            // type 6            struct            {                Ipp32u pic_size_in_map_units;       // number of macroblocks if no field coding                Ipp8u *pSliceGroupIDMap;            // Id for each slice group map unit            } t3;        };    };  // SliceGroupInfoStruct    // Sequence parameter set structure, corresponding to the H.264 bitstream definition.    struct H264SeqParamSet    {        Ipp8u       profile_idc;                        // baseline, main, etc.        Ipp8u       level_idc;        Ipp8u       constraint_set0_flag;               // nonzero: bitstream obeys all set 0 constraints        Ipp8u       constraint_set1_flag;               // nonzero: bitstream obeys all set 1 constraints        Ipp8u       constraint_set2_flag;               // nonzero: bitstream obeys all set 2 constraints        Ipp8u       constraint_set3_flag;               // nonzero: bitstream obeys all set 3 constraints        Ipp8u       seq_parameter_set_id;               // id of this sequence parameter set        Ipp8u       log2_max_frame_num;                 // Number of bits to hold the frame_num        Ipp8u       pic_order_cnt_type;                 // Picture order counting method        Ipp8u       delta_pic_order_always_zero_flag;   // If zero, delta_pic_order_cnt fields are        // present in slice header.        Ipp8u       frame_mbs_only_flag;                // Nonzero indicates all pictures in sequence        // are coded as frames (not fields).        Ipp8u       gaps_in_frame_num_value_allowed_flag;        Ipp8u       mb_adaptive_frame_field_flag;       // Nonzero indicates frame/field switch        // at macroblock level        Ipp8u       direct_8x8_inference_flag;          // Direct motion vector derivation method        Ipp8u       vui_parameters_present_flag;        // Zero indicates default VUI parameters        Ipp8u       frame_cropping_flag;            // Nonzero indicates frame crop offsets are present.        Ipp32u      frame_crop_left_offset;        Ipp32u      frame_crop_right_offset;        Ipp32u      frame_crop_top_offset;        Ipp32u      frame_crop_bottom_offset;        Ipp32u      log2_max_pic_order_cnt_lsb;         // Value of MaxPicOrderCntLsb.        Ipp32s      offset_for_non_ref_pic;        Ipp32s      offset_for_top_to_bottom_field;     // Expected pic order count difference from        // top field to bottom field.        Ipp32u      num_ref_frames_in_pic_order_cnt_cycle;        Ipp32s      *poffset_for_ref_frame;             // pointer to array of stored frame offsets,        // length num_stored_frames_in_pic_order_cnt_cycle,        // for pic order cnt type 1        Ipp32u      num_ref_frames;                     // total number of pics in decoded pic buffer        Ipp32u      frame_width_in_mbs;        Ipp32u      frame_height_in_mbs;        // These fields are calculated from values above.  They are not written to the bitstream        Ipp32u      MaxMbAddress;        Ipp32u      MaxPicOrderCntLsb;    };  // H264SeqParamSet    // Picture parameter set structure, corresponding to the H.264 bitstream definition.    struct H264PicParamSet    {        Ipp8u       pic_parameter_set_id;           // of this picture parameter set        Ipp8u       seq_parameter_set_id;           // of seq param set used for this pic param set        Ipp8u       entropy_coding_mode;            // zero: CAVLC, else CABAC        Ipp8u       pic_order_present_flag;         // Zero indicates only delta_pic_order_cnt[0] is        // present in slice header; nonzero indicates        // delta_pic_order_cnt[1] is also present.        Ipp8u       weighted_pred_flag;             // Nonzero indicates weighted prediction applied to        // P and SP slices        Ipp8u       weighted_bipred_idc;            // 0: no weighted prediction in B slices        // 1: explicit weighted prediction        // 2: implicit weighted prediction        Ipp8u       pic_init_qp;                    // default QP for I,P,B slices        Ipp8u       pic_init_qs;                    // default QP for SP, SI slices        Ipp8s       chroma_qp_index_offset;         // offset to add to QP for chroma        Ipp8u       deblocking_filter_variables_present_flag;   // If nonzero, deblock filter params are        // present in the slice header.        Ipp8u       constrained_intra_pred_flag;    // Nonzero indicates constrained intra mode        Ipp8u       redundant_pic_cnt_present_flag; // Nonzero indicates presence of redundant_pic_cnt        // in slice header        Ipp8u       num_slice_groups;               // Usually 1        SliceGroupInfoStruct SliceGroupInfo;    // Used only when num_slice_groups > 1        Ipp32u      num_ref_idx_l0_active;          // num of ref pics in list 0 used to decode the picture        Ipp32u      num_ref_idx_l1_active;          // num of ref pics in list 1 used to decode the picture        int         mb_width;    // mb_width of the picture        int         mb_height;   // mb_height of the picture        PictureStructure picture_structure; // frame, top_field, bottom_field.    };  // H264PicParamSet#define MAX_NUM_SEQ_PARAM_SETS 32#define MAX_NUM_PIC_PARAM_SETS 128#define MAX_PROFILE_IDC 90#define MIN_PROFILE_IDC 65#define MAX_LEVEL_IDC 109#define MIN_LEVEL_IDC 0    // Slice header structure, corresponding to the H.264 bitstream definition.    struct H264SliceHeader    {        Ipp8u       pic_parameter_set_id;               // of pic param set used for this slice        Ipp8u       field_pic_flag;                     // zero: frame picture, else field picture        Ipp8u       bottom_field_flag;                  // zero: top field, else bottom field        Ipp8u       direct_spatial_mv_pred_flag;        // zero: temporal direct, else spatial direct        Ipp8u       num_ref_idx_active_override_flag;   // nonzero: use ref_idx_active from slice header        // instead of those from pic param set        Ipp8u       no_output_of_prior_pics_flag;       // nonzero: remove previously decoded pictures        // from decoded picture buffer        Ipp8u       long_term_reference_flag;           // nonzero: use as long term reference        Ipp8u       cabac_init_idc;                     // CABAC initialization table index (0..2)        Ipp8u       adaptive_ref_pic_marking_mode_flag; // Ref pic marking mode of current picture        Ipp8s       slice_qp_delta;                     // to calculate default slice QP        Ipp8u       sp_for_switch_flag;                 // SP slice decoding control        Ipp8s       slice_qs_delta;                     // to calculate default SP,SI slice QS        Ipp8u       disable_deblocking_filter_idc;      // deblock filter control, 0=filter all edges        Ipp8s       slice_alpha_c0_offset;              // deblock filter c0, alpha table offset        Ipp8s       slice_beta_offset;                  // deblock filter beta table offset        Ipp8u       luma_log2_weight_denom;             // luma weighting denominator        Ipp8u       chroma_log2_weight_denom;           // chroma weighting denominator        Ipp32u      first_mb_in_slice;        Ipp32u      frame_num;        EnumSliceType slice_type;        Ipp32u      idr_pic_id;                         // ID of an IDR picture        Ipp32u      pic_order_cnt_lsb;                  // picture order count (mod MaxPicOrderCntLsb)        Ipp32s      delta_pic_order_cnt_bottom;         // Pic order count difference, top & bottom fields        Ipp32s      delta_pic_order_cnt[2];             // picture order count differences        Ipp32u      redundant_pic_cnt;                  // for redundant slices        Ipp32u      num_ref_idx_l0_active;              // num of ref pics in list 0 used to decode the slice,        // see num_ref_idx_active_override_flag        Ipp32u      num_ref_idx_l1_active;              // num of ref pics in list 1 used to decode the slice        // see num_ref_idx_active_override_flag        Ipp32u      slice_group_change_cycle;           // for slice group map types 3..5        Ipp32s        DistScaleFactor[MAX_NUM_REF_FRAMES];        Ipp32s        DistScaleFactorMV[MAX_NUM_REF_FRAMES];        Ipp32s        DistScaleFactorAFF[2][2][2][MAX_NUM_REF_FRAMES]; // [curmb field],[ref1field],[ref0field]        Ipp32s        DistScaleFactorMVAFF[2][2][2][MAX_NUM_REF_FRAMES]; // [curmb field],[ref1field],[ref0field]    };  // H264SliceHeader    // Possible values for disable_deblocking_filter_idc:#define DEBLOCK_FILTER_ON                   0#define DEBLOCK_FILTER_OFF                  1#define DEBLOCK_FILTER_ON_NO_SLICE_EDGES    2    // Weight table struct for weights for list 0 or list 1 of a slice    struct PredWeightTable    {        Ipp8u       luma_weight_flag;           // nonzero: luma weight and offset in bitstream        Ipp8u       chroma_weight_flag;         // nonzero: chroma weight and offset in bitstream        Ipp8s       luma_weight;                // luma weighting factor        Ipp8s       luma_offset;                // luma weighting offset        Ipp8s       chroma_weight[2];           // chroma weighting factor (Cb,Cr)        Ipp8s       chroma_offset[2];           // chroma weighting offset (Cb,Cr)    };  // PredWeightTable    // Reference picture list reordering data in the slice header.    struct RefPicListReorderInfo    {        Ipp32u      num_entries;                // number of currently valid idc,value pairs        Ipp8u       reordering_of_pic_nums_idc[MAX_NUM_REF_FRAMES];        Ipp32u      reorder_value[MAX_NUM_REF_FRAMES];  // abs_diff_pic_num or long_term_pic_num    };    // Adaptive reference picture marking commands in the slice header    struct AdaptiveMarkingInfo    {        Ipp32u      num_entries;                // number of currently valid mmco,value pairs        Ipp8u       mmco[MAX_NUM_REF_FRAMES];   // memory management control operation id        Ipp32u      value[MAX_NUM_REF_FRAMES*2];// operation-dependent data, max 2 per operation    };    typedef Ipp32s H264DecoderMBAddr;    // The following functions have implementations in both .cpp and .asm files,    // and thus must be properly prototyped with extern "C" and with    // the calling functions.  They are declared here because they are shared    // by several codec components (encoder or decoder or displayer).        void FrameCopy (            Ipp8u *pInputPlane,          // Address of input data.            Ipp8u *pOuptutPlane,         // Address of output data.            Ipp32u uFrameHeight,         // Lines to copy.            Ipp32u uFrameWidth,          // Columns to copy.            Ipp32u uPitch);   // Pitch.        void PitchFrameCopy (            Ipp8u *pInputPlane,          // Address of input data.            Ipp8u *pOuptutPlane,         // Address of output data.            Ipp32u uFrameHeight,         // Lines to copy.            Ipp32u uFrameWidth,          // Columns to copy.            Ipp32u uSrcPitch,            // Source plane pitch.            Ipp32u uDstPitch); // Destination plane pitch.        void ExpandPlane(            Ipp8u *StartPtr,            Ipp32u uFrameWidth,            Ipp32u uFrameHeight,            Ipp32u uPitch,            Ipp32u uPels);             // size of expansion (8 or 16)        // Rotate video plane 90 degrees clockwise        void PitchFrameRotate (            Ipp8u *pInputPlane,          // Address of input data.            Ipp8u *pOutputPlane,         // Address of output data.            Ipp32u uFrameHeight,         // Src Lines to copy.            Ipp32u uFrameWidth,          // Src Columns to copy.            Ipp32u uSrcPitch,            // Source plane pitch.            Ipp32u uDstPitch);           // Destination plane pitch.//// Define formats for representing frame rate and data rate control options.// These options allow an application to specify the desired encoder bit rate.// Rate control options can be set independently for key frames and for// non-key frames.//// We use "const Ipp32u" instead of "enum", because the former type// has a well defined size.////// A H264_Sequence_Controls object combines several sets of options that// affect the encoding of a video sequence.  It is used only for non-layered// encoding.//const   Ipp32u     H264_Max_B_Frames            = 4;//// Enumerate all of our return codes.//struct sDimensions{    Ipp32u            width;    Ipp32u            height;    sDimensions()                        { width = height = 0; }    sDimensions(Ipp32u w, Ipp32u h)        { width = w; height = h; }    // Define equivalence operators for comparing dimensions.    int operator == (const sDimensions &oprnd) const    { return width == oprnd.width && height == oprnd.height; };    int operator != (const sDimensions &oprnd) const    { return !(*this == oprnd); };    Ipp32u     Area(void) const { return width * height; }};// A sRectangle specifies a rectangle within a (probably larger) rectangular

⌨️ 快捷键说明

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