Merge "Revert "Replace the zero handling in extend_to_full_distribution.""

This commit is contained in:
Alex Converse 2015-10-28 20:48:52 +00:00 коммит произвёл Gerrit Code Review
Родитель bb0bc06fa5 663960e757
Коммит e765969971
4 изменённых файлов: 10 добавлений и 12 удалений

Просмотреть файл

@ -403,6 +403,7 @@ const vpx_prob vp10_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES] = {
{255, 241, 243, 255, 236, 255, 252, 254}, {255, 241, 243, 255, 236, 255, 252, 254},
{255, 243, 245, 255, 237, 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},
{255, 246, 247, 255, 239, 255, 253, 255},
}; };
static const vp10_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = { static const vp10_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = {
@ -742,16 +743,14 @@ static const vp10_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = {
}; };
static void extend_to_full_distribution(vpx_prob *probs, vpx_prob p) { static void extend_to_full_distribution(vpx_prob *probs, vpx_prob p) {
memcpy(probs, vp10_pareto8_full[p - 1], MODEL_NODES * sizeof(vpx_prob)); memcpy(probs, vp10_pareto8_full[p = 0 ? 0 : p - 1],
MODEL_NODES * sizeof(vpx_prob));
} }
void vp10_model_to_full_probs(const vpx_prob *model, vpx_prob *full) { void vp10_model_to_full_probs(const vpx_prob *model, vpx_prob *full) {
if (full != model) if (full != model)
memcpy(full, model, sizeof(vpx_prob) * UNCONSTRAINED_NODES); memcpy(full, model, sizeof(vpx_prob) * UNCONSTRAINED_NODES);
// TODO(aconverse): model[PIVOT_NODE] should never be zero. extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]);
// https://code.google.com/p/webm/issues/detail?id=1089
if (model[PIVOT_NODE] != 0)
extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]);
} }
void vp10_default_coef_probs(VP10_COMMON *cm) { void vp10_default_coef_probs(VP10_COMMON *cm) {

Просмотреть файл

@ -153,7 +153,7 @@ static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) {
// 1, 3, 5, 7, ..., 253, 255 // 1, 3, 5, 7, ..., 253, 255
// In between probabilities are interpolated linearly // In between probabilities are interpolated linearly
#define COEFF_PROB_MODELS 255 #define COEFF_PROB_MODELS 256
#define UNCONSTRAINED_NODES 3 #define UNCONSTRAINED_NODES 3

Просмотреть файл

@ -403,6 +403,7 @@ const vpx_prob vp9_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES] = {
{255, 241, 243, 255, 236, 255, 252, 254}, {255, 241, 243, 255, 236, 255, 252, 254},
{255, 243, 245, 255, 237, 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},
{255, 246, 247, 255, 239, 255, 253, 255},
}; };
static const vp9_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = { static const vp9_coeff_probs_model default_coef_probs_4x4[PLANE_TYPES] = {
@ -742,16 +743,14 @@ static const vp9_coeff_probs_model default_coef_probs_32x32[PLANE_TYPES] = {
}; };
static void extend_to_full_distribution(vpx_prob *probs, vpx_prob p) { static void extend_to_full_distribution(vpx_prob *probs, vpx_prob p) {
memcpy(probs, vp9_pareto8_full[p - 1], MODEL_NODES * sizeof(vpx_prob)); memcpy(probs, vp9_pareto8_full[p = 0 ? 0 : p - 1],
MODEL_NODES * sizeof(vpx_prob));
} }
void vp9_model_to_full_probs(const vpx_prob *model, vpx_prob *full) { void vp9_model_to_full_probs(const vpx_prob *model, vpx_prob *full) {
if (full != model) if (full != model)
memcpy(full, model, sizeof(vpx_prob) * UNCONSTRAINED_NODES); memcpy(full, model, sizeof(vpx_prob) * UNCONSTRAINED_NODES);
// TODO(aconverse): model[PIVOT_NODE] should never be zero. extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]);
// https://code.google.com/p/webm/issues/detail?id=1089
if (model[PIVOT_NODE] != 0)
extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]);
} }
void vp9_default_coef_probs(VP9_COMMON *cm) { void vp9_default_coef_probs(VP9_COMMON *cm) {

Просмотреть файл

@ -138,7 +138,7 @@ static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) {
// 1, 3, 5, 7, ..., 253, 255 // 1, 3, 5, 7, ..., 253, 255
// In between probabilities are interpolated linearly // In between probabilities are interpolated linearly
#define COEFF_PROB_MODELS 255 #define COEFF_PROB_MODELS 256
#define UNCONSTRAINED_NODES 3 #define UNCONSTRAINED_NODES 3