diff options
author | Paul Wilkins <paulwilkins@google.com> | 2013-02-19 10:12:00 -0800 |
---|---|---|
committer | Ronald S. Bultje <rbultje@google.com> | 2013-02-23 07:29:09 -0800 |
commit | c17672a33d9a0f94b9b5cf178d83455fee269ee6 (patch) | |
tree | 7c40cd7fd21cf35eccb21204c497d66c445ae41d /vp9/common/vp9_treecoder.h | |
parent | bf0570a7e6773ea4daeeab1e59a911ba7e002b23 (diff) | |
download | libvpx-c17672a33d9a0f94b9b5cf178d83455fee269ee6.tar libvpx-c17672a33d9a0f94b9b5cf178d83455fee269ee6.tar.gz libvpx-c17672a33d9a0f94b9b5cf178d83455fee269ee6.tar.bz2 libvpx-c17672a33d9a0f94b9b5cf178d83455fee269ee6.zip |
Further changes to coefficient contexts.
This patch alters the balance of context between the
coefficient bands (reflecting the position of coefficients
within a transform blocks) and the energy of the previous
token (or tokens) within a block.
In this case the number of coefficient bands is reduced
but more previous token energy bands are supported.
Some initial rebalancing of the default tables has been
by running multiple derf clips at multiple data rates using
the ENTOPY_STATS macro. Further balancing needs to be
done using larger image formatsd especially in regard to
the bigger transform sizes which are not as well represented
in encodings of smaller image formats.
Change-Id: If9736e95c391e711b04aef6393d26f60f36e1f8a
Diffstat (limited to 'vp9/common/vp9_treecoder.h')
-rw-r--r-- | vp9/common/vp9_treecoder.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/vp9/common/vp9_treecoder.h b/vp9/common/vp9_treecoder.h index 8eca8a8bc..f9f1d135e 100644 --- a/vp9/common/vp9_treecoder.h +++ b/vp9/common/vp9_treecoder.h @@ -58,9 +58,18 @@ static INLINE vp9_prob clip_prob(int p) { return (p > 255) ? 255u : (p < 1) ? 1u : p; } +// int64 is not needed for normal frame level calculations. +// However when outputing entropy stats accumulated over many frames +// or even clips we can overflow int math. +#ifdef ENTROPY_STATS +static INLINE vp9_prob get_prob(int num, int den) { + return (den == 0) ? 128u : clip_prob(((int64_t)num * 256 + (den >> 1)) / den); +} +#else static INLINE vp9_prob get_prob(int num, int den) { return (den == 0) ? 128u : clip_prob((num * 256 + (den >> 1)) / den); } +#endif static INLINE vp9_prob get_binary_prob(int n0, int n1) { return get_prob(n0, n0 + n1); |