diff options
author | trav90 <travawine@palemoon.org> | 2018-10-19 23:00:02 -0500 |
---|---|---|
committer | trav90 <travawine@palemoon.org> | 2018-10-19 23:00:02 -0500 |
commit | b8df135c97a854c2ff9b4394b016649c601177fa (patch) | |
tree | 802b7de5ad245f1a12adbcef835ab0d0687c1bf8 /third_party/aom/av1/encoder/bitstream.c | |
parent | a4d3c59dcac642f6b9557dc09b60eda40b517630 (diff) | |
download | UXP-b8df135c97a854c2ff9b4394b016649c601177fa.tar UXP-b8df135c97a854c2ff9b4394b016649c601177fa.tar.gz UXP-b8df135c97a854c2ff9b4394b016649c601177fa.tar.lz UXP-b8df135c97a854c2ff9b4394b016649c601177fa.tar.xz UXP-b8df135c97a854c2ff9b4394b016649c601177fa.zip |
Update libaom to rev b25610052a1398032320008d69b51d2da94f5928
Diffstat (limited to 'third_party/aom/av1/encoder/bitstream.c')
-rw-r--r-- | third_party/aom/av1/encoder/bitstream.c | 232 |
1 files changed, 124 insertions, 108 deletions
diff --git a/third_party/aom/av1/encoder/bitstream.c b/third_party/aom/av1/encoder/bitstream.c index cdd7c2492..2070755cd 100644 --- a/third_party/aom/av1/encoder/bitstream.c +++ b/third_party/aom/av1/encoder/bitstream.c @@ -769,7 +769,7 @@ static void write_palette_mode_info(const AV1_COMMON *cm, const MACROBLOCKD *xd, aom_write_symbol(w, n - PALETTE_MIN_SIZE, xd->tile_ctx->palette_y_size_cdf[bsize_ctx], PALETTE_SIZES); - write_palette_colors_y(xd, pmi, cm->bit_depth, w); + write_palette_colors_y(xd, pmi, cm->seq_params.bit_depth, w); } } @@ -786,7 +786,7 @@ static void write_palette_mode_info(const AV1_COMMON *cm, const MACROBLOCKD *xd, aom_write_symbol(w, n - PALETTE_MIN_SIZE, xd->tile_ctx->palette_uv_size_cdf[bsize_ctx], PALETTE_SIZES); - write_palette_colors_uv(xd, pmi, cm->bit_depth, w); + write_palette_colors_uv(xd, pmi, cm->seq_params.bit_depth, w); } } } @@ -1421,8 +1421,8 @@ static void write_inter_txb_coeff(AV1_COMMON *const cm, MACROBLOCK *const x, for (blk_col = col >> pd->subsampling_x; blk_col < unit_width; blk_col += bkw) { pack_txb_tokens(w, cm, x, tok, tok_end, xd, mbmi, plane, plane_bsize, - cm->bit_depth, *block, blk_row, blk_col, max_tx_size, - token_stats); + cm->seq_params.bit_depth, *block, blk_row, blk_col, + max_tx_size, token_stats); *block += step; } } @@ -1612,14 +1612,13 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile, const int num_planes = av1_num_planes(cm); for (int plane = 0; plane < num_planes; ++plane) { - int rcol0, rcol1, rrow0, rrow1, tile_tl_idx; + int rcol0, rcol1, rrow0, rrow1; if (av1_loop_restoration_corners_in_sb(cm, plane, mi_row, mi_col, bsize, - &rcol0, &rcol1, &rrow0, &rrow1, - &tile_tl_idx)) { + &rcol0, &rcol1, &rrow0, &rrow1)) { const int rstride = cm->rst_info[plane].horz_units_per_tile; for (int rrow = rrow0; rrow < rrow1; ++rrow) { for (int rcol = rcol0; rcol < rcol1; ++rcol) { - const int runit_idx = tile_tl_idx + rcol + rrow * rstride; + const int runit_idx = rcol + rrow * rstride; const RestorationUnitInfo *rui = &cm->rst_info[plane].unit_info[runit_idx]; loop_restoration_write_sb_coeffs(cm, xd, rui, w, plane, @@ -1705,7 +1704,7 @@ static void write_modes(AV1_COMP *const cpi, const TileInfo *const tile, const int mi_col_end = tile->mi_col_end; int mi_row, mi_col; - av1_zero_above_context(cm, mi_col_start, mi_col_end, tile->tile_row); + av1_zero_above_context(cm, xd, mi_col_start, mi_col_end, tile->tile_row); av1_init_above_context(cm, xd, tile->tile_row); if (cpi->common.delta_q_present_flag) { @@ -1779,7 +1778,7 @@ static void encode_restoration_mode(AV1_COMMON *cm, } if (num_planes > 1) { - int s = AOMMIN(cm->subsampling_x, cm->subsampling_y); + int s = AOMMIN(cm->seq_params.subsampling_x, cm->seq_params.subsampling_y); if (s && !chroma_none) { aom_wb_write_bit(wb, cm->rst_info[1].restoration_unit_size != cm->rst_info[0].restoration_unit_size); @@ -2020,7 +2019,7 @@ static void encode_quantization(const AV1_COMMON *const cm, if (num_planes > 1) { int diff_uv_delta = (cm->u_dc_delta_q != cm->v_dc_delta_q) || (cm->u_ac_delta_q != cm->v_ac_delta_q); - if (cm->separate_uv_delta_q) aom_wb_write_bit(wb, diff_uv_delta); + if (cm->seq_params.separate_uv_delta_q) aom_wb_write_bit(wb, diff_uv_delta); write_delta_q(wb, cm->u_dc_delta_q); write_delta_q(wb, cm->u_ac_delta_q); if (diff_uv_delta) { @@ -2032,7 +2031,7 @@ static void encode_quantization(const AV1_COMMON *const cm, if (cm->using_qmatrix) { aom_wb_write_literal(wb, cm->qm_y, QM_LEVEL_BITS); aom_wb_write_literal(wb, cm->qm_u, QM_LEVEL_BITS); - if (!cm->separate_uv_delta_q) + if (!cm->seq_params.separate_uv_delta_q) assert(cm->qm_u == cm->qm_v); else aom_wb_write_literal(wb, cm->qm_v, QM_LEVEL_BITS); @@ -2240,7 +2239,8 @@ static int get_refresh_mask_gf16(AV1_COMP *cpi) { #endif // USE_GF16_MULTI_LAYER static int get_refresh_mask(AV1_COMP *cpi) { - if (cpi->common.frame_type == KEY_FRAME || frame_is_sframe(&cpi->common)) + if ((cpi->common.frame_type == KEY_FRAME && cpi->common.show_frame) || + frame_is_sframe(&cpi->common)) return 0xFF; int refresh_mask = 0; @@ -2258,9 +2258,15 @@ static int get_refresh_mask(AV1_COMP *cpi) { // LAST3_FRAME. refresh_mask |= (cpi->refresh_last_frame << cpi->ref_fb_idx[LAST_REF_FRAMES - 1]); - +#if USE_SYMM_MULTI_LAYER + refresh_mask |= + (cpi->new_bwdref_update_rule == 1) + ? (cpi->refresh_bwd_ref_frame << cpi->ref_fb_idx[EXTREF_FRAME - 1]) + : (cpi->refresh_bwd_ref_frame << cpi->ref_fb_idx[BWDREF_FRAME - 1]); +#else refresh_mask |= (cpi->refresh_bwd_ref_frame << cpi->ref_fb_idx[BWDREF_FRAME - 1]); +#endif refresh_mask |= (cpi->refresh_alt2_ref_frame << cpi->ref_fb_idx[ALTREF2_FRAME - 1]); @@ -2419,80 +2425,82 @@ static void write_profile(BITSTREAM_PROFILE profile, aom_wb_write_literal(wb, profile, PROFILE_BITS); } -static void write_bitdepth(AV1_COMMON *const cm, +static void write_bitdepth(const SequenceHeader *const seq_params, struct aom_write_bit_buffer *wb) { // Profile 0/1: [0] for 8 bit, [1] 10-bit // Profile 2: [0] for 8 bit, [10] 10-bit, [11] - 12-bit - aom_wb_write_bit(wb, cm->bit_depth == AOM_BITS_8 ? 0 : 1); - if (cm->profile == PROFILE_2 && cm->bit_depth != AOM_BITS_8) { - aom_wb_write_bit(wb, cm->bit_depth == AOM_BITS_10 ? 0 : 1); + aom_wb_write_bit(wb, seq_params->bit_depth == AOM_BITS_8 ? 0 : 1); + if (seq_params->profile == PROFILE_2 && seq_params->bit_depth != AOM_BITS_8) { + aom_wb_write_bit(wb, seq_params->bit_depth == AOM_BITS_10 ? 0 : 1); } } -static void write_color_config(AV1_COMMON *const cm, +static void write_color_config(const SequenceHeader *const seq_params, struct aom_write_bit_buffer *wb) { - write_bitdepth(cm, wb); - const int is_monochrome = cm->seq_params.monochrome; + write_bitdepth(seq_params, wb); + const int is_monochrome = seq_params->monochrome; // monochrome bit - if (cm->profile != PROFILE_1) + if (seq_params->profile != PROFILE_1) aom_wb_write_bit(wb, is_monochrome); else assert(!is_monochrome); - if (cm->color_primaries == AOM_CICP_CP_UNSPECIFIED && - cm->transfer_characteristics == AOM_CICP_TC_UNSPECIFIED && - cm->matrix_coefficients == AOM_CICP_MC_UNSPECIFIED) { + if (seq_params->color_primaries == AOM_CICP_CP_UNSPECIFIED && + seq_params->transfer_characteristics == AOM_CICP_TC_UNSPECIFIED && + seq_params->matrix_coefficients == AOM_CICP_MC_UNSPECIFIED) { aom_wb_write_bit(wb, 0); // No color description present } else { aom_wb_write_bit(wb, 1); // Color description present - aom_wb_write_literal(wb, cm->color_primaries, 8); - aom_wb_write_literal(wb, cm->transfer_characteristics, 8); - aom_wb_write_literal(wb, cm->matrix_coefficients, 8); + aom_wb_write_literal(wb, seq_params->color_primaries, 8); + aom_wb_write_literal(wb, seq_params->transfer_characteristics, 8); + aom_wb_write_literal(wb, seq_params->matrix_coefficients, 8); } if (is_monochrome) { // 0: [16, 235] (i.e. xvYCC), 1: [0, 255] - aom_wb_write_bit(wb, cm->color_range); + aom_wb_write_bit(wb, seq_params->color_range); return; } - if (cm->color_primaries == AOM_CICP_CP_BT_709 && - cm->transfer_characteristics == AOM_CICP_TC_SRGB && - cm->matrix_coefficients == + if (seq_params->color_primaries == AOM_CICP_CP_BT_709 && + seq_params->transfer_characteristics == AOM_CICP_TC_SRGB && + seq_params->matrix_coefficients == AOM_CICP_MC_IDENTITY) { // it would be better to remove this // dependency too - assert(cm->subsampling_x == 0 && cm->subsampling_y == 0); - assert(cm->profile == PROFILE_1 || - (cm->profile == PROFILE_2 && cm->bit_depth == AOM_BITS_12)); + assert(seq_params->subsampling_x == 0 && seq_params->subsampling_y == 0); + assert(seq_params->profile == PROFILE_1 || + (seq_params->profile == PROFILE_2 && + seq_params->bit_depth == AOM_BITS_12)); } else { // 0: [16, 235] (i.e. xvYCC), 1: [0, 255] - aom_wb_write_bit(wb, cm->color_range); - if (cm->profile == PROFILE_0) { + aom_wb_write_bit(wb, seq_params->color_range); + if (seq_params->profile == PROFILE_0) { // 420 only - assert(cm->subsampling_x == 1 && cm->subsampling_y == 1); - } else if (cm->profile == PROFILE_1) { + assert(seq_params->subsampling_x == 1 && seq_params->subsampling_y == 1); + } else if (seq_params->profile == PROFILE_1) { // 444 only - assert(cm->subsampling_x == 0 && cm->subsampling_y == 0); - } else if (cm->profile == PROFILE_2) { - if (cm->bit_depth == AOM_BITS_12) { + assert(seq_params->subsampling_x == 0 && seq_params->subsampling_y == 0); + } else if (seq_params->profile == PROFILE_2) { + if (seq_params->bit_depth == AOM_BITS_12) { // 420, 444 or 422 - aom_wb_write_bit(wb, cm->subsampling_x); - if (cm->subsampling_x == 0) { - assert(cm->subsampling_y == 0 && + aom_wb_write_bit(wb, seq_params->subsampling_x); + if (seq_params->subsampling_x == 0) { + assert(seq_params->subsampling_y == 0 && "4:4:0 subsampling not allowed in AV1"); } else { - aom_wb_write_bit(wb, cm->subsampling_y); + aom_wb_write_bit(wb, seq_params->subsampling_y); } } else { // 422 only - assert(cm->subsampling_x == 1 && cm->subsampling_y == 0); + assert(seq_params->subsampling_x == 1 && + seq_params->subsampling_y == 0); } } - if (cm->matrix_coefficients == AOM_CICP_MC_IDENTITY) { - assert(cm->subsampling_x == 0 && cm->subsampling_y == 0); + if (seq_params->matrix_coefficients == AOM_CICP_MC_IDENTITY) { + assert(seq_params->subsampling_x == 0 && seq_params->subsampling_y == 0); } - if (cm->subsampling_x == 1 && cm->subsampling_y == 1) { - aom_wb_write_literal(wb, cm->chroma_sample_position, 2); + if (seq_params->subsampling_x == 1 && seq_params->subsampling_y == 1) { + aom_wb_write_literal(wb, seq_params->chroma_sample_position, 2); } } - aom_wb_write_bit(wb, cm->separate_uv_delta_q); + aom_wb_write_bit(wb, seq_params->separate_uv_delta_q); } static void write_timing_info_header(AV1_COMMON *const cm, @@ -2517,8 +2525,8 @@ static void write_decoder_model_info(AV1_COMMON *const cm, wb, cm->buffer_model.encoder_decoder_buffer_delay_length - 1, 5); aom_wb_write_unsigned_literal(wb, cm->buffer_model.num_units_in_decoding_tick, 32); // Number of units in decoding tick - aom_wb_write_literal(wb, cm->buffer_model.buffer_removal_delay_length - 1, 5); - aom_wb_write_literal(wb, cm->buffer_model.frame_presentation_delay_length - 1, + aom_wb_write_literal(wb, cm->buffer_model.buffer_removal_time_length - 1, 5); + aom_wb_write_literal(wb, cm->buffer_model.frame_presentation_time_length - 1, 5); } @@ -2533,23 +2541,25 @@ static void write_dec_model_op_parameters(AV1_COMMON *const cm, // aom_wb_write_bit(wb, cm->op_params[op_num].has_parameters); // if (!cm->op_params[op_num].has_parameters) return; - aom_wb_write_literal(wb, cm->op_params[op_num].decoder_buffer_delay, - cm->buffer_model.encoder_decoder_buffer_delay_length); + aom_wb_write_unsigned_literal( + wb, cm->op_params[op_num].decoder_buffer_delay, + cm->buffer_model.encoder_decoder_buffer_delay_length); - aom_wb_write_literal(wb, cm->op_params[op_num].encoder_buffer_delay, - cm->buffer_model.encoder_decoder_buffer_delay_length); + aom_wb_write_unsigned_literal( + wb, cm->op_params[op_num].encoder_buffer_delay, + cm->buffer_model.encoder_decoder_buffer_delay_length); aom_wb_write_bit(wb, cm->op_params[op_num].low_delay_mode_flag); - cm->op_frame_timing[op_num].buffer_removal_delay = + cm->op_frame_timing[op_num].buffer_removal_time = 0; // reset the decoded frame counter } static void write_tu_pts_info(AV1_COMMON *const cm, struct aom_write_bit_buffer *wb) { aom_wb_write_unsigned_literal( - wb, (uint32_t)cm->tu_presentation_delay, - cm->buffer_model.frame_presentation_delay_length); + wb, cm->frame_presentation_time, + cm->buffer_model.frame_presentation_time_length); } static void write_film_grain_params(AV1_COMP *cpi, @@ -2601,8 +2611,8 @@ static void write_film_grain_params(AV1_COMP *cpi, pars->chroma_scaling_from_luma = 0; // for monochrome override to 0 if (cm->seq_params.monochrome || pars->chroma_scaling_from_luma || - ((cm->subsampling_x == 1) && (cm->subsampling_y == 1) && - (pars->num_y_points == 0))) { + ((cm->seq_params.subsampling_x == 1) && + (cm->seq_params.subsampling_y == 1) && (pars->num_y_points == 0))) { pars->num_cb_points = 0; pars->num_cr_points = 0; } else { @@ -2931,18 +2941,19 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi, struct aom_write_bit_buffer *saved_wb, struct aom_write_bit_buffer *wb) { AV1_COMMON *const cm = &cpi->common; + const SequenceHeader *const seq_params = &cm->seq_params; MACROBLOCKD *const xd = &cpi->td.mb.e_mbd; // NOTE: By default all coded frames to be used as a reference cm->is_reference_frame = 1; cm->frame_type = cm->intra_only ? INTRA_ONLY_FRAME : cm->frame_type; - if (cm->seq_params.still_picture) { + if (seq_params->still_picture) { assert(cm->show_existing_frame == 0); assert(cm->show_frame == 1); assert(cm->frame_type == KEY_FRAME); } - if (!cm->seq_params.reduced_still_picture_hdr) { + if (!seq_params->reduced_still_picture_hdr) { if (cm->show_existing_frame) { RefCntBuffer *const frame_bufs = cm->buffer_pool->frame_bufs; const int frame_to_show = cm->ref_frame_map[cpi->existing_fb_idx_to_show]; @@ -2957,12 +2968,12 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi, aom_wb_write_bit(wb, 1); // show_existing_frame aom_wb_write_literal(wb, cpi->existing_fb_idx_to_show, 3); - if (cm->seq_params.decoder_model_info_present_flag && + if (seq_params->decoder_model_info_present_flag && cm->timing_info.equal_picture_interval == 0) { write_tu_pts_info(cm, wb); } - if (cm->seq_params.frame_id_numbers_present_flag) { - int frame_id_len = cm->seq_params.frame_id_length; + if (seq_params->frame_id_numbers_present_flag) { + int frame_id_len = seq_params->frame_id_length; int display_frame_id = cm->ref_frame_id[cpi->existing_fb_idx_to_show]; aom_wb_write_literal(wb, display_frame_id, frame_id_len); } @@ -2983,7 +2994,7 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi, aom_wb_write_bit(wb, cm->show_frame); if (cm->show_frame) { - if (cm->seq_params.decoder_model_info_present_flag && + if (seq_params->decoder_model_info_present_flag && cm->timing_info.equal_picture_interval == 0) write_tu_pts_info(cm, wb); } else { @@ -2997,18 +3008,18 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi, } aom_wb_write_bit(wb, cm->disable_cdf_update); - if (cm->seq_params.force_screen_content_tools == 2) { + if (seq_params->force_screen_content_tools == 2) { aom_wb_write_bit(wb, cm->allow_screen_content_tools); } else { assert(cm->allow_screen_content_tools == - cm->seq_params.force_screen_content_tools); + seq_params->force_screen_content_tools); } if (cm->allow_screen_content_tools) { - if (cm->seq_params.force_integer_mv == 2) { + if (seq_params->force_integer_mv == 2) { aom_wb_write_bit(wb, cm->cur_frame_force_integer_mv); } else { - assert(cm->cur_frame_force_integer_mv == cm->seq_params.force_integer_mv); + assert(cm->cur_frame_force_integer_mv == seq_params->force_integer_mv); } } else { assert(cm->cur_frame_force_integer_mv == 0); @@ -3018,53 +3029,57 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi, int frame_size_override_flag = 0; cm->frame_refs_short_signaling = 0; - if (cm->seq_params.reduced_still_picture_hdr) { - assert(cm->width == cm->seq_params.max_frame_width && - cm->height == cm->seq_params.max_frame_height); + if (seq_params->reduced_still_picture_hdr) { + assert(cm->width == seq_params->max_frame_width && + cm->height == seq_params->max_frame_height); } else { - if (cm->seq_params.frame_id_numbers_present_flag) { - int frame_id_len = cm->seq_params.frame_id_length; + if (seq_params->frame_id_numbers_present_flag) { + int frame_id_len = seq_params->frame_id_length; aom_wb_write_literal(wb, cm->current_frame_id, frame_id_len); } - if (cm->width > cm->seq_params.max_frame_width || - cm->height > cm->seq_params.max_frame_height) { + if (cm->width > seq_params->max_frame_width || + cm->height > seq_params->max_frame_height) { aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM, "Frame dimensions are larger than the maximum values"); } frame_size_override_flag = frame_is_sframe(cm) ? 1 - : (cm->width != cm->seq_params.max_frame_width || - cm->height != cm->seq_params.max_frame_height); + : (cm->width != seq_params->max_frame_width || + cm->height != seq_params->max_frame_height); if (!frame_is_sframe(cm)) aom_wb_write_bit(wb, frame_size_override_flag); - if (cm->seq_params.enable_order_hint) + if (seq_params->enable_order_hint) aom_wb_write_literal(wb, cm->frame_offset, - cm->seq_params.order_hint_bits_minus_1 + 1); + seq_params->order_hint_bits_minus_1 + 1); if (!cm->error_resilient_mode && !frame_is_intra_only(cm)) { aom_wb_write_literal(wb, cm->primary_ref_frame, PRIMARY_REF_BITS); } } - if (cm->seq_params.decoder_model_info_present_flag) { - aom_wb_write_bit(wb, cm->buffer_removal_delay_present); - if (cm->buffer_removal_delay_present) { + if (seq_params->decoder_model_info_present_flag) { + aom_wb_write_bit(wb, cm->buffer_removal_time_present); + if (cm->buffer_removal_time_present) { for (int op_num = 0; - op_num < cm->seq_params.operating_points_cnt_minus_1 + 1; op_num++) { + op_num < seq_params->operating_points_cnt_minus_1 + 1; op_num++) { if (cm->op_params[op_num].decoder_model_param_present_flag) { - if (((cm->seq_params.operating_point_idc[op_num] >> + if (((seq_params->operating_point_idc[op_num] >> cm->temporal_layer_id) & 0x1 && - (cm->seq_params.operating_point_idc[op_num] >> + (seq_params->operating_point_idc[op_num] >> (cm->spatial_layer_id + 8)) & 0x1) || - cm->seq_params.operating_point_idc[op_num] == 0) { - aom_wb_write_literal( - wb, (uint32_t)cm->op_frame_timing[op_num].buffer_removal_delay, - cm->buffer_model.buffer_removal_delay_length); - cm->op_frame_timing[op_num].buffer_removal_delay++; + seq_params->operating_point_idc[op_num] == 0) { + aom_wb_write_unsigned_literal( + wb, cm->op_frame_timing[op_num].buffer_removal_time, + cm->buffer_model.buffer_removal_time_length); + cm->op_frame_timing[op_num].buffer_removal_time++; + if (cm->op_frame_timing[op_num].buffer_removal_time == 0) { + aom_internal_error(&cm->error, AOM_CODEC_UNSUP_BITSTREAM, + "buffer_removal_time overflowed"); + } } } } @@ -3122,7 +3137,7 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi, if (!frame_is_intra_only(cm) || cpi->refresh_frame_mask != 0xFF) { // Write all ref frame order hints if error_resilient_mode == 1 - if (cm->error_resilient_mode && cm->seq_params.enable_order_hint) { + if (cm->error_resilient_mode && seq_params->enable_order_hint) { RefCntBuffer *const frame_bufs = cm->buffer_pool->frame_bufs; for (int ref_idx = 0; ref_idx < REF_FRAMES; ref_idx++) { // Get buffer index @@ -3131,7 +3146,7 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi, // Write order hint to bit stream aom_wb_write_literal(wb, frame_bufs[buf_idx].cur_frame_offset, - cm->seq_params.order_hint_bits_minus_1 + 1); + seq_params->order_hint_bits_minus_1 + 1); } } } @@ -3156,7 +3171,7 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi, // automatically. #define FRAME_REFS_SHORT_SIGNALING 0 #if FRAME_REFS_SHORT_SIGNALING - cm->frame_refs_short_signaling = cm->seq_params.enable_order_hint; + cm->frame_refs_short_signaling = seq_params->enable_order_hint; #endif // FRAME_REFS_SHORT_SIGNALING if (cm->frame_refs_short_signaling) { @@ -3167,7 +3182,7 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi, check_frame_refs_short_signaling(cpi); } - if (cm->seq_params.enable_order_hint) + if (seq_params->enable_order_hint) aom_wb_write_bit(wb, cm->frame_refs_short_signaling); if (cm->frame_refs_short_signaling) { @@ -3183,10 +3198,10 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi, if (!cm->frame_refs_short_signaling) aom_wb_write_literal(wb, get_ref_frame_map_idx(cpi, ref_frame), REF_FRAMES_LOG2); - if (cm->seq_params.frame_id_numbers_present_flag) { + if (seq_params->frame_id_numbers_present_flag) { int i = get_ref_frame_map_idx(cpi, ref_frame); - int frame_id_len = cm->seq_params.frame_id_length; - int diff_len = cm->seq_params.delta_frame_id_length; + int frame_id_len = seq_params->frame_id_length; + int diff_len = seq_params->delta_frame_id_length; int delta_frame_id_minus_1 = ((cm->current_frame_id - cm->ref_frame_id[i] + (1 << frame_id_len)) % @@ -3222,7 +3237,7 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi, } const int might_bwd_adapt = - !(cm->seq_params.reduced_still_picture_hdr) && !(cm->disable_cdf_update); + !(seq_params->reduced_still_picture_hdr) && !(cm->disable_cdf_update); if (cm->large_scale_tile) cm->refresh_frame_context = REFRESH_FRAME_CONTEXT_DISABLED; @@ -3282,7 +3297,8 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi, if (!frame_is_intra_only(cm)) write_global_motion(cpi, wb); - if (cm->film_grain_params_present && (cm->show_frame || cm->showable_frame)) { + if (seq_params->film_grain_params_present && + (cm->show_frame || cm->showable_frame)) { int flip_back_update_parameters_flag = 0; if (cm->frame_type != INTER_FRAME && cm->film_grain_params.update_parameters == 0) { @@ -3497,7 +3513,7 @@ static uint32_t write_sequence_header_obu(AV1_COMP *cpi, uint8_t *const dst) { struct aom_write_bit_buffer wb = { dst, 0 }; uint32_t size = 0; - write_profile(cm->profile, &wb); + write_profile(cm->seq_params.profile, &wb); // Still picture or not aom_wb_write_bit(&wb, cm->seq_params.still_picture); @@ -3551,9 +3567,9 @@ static uint32_t write_sequence_header_obu(AV1_COMP *cpi, uint8_t *const dst) { } write_sequence_header(cpi, &wb); - write_color_config(cm, &wb); + write_color_config(&cm->seq_params, &wb); - aom_wb_write_bit(&wb, cm->film_grain_params_present); + aom_wb_write_bit(&wb, cm->seq_params.film_grain_params_present); add_trailing_bits(&wb); @@ -3960,7 +3976,7 @@ int av1_pack_bitstream(AV1_COMP *const cpi, uint8_t *dst, size_t *size) { // The TD is now written outside the frame encode loop // write sequence header obu if KEY_FRAME, preceded by 4-byte size - if (cm->frame_type == KEY_FRAME) { + if (cm->frame_type == KEY_FRAME && cm->show_frame) { obu_header_size = write_obu_header(OBU_SEQUENCE_HEADER, 0, data); obu_payload_size = write_sequence_header_obu(cpi, data + obu_header_size); |