]> git.sesse.net Git - x264/blob - common/set.h
cosmetics: merge some duplicate tables
[x264] / common / set.h
1 /*****************************************************************************
2  * set.h: h264 encoder
3  *****************************************************************************
4  * Copyright (C) 2003 Laurent Aimar
5  * $Id: set.h,v 1.1 2004/06/03 19:27:07 fenrir Exp $
6  *
7  * Authors: 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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 #ifndef _SET_H
25 #define _SET_H 1
26
27 enum profile_e
28 {
29     PROFILE_BASELINE = 66,
30     PROFILE_MAIN     = 77,
31     PROFILE_EXTENTED = 88,
32     PROFILE_HIGH    = 100,
33     PROFILE_HIGH10  = 110,
34     PROFILE_HIGH422 = 122,
35     PROFILE_HIGH444 = 144
36 };
37
38 enum cqm4_e
39 {
40     CQM_4IY = 0,
41     CQM_4PY = 1,
42     CQM_4IC = 2,
43     CQM_4PC = 3
44 };
45 enum cqm8_e
46 {
47     CQM_8IY = 0,
48     CQM_8PY = 1
49 };
50
51 typedef struct
52 {
53     int i_id;
54
55     int i_profile_idc;
56     int i_level_idc;
57
58     int b_constraint_set0;
59     int b_constraint_set1;
60     int b_constraint_set2;
61
62     int i_log2_max_frame_num;
63
64     int i_poc_type;
65     /* poc 0 */
66     int i_log2_max_poc_lsb;
67     /* poc 1 */
68     int b_delta_pic_order_always_zero;
69     int i_offset_for_non_ref_pic;
70     int i_offset_for_top_to_bottom_field;
71     int i_num_ref_frames_in_poc_cycle;
72     int i_offset_for_ref_frame[256];
73
74     int i_num_ref_frames;
75     int b_gaps_in_frame_num_value_allowed;
76     int i_mb_width;
77     int i_mb_height;
78     int b_frame_mbs_only;
79     int b_mb_adaptive_frame_field;
80     int b_direct8x8_inference;
81
82     int b_crop;
83     struct
84     {
85         int i_left;
86         int i_right;
87         int i_top;
88         int i_bottom;
89     } crop;
90
91     int b_vui;
92     struct
93     {
94         int b_aspect_ratio_info_present;
95         int i_sar_width;
96         int i_sar_height;
97         
98         int b_overscan_info_present;
99         int b_overscan_info;
100
101         int b_signal_type_present;
102         int i_vidformat;
103         int b_fullrange;
104         int b_color_description_present;
105         int i_colorprim;
106         int i_transfer;
107         int i_colmatrix;
108
109         int b_chroma_loc_info_present;
110         int i_chroma_loc_top;
111         int i_chroma_loc_bottom;
112
113         int b_timing_info_present;
114         int i_num_units_in_tick;
115         int i_time_scale;
116         int b_fixed_frame_rate;
117
118         int b_bitstream_restriction;
119         int b_motion_vectors_over_pic_boundaries;
120         int i_max_bytes_per_pic_denom;
121         int i_max_bits_per_mb_denom;
122         int i_log2_max_mv_length_horizontal;
123         int i_log2_max_mv_length_vertical;
124         int i_num_reorder_frames;
125         int i_max_dec_frame_buffering;
126
127         /* FIXME to complete */
128     } vui;
129
130     int b_qpprime_y_zero_transform_bypass;
131
132 } x264_sps_t;
133
134 typedef struct
135 {
136     int i_id;
137     int i_sps_id;
138
139     int b_cabac;
140
141     int b_pic_order;
142     int i_num_slice_groups;
143
144 #if 0
145     /* FIXME: if this stuff is ever needed, move SPS/PPS from x264_t
146      * to the heap, to avoid excessive memcpy'ing with threads. */
147     int i_slice_group_map_type;
148     /* i_slice_group_map_type == 0 */
149     int i_run_length[256];      /* FIXME */
150     /* i_slice_group_map_type == 2 */
151     int i_top_left[256];        /* FIXME */
152     int i_bottom_right[256];    /* FIXME */
153     /* i_slice_group_map_type == 3, 4, 5 */
154     int b_slice_group_change_direction;
155     int i_slice_group_change_rate;
156     /* i_slice_group_map_type == 6 */
157     int i_pic_size_in_map_units;
158     int i_slice_group_id[256];  /* FIXME */
159 #endif
160
161     int i_num_ref_idx_l0_active;
162     int i_num_ref_idx_l1_active;
163
164     int b_weighted_pred;
165     int b_weighted_bipred;
166
167     int i_pic_init_qp;
168     int i_pic_init_qs;
169
170     int i_chroma_qp_index_offset;
171
172     int b_deblocking_filter_control;
173     int b_constrained_intra_pred;
174     int b_redundant_pic_cnt;
175
176     int b_transform_8x8_mode;
177
178     int i_cqm_preset;
179     const uint8_t *scaling_list[6]; /* could be 8, but we don't allow separate Cb/Cr lists */
180
181 } x264_pps_t;
182
183 /* default quant matrices */
184 static const uint8_t x264_cqm_jvt4i[16] =
185 {
186       6,13,20,28,
187      13,20,28,32,
188      20,28,32,37,
189      28,32,37,42
190 };
191 static const uint8_t x264_cqm_jvt4p[16] =
192 {
193     10,14,20,24,
194     14,20,24,27,
195     20,24,27,30,
196     24,27,30,34
197 };
198 static const uint8_t x264_cqm_jvt8i[64] =
199 {
200      6,10,13,16,18,23,25,27,
201     10,11,16,18,23,25,27,29,
202     13,16,18,23,25,27,29,31,
203     16,18,23,25,27,29,31,33,
204     18,23,25,27,29,31,33,36,
205     23,25,27,29,31,33,36,38,
206     25,27,29,31,33,36,38,40,
207     27,29,31,33,36,38,40,42
208 };
209 static const uint8_t x264_cqm_jvt8p[64] =
210 {
211      9,13,15,17,19,21,22,24,
212     13,13,17,19,21,22,24,25,
213     15,17,19,21,22,24,25,27,
214     17,19,21,22,24,25,27,28,
215     19,21,22,24,25,27,28,30,
216     21,22,24,25,27,28,30,32,
217     22,24,25,27,28,30,32,33,
218     24,25,27,28,30,32,33,35
219 };
220 static const uint8_t x264_cqm_flat16[64] =
221 {
222     16,16,16,16,16,16,16,16,
223     16,16,16,16,16,16,16,16,
224     16,16,16,16,16,16,16,16,
225     16,16,16,16,16,16,16,16,
226     16,16,16,16,16,16,16,16,
227     16,16,16,16,16,16,16,16,
228     16,16,16,16,16,16,16,16,
229     16,16,16,16,16,16,16,16
230 };
231
232 void x264_cqm_init( x264_t *h );
233 int  x264_cqm_parse_file( x264_t *h, const char *filename );
234
235 #endif