📄 parameterset.h
字号:
/*COPYRIGHT, LICENSE AND WARRANTY INFORMATIONThis software module has been originally developed by Nokia Corporation. Provided that a person, entity or a company willing to use the Software (hereinafter Licensee) comply with all the terms and conditions of this Statement and subject to the limitations set forth in this Statement Nokia grants to such Licensee a non-exclusive, sub-licensable, worldwide, limited license under copyrights owned by Nokia to use the Software for the sole purpose of creating, manufacturing, selling, marketing, or distributing (including the right to make modifications to the Software) a fully compliant decoder implementation (hereinafter "Decoder") of ITU-T Recommendation H.264 / ISO/IEC International Standard 14496-10 and an encoder implementation producing output that is decodable with the Decoder.Nokia retains the ownership of copyrights to the Software. There is no patent nor other intellectual property right of Nokia licensed under this Statement (except the copyright license above). Licensee hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if patent licenses are required, it is their responsibility to acquire the license before utilizing the Software.The license by Nokia is subject to that the Licensee grants to Nokia the non-exclusive, worldwide, royalty-free, perpetual and irrevocable covenant that the Licensee(s) shall not bring a suit before any court or administrative agency or otherwise assert a claim for infringement under the Licensee intellectual property rights that, but for a license, would be infringed by the Software against (a) Nokia or Nokia's Affiliate; or (b) other recipient of a license and covenant not to sue with respect to the Software from Nokia; or (c) contractor, customer or distributor of a party listed above in a or b, which suit or claim is related to the Software or use thereof.The Licensee(s) further agrees to grant a reciprocal license to Nokia (as granted by Nokia to the Licensee(s) on the modifications made by Licensee(s) to the Software. THE SOFTWARE IS PROVIDED "AS IS" AND THE ORIGINAL DEVELOPER DISCLAIMS ANY AND ALL WARRANTIES WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. THOSE INTENDING TO USE THE SOFTWARE ARE EXPRESSLY ADVISED THAT ITS USE MAY INFRINGE EXISTING PATENTS AND BE SUBJECT TO ROYALTY PAYMENTS TO PATENT OWNERS. ANYONE USING THE SOFTWARE ON THE BASIS OF THIS LICENSE AGREES TO OBTAIN THE NECESSARY PERMISSIONS FROM ANY AND ALL APPLICABLE PATENT OWNERS FOR SUCH USE.IN NO EVENT SHALL THE ORIGINAL DEVELOPER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.This copyright, license and warranty information notice must be retained in all copies and derivative works of the Software or substantial portions thereof.*/#ifndef _PARAMETERSET_H_#define _PARAMETERSET_H_#include "bitbuffer.h"#include "globals.h"#include "encparams.h"//! Boolean Typetypedef unsigned int Boolean;#define PS_BASELINE_PROFILE_IDC 66#define PS_MAIN_PROFILE_IDC 77#define PS_EXTENDED_PROFILE_IDC 88#define PS_EXTENDED_SAR 255#define PS_MAX_CPB_CNT 32/* supported by baseline profile and extended profile */#define PS_MAX_NUM_SLICE_GROUPS 8#define PS_MAX_NUM_REF_FRAMES_IN_PIC_ORDER_CNT_CYCLE 256/* * Hypothetical reference decoder parameters */typedef struct _hrd_parameters_s{ unsigned cpb_cnt_minus1; // ue(v) unsigned bit_rate_scale; // u(4) unsigned cpb_size_scale; // u(4) unsigned bit_rate_value_minus1[PS_MAX_CPB_CNT]; // ue(v) unsigned cpb_size_value_minus1[PS_MAX_CPB_CNT]; // ue(v) unsigned cbr_flag[PS_MAX_CPB_CNT]; // u(1) unsigned initial_cpb_removal_delay_length_minus1; // u(5) unsigned cpb_removal_delay_length_minus1; // u(5) unsigned dpb_output_delay_length_minus1; // u(5) unsigned time_offset_length; // u(5)} hrd_parameters_s;/* * Video usability information */typedef struct _vui_parameters_s{ Boolean aspect_ratio_info_present_flag; // u(1) unsigned aspect_ratio_idc; // u(8) unsigned sar_width; // u(16) unsigned sar_height; // u(16) Boolean overscan_info_present_flag; // u(1) Boolean overscan_appropriate_flag; // u(1) Boolean video_signal_type_present_flag; // u(1) unsigned video_format; // u(3) Boolean video_full_range_flag; // u(1) Boolean colour_description_present_flag; // u(1) unsigned colour_primaries; // u(8) unsigned transfer_characteristics; // u(8) unsigned matrix_coefficients; // u(8) Boolean chroma_loc_info_present_flag; // u(1) unsigned chroma_sample_loc_type_top_field; // ue(v) unsigned chroma_sample_loc_type_bottom_field; // ue(v) Boolean timing_info_present_flag; // u(1) unsigned num_units_in_tick; // u(32) unsigned time_scale; // u(32) Boolean fixed_frame_rate_flag; // u(1) Boolean nal_hrd_parameters_present_flag; // u(1) hrd_parameters_s nal_hrd_parameters; // hrd_paramters_s Boolean vcl_hrd_parameters_present_flag; // u(1) hrd_parameters_s vcl_hrd_parameters; // hrd_paramters_s // if ((nal_hrd_parameters_present_flag || (vcl_hrd_parameters_present_flag)) Boolean low_delay_hrd_flag; // u(1) Boolean pic_struct_present_flag; // u(1) Boolean bitstream_restriction_flag; // u(1) Boolean motion_vectors_over_pic_boundaries_flag; // u(1) unsigned max_bytes_per_pic_denom; // ue(v) unsigned max_bits_per_mb_denom; // ue(v) unsigned log2_max_mv_length_horizontal; // ue(v) unsigned log2_max_mv_length_vertical; // ue(v) unsigned num_reorder_frames; // ue(v) unsigned max_dec_frame_buffering; // ue(v)} vui_parameters_s;/* * Picture parameter set */typedef struct _pic_parameter_set_s{ Boolean Valid; // indicates the parameter set is valid unsigned pic_parameter_set_id; // ue(v) unsigned seq_parameter_set_id; // ue(v) Boolean entropy_coding_mode_flag; // u(1) Boolean pic_order_present_flag; // u(1) unsigned num_slice_groups_minus1; // ue(v) unsigned slice_group_map_type; // ue(v) // if( slice_group_map_type = = 0 ) unsigned run_length_minus1[PS_MAX_NUM_SLICE_GROUPS]; // ue(v) // else if( slice_group_map_type = = 2 ) unsigned top_left[PS_MAX_NUM_SLICE_GROUPS]; // ue(v) unsigned bottom_right[PS_MAX_NUM_SLICE_GROUPS]; // ue(v) // else if( slice_group_map_type = = 3 || 4 || 5 Boolean slice_group_change_direction_flag; // u(1) unsigned slice_group_change_rate_minus1; // ue(v) // else if( slice_group_map_type = = 6 ) unsigned pic_size_in_map_units_minus1; // ue(v) int8 *slice_group_id; // complete MBAmap u(v) unsigned num_ref_idx_l0_active_minus1; // ue(v) unsigned num_ref_idx_l1_active_minus1; // ue(v) Boolean weighted_pred_flag; // u(1) Boolean weighted_bipred_idc; // u(2) int pic_init_qp_minus26; // se(v) int pic_init_qs_minus26; // se(v) int chroma_qp_index_offset; // se(v) Boolean deblocking_filter_parameters_present_flag; // u(1) Boolean constrained_intra_pred_flag; // u(1) Boolean redundant_pic_cnt_present_flag; // u(1)} pic_parameter_set_s;/* * Sequence parameter set */typedef struct _seq_parameter_set_s{ Boolean Valid; // indicates the parameter set is valid unsigned profile_idc; // u(8) Boolean constraint_set0_flag; // u(1) !! Boolean constraint_set1_flag; // u(1) !! Boolean constraint_set2_flag; // u(1) !! Boolean reserved_zero_5bits; // u(5) !! unsigned level_idc; // u(8) unsigned seq_parameter_set_id; // ue(v) unsigned log2_max_frame_num_minus4; // ue(v) unsigned pic_order_cnt_type; // if( pic_order_cnt_type == 0 ) unsigned log2_max_pic_order_cnt_lsb_minus4; // ue(v) // else if( pic_order_cnt_type == 1 ) Boolean delta_pic_order_always_zero_flag; // u(1) int offset_for_non_ref_pic; // se(v) int offset_for_top_to_bottom_field; // se(v) unsigned num_ref_frames_in_pic_order_cnt_cycle; // ue(v) // for( i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ ) int offset_for_ref_frame[PS_MAX_NUM_REF_FRAMES_IN_PIC_ORDER_CNT_CYCLE]; // se(v) unsigned num_ref_frames; // ue(v) Boolean gaps_in_frame_num_value_allowed_flag; // u(1) unsigned pic_width_in_mbs_minus1; // ue(v) unsigned pic_height_in_map_units_minus1; // ue(v) Boolean frame_mbs_only_flag; // u(1) // if( !frame_mbs_only_flag ) Boolean mb_adaptive_frame_field_flag; // u(1) Boolean direct_8x8_inference_flag; // u(1) Boolean frame_cropping_flag; // u(1) unsigned frame_crop_left_offset; // ue(v) unsigned frame_crop_right_offset; // ue(v) unsigned frame_crop_top_offset; // ue(v) unsigned frame_crop_bottom_offset; // ue(v) Boolean vui_parameters_present_flag; // u(1) vui_parameters_s vui_parameters; // vui_seq_parameters_s} seq_parameter_set_s;/* * Function prototypes */void psValidateSliceParams(encParams_s *param);void psFillParameterSetStructures(seq_parameter_set_s *sps, pic_parameter_set_s *pps, encParams_s *param);int psSendSeqParameterSet(bitbuffer_s *bitbuf, seq_parameter_set_s *sps, int *bitsNal);int psSendPicParameterSet(bitbuffer_s *bitbuf, pic_parameter_set_s *pps, int *bitsNal);void psCloseParameterSet(pic_parameter_set_s *pps);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -