diff options
author | Luc Trudeau <ltrudeau@twoorioles.com> | 2018-10-19 07:58:03 +0300 |
---|---|---|
committer | Luc Trudeau <ltrudeau@twoorioles.com> | 2018-10-23 16:03:39 +0300 |
commit | 5186abdba5cbdec208ced5fe51d47ed307287e33 (patch) | |
tree | 10b1e09439e6df088bceafd5184649d303afb544 /src/getbits.h | |
parent | 8eed0b67610b91b82c46c639079f7f14e5a08704 (diff) |
Avoid calling get_uniform(max=1)
Calling get_uniform(max=1) results in a read_bits(n=0),
In get_uniform, the n param is renamed to max to clarify the
semantics. Asserts are added to detect calls to get_uniform()
and get_bits() that don't actually read anything.
Closes #76
Diffstat (limited to 'src/getbits.h')
-rw-r--r-- | src/getbits.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/getbits.h b/src/getbits.h index fc74ff1..6a59db2 100644 --- a/src/getbits.h +++ b/src/getbits.h @@ -41,7 +41,9 @@ typedef struct GetBits { void dav1d_init_get_bits(GetBits *c, const uint8_t *data, size_t sz); unsigned dav1d_get_bits(GetBits *c, unsigned n); int dav1d_get_sbits(GetBits *c, unsigned n); -unsigned dav1d_get_uniform(GetBits *c, unsigned range); + +// Output in range 0..max-1 +unsigned dav1d_get_uniform(GetBits *c, unsigned max); unsigned dav1d_get_vlc(GetBits *c); int dav1d_get_bits_subexp(GetBits *c, int ref, unsigned n); const uint8_t *dav1d_flush_get_bits(GetBits *c); |