summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Converse <aconverse@google.com>2015-10-08 16:01:42 -0700
committerAlex Converse <aconverse@google.com>2015-10-29 14:46:55 -0700
commit989193c797722dd2a37d481ab7cbd01a5d37270f (patch)
tree350c1307beef44977df3d6efa22d25f485cb938b
parent6f229b3e62549045ec12b955148dba56e4496cac (diff)
downloadlibvpx-989193c797722dd2a37d481ab7cbd01a5d37270f.tar
libvpx-989193c797722dd2a37d481ab7cbd01a5d37270f.tar.gz
libvpx-989193c797722dd2a37d481ab7cbd01a5d37270f.tar.bz2
libvpx-989193c797722dd2a37d481ab7cbd01a5d37270f.zip
Make the zero handling in extend_to_full_distribution more explicit.
The old workaround "p = 0 ? 0 : p -1" is misleading. ?: happens before = assigning back to p truncates to one byte. Therefore it is equivalent to (p - 1) & 0xFF, but the check just exists to work around a first pass bug, so let's make the work around more clear. https://bugs.chromium.org/p/webm/issues/detail?id=1089 Change-Id: I587c44dd61c1f3767543c0126376f881889935af
-rw-r--r--vp10/common/entropy.c5
-rw-r--r--vp10/common/entropy.h2
-rw-r--r--vp9/common/vp9_entropy.c5
-rw-r--r--vp9/common/vp9_entropy.h2
4 files changed, 8 insertions, 6 deletions
diff --git a/vp10/common/entropy.c b/vp10/common/entropy.c
index 56dd73a4a..3da08a61b 100644
--- a/vp10/common/entropy.c
+++ b/vp10/common/entropy.c
@@ -403,7 +403,6 @@ const vpx_prob vp10_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES] = {
{255, 241, 243, 255, 236, 255, 252, 254},
{255, 243, 245, 255, 237, 255, 252, 254},
{255, 246, 247, 255, 239, 255, 253, 255},
- {255, 246, 247, 255, 239, 255, 253, 255},
};
static const vp10_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = {
@@ -743,7 +742,9 @@ static const vp10_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = {
};
static void extend_to_full_distribution(vpx_prob *probs, vpx_prob p) {
- memcpy(probs, vp10_pareto8_full[p = 0 ? 0 : p - 1],
+ // TODO(aconverse): model[PIVOT_NODE] should never be zero.
+ // https://code.google.com/p/webm/issues/detail?id=1089
+ memcpy(probs, vp10_pareto8_full[p == 0 ? 254 : p - 1],
MODEL_NODES * sizeof(vpx_prob));
}
diff --git a/vp10/common/entropy.h b/vp10/common/entropy.h
index fba7020a5..2f93cb31c 100644
--- a/vp10/common/entropy.h
+++ b/vp10/common/entropy.h
@@ -153,7 +153,7 @@ static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) {
// 1, 3, 5, 7, ..., 253, 255
// In between probabilities are interpolated linearly
-#define COEFF_PROB_MODELS 256
+#define COEFF_PROB_MODELS 255
#define UNCONSTRAINED_NODES 3
diff --git a/vp9/common/vp9_entropy.c b/vp9/common/vp9_entropy.c
index 579857bc9..1c8158187 100644
--- a/vp9/common/vp9_entropy.c
+++ b/vp9/common/vp9_entropy.c
@@ -403,7 +403,6 @@ const vpx_prob vp9_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES] = {
{255, 241, 243, 255, 236, 255, 252, 254},
{255, 243, 245, 255, 237, 255, 252, 254},
{255, 246, 247, 255, 239, 255, 253, 255},
- {255, 246, 247, 255, 239, 255, 253, 255},
};
static const vp9_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = {
@@ -743,7 +742,9 @@ static const vp9_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = {
};
static void extend_to_full_distribution(vpx_prob *probs, vpx_prob p) {
- memcpy(probs, vp9_pareto8_full[p = 0 ? 0 : p - 1],
+ // TODO(aconverse): model[PIVOT_NODE] should never be zero.
+ // https://code.google.com/p/webm/issues/detail?id=1089
+ memcpy(probs, vp9_pareto8_full[p == 0 ? 254 : p - 1],
MODEL_NODES * sizeof(vpx_prob));
}
diff --git a/vp9/common/vp9_entropy.h b/vp9/common/vp9_entropy.h
index 21611ed6d..63b3bff5d 100644
--- a/vp9/common/vp9_entropy.h
+++ b/vp9/common/vp9_entropy.h
@@ -138,7 +138,7 @@ static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) {
// 1, 3, 5, 7, ..., 253, 255
// In between probabilities are interpolated linearly
-#define COEFF_PROB_MODELS 256
+#define COEFF_PROB_MODELS 255
#define UNCONSTRAINED_NODES 3