diff --git a/src/cabac.c b/src/cabac.c index c5b28090..794e4de5 100644 --- a/src/cabac.c +++ b/src/cabac.c @@ -362,12 +362,12 @@ void uvg_cabac_write_unary_max_symbol(cabac_data_t * const data, cabac_ctx_t * c if (!symbol) return; + data->cur_ctx = &ctx[offset]; + while (--symbol) { - //data->cur_ctx = &ctx[offset]; CABAC_BIN(data, 1, "ums"); } if (code_last) { - //data->cur_ctx = &ctx[offset]; CABAC_BIN(data, 0, "ums"); } } diff --git a/src/encode_coding_tree.c b/src/encode_coding_tree.c index fa789032..d9bc8cb9 100644 --- a/src/encode_coding_tree.c +++ b/src/encode_coding_tree.c @@ -580,7 +580,6 @@ static void encode_transform_coeff(encoder_state_t * const state, cabac_data_t* cabac = &state->cabac; // cu_qp_delta_abs prefix - cabac->cur_ctx = &cabac->ctx.cu_qp_delta_abs[0]; uvg_cabac_write_unary_max_symbol(cabac, cabac->ctx.cu_qp_delta_abs, MIN(qp_delta_abs, 5), 1, 5); if (qp_delta_abs >= 5) { diff --git a/src/encoder_state-bitstream.c b/src/encoder_state-bitstream.c index 57a80e54..ae346526 100644 --- a/src/encoder_state-bitstream.c +++ b/src/encoder_state-bitstream.c @@ -806,10 +806,6 @@ static void encoder_state_write_bitstream_pic_parameter_set(bitstream_t* stream, WRITE_SE(stream, ((int8_t)encoder->cfg.qp) - 26, "pps_init_qp_minus26"); WRITE_U(stream, encoder->max_qp_delta_depth >= 0 ? 1:0, 1, "pps_cu_qp_delta_enabled_flag"); - if (encoder->max_qp_delta_depth >= 0) { - // Use separate QP for each LCU when rate control is enabled. - WRITE_UE(stream, encoder->max_qp_delta_depth, "diff_cu_qp_delta_depth"); - } WRITE_U(stream, 0,1, "pps_chroma_tool_offsets_present_flag"); /* // If chroma_tool_offsets_present @@ -1041,6 +1037,10 @@ static void uvg_encoder_state_write_bitstream_picture_header( const int poc_lsb = state->frame->poc & ((1 << encoder->poc_lsb_bits) - 1); WRITE_U(stream, poc_lsb, encoder->poc_lsb_bits, "ph_pic_order_cnt_lsb"); + if (encoder->max_qp_delta_depth >= 0) { + WRITE_UE(stream, encoder->max_qp_delta_depth, "ph_cu_qp_delta_subdiv_intra_slice"); + } + // alf enable flags and aps IDs if (encoder->cfg.alf_type) { @@ -1118,6 +1118,9 @@ static void uvg_encoder_state_write_bitstream_picture_header( || state->frame->pictype == UVG_NAL_IDR_N_LP) { } else { + if (encoder->max_qp_delta_depth >= 0) { + WRITE_UE(stream, encoder->max_qp_delta_depth, "ph_cu_qp_delta_subdiv_inter_slice"); + } if (state->encoder_control->cfg.tmvp_enable) { WRITE_U(stream, state->encoder_control->cfg.tmvp_enable, 1, "ph_pic_temporal_mvp_enabled_flag"); } diff --git a/tests/test_tools.sh b/tests/test_tools.sh index fbcd1856..b7372b9d 100755 --- a/tests/test_tools.sh +++ b/tests/test_tools.sh @@ -12,3 +12,6 @@ valgrind_test $common_args --no-rdoq --no-signhide --subme=0 --bipred valgrind_test $common_args --rdoq --no-deblock --no-sao --subme=0 valgrind_test $common_args --gop=8 --subme=4 --bipred --tmvp valgrind_test $common_args --transform-skip --tr-skip-max-size=5 +valgrind_test $common_args --vaq=8 +valgrind_test $common_args --vaq=8 --bitrate 350000 +valgrind_test $common_args --vaq=8 --rc-algorithm oba --bitrate 350000 \ No newline at end of file