1 /***************************************************************************** 2 * set.h: quantization init 3 ***************************************************************************** 4 * Copyright (C) 2003-2021 x264 project 5 * 6 * Authors: Loren Merritt <lorenm@u.washington.edu> 7 * Laurent Aimar <fenrir@via.ecp.fr> 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. 22 * 23 * This program is also available under a commercial proprietary license. 24 * For more information, contact us at licensing@x264.com. 25 *****************************************************************************/ 26 27 #ifndef X264_SET_H 28 #define X264_SET_H 29 30 enum cqm4_e 31 { 32 CQM_4IY = 0, 33 CQM_4PY = 1, 34 CQM_4IC = 2, 35 CQM_4PC = 3 36 }; 37 enum cqm8_e 38 { 39 CQM_8IY = 0, 40 CQM_8PY = 1, 41 CQM_8IC = 2, 42 CQM_8PC = 3, 43 }; 44 45 typedef struct 46 { 47 int i_id; 48 49 int i_profile_idc; 50 int i_level_idc; 51 52 int b_constraint_set0; 53 int b_constraint_set1; 54 int b_constraint_set2; 55 int b_constraint_set3; 56 57 int i_log2_max_frame_num; 58 59 int i_poc_type; 60 /* poc 0 */ 61 int i_log2_max_poc_lsb; 62 63 int i_num_ref_frames; 64 int b_gaps_in_frame_num_value_allowed; 65 int i_mb_width; 66 int i_mb_height; 67 int b_frame_mbs_only; 68 int b_mb_adaptive_frame_field; 69 int b_direct8x8_inference; 70 71 int b_crop; 72 struct 73 { 74 int i_left; 75 int i_right; 76 int i_top; 77 int i_bottom; 78 } crop; 79 80 int b_vui; 81 struct 82 { 83 int b_aspect_ratio_info_present; 84 int i_sar_width; 85 int i_sar_height; 86 87 int b_overscan_info_present; 88 int b_overscan_info; 89 90 int b_signal_type_present; 91 int i_vidformat; 92 int b_fullrange; 93 int b_color_description_present; 94 int i_colorprim; 95 int i_transfer; 96 int i_colmatrix; 97 98 int b_chroma_loc_info_present; 99 int i_chroma_loc_top; 100 int i_chroma_loc_bottom; 101 102 int b_timing_info_present; 103 uint32_t i_num_units_in_tick; 104 uint32_t i_time_scale; 105 int b_fixed_frame_rate; 106 107 int b_nal_hrd_parameters_present; 108 int b_vcl_hrd_parameters_present; 109 110 struct 111 { 112 int i_cpb_cnt; 113 int i_bit_rate_scale; 114 int i_cpb_size_scale; 115 int i_bit_rate_value; 116 int i_cpb_size_value; 117 int i_bit_rate_unscaled; 118 int i_cpb_size_unscaled; 119 int b_cbr_hrd; 120 121 int i_initial_cpb_removal_delay_length; 122 int i_cpb_removal_delay_length; 123 int i_dpb_output_delay_length; 124 int i_time_offset_length; 125 } hrd; 126 127 int b_pic_struct_present; 128 int b_bitstream_restriction; 129 int b_motion_vectors_over_pic_boundaries; 130 int i_max_bytes_per_pic_denom; 131 int i_max_bits_per_mb_denom; 132 int i_log2_max_mv_length_horizontal; 133 int i_log2_max_mv_length_vertical; 134 int i_num_reorder_frames; 135 int i_max_dec_frame_buffering; 136 137 /* FIXME to complete */ 138 } vui; 139 140 int b_qpprime_y_zero_transform_bypass; 141 int i_chroma_format_idc; 142 143 int b_avcintra; 144 int i_cqm_preset; 145 const uint8_t *scaling_list[8]; /* could be 12, but we don't allow separate Cb/Cr lists */ 146 147 } x264_sps_t; 148 149 typedef struct 150 { 151 int i_id; 152 int i_sps_id; 153 154 int b_cabac; 155 156 int b_pic_order; 157 int i_num_slice_groups; 158 159 int i_num_ref_idx_l0_default_active; 160 int i_num_ref_idx_l1_default_active; 161 162 int b_weighted_pred; 163 int b_weighted_bipred; 164 165 int i_pic_init_qp; 166 int i_pic_init_qs; 167 168 int i_chroma_qp_index_offset; 169 170 int b_deblocking_filter_control; 171 int b_constrained_intra_pred; 172 int b_redundant_pic_cnt; 173 174 int b_transform_8x8_mode; 175 176 } x264_pps_t; 177 178 #define x264_cqm_init x264_template(cqm_init) 179 int x264_cqm_init( x264_t *h ); 180 #define x264_cqm_delete x264_template(cqm_delete) 181 void x264_cqm_delete( x264_t *h ); 182 #define x264_cqm_parse_file x264_template(cqm_parse_file) 183 int x264_cqm_parse_file( x264_t *h, const char *filename ); 184 185 #endif 186