Commit 85d27f7e authored by David Barker's avatar David Barker

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.


Change-Id: Iaa5884d37b7dfbfd703c94449597bd0050525168
parent cba7da74
......@@ -48,9 +48,7 @@ int av1_get_qindex(const struct segmentation *seg, int segment_id,
// 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,
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