📄 umc_h264_pub.h
字号:
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.
};
// 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
struct H264VUIParams{
H264VUIParams();
~H264VUIParams();
Ipp8u aspect_ratio_info_present_flag;
Ipp8u aspect_ratio_idc;
Ipp16u sar_width;
Ipp16u sar_height;
Ipp8u overscan_info_present_flag;
Ipp8u overscan_appropriate_flag;
Ipp8u video_signal_type_present_flag;
Ipp8u video_format;
Ipp8u video_full_range_flag;
Ipp8u colour_description_present_flag;
Ipp8u colour_primaries;
Ipp8u transfer_characteristics;
Ipp8u matrix_coefficients;
Ipp8u chroma_loc_info_present_flag;
Ipp8u chroma_sample_loc_type_top_field;
Ipp8u chroma_sample_loc_type_bottom_field;
Ipp8u timing_info_present_flag;
Ipp32u num_units_in_tick;
Ipp32u time_scale;
Ipp8u fixed_frame_rate_flag;
Ipp8u nal_hrd_parameters_present_flag;
Ipp8u vcl_hrd_parameters_present_flag;
Ipp8u low_delay_hrd_flag;
Ipp8u pic_struct_present_flag;
Ipp8u bitstream_restriction_flag;
Ipp8u motion_vectors_over_pic_boundaries_flag;
Ipp8u max_bytes_per_pic_denom;
Ipp8u max_bits_per_mb_denom;
Ipp8u log2_max_mv_length_horizontal;
Ipp8u log2_max_mv_length_vertical;
Ipp8u num_reorder_frames;
Ipp8u max_dec_frame_buffering;
};
// Sequence parameter set structure, corresponding to the H.264 bitstream definition.
struct H264SeqParamSet
{
H264_PROFILE_IDC profile_idc; // baseline, main, etc.
Ipp8s level_idc;
Ipp8s constraint_set0_flag; // nonzero: bitstream obeys all set 0 constraints
Ipp8s constraint_set1_flag; // nonzero: bitstream obeys all set 1 constraints
Ipp8s constraint_set2_flag; // nonzero: bitstream obeys all set 2 constraints
Ipp8s constraint_set3_flag; // nonzero: bitstream obeys all set 3 constraints
Ipp8s chroma_format_idc;
Ipp8s seq_parameter_set_id; // id of this sequence parameter set
Ipp8s log2_max_frame_num; // Number of bits to hold the frame_num
Ipp8s pic_order_cnt_type; // Picture order counting method
Ipp8s delta_pic_order_always_zero_flag; // If zero, delta_pic_order_cnt fields are
// present in slice header.
Ipp8s frame_mbs_only_flag; // Nonzero indicates all pictures in sequence
// are coded as frames (not fields).
Ipp8s gaps_in_frame_num_value_allowed_flag;
Ipp8s mb_adaptive_frame_field_flag; // Nonzero indicates frame/field switch
// at macroblock level
Ipp8s direct_8x8_inference_flag; // Direct motion vector derivation method
Ipp8s vui_parameters_present_flag; // Zero indicates default VUI parameters
H264VUIParams vui_parameters; // VUI parameters if it is going to be used
Ipp8s frame_cropping_flag; // Nonzero indicates frame crop offsets are present.
Ipp32s frame_crop_left_offset;
Ipp32s frame_crop_right_offset;
Ipp32s frame_crop_top_offset;
Ipp32s frame_crop_bottom_offset;
Ipp32s 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.
Ipp32s 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
Ipp32s num_ref_frames; // total number of pics in decoded pic buffer
Ipp32s frame_width_in_mbs;
Ipp32s frame_height_in_mbs;
// These fields are calculated from values above. They are not written to the bitstream
Ipp32s MaxMbAddress;
Ipp32s MaxPicOrderCntLsb;
Ipp32s aux_format_idc; // See H.264 standard for details.
Ipp32s bit_depth_aux;
Ipp32s bit_depth_luma;
Ipp32s bit_depth_chroma;
Ipp32s alpha_incr_flag;
Ipp32s alpha_opaque_value;
Ipp32s alpha_transparent_value;
bool seq_scaling_matrix_present_flag;
bool seq_scaling_list_present_flag[8];
Ipp8u seq_scaling_list_4x4[6][16];
Ipp8u seq_scaling_list_8x8[2][64];
Ipp16s seq_scaling_matrix_4x4[6][6][16];
Ipp16s seq_scaling_matrix_8x8[2][6][64];
Ipp16s seq_scaling_inv_matrix_4x4[6][6][16];
Ipp16s seq_scaling_inv_matrix_8x8[2][6][64];
bool pack_sequence_extension;
Ipp32s qpprime_y_zero_transform_bypass_flag;
bool residual_colour_transform_flag;
Ipp32s additional_extension_flag;
}; // H264SeqParamSet
// Picture parameter set structure, corresponding to the H.264 bitstream definition.
struct H264PicParamSet
{
Ipp8s pic_parameter_set_id; // of this picture parameter set
Ipp8s seq_parameter_set_id; // of seq param set used for this pic param set
Ipp8s entropy_coding_mode; // zero: CAVLC, else CABAC
Ipp8s 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.
Ipp8s weighted_pred_flag; // Nonzero indicates weighted prediction applied to
// P and SP slices
Ipp8s weighted_bipred_idc; // 0: no weighted prediction in B slices
// 1: explicit weighted prediction
// 2: implicit weighted prediction
Ipp8s pic_init_qp; // default QP for I,P,B slices
Ipp8s pic_init_qs; // default QP for SP, SI slices
Ipp8s chroma_qp_index_offset; // offset to add to QP for chroma
Ipp8s deblocking_filter_variables_present_flag; // If nonzero, deblock filter params are
// present in the slice header.
Ipp8s constrained_intra_pred_flag; // Nonzero indicates constrained intra mode
Ipp8s redundant_pic_cnt_present_flag; // Nonzero indicates presence of redundant_pic_cnt
// in slice header
Ipp8s num_slice_groups; // Usually 1
Ipp8s second_chroma_qp_index_offset;
SliceGroupInfoStruct SliceGroupInfo; // Used only when num_slice_groups > 1
Ipp32s num_ref_idx_l0_active; // num of ref pics in list 0 used to decode the picture
Ipp32s num_ref_idx_l1_active; // num of ref pics in list 1 used to decode the picture
bool transform_8x8_mode_flag;
bool pic_scaling_matrix_present_flag; // Only "false" is supported.
bool pack_sequence_extension;
Ipp32s chroma_format_idc; // needed for aux/primary picture switch.
Ipp32s bit_depth_luma; // needed for aux/primary picture switch.
}; // H264PicParamSet
// 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 MbaffFrameFlag;
Ipp8u bottom_field_flag; // zero: top field, else bottom field
Ipp8u direct_spatial_mv_pred_flag; // zero: temporal direct, else spatial direct
// 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 adaptive_ref_pic_marking_mode_flag; // Ref pic marking mode of current picture
Ipp8u sp_for_switch_flag; // SP slice decoding control
Ipp8s slice_qs_delta; // to calculate default SP,SI slice QS
Ipp8u luma_log2_weight_denom; // luma weighting denominator
Ipp8u chroma_log2_weight_denom; // chroma weighting denominator
Ipp32u frame_num;
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 slice_group_change_cycle; // for slice group map types 3..5
}; // H264SliceHeader
// Struct containing list 0 and list 1 reference picture lists for one slice.
// Length is plus 1 to provide for null termination.
template <class PixType> class H264EncoderFrame;
template <class PixType> struct EncoderRefPicListStruct
{
H264EncoderFrame<PixType> *m_RefPicList[MAX_NUM_REF_FRAMES + 1];
Ipp8s m_Prediction[MAX_NUM_REF_FRAMES + 1];
Ipp32s m_POC[MAX_NUM_REF_FRAMES+1];
};
template <class PixType> struct EncoderRefPicList
{
EncoderRefPicListStruct<PixType> m_RefPicListL0;
EncoderRefPicListStruct<PixType> m_RefPicListL1;
}; // EncoderRefPicList
// 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
};
template <class PixType>
void ExpandPlane (PixType *StartPtr,
Ipp32s FrameWidth,
Ipp32s FrameHeight,
Ipp32s pitchPixels,
Ipp32s pels); // size of expansion (8 or 16)
//
// 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.
//
struct H264LimitedSliceHeader
{
EnumSliceType slice_type; // (EnumSliceCodType) slice type
Ipp8u disable_deblocking_filter_idc; // (Ipp8u) deblock filter control, 0 = filter all edges
Ipp8s slice_alpha_c0_offset; // (Ipp8s) deblock filter c0, alpha table offset
Ipp8s slice_beta_offset; // (Ipp8s) deblock filter beta table offset
}; // H264LimitedSliceHeader
enum
{
DATA_ALIGN = 64,
LUMA_PADDING = YUV_Y_PADDING,
CHROMA_PADDING = YUV_UV_PADDING
};
inline Ipp32u CalcPitchFromWidth(Ipp32u width, Ipp32s pixSize)
{
return align_value<Ipp32u> (((width + LUMA_PADDING * 2)*pixSize), DATA_ALIGN);
}
} //namespace UMC_H264_ENCODER
#endif // UMC_H264_PUB_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -