Commit graph

23 commits

Author SHA1 Message Date
Jean-Marc Valin
c52d768943 Minor fixes to testcases 2011-01-11 09:42:28 -05:00
David Schleef
b045a26a68 MSVC build fixes 2011-01-11 09:33:08 -05:00
Timothy B. Terriberry
845dfa1986 Changes to ec_dec_cdf() to support 8-bit tables.
This renames ec_dec_cdf() to ec_dec_icdf(), and changes the
 functionality to use an "inverse" CDF table, where
 icdf[i]=ft-cdf[i+1].
The first entry is omitted entirely.
It also adds a corresonding ec_enc_icdf() to the encoder, which uses
 the same table.
One could use ec_encode_bin() by converting the values in the tables
 back to normal CDF values, but the icdf[] table already has them in
 the form ec_encode_bin() wants to use them, so there's no reason to
 translate them and then translate them back.

This is done primarily to allow SILK to use the range coder with
 8-bit probability tables containing cumulative frequencies that
 span the full range 0...256.
With an 8-bit table, the final 256 of a normal CDF becomes 0 in the
 "inverse" CDF.
It's the 0 at the start of a normal CDF which would become 256, but
 this is the value we omit, as it already has to be special-cased in
 the encoder, and is not used at all in the decoder.
2011-01-08 14:57:01 -05:00
Timothy B. Terriberry
1aaa50d1c1 Update ec_dec_cdf() to use an unsigned cdf[].
For our current usage, this doesn't matter, but is more consistent
 with the rest of the API.
We may want to reduce this to an unsigned char[], but I'd rather
 coordinate that optimization with SILK's planned reduction to
 8-bit CDFs, as we may be able to use the same code.
2010-12-21 21:00:41 -05:00
Timothy B. Terriberry
de31e7e09a Add test coverage for entropy coder compatibility.
This ensures that the various alternative routines in the entropy
 encoder and decoder (e.g., ec_{enc|dec}_bit_logp()) really are
 just specialized optimizations of the same general ec_encode()
 and ec_decode() routines.
This is done by randomly picking one to encode with for each symbol,
 and randomly picking a different one to decode with.
2010-12-21 20:41:52 -05:00
Timothy B. Terriberry
30df6cf3f8 Entropy coder clean-up.
This simplifies a good bit of the error handling, and should make it
 impossible to overrun the buffer in the encoder or decoder, while
 still allowing tell() to operate correctly after a bust.
The encoder now tries to keep the range coder data intact after a
 bust instead of corrupting it with extra bits data, though this is
 not a guarantee (too many extra bits may have already been flushed).
It also now correctly reports errors when the bust occurs merging the
 last byte of range coder and extra bits.

A number of abstraction barrier violations were cleaned up, as well.
This patch also includes a number of minor performance improvements:
 ec_{enc|dec}_bits() in particular should be much faster.

Finally, tf_select was changed to be coded with the range coder
 rather than extra bits, so that it is at the front of the packet
 (for unequal error protection robustness).
2010-12-21 14:23:45 -05:00
Jean-Marc Valin
531f2ae7e3 Remove useless use of "long", remove useless prototypes 2010-08-02 09:01:28 -04:00
Jean-Marc Valin
789fc14163 Removing unused code in the entropy coder 2009-10-23 21:44:54 -04:00
Jean-Marc Valin
1e3263a267 Fix for some test program compat and an assertion that didn't make sense anymore 2009-10-02 17:48:25 -04:00
Jean-Marc Valin
c08be4485b Implemented "raw bits"
Making it so all the information encoded directly with ec_enc_bits() gets
stored at the end of the stream, without going through the range coder. This
should be both faster and reduce the effects of bit errors.

Conflicts:

	tests/ectest.c
2009-07-23 07:33:24 -04:00
Gregory Maxwell
7aa0ed40c1 Make ectest use random random numbers. Add a new test
"tandem-test" which tests the encoder and decoder in
many modes.
2009-05-26 22:44:04 -04:00
Jean-Marc Valin
4d108fc37a Unit tests now #include the relevant source files to prevent symbol visibility
problems when building shared libraries only.
2008-12-23 09:31:39 -05:00
Timothy B. Terriberry
0268a99676 Fix ectest to not check a case which isn't guaranteed to work, and which we don't use.
When I removed the special case for EC_ILOG(0) in commit
 06390d082d, it broke ec_dec_uint() with _ft=1
 (which should encode the value 0 using 0 bits).
This feature was tested by ectest.c, but not actually used by libcelt.
An assert has been added to ec_dec_uint() to ensure that we don't try to use
 this feature by accident.
ec_enc_uint() was actually correct, but support for this feature has been
 removed and the assert put in its place.
2008-12-20 23:19:56 -05:00
Jean-Marc Valin
2b08d7a210 Removing the 64-bit part of the range coder. 2008-10-04 21:10:26 -04:00
Jean-Marc Valin
a82dfdd240 Adjusting/fixing warnings 2008-03-13 23:01:55 +11:00
Jean-Marc Valin
4c2787a45c Laplace encoder now works with 16-bit frequencies 2008-03-03 10:04:48 +11:00
Jean-Marc Valin
2f5ccf60b1 C90-fying ectest 2008-02-27 07:48:48 +11:00
Jean-Marc Valin
3df6e27f34 making sure testcases have a non-zero error code when they fail 2008-02-20 15:08:08 +11:00
Jean-Marc Valin
9a0bba183c Everything should now compile with a C89 compiler. 2008-02-20 14:08:50 +11:00
Jean-Marc Valin
2991af5b8e Updated the testcase for the latest issues found with libentcode 2008-02-19 21:02:43 +11:00
Jean-Marc Valin
b3756709ad Fixed incorrect assumption about the number of bytes returned by the
entropy coder. All testcases pass again.
2008-02-08 11:50:17 +11:00
Jean-Marc Valin
cb0956d06d Add a test for tell(). Turns out we can make it fail by writing zeros. 2008-02-07 20:21:57 +11:00
Jean-Marc Valin
6238bc0ece Moved the content of libentcode into libcelt to reduce dependencies,
especially now that we have a custom version of that code anyway. Moved
the test code to tests/
2008-01-28 22:28:54 +11:00
Renamed from libentcode/ectest.c (Browse further)