mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
remove unused parameter 'round' from CalcProba()
Change-Id: I0d89c34565decb28776aee7500ebd261fc43caf7
This commit is contained in:
parent
231ec1fb6d
commit
9630e16854
@ -246,11 +246,10 @@ static void ExchangeSymbol(const TCoder* const c, const int pos) {
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// probability computation
|
// probability computation
|
||||||
|
|
||||||
static WEBP_INLINE int CalcProba(Count_t num, Count_t total,
|
static WEBP_INLINE int CalcProba(Count_t num, Count_t total, int max_proba) {
|
||||||
int max_proba, int round) {
|
|
||||||
int p;
|
int p;
|
||||||
assert(total > 0);
|
assert(total > 0);
|
||||||
p = (num * max_proba + round) / total;
|
p = num * max_proba / total;
|
||||||
assert(p >= 0 && p <= MAX_PROBA);
|
assert(p >= 0 && p <= MAX_PROBA);
|
||||||
return MAX_PROBA - p;
|
return MAX_PROBA - p;
|
||||||
}
|
}
|
||||||
@ -259,13 +258,13 @@ static WEBP_INLINE void UpdateNodeProbas(TCoder* const c, int pos) {
|
|||||||
Node* const node = &c->nodes_[pos];
|
Node* const node = &c->nodes_[pos];
|
||||||
const Count_t total = TotalCount(node);
|
const Count_t total = TotalCount(node);
|
||||||
if (total < COUNTER_CUT_OFF)
|
if (total < COUNTER_CUT_OFF)
|
||||||
node->probaS_ = CalcProba(node->countS_, total, MAX_PROBA, 0);
|
node->probaS_ = CalcProba(node->countS_, total, MAX_PROBA);
|
||||||
if (!IsLeaf(c, pos)) {
|
if (!IsLeaf(c, pos)) {
|
||||||
const Count_t total_count = node->count_;
|
const Count_t total_count = node->count_;
|
||||||
if (total_count < COUNTER_CUT_OFF) {
|
if (total_count < COUNTER_CUT_OFF) {
|
||||||
const Count_t left_count = TotalCount(&c->nodes_[2 * pos]);
|
const Count_t left_count = TotalCount(&c->nodes_[2 * pos]);
|
||||||
node->probaL_ =
|
node->probaL_ =
|
||||||
MAX_PROBA - CalcProba(left_count, total_count, MAX_PROBA, 0);
|
MAX_PROBA - CalcProba(left_count, total_count, MAX_PROBA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -353,7 +352,7 @@ void TCoderEncode(TCoder* const c, int s, VP8BitWriter* const bw) {
|
|||||||
if (c->num_symbols_ > 0) {
|
if (c->num_symbols_ > 0) {
|
||||||
if (bw != NULL) {
|
if (bw != NULL) {
|
||||||
const int new_symbol_proba =
|
const int new_symbol_proba =
|
||||||
CalcProba(c->num_symbols_, c->total_coded_, HALF_PROBA - 1, 0);
|
CalcProba(c->num_symbols_, c->total_coded_, HALF_PROBA - 1);
|
||||||
VP8PutBit(bw, is_new_symbol, new_symbol_proba);
|
VP8PutBit(bw, is_new_symbol, new_symbol_proba);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -413,7 +412,7 @@ int TCoderDecode(TCoder* const c, VP8BitReader* const br) {
|
|||||||
if (!c->fixed_symbols_ && c->num_symbols_ < c->num_nodes_) {
|
if (!c->fixed_symbols_ && c->num_symbols_ < c->num_nodes_) {
|
||||||
if (c->num_symbols_ > 0) {
|
if (c->num_symbols_ > 0) {
|
||||||
const int new_symbol_proba =
|
const int new_symbol_proba =
|
||||||
CalcProba(c->num_symbols_, c->total_coded_, HALF_PROBA - 1, 0);
|
CalcProba(c->num_symbols_, c->total_coded_, HALF_PROBA - 1);
|
||||||
is_new_symbol = VP8GetBit(br, new_symbol_proba);
|
is_new_symbol = VP8GetBit(br, new_symbol_proba);
|
||||||
} else {
|
} else {
|
||||||
is_new_symbol = 1;
|
is_new_symbol = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user