diff --git a/src/enc/frame.c b/src/enc/frame.c index bf991517..70d2131b 100644 --- a/src/enc/frame.c +++ b/src/enc/frame.c @@ -215,11 +215,9 @@ static int FinalizeTokenProbas(VP8Encoder* const enc) { // Finalize Segment probability based on the coding tree static int GetProba(int a, int b) { - int proba; const int total = a + b; - if (total == 0) return 255; // that's the default probability. - proba = (255 * a + total / 2) / total; - return proba; + return (total == 0) ? 255 // that's the default probability. + : (255 * a + total / 2) / total; // rounded proba } static void SetSegmentProbas(VP8Encoder* const enc) { @@ -244,10 +242,10 @@ static void SetSegmentProbas(VP8Encoder* const enc) { enc->segment_hdr_.update_map_ = (probas[0] != 255) || (probas[1] != 255) || (probas[2] != 255); enc->segment_hdr_.size_ = - p[0] * (VP8BitCost(0, probas[0]) + VP8BitCost(0, probas[1])) + - p[1] * (VP8BitCost(0, probas[0]) + VP8BitCost(1, probas[1])) + - p[2] * (VP8BitCost(1, probas[0]) + VP8BitCost(0, probas[2])) + - p[3] * (VP8BitCost(1, probas[0]) + VP8BitCost(1, probas[2])); + p[0] * (VP8BitCost(0, probas[0]) + VP8BitCost(0, probas[1])) + + p[1] * (VP8BitCost(0, probas[0]) + VP8BitCost(1, probas[1])) + + p[2] * (VP8BitCost(1, probas[0]) + VP8BitCost(0, probas[2])) + + p[3] * (VP8BitCost(1, probas[0]) + VP8BitCost(1, probas[2])); } else { enc->segment_hdr_.update_map_ = 0; enc->segment_hdr_.size_ = 0; diff --git a/src/enc/quant.c b/src/enc/quant.c index 44d89d65..b5d2d94c 100644 --- a/src/enc/quant.c +++ b/src/enc/quant.c @@ -259,7 +259,7 @@ static void SimplifySegments(VP8Encoder* const enc) { } } if (num_final_segments < num_segments) { // Remap - int i = enc->mb_w_* enc->mb_h_; + int i = enc->mb_w_ * enc->mb_h_; while (i-- > 0) enc->mb_info_[i].segment_ = map[enc->mb_info_[i].segment_]; enc->segment_hdr_.num_segments_ = num_final_segments; // Replicate the trailing segment infos (it's mostly cosmetics)