1 /* 2 * Copyright 2015 Rockchip Electronics Co. LTD 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __H264E_SPS_H__ 18 #define __H264E_SPS_H__ 19 20 #include "mpp_packet.h" 21 #include "mpp_enc_cfg.h" 22 23 #include "h264_syntax.h" 24 25 typedef struct H264eVui_t { 26 RK_U32 vui_en; 27 28 RK_S32 aspect_ratio_info_present; 29 RK_S32 aspect_ratio_idc; 30 RK_S32 sar_width; 31 RK_S32 sar_height; 32 33 RK_S32 overscan_info_present; 34 RK_S32 overscan_appropriate_flag; 35 36 RK_S32 signal_type_present; 37 RK_S32 vidformat; 38 RK_S32 fullrange; 39 RK_S32 color_description_present; 40 RK_S32 colorprim; 41 RK_S32 colortrc; 42 RK_S32 colmatrix; 43 44 RK_S32 chroma_loc_info_present; 45 RK_S32 chroma_loc_top; 46 RK_S32 chroma_loc_bottom; 47 48 RK_S32 timing_info_present; 49 RK_U32 num_units_in_tick; 50 RK_U32 time_scale; 51 RK_S32 fixed_frame_rate; 52 53 RK_S32 nal_hrd_parameters_present; 54 RK_S32 vcl_hrd_parameters_present; 55 56 struct { 57 RK_S32 cpb_cnt; 58 RK_S32 bit_rate_scale; 59 RK_S32 cpb_size_scale; 60 RK_S32 bit_rate_value; 61 RK_S32 cpb_size_value; 62 RK_S32 bit_rate_unscaled; 63 RK_S32 cpb_size_unscaled; 64 RK_S32 cbr_hrd; 65 66 RK_S32 initial_cpb_removal_delay_length; 67 RK_S32 cpb_removal_delay_length; 68 RK_S32 dpb_output_delay_length; 69 RK_S32 time_offset_length; 70 } hrd; 71 72 RK_S32 pic_struct_present; 73 RK_S32 bitstream_restriction; 74 RK_S32 motion_vectors_over_pic_boundaries; 75 RK_S32 max_bytes_per_pic_denom; 76 RK_S32 max_bits_per_mb_denom; 77 RK_S32 log2_max_mv_length_horizontal; 78 RK_S32 log2_max_mv_length_vertical; 79 RK_S32 num_reorder_frames; 80 RK_S32 max_dec_frame_buffering; 81 } H264eVui; 82 83 typedef struct H264eSps_t { 84 RK_S32 profile_idc; 85 86 RK_S32 constraint_set0; 87 RK_S32 constraint_set1; 88 RK_S32 constraint_set2; 89 RK_S32 constraint_set3; 90 RK_S32 constraint_set4; 91 RK_S32 constraint_set5; 92 93 RK_S32 level_idc; 94 RK_U32 sps_id; 95 96 RK_S32 chroma_format_idc; 97 /* scaling list is in pps */ 98 99 RK_S32 log2_max_frame_num_minus4; 100 RK_S32 pic_order_cnt_type; 101 /* poc type 0 */ 102 RK_S32 log2_max_poc_lsb_minus4; 103 104 RK_S32 num_ref_frames; 105 RK_S32 gaps_in_frame_num_value_allowed; 106 RK_S32 pic_width_in_mbs; 107 RK_S32 pic_height_in_mbs; 108 109 // alway frame encoding 110 RK_S32 frame_mbs_only; 111 RK_S32 direct8x8_inference; 112 113 RK_S32 cropping; 114 struct { 115 RK_S32 left; 116 RK_S32 right; 117 RK_S32 top; 118 RK_S32 bottom; 119 } crop; 120 121 H264eVui vui; 122 } H264eSps; 123 124 #ifdef __cplusplus 125 extern "C" { 126 #endif 127 128 MPP_RET h264e_sps_update(H264eSps *sps, MppEncCfgSet *cfg); 129 MPP_RET h264e_sps_to_packet(H264eSps *sps, MppPacket packet, RK_S32 *offset, 130 RK_S32 *len, MppEncCfgSet *cfg); 131 MPP_RET h264e_sps_dump(H264eSps *sps); 132 133 #ifdef __cplusplus 134 } 135 #endif 136 137 #endif /* __H264E_SPS_H__ */ 138