Simplify aom_get_qmlevel Change the way the qmlevel is calculated from min_qmlevel, max_qmlevel and qindex. This fixes an issue where we could end up with qmlevel = max_qmlevel + 1 - see the associated bug report for details. BUG=aomedia:747 Change-Id: Iaa5884d37b7dfbfd703c94449597bd0050525168
diff --git a/av1/common/quant_common.h b/av1/common/quant_common.h index 2795425..92843fe 100644 --- a/av1/common/quant_common.h +++ b/av1/common/quant_common.h
@@ -48,9 +48,7 @@ // Reduce the large number of quantizers to a smaller number of levels for which // different matrices may be defined static INLINE int aom_get_qmlevel(int qindex, int first, int last) { - int qmlevel = (qindex * (last + 1 - first) + QINDEX_RANGE / 2) / QINDEX_RANGE; - qmlevel = AOMMIN(qmlevel + first, NUM_QM_LEVELS - 1); - return qmlevel; + return first + (qindex * (last + 1 - first)) / QINDEX_RANGE; } void aom_qm_init(struct AV1Common *cm); qm_val_t *aom_iqmatrix(struct AV1Common *cm, int qindex, int comp,