(&mut self)
| 47 | } |
| 48 | |
| 49 | pub fn run(&mut self) { |
| 50 | let runtime = SystemTime::now(); |
| 51 | let ctrl_channel = setup_ctrl_channel(); |
| 52 | let mut target_quality_found = false; |
| 53 | |
| 54 | let mut ignore_factor = 1 as c_float; |
| 55 | let mut calc_time: Option<Duration> = None; |
| 56 | for i in 0..self.permutations.clone().len() { |
| 57 | let permutation_start_time = SystemTime::now(); |
| 58 | let mut permutation = self.permutations[i].clone(); |
| 59 | log_permutation_header(i, &self.permutations, calc_time, ignore_factor); |
| 60 | |
| 61 | // if this permutation was added to the list of duplicates, skip to save calculation time |
| 62 | if !permutation.allow_duplicates |
| 63 | && permutation.check_quality |
| 64 | && will_be_duplicate(&self.dup_results, &permutation) |
| 65 | { |
| 66 | draw_yellow_bar(permutation.get_metadata().frames); |
| 67 | println!("\n!!! Above encoder settings will produce identical vmaf score as other permutations, skipping... \n"); |
| 68 | continue; |
| 69 | } |
| 70 | |
| 71 | let mut result = run_encode(permutation.clone(), &ctrl_channel); |
| 72 | calc_time = Option::from(permutation_start_time.elapsed().unwrap()); |
| 73 | |
| 74 | if !result.was_overloaded && permutation.check_quality.clone() { |
| 75 | let vmaf_start_time = SystemTime::now(); |
| 76 | result.vmaf_score = check_encode_quality( |
| 77 | &mut permutation.clone(), |
| 78 | &ctrl_channel, |
| 79 | permutation.verbose, |
| 80 | i, |
| 81 | ) |
| 82 | .expect("Failed to check encode quality"); |
| 83 | |
| 84 | result.vmaf_calculation_time = vmaf_start_time.elapsed().unwrap().as_secs(); |
| 85 | |
| 86 | // if this is higher than the target quality, stop at this bitrate during benchmark |
| 87 | if result.vmaf_score >= TARGET_QUALITY { |
| 88 | target_quality_found = true; |
| 89 | } |
| 90 | |
| 91 | // take the vmaf calculation time into account for the total ETA calculation |
| 92 | calc_time = Option::from(permutation_start_time.elapsed().unwrap()); |
| 93 | } |
| 94 | |
| 95 | let is_initial_bitrate_permutation_over = i == self.permutations.len() - 1 |
| 96 | || self.permutations[i + 1].clone().bitrate != permutation.bitrate; |
| 97 | self.add_result( |
| 98 | result, |
| 99 | is_initial_bitrate_permutation_over, |
| 100 | permutation.check_quality, |
| 101 | permutation.allow_duplicates, |
| 102 | ); |
| 103 | |
| 104 | // we'll calculate the ignore factor of permutations that will be skipped |
| 105 | if is_initial_bitrate_permutation_over { |
| 106 | // % of permutations that we will actually permute over past the initial bitrate |
nothing calls this directly
no test coverage detected