aom_dsp/get_prob: relocate den == 0 test
to get_binary_prob(). the only other caller mode_mv_merge_probs() does its own test on 0. cherry-picked from libvpx: 93c823e24 vpx_dsp/get_prob: relocate den == 0 test Change-Id: Ie0604ad405a97ed754e4b88c6d580eb4894ea0f6
This commit is contained in:
Родитель
563101967a
Коммит
751f26a4f9
|
@ -12,6 +12,8 @@
|
|||
#ifndef AOM_DSP_PROB_H_
|
||||
#define AOM_DSP_PROB_H_
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "./aom_config.h"
|
||||
#include "./aom_dsp_common.h"
|
||||
|
||||
|
@ -54,7 +56,7 @@ typedef int8_t aom_tree_index;
|
|||
typedef const aom_tree_index aom_tree[];
|
||||
|
||||
static INLINE aom_prob get_prob(unsigned int num, unsigned int den) {
|
||||
if (den == 0) return 128u;
|
||||
assert(den != 0);
|
||||
{
|
||||
const int p = (int)(((int64_t)num * 256 + (den >> 1)) / den);
|
||||
// (p > 255) ? 255 : (p < 1) ? 1 : p;
|
||||
|
@ -64,7 +66,9 @@ static INLINE aom_prob get_prob(unsigned int num, unsigned int den) {
|
|||
}
|
||||
|
||||
static INLINE aom_prob get_binary_prob(unsigned int n0, unsigned int n1) {
|
||||
return get_prob(n0, n0 + n1);
|
||||
const unsigned int den = n0 + n1;
|
||||
if (den == 0) return 128u;
|
||||
return get_prob(n0, den);
|
||||
}
|
||||
|
||||
/* This function assumes prob1 and prob2 are already within [1,255] range. */
|
||||
|
|
Загрузка…
Ссылка в новой задаче