27 fc(1, obu_forbidden_bit, 0, 0);
30 flag(obu_extension_flag);
31 flag(obu_has_size_field);
33 fc(1, obu_reserved_1bit, 0, 0);
35 if (
current->obu_extension_flag) {
38 fc(3, extension_header_reserved_3bits, 0, 0);
40 infer(temporal_id, 0);
56 fixed(1, trailing_one_bit, 1);
60 fixed(1, trailing_zero_bit, 0);
72 fixed(1, zero_bit, 0);
94 infer(mono_chrome, 0);
99 flag(color_description_present_flag);
100 if (
current->color_description_present_flag) {
103 fb(8, matrix_coefficients);
113 infer(subsampling_x, 1);
114 infer(subsampling_y, 1);
116 infer(separate_uv_delta_q, 0);
122 infer(subsampling_x, 0);
123 infer(subsampling_y, 0);
124 flag(separate_uv_delta_q);
130 infer(subsampling_x, 1);
131 infer(subsampling_y, 1);
133 infer(subsampling_x, 0);
134 infer(subsampling_y, 0);
137 fb(1, subsampling_x);
139 fb(1, subsampling_y);
141 infer(subsampling_y, 0);
143 infer(subsampling_x, 1);
144 infer(subsampling_y, 0);
152 flag(separate_uv_delta_q);
166 flag(equal_picture_interval);
167 if (
current->equal_picture_interval)
178 fb(5, buffer_delay_length_minus_1);
180 fb(5, buffer_removal_time_length_minus_1);
181 fb(5, frame_presentation_time_length_minus_1);
192 HEADER(
"Sequence Header");
199 flag(reduced_still_picture_header);
201 if (
current->reduced_still_picture_header) {
202 infer(timing_info_present_flag, 0);
203 infer(decoder_model_info_present_flag, 0);
204 infer(initial_display_delay_present_flag, 0);
205 infer(operating_points_cnt_minus_1, 0);
206 infer(operating_point_idc[0], 0);
208 fb(5, seq_level_idx[0]);
210 infer(seq_tier[0], 0);
211 infer(decoder_model_present_for_this_op[0], 0);
212 infer(initial_display_delay_present_for_this_op[0], 0);
215 flag(timing_info_present_flag);
216 if (
current->timing_info_present_flag) {
219 flag(decoder_model_info_present_flag);
220 if (
current->decoder_model_info_present_flag) {
225 infer(decoder_model_info_present_flag, 0);
228 flag(initial_display_delay_present_flag);
230 fb(5, operating_points_cnt_minus_1);
231 for (
i = 0;
i <=
current->operating_points_cnt_minus_1;
i++) {
232 fbs(12, operating_point_idc[
i], 1,
i);
233 fbs(5, seq_level_idx[
i], 1,
i);
240 if (
current->decoder_model_info_present_flag) {
241 flags(decoder_model_present_for_this_op[
i], 1,
i);
242 if (
current->decoder_model_present_for_this_op[
i]) {
243 int n =
current->decoder_model_info.buffer_delay_length_minus_1 + 1;
244 fbs(n, decoder_buffer_delay[
i], 1,
i);
245 fbs(n, encoder_buffer_delay[
i], 1,
i);
246 flags(low_delay_mode_flag[
i], 1,
i);
249 infer(decoder_model_present_for_this_op[
i], 0);
252 if (
current->initial_display_delay_present_flag) {
253 flags(initial_display_delay_present_for_this_op[
i], 1,
i);
254 if (
current->initial_display_delay_present_for_this_op[
i])
255 fbs(4, initial_display_delay_minus_1[
i], 1,
i);
260 fb(4, frame_width_bits_minus_1);
261 fb(4, frame_height_bits_minus_1);
263 fb(
current->frame_width_bits_minus_1 + 1, max_frame_width_minus_1);
264 fb(
current->frame_height_bits_minus_1 + 1, max_frame_height_minus_1);
266 if (
current->reduced_still_picture_header)
267 infer(frame_id_numbers_present_flag, 0);
269 flag(frame_id_numbers_present_flag);
270 if (
current->frame_id_numbers_present_flag) {
271 fb(4, delta_frame_id_length_minus_2);
272 fb(3, additional_frame_id_length_minus_1);
275 flag(use_128x128_superblock);
276 flag(enable_filter_intra);
277 flag(enable_intra_edge_filter);
279 if (
current->reduced_still_picture_header) {
280 infer(enable_interintra_compound, 0);
281 infer(enable_masked_compound, 0);
282 infer(enable_warped_motion, 0);
283 infer(enable_dual_filter, 0);
284 infer(enable_order_hint, 0);
285 infer(enable_jnt_comp, 0);
286 infer(enable_ref_frame_mvs, 0);
288 infer(seq_force_screen_content_tools,
290 infer(seq_force_integer_mv,
293 flag(enable_interintra_compound);
294 flag(enable_masked_compound);
295 flag(enable_warped_motion);
296 flag(enable_dual_filter);
298 flag(enable_order_hint);
299 if (
current->enable_order_hint) {
300 flag(enable_jnt_comp);
301 flag(enable_ref_frame_mvs);
303 infer(enable_jnt_comp, 0);
304 infer(enable_ref_frame_mvs, 0);
307 flag(seq_choose_screen_content_tools);
308 if (
current->seq_choose_screen_content_tools)
309 infer(seq_force_screen_content_tools,
312 fb(1, seq_force_screen_content_tools);
313 if (
current->seq_force_screen_content_tools > 0) {
314 flag(seq_choose_integer_mv);
315 if (
current->seq_choose_integer_mv)
316 infer(seq_force_integer_mv,
319 fb(1, seq_force_integer_mv);
324 if (
current->enable_order_hint)
325 fb(3, order_hint_bits_minus_1);
328 flag(enable_superres);
330 flag(enable_restoration);
335 flag(film_grain_params_present);
344 HEADER(
"Temporal Delimiter");
362 int cur_frame_hint, latest_order_hint, earliest_order_hint,
ref;
372 used_frame[
current->last_frame_idx] = 1;
373 used_frame[
current->golden_frame_idx] = 1;
377 shifted_order_hints[
i] = cur_frame_hint +
381 latest_order_hint = shifted_order_hints[
current->last_frame_idx];
382 earliest_order_hint = shifted_order_hints[
current->golden_frame_idx];
386 int hint = shifted_order_hints[
i];
387 if (!used_frame[
i] && hint >= cur_frame_hint &&
388 (ref < 0 || hint >= latest_order_hint)) {
390 latest_order_hint = hint;
400 int hint = shifted_order_hints[
i];
401 if (!used_frame[
i] && hint >= cur_frame_hint &&
402 (
ref < 0 || hint < earliest_order_hint)) {
404 earliest_order_hint = hint;
414 int hint = shifted_order_hints[
i];
415 if (!used_frame[
i] && hint >= cur_frame_hint &&
416 (
ref < 0 || hint < earliest_order_hint)) {
418 earliest_order_hint = hint;
431 int hint = shifted_order_hints[j];
432 if (!used_frame[j] && hint < cur_frame_hint &&
433 (ref < 0 || hint >= latest_order_hint)) {
435 latest_order_hint = hint;
447 int hint = shifted_order_hints[
i];
448 if (
ref < 0 || hint < earliest_order_hint) {
450 earliest_order_hint = hint;
454 if (ref_frame_idx[
i] < 0)
455 ref_frame_idx[
i] =
ref;
456 infer(ref_frame_idx[
i], ref_frame_idx[
i]);
472 infer(use_superres, 0);
495 if (
current->frame_size_override_flag) {
517 flag(render_and_frame_size_different);
519 if (
current->render_and_frame_size_different) {
520 fb(16, render_width_minus_1);
521 fb(16, render_height_minus_1);
523 infer(render_width_minus_1,
current->frame_width_minus_1);
524 infer(render_height_minus_1,
current->frame_height_minus_1);
547 "Missing reference frame needed for frame size "
548 "(ref = %d, ref_frame_idx = %d).\n",
553 infer(frame_width_minus_1,
ref->upscaled_width - 1);
554 infer(frame_height_minus_1,
ref->frame_height - 1);
555 infer(render_width_minus_1,
ref->render_width - 1);
556 infer(render_height_minus_1,
ref->render_height - 1);
582 flag(is_filter_switchable);
583 if (
current->is_filter_switchable)
597 int mi_cols, mi_rows, sb_cols, sb_rows, sb_shift, sb_size;
598 int max_tile_width_sb, max_tile_height_sb, max_tile_area_sb;
599 int min_log2_tile_cols, max_log2_tile_cols, max_log2_tile_rows;
600 int min_log2_tiles, min_log2_tile_rows;
607 : ((mi_cols + 15) >> 4);
609 : ((mi_rows + 15) >> 4);
612 sb_size = sb_shift + 2;
620 min_log2_tiles =
FFMAX(min_log2_tile_cols,
623 flag(uniform_tile_spacing_flag);
625 if (
current->uniform_tile_spacing_flag) {
626 int tile_width_sb, tile_height_sb;
628 increment(tile_cols_log2, min_log2_tile_cols, max_log2_tile_cols);
630 tile_width_sb = (sb_cols + (1 <<
current->tile_cols_log2) - 1) >>
633 for (
int off = 0, j = 0; off < sb_cols; off += tile_width_sb)
634 current->tile_start_col_sb[j++] = off;
636 current->tile_cols = (sb_cols + tile_width_sb - 1) / tile_width_sb;
638 min_log2_tile_rows =
FFMAX(min_log2_tiles -
current->tile_cols_log2, 0);
640 increment(tile_rows_log2, min_log2_tile_rows, max_log2_tile_rows);
642 tile_height_sb = (sb_rows + (1 <<
current->tile_rows_log2) - 1) >>
645 for (
int off = 0, j = 0; off < sb_rows; off += tile_height_sb)
646 current->tile_start_row_sb[j++] = off;
648 current->tile_rows = (sb_rows + tile_height_sb - 1) / tile_height_sb;
652 infer(width_in_sbs_minus_1[
i], tile_width_sb - 1);
653 infer(width_in_sbs_minus_1[
i],
654 sb_cols - (
current->tile_cols - 1) * tile_width_sb - 1);
656 infer(height_in_sbs_minus_1[
i], tile_height_sb - 1);
657 infer(height_in_sbs_minus_1[
i],
658 sb_rows - (
current->tile_rows - 1) * tile_height_sb - 1);
661 int widest_tile_sb, start_sb, size_sb, max_width, max_height,
i;
667 current->tile_start_col_sb[
i] = start_sb;
668 max_width =
FFMIN(sb_cols - start_sb, max_tile_width_sb);
669 ns(max_width, width_in_sbs_minus_1[
i], 1,
i);
670 size_sb =
current->width_in_sbs_minus_1[
i] + 1;
671 widest_tile_sb =
FFMAX(size_sb, widest_tile_sb);
677 if (min_log2_tiles > 0)
678 max_tile_area_sb = (sb_rows * sb_cols) >> (min_log2_tiles + 1);
680 max_tile_area_sb = sb_rows * sb_cols;
681 max_tile_height_sb =
FFMAX(max_tile_area_sb / widest_tile_sb, 1);
685 current->tile_start_row_sb[
i] = start_sb;
686 max_height =
FFMIN(sb_rows - start_sb, max_tile_height_sb);
687 ns(max_height, height_in_sbs_minus_1[
i], 1,
i);
688 size_sb =
current->height_in_sbs_minus_1[
i] + 1;
695 if (
current->tile_cols_log2 > 0 ||
698 context_update_tile_id);
699 fb(2, tile_size_bytes_minus1);
701 infer(context_update_tile_id, 0);
725 infer(diff_uv_delta, 0);
738 infer(delta_q_u_dc, 0);
739 infer(delta_q_u_ac, 0);
740 infer(delta_q_v_dc, 0);
741 infer(delta_q_v_ac, 0);
762 static const uint8_t sign[
AV1_SEG_LVL_MAX] = { 1, 1, 1, 1, 1, 0, 0, 0 };
767 flag(segmentation_enabled);
769 if (
current->segmentation_enabled) {
771 infer(segmentation_update_map, 1);
772 infer(segmentation_temporal_update, 0);
773 infer(segmentation_update_data, 1);
775 flag(segmentation_update_map);
776 if (
current->segmentation_update_map)
777 flag(segmentation_temporal_update);
779 infer(segmentation_temporal_update, 0);
780 flag(segmentation_update_data);
784 const uint8_t *ref_feature_enabled;
785 const int16_t *ref_feature_value;
788 ref_feature_enabled = default_feature_enabled;
789 ref_feature_value = default_feature_value;
791 ref_feature_enabled =
798 if (
current->segmentation_update_data) {
799 flags(feature_enabled[
i][j], 2,
i, j);
803 sus(1 +
bits[j], feature_value[
i][j], 2,
i, j);
805 fbs(
bits[j], feature_value[
i][j], 2,
i, j);
807 infer(feature_value[
i][j], 0);
810 infer(feature_enabled[
i][j], ref_feature_enabled[j]);
811 infer(feature_value[
i][j], ref_feature_value[j]);
818 infer(feature_enabled[
i][j], 0);
819 infer(feature_value[
i][j], 0);
833 flag(delta_q_present);
835 infer(delta_q_present, 0);
848 if (
current->delta_q_present) {
850 flag(delta_lf_present);
852 infer(delta_lf_present, 0);
853 if (
current->delta_lf_present) {
855 flag(delta_lf_multi);
857 infer(delta_lf_res, 0);
858 infer(delta_lf_multi, 0);
861 infer(delta_lf_present, 0);
862 infer(delta_lf_res, 0);
863 infer(delta_lf_multi, 0);
874 { 1, 0, 0, 0, -1, 0, -1, -1 };
875 static const int8_t default_loop_filter_mode_deltas[2] = { 0, 0 };
879 infer(loop_filter_level[0], 0);
880 infer(loop_filter_level[1], 0);
889 for (
i = 0;
i < 2;
i++)
890 infer(loop_filter_mode_deltas[
i], 0);
894 fb(6, loop_filter_level[0]);
895 fb(6, loop_filter_level[1]);
898 if (
current->loop_filter_level[0] ||
899 current->loop_filter_level[1]) {
900 fb(6, loop_filter_level[2]);
901 fb(6, loop_filter_level[3]);
905 fb(3, loop_filter_sharpness);
907 flag(loop_filter_delta_enabled);
908 if (
current->loop_filter_delta_enabled) {
909 const int8_t *ref_loop_filter_ref_deltas, *ref_loop_filter_mode_deltas;
912 ref_loop_filter_ref_deltas = default_loop_filter_ref_deltas;
913 ref_loop_filter_mode_deltas = default_loop_filter_mode_deltas;
915 ref_loop_filter_ref_deltas =
917 ref_loop_filter_mode_deltas =
921 flag(loop_filter_delta_update);
923 if (
current->loop_filter_delta_update)
924 flags(update_ref_delta[
i], 1,
i);
926 infer(update_ref_delta[
i], 0);
928 sus(1 + 6, loop_filter_ref_deltas[
i], 1,
i);
930 infer(loop_filter_ref_deltas[
i], ref_loop_filter_ref_deltas[
i]);
932 for (
i = 0;
i < 2;
i++) {
933 if (
current->loop_filter_delta_update)
934 flags(update_mode_delta[
i], 1,
i);
936 infer(update_mode_delta[
i], 0);
938 sus(1 + 6, loop_filter_mode_deltas[
i], 1,
i);
940 infer(loop_filter_mode_deltas[
i], ref_loop_filter_mode_deltas[
i]);
944 infer(loop_filter_ref_deltas[
i], default_loop_filter_ref_deltas[
i]);
945 for (
i = 0;
i < 2;
i++)
946 infer(loop_filter_mode_deltas[
i], default_loop_filter_mode_deltas[
i]);
961 infer(cdef_damping_minus_3, 0);
963 infer(cdef_y_pri_strength[0], 0);
964 infer(cdef_y_sec_strength[0], 0);
965 infer(cdef_uv_pri_strength[0], 0);
966 infer(cdef_uv_sec_strength[0], 0);
971 fb(2, cdef_damping_minus_3);
974 for (
i = 0;
i < (1 <<
current->cdef_bits);
i++) {
975 fbs(4, cdef_y_pri_strength[
i], 1,
i);
976 fbs(2, cdef_y_sec_strength[
i], 1,
i);
979 fbs(4, cdef_uv_pri_strength[
i], 1,
i);
980 fbs(2, cdef_uv_sec_strength[
i], 1,
i);
992 int uses_lr, uses_chroma_lr;
1000 uses_lr = uses_chroma_lr = 0;
1002 fbs(2, lr_type[
i], 1,
i);
1021 infer(lr_uv_shift, 0);
1049 infer(reference_select, 0);
1051 flag(reference_select);
1061 int skip_mode_allowed;
1067 skip_mode_allowed = 0;
1069 int forward_idx, backward_idx;
1070 int forward_hint, backward_hint;
1071 int ref_hint, dist,
i;
1080 if (forward_idx < 0 ||
1082 forward_hint) > 0) {
1084 forward_hint = ref_hint;
1086 }
else if (dist > 0) {
1087 if (backward_idx < 0 ||
1089 backward_hint) < 0) {
1091 backward_hint = ref_hint;
1096 if (forward_idx < 0) {
1097 skip_mode_allowed = 0;
1098 }
else if (backward_idx >= 0) {
1099 skip_mode_allowed = 1;
1102 int second_forward_idx;
1103 int second_forward_hint;
1105 second_forward_idx = -1;
1109 forward_hint) < 0) {
1110 if (second_forward_idx < 0 ||
1112 second_forward_hint) > 0) {
1113 second_forward_idx =
i;
1114 second_forward_hint = ref_hint;
1119 if (second_forward_idx < 0) {
1120 skip_mode_allowed = 0;
1122 skip_mode_allowed = 1;
1128 if (skip_mode_allowed)
1129 flag(skip_mode_present);
1131 infer(skip_mode_present, 0);
1140 uint32_t abs_bits, prec_bits, num_syms;
1156 num_syms = 2 * (1 << abs_bits) + 1;
1216 int num_pos_luma, num_pos_chroma;
1233 infer(update_grain, 1);
1236 fb(3, film_grain_params_ref_idx);
1240 fc(4, num_y_points, 0, 14);
1241 for (
i = 0;
i <
current->num_y_points;
i++) {
1242 fcs(8, point_y_value[
i],
1243 i ?
current->point_y_value[
i - 1] + 1 : 0,
1246 fbs(8, point_y_scaling[
i], 1,
i);
1250 infer(chroma_scaling_from_luma, 0);
1252 flag(chroma_scaling_from_luma);
1255 current->chroma_scaling_from_luma ||
1258 current->num_y_points == 0)) {
1259 infer(num_cb_points, 0);
1260 infer(num_cr_points, 0);
1262 fc(4, num_cb_points, 0, 10);
1263 for (
i = 0;
i <
current->num_cb_points;
i++) {
1264 fcs(8, point_cb_value[
i],
1265 i ?
current->point_cb_value[
i - 1] + 1 : 0,
1268 fbs(8, point_cb_scaling[
i], 1,
i);
1270 fc(4, num_cr_points, 0, 10);
1271 for (
i = 0;
i <
current->num_cr_points;
i++) {
1272 fcs(8, point_cr_value[
i],
1273 i ?
current->point_cr_value[
i - 1] + 1 : 0,
1276 fbs(8, point_cr_scaling[
i], 1,
i);
1280 fb(2, grain_scaling_minus_8);
1281 fb(2, ar_coeff_lag);
1282 num_pos_luma = 2 *
current->ar_coeff_lag * (
current->ar_coeff_lag + 1);
1284 num_pos_chroma = num_pos_luma + 1;
1285 for (
i = 0;
i < num_pos_luma;
i++)
1286 fbs(8, ar_coeffs_y_plus_128[
i], 1,
i);
1288 num_pos_chroma = num_pos_luma;
1290 if (
current->chroma_scaling_from_luma ||
current->num_cb_points) {
1291 for (
i = 0;
i < num_pos_chroma;
i++)
1292 fbs(8, ar_coeffs_cb_plus_128[
i], 1,
i);
1294 if (
current->chroma_scaling_from_luma ||
current->num_cr_points) {
1295 for (
i = 0;
i < num_pos_chroma;
i++)
1296 fbs(8, ar_coeffs_cr_plus_128[
i], 1,
i);
1298 fb(2, ar_coeff_shift_minus_6);
1299 fb(2, grain_scale_shift);
1302 fb(8, cb_luma_mult);
1307 fb(8, cr_luma_mult);
1312 flag(clip_to_restricted_range);
1322 int id_len, diff_len, all_frames, frame_is_intra, order_hint_bits;
1327 "unable to decode frame header.\n");
1337 infer(show_existing_frame, 0);
1340 infer(showable_frame, 0);
1344 flag(show_existing_frame);
1346 if (
current->show_existing_frame) {
1349 fb(3, frame_to_show_map_idx);
1354 "show_existing_frame (frame_to_show_map_idx = %d).\n",
1355 current->frame_to_show_map_idx);
1362 frame_presentation_time);
1366 fb(id_len, display_frame_id);
1370 infer(refresh_frame_flags, all_frames);
1373 infer(current_frame_id,
ref->frame_id);
1383 sizeof(
ref->loop_filter_ref_deltas));
1385 sizeof(
ref->loop_filter_mode_deltas));
1387 sizeof(
ref->feature_enabled));
1389 sizeof(
ref->feature_value));
1391 infer(refresh_frame_flags, 0);
1393 infer(frame_width_minus_1,
ref->upscaled_width - 1);
1394 infer(frame_height_minus_1,
ref->frame_height - 1);
1395 infer(render_width_minus_1,
ref->render_width - 1);
1396 infer(render_height_minus_1,
ref->render_height - 1);
1411 frame_presentation_time);
1416 flag(showable_frame);
1420 infer(error_resilient_mode, 1);
1422 flag(error_resilient_mode);
1434 flag(disable_cdf_update);
1438 flag(allow_screen_content_tools);
1440 infer(allow_screen_content_tools,
1443 if (
current->allow_screen_content_tools) {
1445 flag(force_integer_mv);
1449 infer(force_integer_mv, 0);
1453 fb(id_len, current_frame_id);
1457 if (
current->current_frame_id > (1 << diff_len)) {
1471 infer(current_frame_id, 0);
1475 infer(frame_size_override_flag, 1);
1477 infer(frame_size_override_flag, 0);
1479 flag(frame_size_override_flag);
1483 if (order_hint_bits > 0)
1484 fb(order_hint_bits, order_hint);
1486 infer(order_hint, 0);
1489 if (frame_is_intra ||
current->error_resilient_mode)
1492 fb(3, primary_ref_frame);
1495 flag(buffer_removal_time_present_flag);
1496 if (
current->buffer_removal_time_present_flag) {
1500 int in_temporal_layer = (op_pt_idc >> priv->
temporal_id ) & 1;
1501 int in_spatial_layer = (op_pt_idc >> (priv->
spatial_id + 8)) & 1;
1503 (in_temporal_layer && in_spatial_layer)) {
1505 buffer_removal_time[
i], 1,
i);
1514 infer(refresh_frame_flags, all_frames);
1516 fb(8, refresh_frame_flags);
1518 if (!frame_is_intra ||
current->refresh_frame_flags != all_frames) {
1521 if (
current->error_resilient_mode)
1522 fbs(order_hint_bits, ref_order_hint[
i], 1,
i);
1536 if (
current->allow_screen_content_tools &&
1538 flag(allow_intrabc);
1540 infer(allow_intrabc, 0);
1544 infer(frame_refs_short_signaling, 0);
1546 flag(frame_refs_short_signaling);
1547 if (
current->frame_refs_short_signaling) {
1548 fb(3, last_frame_idx);
1549 fb(3, golden_frame_idx);
1555 if (!
current->frame_refs_short_signaling)
1556 fbs(3, ref_frame_idx[
i], 1,
i);
1559 delta_frame_id_minus1[
i], 1,
i);
1563 if (
current->frame_size_override_flag &&
1564 !
current->error_resilient_mode) {
1571 if (
current->force_integer_mv)
1572 infer(allow_high_precision_mv, 0);
1574 flag(allow_high_precision_mv);
1578 flag(is_motion_mode_switchable);
1580 if (
current->error_resilient_mode ||
1582 infer(use_ref_frame_mvs, 0);
1584 flag(use_ref_frame_mvs);
1599 infer(allow_intrabc, 0);
1603 infer(disable_frame_end_update_cdf, 1);
1605 flag(disable_frame_end_update_cdf);
1615 if (
current->use_ref_frame_mvs) {
1635 qindex = (
current->base_q_idx +
1642 if (qindex ||
current->delta_q_y_dc ||
1663 if (frame_is_intra ||
current->error_resilient_mode ||
1665 infer(allow_warped_motion, 0);
1667 flag(allow_warped_motion);
1669 flag(reduced_tx_set);
1676 "upscaled %d render %dx%d subsample %dx%d "
1677 "bitdepth %d tiles %dx%d.\n", priv->
order_hint,
1686 if (
current->refresh_frame_flags & (1 <<
i)) {
1689 .frame_id =
current->current_frame_id,
1695 .frame_type =
current->frame_type,
1707 if (
current->show_existing_frame) {
1718 sizeof(
current->loop_filter_ref_deltas));
1720 sizeof(
current->loop_filter_mode_deltas));
1722 sizeof(
current->feature_enabled));
1724 sizeof(
current->feature_value));
1737 int start_pos, fh_bits, fh_bytes, err;
1743 "frame header OBU.\n");
1750 HEADER(
"Redundant Frame Header");
1759 xf(
b, frame_header_copy[
i],
1766 HEADER(
"Redundant Frame Header (used as Frame Header)");
1770 "frame header OBU.\n");
1787 if (
current->show_existing_frame) {
1796 fh_start = (uint8_t*)rw->buffer + start_pos / 8;
1806 fh_start = rw->buf + start_pos / 8;
1808 fh_bytes = (fh_bits + 7) / 8;
1812 if (rw_buffer_ref) {
1835 int num_tiles, tile_bits;
1842 flag(tile_start_and_end_present_flag);
1844 infer(tile_start_and_end_present_flag, 0);
1846 if (num_tiles == 1 || !
current->tile_start_and_end_present_flag) {
1848 infer(tg_end, num_tiles - 1);
1852 fc(tile_bits, tg_start, priv->
tile_num, num_tiles - 1);
1853 fc(tile_bits, tg_end,
current->tg_start, num_tiles - 1);
1861 if (
current->tg_end == num_tiles - 1)
1883 #if CBS_AV1_OBU_TILE_LIST
1889 fb(8, output_frame_width_in_tiles_minus_1);
1890 fb(8, output_frame_height_in_tiles_minus_1);
1892 fb(16, tile_count_minus_1);
1900 #if CBS_AV1_OBU_METADATA
1906 HEADER(
"HDR CLL Metadata");
1919 HEADER(
"HDR MDCV Metadata");
1921 for (
i = 0;
i < 3;
i++) {
1922 fbs(16, primary_chromaticity_x[
i], 1,
i);
1923 fbs(16, primary_chromaticity_y[
i], 1,
i);
1926 fb(16, white_point_chromaticity_x);
1927 fb(16, white_point_chromaticity_y);
1929 fb(32, luminance_max);
1930 fb(32, luminance_min);
1944 "unable to parse scalability metadata.\n");
1949 fb(2, spatial_layers_cnt_minus_1);
1950 flag(spatial_layer_dimensions_present_flag);
1951 flag(spatial_layer_description_present_flag);
1952 flag(temporal_group_description_present_flag);
1953 fc(3, scalability_structure_reserved_3bits, 0, 0);
1954 if (
current->spatial_layer_dimensions_present_flag) {
1955 for (
i = 0;
i <=
current->spatial_layers_cnt_minus_1;
i++) {
1956 fcs(16, spatial_layer_max_width[
i],
1958 fcs(16, spatial_layer_max_height[
i],
1962 if (
current->spatial_layer_description_present_flag) {
1963 for (
i = 0;
i <=
current->spatial_layers_cnt_minus_1;
i++)
1964 fbs(8, spatial_layer_ref_id[
i], 1,
i);
1966 if (
current->temporal_group_description_present_flag) {
1967 fb(8, temporal_group_size);
1968 for (
i = 0;
i <
current->temporal_group_size;
i++) {
1969 fbs(3, temporal_group_temporal_id[
i], 1,
i);
1970 flags(temporal_group_temporal_switching_up_point_flag[
i], 1,
i);
1971 flags(temporal_group_spatial_switching_up_point_flag[
i], 1,
i);
1972 fbs(3, temporal_group_ref_cnt[
i], 1,
i);
1973 for (j = 0; j <
current->temporal_group_ref_cnt[
i]; j++) {
1974 fbs(8, temporal_group_ref_pic_diff[
i][j], 2,
i, j);
1987 HEADER(
"Scalability Metadata");
1989 fb(8, scalability_mode_idc);
2003 HEADER(
"ITU-T T.35 Metadata");
2005 fb(8, itu_t_t35_country_code);
2006 if (
current->itu_t_t35_country_code == 0xff)
2007 fb(8, itu_t_t35_country_code_extension_byte);
2021 xf(8, itu_t_t35_payload_bytes[
i],
current->payload[
i],
2032 HEADER(
"Timecode Metadata");
2034 fb(5, counting_type);
2035 flag(full_timestamp_flag);
2036 flag(discontinuity_flag);
2037 flag(cnt_dropped_flag);
2040 if (
current->full_timestamp_flag) {
2041 fc(6, seconds_value, 0, 59);
2042 fc(6, minutes_value, 0, 59);
2043 fc(5, hours_value, 0, 23);
2047 fc(6, seconds_value, 0, 59);
2050 fc(6, minutes_value, 0, 59);
2053 fc(5, hours_value, 0, 23);
2058 fb(5, time_offset_length);
2059 if (
current->time_offset_length > 0)
2060 fb(
current->time_offset_length, time_offset_value);
2062 infer(time_offset_length, 0);
2073 HEADER(
"Unknown Metadata");
2085 fbs(8, payload[
i], 1,
i);
2097 switch (
current->metadata_type) {
2121 #if CBS_AV1_OBU_PADDING
2141 xf(8, obu_padding_byte[
i],
current->payload[
i], 0x00, 0xff, 1,
i);