diff options
author | Timothy B. Terriberry <tterribe@xiph.org> | 2010-11-09 12:43:18 +0300 |
---|---|---|
committer | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2010-11-09 12:54:41 +0300 |
commit | ef2e6505927dfda67b9bd4b7b438bf93df5128ab (patch) | |
tree | 254bd9caf6954a27ad9c4764f55fdea199149b07 /tests | |
parent | 99a19474a0eb683893664d60a33adc4dc3ec1e4f (diff) |
Add coarse energy entropy model tuning.
This tunes the entropy model for coarse energy introduced in commit
c1c40a76.
It uses a constant set of parameters, tuned from about an hour and a
half of randomly selected test data encoded for each frame size,
prediction type (inter/intra), and band number.
These will be slightly sub-optimal for different frame sizes, but
should be better than what we were using.
For inter, this saves an average of 2.8, 5.2, 7.1, and 6.7 bits/frame
for frame sizes of 120, 240, 480, and 960, respectively.
For intra, this saves an average of 1.5, 3.0, 4.5, and 5.3 bits/frame
(for the same frame sizes, respectively).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/laplace-test.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/laplace-test.c b/tests/laplace-test.c index 417f4e1..7778667 100644 --- a/tests/laplace-test.c +++ b/tests/laplace-test.c @@ -17,6 +17,13 @@ #define DATA_SIZE 40000 +int ec_laplace_get_start_freq(int decay) +{ + celt_uint32 ft = 32768 - LAPLACE_MINP*(2*LAPLACE_NMIN+1); + int fs = (ft*(16384-decay))/(16384+decay); + return fs+LAPLACE_MINP; +} + int main(void) { int i; @@ -41,8 +48,9 @@ int main(void) decay[i] = rand()%11000+5000; } for (i=0;i<10000;i++) - ec_laplace_encode(&enc, &val[i], decay[i]); - + ec_laplace_encode(&enc, &val[i], + ec_laplace_get_start_freq(decay[i]), decay[i]); + ec_enc_done(&enc); ec_byte_readinit(&buf,ec_byte_get_buffer(&buf),ec_byte_bytes(&buf)); @@ -50,7 +58,8 @@ int main(void) for (i=0;i<10000;i++) { - int d = ec_laplace_decode(&dec, decay[i]); + int d = ec_laplace_decode(&dec, + ec_laplace_get_start_freq(decay[i]), decay[i]); if (d != val[i]) { fprintf (stderr, "Got %d instead of %d\n", d, val[i]); |