Commit f8d165d1 authored by Angie Chiang's avatar Angie Chiang Committed by James Zern

Clean up shorten-64-to-32 warning in scan.c

Change-Id: Ifbc5310fa6476c64db9d35576fa45dfb2014989f
parent 77368af8
......@@ -6600,6 +6600,10 @@ static uint32_t *get_non_zero_counts(FRAME_COUNTS *counts, TX_SIZE tx_size,
}
}
static INLINE int clamp_64(int64_t value, int low, int high) {
return value < low ? low : (value > high ? high : (int)value);
}
static void update_scan_prob(AV1_COMMON *cm, TX_SIZE tx_size, TX_TYPE tx_type,
int rate_16) {
FRAME_CONTEXT *pre_fc = &cm->frame_contexts[cm->frame_context_idx];
......@@ -6615,7 +6619,9 @@ static void update_scan_prob(AV1_COMMON *cm, TX_SIZE tx_size, TX_TYPE tx_type,
int64_t prev_prob = prev_non_zero_prob[i];
int64_t pred_prob =
(curr_prob * rate_16 + prev_prob * ((1 << 16) - rate_16)) >> 16;
non_zero_prob[i] = clamp(pred_prob, 0, UINT16_MAX);
// TODO(angiebird): reduce the bit usage of probabilities and remove
// clamp_64()
non_zero_prob[i] = clamp_64(pred_prob, 0, UINT16_MAX);
}
}
......
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