Merge "Decoder performance improvement with daala_ec." into nextgenv2

This commit is contained in:
Yaowu Xu
2016-10-21 21:50:13 +00:00
committed by Gerrit Code Review

View File

@@ -206,6 +206,7 @@ int od_ec_decode_bool_q15(od_ec_dec *dec, unsigned fz) {
od_ec_window dif; od_ec_window dif;
od_ec_window vw; od_ec_window vw;
unsigned r; unsigned r;
unsigned r_new;
unsigned v; unsigned v;
int ret; int ret;
OD_ASSERT(0 < fz); OD_ASSERT(0 < fz);
@@ -216,10 +217,14 @@ int od_ec_decode_bool_q15(od_ec_dec *dec, unsigned fz) {
OD_ASSERT(32768U <= r); OD_ASSERT(32768U <= r);
v = fz * (uint32_t)r >> 15; v = fz * (uint32_t)r >> 15;
vw = (od_ec_window)v << (OD_EC_WINDOW_SIZE - 16); vw = (od_ec_window)v << (OD_EC_WINDOW_SIZE - 16);
ret = dif >= vw; ret = 0;
if (ret) dif -= vw; r_new = v;
r = ret ? r - v : v; if (dif >= vw) {
return od_ec_dec_normalize(dec, dif, r, ret); r_new = r - v;
dif -= vw;
ret = 1;
}
return od_ec_dec_normalize(dec, dif, r_new, ret);
} }
/*Decodes a symbol given a cumulative distribution function (CDF) table. /*Decodes a symbol given a cumulative distribution function (CDF) table.