Merge "use NULL for lf_stats_ testing, not bool"

This commit is contained in:
Pascal Massimino 2013-09-04 07:18:42 -07:00 committed by Gerrit Code Review
commit 2fd091c9ae

View File

@ -340,13 +340,13 @@ static double GetMBSSIM(const uint8_t* yuv1, const uint8_t* yuv2) {
// loop filter strength // loop filter strength
void VP8InitFilter(VP8EncIterator* const it) { void VP8InitFilter(VP8EncIterator* const it) {
int s, i; if (it->lf_stats_ != NULL) {
if (!it->lf_stats_) return; int s, i;
InitTables();
InitTables(); for (s = 0; s < NUM_MB_SEGMENTS; s++) {
for (s = 0; s < NUM_MB_SEGMENTS; s++) { for (i = 0; i < MAX_LF_LEVELS; i++) {
for (i = 0; i < MAX_LF_LEVELS; i++) { (*it->lf_stats_)[s][i] = 0;
(*it->lf_stats_)[s][i] = 0; }
} }
} }
} }
@ -361,7 +361,7 @@ void VP8StoreFilterStats(VP8EncIterator* const it) {
const int delta_max = it->enc_->dqm_[s].quant_; const int delta_max = it->enc_->dqm_[s].quant_;
const int step_size = (delta_max - delta_min >= 4) ? 4 : 1; const int step_size = (delta_max - delta_min >= 4) ? 4 : 1;
if (!it->lf_stats_) return; if (it->lf_stats_ == NULL) return;
// NOTE: Currently we are applying filter only across the sublock edges // NOTE: Currently we are applying filter only across the sublock edges
// There are two reasons for that. // There are two reasons for that.
@ -385,24 +385,22 @@ void VP8StoreFilterStats(VP8EncIterator* const it) {
} }
void VP8AdjustFilterStrength(VP8EncIterator* const it) { void VP8AdjustFilterStrength(VP8EncIterator* const it) {
int s; if (it->lf_stats_ != NULL) {
VP8Encoder* const enc = it->enc_; int s;
VP8Encoder* const enc = it->enc_;
if (!it->lf_stats_) { for (s = 0; s < NUM_MB_SEGMENTS; s++) {
return; int i, best_level = 0;
} // Improvement over filter level 0 should be at least 1e-5 (relatively)
for (s = 0; s < NUM_MB_SEGMENTS; s++) { double best_v = 1.00001 * (*it->lf_stats_)[s][0];
int i, best_level = 0; for (i = 1; i < MAX_LF_LEVELS; i++) {
// Improvement over filter level 0 should be at least 1e-5 (relatively) const double v = (*it->lf_stats_)[s][i];
double best_v = 1.00001 * (*it->lf_stats_)[s][0]; if (v > best_v) {
for (i = 1; i < MAX_LF_LEVELS; i++) { best_v = v;
const double v = (*it->lf_stats_)[s][i]; best_level = i;
if (v > best_v) { }
best_v = v;
best_level = i;
} }
enc->dqm_[s].fstrength_ = best_level;
} }
enc->dqm_[s].fstrength_ = best_level;
} }
} }