minor cosmetics

spotted in patch #34187

Change-Id: Ia706af6ef7674ec7a1d7250da08f718ed7c09e72
This commit is contained in:
skal 2012-10-03 15:22:33 +02:00
parent a792b913bd
commit 0b9e682934
2 changed files with 7 additions and 9 deletions

View File

@ -215,11 +215,9 @@ static int FinalizeTokenProbas(VP8Encoder* const enc) {
// Finalize Segment probability based on the coding tree // Finalize Segment probability based on the coding tree
static int GetProba(int a, int b) { static int GetProba(int a, int b) {
int proba;
const int total = a + b; const int total = a + b;
if (total == 0) return 255; // that's the default probability. return (total == 0) ? 255 // that's the default probability.
proba = (255 * a + total / 2) / total; : (255 * a + total / 2) / total; // rounded proba
return proba;
} }
static void SetSegmentProbas(VP8Encoder* const enc) { static void SetSegmentProbas(VP8Encoder* const enc) {
@ -244,10 +242,10 @@ static void SetSegmentProbas(VP8Encoder* const enc) {
enc->segment_hdr_.update_map_ = enc->segment_hdr_.update_map_ =
(probas[0] != 255) || (probas[1] != 255) || (probas[2] != 255); (probas[0] != 255) || (probas[1] != 255) || (probas[2] != 255);
enc->segment_hdr_.size_ = enc->segment_hdr_.size_ =
p[0] * (VP8BitCost(0, probas[0]) + VP8BitCost(0, probas[1])) + p[0] * (VP8BitCost(0, probas[0]) + VP8BitCost(0, probas[1])) +
p[1] * (VP8BitCost(0, probas[0]) + VP8BitCost(1, probas[1])) + p[1] * (VP8BitCost(0, probas[0]) + VP8BitCost(1, probas[1])) +
p[2] * (VP8BitCost(1, probas[0]) + VP8BitCost(0, probas[2])) + p[2] * (VP8BitCost(1, probas[0]) + VP8BitCost(0, probas[2])) +
p[3] * (VP8BitCost(1, probas[0]) + VP8BitCost(1, probas[2])); p[3] * (VP8BitCost(1, probas[0]) + VP8BitCost(1, probas[2]));
} else { } else {
enc->segment_hdr_.update_map_ = 0; enc->segment_hdr_.update_map_ = 0;
enc->segment_hdr_.size_ = 0; enc->segment_hdr_.size_ = 0;

View File

@ -259,7 +259,7 @@ static void SimplifySegments(VP8Encoder* const enc) {
} }
} }
if (num_final_segments < num_segments) { // Remap 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_]; while (i-- > 0) enc->mb_info_[i].segment_ = map[enc->mb_info_[i].segment_];
enc->segment_hdr_.num_segments_ = num_final_segments; enc->segment_hdr_.num_segments_ = num_final_segments;
// Replicate the trailing segment infos (it's mostly cosmetics) // Replicate the trailing segment infos (it's mostly cosmetics)