| 137 | } |
| 138 | |
| 139 | fn add_result( |
| 140 | &mut self, |
| 141 | result: PermutationResult, |
| 142 | is_bitrate_permutation_over: bool, |
| 143 | is_checking_quality: bool, |
| 144 | allow_duplicates: bool, |
| 145 | ) { |
| 146 | // only do this duplicate mapping during the first bitrate permutation |
| 147 | // notice how we do not add this for overloaded results |
| 148 | if !allow_duplicates |
| 149 | && is_checking_quality |
| 150 | && !result.was_overloaded |
| 151 | && !is_bitrate_permutation_over |
| 152 | { |
| 153 | let score_str = result.vmaf_score.to_string(); |
| 154 | if !self.vmaf_scores.contains(&score_str) { |
| 155 | self.results.push(result); |
| 156 | self.vmaf_scores.insert((*score_str).parse().unwrap()); |
| 157 | } else { |
| 158 | self.dup_results.push(result); |
| 159 | } |
| 160 | } else { |
| 161 | // always keep results; any duplicates will be ignored already |
| 162 | self.results.push(result); |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | fn calc_vmaf_score( |