Commit 65fe7d76 authored by Jingning Han's avatar Jingning Han Committed by Gerrit Code Review
Browse files

Merge "Remove redundant condition check in 32x32 quant"

Showing with 10 additions and 16 deletions
...@@ -94,7 +94,7 @@ void vp9_quantize_b_32x32_c(int16_t *coeff_ptr, intptr_t n_coeffs, ...@@ -94,7 +94,7 @@ void vp9_quantize_b_32x32_c(int16_t *coeff_ptr, intptr_t n_coeffs,
uint16_t *eob_ptr, const int16_t *scan, uint16_t *eob_ptr, const int16_t *scan,
const int16_t *iscan) { const int16_t *iscan) {
int i, rc, eob; int i, rc, eob;
int zbins[2], nzbins[2], zbin; int zbins[2], nzbins[2];
int x, y, z, sz; int x, y, z, sz;
int idx = 0; int idx = 0;
int idx_arr[1024]; int idx_arr[1024];
...@@ -127,27 +127,21 @@ void vp9_quantize_b_32x32_c(int16_t *coeff_ptr, intptr_t n_coeffs, ...@@ -127,27 +127,21 @@ void vp9_quantize_b_32x32_c(int16_t *coeff_ptr, intptr_t n_coeffs,
for (i = 0; i < idx; i++) { for (i = 0; i < idx; i++) {
rc = scan[idx_arr[i]]; rc = scan[idx_arr[i]];
// Calculate ZBIN
zbin = (zbins[rc != 0]);
z = coeff_ptr[rc]; z = coeff_ptr[rc];
sz = (z >> 31); // sign of z sz = (z >> 31); // sign of z
x = (z ^ sz) - sz; // x = abs(z) x = (z ^ sz) - sz; // x = abs(z)
if (x >= zbin) { x += ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1);
x += ROUND_POWER_OF_TWO(round_ptr[rc != 0], 1); x = clamp(x, INT16_MIN, INT16_MAX);
x = clamp(x, INT16_MIN, INT16_MAX); y = ((((x * quant_ptr[rc != 0]) >> 16) + x) *
y = (((int)(((int)(x * quant_ptr[rc != 0]) >> 16) + x)) * quant_shift_ptr[rc != 0]) >> 15; // quantize (x)
quant_shift_ptr[rc != 0]) >> 15; // quantize (x)
x = (y ^ sz) - sz; // get the sign back x = (y ^ sz) - sz; // get the sign back
qcoeff_ptr[rc] = x; // write to destination qcoeff_ptr[rc] = x; // write to destination
dqcoeff_ptr[rc] = x * dequant_ptr[rc != 0] / 2; // dequantized value dqcoeff_ptr[rc] = x * dequant_ptr[rc != 0] / 2; // dequantized value
if (y) { if (y)
eob = idx_arr[i]; // last nonzero coeffs eob = idx_arr[i]; // last nonzero coeffs
}
}
} }
} }
*eob_ptr = eob + 1; *eob_ptr = eob + 1;
......
Supports Markdown
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