Clean up shorten-64-to-32 warning in scan.c Change-Id: Ifbc5310fa6476c64db9d35576fa45dfb2014989f
diff --git a/av1/common/scan.c b/av1/common/scan.c index 2377d90..6d0d15e 100644 --- a/av1/common/scan.c +++ b/av1/common/scan.c
@@ -6600,6 +6600,10 @@ } } +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 @@ 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); } }