Commit 3aec8d6c authored by David Barker's avatar David Barker

Fix encode/decode mismatches for supertx + delta-q

This fixes the following mismatch bugs:
* At the bitstream level, the decoder would not read the delta_qindex
  information for supertx blocks, but the encoder always sent it,
  leading to the encoder and decoder becoming misaligned.
  The delta_qindex information is still required for supertx blocks,
  so change the decoder to read it.
* In addition, the quantizer was not properly adjusted for supertx
  blocks at the decoder. We copy the quantizer setup code from
  non-supertx blocks.

Since this does not change the encoder, it should not have any
quality impact.

Change-Id: I9a0f79c3aa66f2a5a353821e2a6f3b526636e7b4
parent 8aca36d3
......@@ -2151,6 +2151,25 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd,
set_segment_id_supertx(cm, mi_row, mi_col, bsize);
#if CONFIG_DELTA_Q
if (cm->delta_q_present_flag) {
for (i = 0; i < MAX_SEGMENTS; i++) {
xd->plane[0].seg_dequant[i][0] =
av1_dc_quant(xd->current_qindex, cm->y_dc_delta_q, cm->bit_depth);
xd->plane[0].seg_dequant[i][1] =
av1_ac_quant(xd->current_qindex, 0, cm->bit_depth);
xd->plane[1].seg_dequant[i][0] =
av1_dc_quant(xd->current_qindex, cm->uv_dc_delta_q, cm->bit_depth);
xd->plane[1].seg_dequant[i][1] =
av1_ac_quant(xd->current_qindex, cm->uv_ac_delta_q, cm->bit_depth);
xd->plane[2].seg_dequant[i][0] =
av1_dc_quant(xd->current_qindex, cm->uv_dc_delta_q, cm->bit_depth);
xd->plane[2].seg_dequant[i][1] =
av1_ac_quant(xd->current_qindex, cm->uv_ac_delta_q, cm->bit_depth);
}
}
#endif
xd->mi = cm->mi_grid_visible + offset;
xd->mi[0] = cm->mi + offset;
set_mi_row_col(xd, tile, mi_row, mi_size_high[bsize], mi_col,
......
......@@ -1987,17 +1987,22 @@ static void read_inter_frame_mode_info(AV1Decoder *const pbi,
mbmi->mv[1].as_int = 0;
mbmi->segment_id = read_inter_segment_id(cm, xd, mi_row, mi_col, r);
#if CONFIG_SUPERTX
if (!supertx_enabled) {
if (!supertx_enabled)
#endif // CONFIG_SUPERTX
mbmi->skip = read_skip(cm, xd, mbmi->segment_id, r);
#if CONFIG_DELTA_Q
if (cm->delta_q_present_flag) {
xd->current_qindex =
xd->prev_qindex +
read_delta_qindex(cm, xd, r, mbmi, mi_col, mi_row) * cm->delta_q_res;
xd->prev_qindex = xd->current_qindex;
}
if (cm->delta_q_present_flag) {
xd->current_qindex =
xd->prev_qindex +
read_delta_qindex(cm, xd, r, mbmi, mi_col, mi_row) * cm->delta_q_res;
xd->prev_qindex = xd->current_qindex;
}
#endif
#if CONFIG_SUPERTX
if (!supertx_enabled) {
#endif // CONFIG_SUPERTX
inter_block = read_is_inter_block(cm, xd, mbmi->segment_id, r);
#if CONFIG_VAR_TX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment