Disallow cm->delta_q_present_flag=1 when cm->base_qindex=0.
Delta quant doesn't make sense if the intent is to encode
the frame in lossless mode.
BUG=aomedia:393
Change-Id: Ic26e30267dd3a061d7ee5e980b6950366f06b32f
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index e4a69a8..fd74e07 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -4352,7 +4352,7 @@
}
cm->delta_q_res = 1;
- if (segment_quantizer_active == 0) {
+ if (segment_quantizer_active == 0 && cm->base_qindex > 0) {
cm->delta_q_present_flag = aom_rb_read_bit(rb);
} else {
cm->delta_q_present_flag = 0;
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index e12f2a4..cc7922a 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -890,6 +890,8 @@
xd->current_qindex =
xd->prev_qindex +
read_delta_qindex(cm, xd, r, mbmi, mi_col, mi_row) * cm->delta_q_res;
+ /* Normative: Clamp to [1,MAXQ] to not interfere with lossless mode */
+ xd->current_qindex = clamp(xd->current_qindex, 1, MAXQ);
xd->prev_qindex = xd->current_qindex;
}
#endif
@@ -2117,6 +2119,8 @@
xd->current_qindex =
xd->prev_qindex +
read_delta_qindex(cm, xd, r, mbmi, mi_col, mi_row) * cm->delta_q_res;
+ /* Normative: Clamp to [1,MAXQ] to not interfere with lossless mode */
+ xd->current_qindex = clamp(xd->current_qindex, 1, MAXQ);
xd->prev_qindex = xd->current_qindex;
}
#endif