[deltaqp] Fix delta qp headers and cabac bits, add vaq and bitrate tests

This commit is contained in:
Marko Viitanen 2022-05-04 10:25:03 +03:00
parent f7dcb71b03
commit 3a0c5b78a3
4 changed files with 12 additions and 7 deletions

View file

@ -362,12 +362,12 @@ void uvg_cabac_write_unary_max_symbol(cabac_data_t * const data, cabac_ctx_t * c
if (!symbol) return; if (!symbol) return;
data->cur_ctx = &ctx[offset];
while (--symbol) { while (--symbol) {
//data->cur_ctx = &ctx[offset];
CABAC_BIN(data, 1, "ums"); CABAC_BIN(data, 1, "ums");
} }
if (code_last) { if (code_last) {
//data->cur_ctx = &ctx[offset];
CABAC_BIN(data, 0, "ums"); CABAC_BIN(data, 0, "ums");
} }
} }

View file

@ -580,7 +580,6 @@ static void encode_transform_coeff(encoder_state_t * const state,
cabac_data_t* cabac = &state->cabac; cabac_data_t* cabac = &state->cabac;
// cu_qp_delta_abs prefix // 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); 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) { if (qp_delta_abs >= 5) {

View file

@ -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_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"); 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"); WRITE_U(stream, 0,1, "pps_chroma_tool_offsets_present_flag");
/* // If chroma_tool_offsets_present /* // 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); 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"); 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 // alf enable flags and aps IDs
if (encoder->cfg.alf_type) 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) { || state->frame->pictype == UVG_NAL_IDR_N_LP) {
} }
else { 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) { if (state->encoder_control->cfg.tmvp_enable) {
WRITE_U(stream, state->encoder_control->cfg.tmvp_enable, 1, "ph_pic_temporal_mvp_enabled_flag"); WRITE_U(stream, state->encoder_control->cfg.tmvp_enable, 1, "ph_pic_temporal_mvp_enabled_flag");
} }

View file

@ -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 --rdoq --no-deblock --no-sao --subme=0
valgrind_test $common_args --gop=8 --subme=4 --bipred --tmvp 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 --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