Commit 39d69bc0 authored by Nathan E. Egge's avatar Nathan E. Egge Committed by Nathan Egge

Decoder performance improvement with daala_ec.

Cherry-pick Daala b5020bee:
 Remove redundant test in od_ec_decode_bool_q15().
Using a test that decodes 100M random binary symbols, making this change
 produced a speed up of 8.81% with gcc-4.9.3 and 3.71% with clang-3.7.1,
 both compiled with -O2.

Change-Id: If6d0077a56121a575ae53bcd4d1d9b7d800a317d
parent 11206c60
...@@ -206,6 +206,7 @@ int od_ec_decode_bool_q15(od_ec_dec *dec, unsigned fz) { ...@@ -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) { ...@@ -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.
......
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