27 ui(8, sequence_header_code);
29 uir(12, horizontal_size_value);
30 uir(12, vertical_size_value);
35 uir(4, aspect_ratio_information);
36 uir(4, frame_rate_code);
37 ui(18, bit_rate_value);
41 ui(10, vbv_buffer_size_value);
42 ui(1, constrained_parameters_flag);
44 ui(1, load_intra_quantiser_matrix);
45 if (current->load_intra_quantiser_matrix) {
46 for (
i = 0;
i < 64;
i++)
47 uirs(8, intra_quantiser_matrix[
i], 1,
i);
50 ui(1, load_non_intra_quantiser_matrix);
51 if (current->load_non_intra_quantiser_matrix) {
52 for (
i = 0;
i < 64;
i++)
53 uirs(8, non_intra_quantiser_matrix[
i], 1,
i);
67 ui(8, user_data_start_code);
72 current->user_data_length = k /= 8;
75 if (!current->user_data_ref)
77 current->user_data = current->user_data_ref->data;
81 for (k = 0; k < current->user_data_length; k++)
93 HEADER(
"Sequence Extension");
95 ui(8, profile_and_level_indication);
96 ui(1, progressive_sequence);
98 ui(2, horizontal_size_extension);
99 ui(2, vertical_size_extension);
102 current->horizontal_size_extension << 12;
104 current->vertical_size_extension << 12;
107 ui(12, bit_rate_extension);
109 ui(8, vbv_buffer_size_extension);
111 ui(2, frame_rate_extension_n);
112 ui(5, frame_rate_extension_d);
122 HEADER(
"Sequence Display Extension");
126 ui(1, colour_description);
127 if (current->colour_description) {
129 #define READ_AND_PATCH(name) do { \
131 if (current->name == 0) { \
133 av_log(ctx->log_ctx, AV_LOG_WARNING, "%s in a sequence display " \
134 "extension had the invalid value 0. Setting it to 2 " \
135 "(meaning unknown) instead.\n", #name); \
138 READ_AND_PATCH(colour_primaries);
140 READ_AND_PATCH(matrix_coefficients);
141 #undef READ_AND_PATCH
143 uir(8, colour_primaries);
145 uir(8, matrix_coefficients);
148 infer(colour_primaries, 2);
150 infer(matrix_coefficients, 2);
153 ui(14, display_horizontal_size);
155 ui(14, display_vertical_size);
165 HEADER(
"Group of Pictures Header");
167 ui(8, group_start_code);
178 const char *element_name,
const char *marker_name)
188 current->extra_information_length = k;
191 current->extra_information_ref =
193 if (!current->extra_information_ref)
195 current->extra_information = current->extra_information_ref->data;
199 for (k = 0; k < current->extra_information_length; k++) {
201 xuia(8, element_name,
202 current->extra_information[k], 0, 255, 1, k);
217 ui(8, picture_start_code);
219 ui(10, temporal_reference);
220 uir(3, picture_coding_type);
223 if (current->picture_coding_type == 2 ||
224 current->picture_coding_type == 3) {
225 ui(1, full_pel_forward_vector);
226 ui(3, forward_f_code);
229 if (current->picture_coding_type == 3) {
230 ui(1, full_pel_backward_vector);
231 ui(3, backward_f_code);
235 "extra_information_picture[k]",
"extra_bit_picture"));
246 HEADER(
"Picture Coding Extension");
248 uir(4, f_code[0][0]);
249 uir(4, f_code[0][1]);
250 uir(4, f_code[1][0]);
251 uir(4, f_code[1][1]);
253 ui(2, intra_dc_precision);
254 ui(2, picture_structure);
255 ui(1, top_field_first);
256 ui(1, frame_pred_frame_dct);
257 ui(1, concealment_motion_vectors);
259 ui(1, intra_vlc_format);
260 ui(1, alternate_scan);
261 ui(1, repeat_first_field);
262 ui(1, chroma_420_type);
263 ui(1, progressive_frame);
266 if (current->repeat_first_field) {
267 if (current->top_field_first)
275 if (current->picture_structure == 1 ||
276 current->picture_structure == 2) {
279 if (current->repeat_first_field)
286 ui(1, composite_display_flag);
287 if (current->composite_display_flag) {
289 ui(3, field_sequence);
291 ui(7, burst_amplitude);
292 ui(8, sub_carrier_phase);
303 HEADER(
"Quant Matrix Extension");
305 ui(1, load_intra_quantiser_matrix);
306 if (current->load_intra_quantiser_matrix) {
307 for (
i = 0;
i < 64;
i++)
308 uirs(8, intra_quantiser_matrix[
i], 1,
i);
311 ui(1, load_non_intra_quantiser_matrix);
312 if (current->load_non_intra_quantiser_matrix) {
313 for (
i = 0;
i < 64;
i++)
314 uirs(8, non_intra_quantiser_matrix[
i], 1,
i);
317 ui(1, load_chroma_intra_quantiser_matrix);
318 if (current->load_chroma_intra_quantiser_matrix) {
319 for (
i = 0;
i < 64;
i++)
320 uirs(8, intra_quantiser_matrix[
i], 1,
i);
323 ui(1, load_chroma_non_intra_quantiser_matrix);
324 if (current->load_chroma_non_intra_quantiser_matrix) {
325 for (
i = 0;
i < 64;
i++)
326 uirs(8, chroma_non_intra_quantiser_matrix[
i], 1,
i);
338 HEADER(
"Picture Display Extension");
341 sis(16, frame_centre_horizontal_offset[
i], 1,
i);
343 sis(16, frame_centre_vertical_offset[
i], 1,
i);
357 ui(8, extension_start_code);
358 ui(4, extension_start_code_identifier);
360 switch (current->extension_start_code_identifier) {
363 (
ctx, rw, ¤t->data.sequence);
366 (
ctx, rw, ¤t->data.sequence_display);
369 (
ctx, rw, ¤t->data.quant_matrix);
372 (
ctx, rw, ¤t->data.picture_display);
375 (
ctx, rw, ¤t->data.picture_coding);
378 current->extension_start_code_identifier);
391 ui(8, slice_vertical_position);
394 ui(3, slice_vertical_position_extension);
397 ui(7, priority_breakpoint);
400 uir(5, quantiser_scale_code);
402 if (
nextbits(1, 1, current->slice_extension_flag)) {
403 ui(1, slice_extension_flag);
405 ui(1, slice_picture_id_enable);
406 ui(6, slice_picture_id);
410 "extra_information_slice[k]",
"extra_bit_slice"));
422 ui(8, sequence_end_code);