Commit 63e8db53 authored by Yaowu Xu's avatar Yaowu Xu

Add clamp32u() function for uint32_t

replace clamp64() with clamp32u() where applicable

Change-Id: I3fc97d576b3235eeda5d26a6a9692b5e51e016f3
parent 7a47170e
......@@ -77,6 +77,10 @@ static INLINE int clamp(int value, int low, int high) {
return value < low ? low : (value > high ? high : value);
}
static INLINE uint32_t clamp32u(uint32_t value, uint32_t low, uint32_t high) {
return value < low ? low : (value > high ? high : value);
}
static INLINE int64_t clamp64(int64_t value, int64_t low, int64_t high) {
return value < low ? low : (value > high ? high : value);
}
......
......@@ -6680,7 +6680,7 @@ void av1_up_sample_scan_count(uint32_t *non_zero_count,
uint32_t count =
non_zero_count_ds[ci_ds] + non_zero_count_ds[ci_ds + 1];
count = ROUND_POWER_OF_TWO(count, 1);
count = clamp64(count, 0, block_num);
count = clamp32u(count, 0, block_num);
non_zero_count[ci + 1] = count;
} else {
non_zero_count[ci + 1] = non_zero_count_ds[ci_ds];
......@@ -6694,7 +6694,7 @@ void av1_up_sample_scan_count(uint32_t *non_zero_count,
if (r + 2 < tx_h) {
uint32_t count = non_zero_count[ci] + non_zero_count[ci + 2 * tx_w];
count = ROUND_POWER_OF_TWO(count, 1);
count = clamp64(count, 0, block_num);
count = clamp32u(count, 0, block_num);
non_zero_count[ci + tx_w] = count;
} else {
non_zero_count[ci + tx_w] = non_zero_count[ci];
......@@ -6715,7 +6715,7 @@ void av1_up_sample_scan_count(uint32_t *non_zero_count,
uint32_t count =
non_zero_count_ds[ci_ds] + non_zero_count_ds[ci_ds + 1];
count = ROUND_POWER_OF_TWO(count, 1);
count = clamp64(count, 0, block_num);
count = clamp32u(count, 0, block_num);
non_zero_count[ci + 1] = count;
} else {
non_zero_count[ci + 1] = non_zero_count_ds[ci_ds];
......@@ -6736,7 +6736,7 @@ void av1_up_sample_scan_count(uint32_t *non_zero_count,
uint32_t count =
non_zero_count_ds[ci_ds] + non_zero_count_ds[ci_ds + tx_w_ds];
count = ROUND_POWER_OF_TWO(count, 1);
count = clamp64(count, 0, block_num);
count = clamp32u(count, 0, block_num);
non_zero_count[ci + tx_w] = count;
} else {
non_zero_count[ci + tx_w] = non_zero_count_ds[ci_ds];
......
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