MCPcopy Create free account
hub / github.com/Proryanator/encoder-benchmark / init

Method init

codecs/src/amf.rs:129–181  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

127
128impl Permute for Amf {
129 fn init(&mut self) -> &Vec<String> {
130 // reset index, otherwise we won't be able to iterate at all
131 self.index = -1;
132
133 // clear the vectors if there were entries before
134 self.permutations.clear();
135
136 let mut permutations = if self.profile_tiers.is_empty() {
137 vec![
138 &self.usages,
139 &self.qualities,
140 &self.profiles,
141 &self.rate_controls,
142 ]
143 } else {
144 vec![
145 &self.usages,
146 &self.qualities,
147 &self.profiles,
148 &self.profile_tiers,
149 &self.rate_controls,
150 ]
151 }
152 .into_iter()
153 .multi_cartesian_product();
154
155 loop {
156 let perm = permutations.next();
157 if perm.is_none() {
158 break;
159 }
160
161 let unwrapped_perm = perm.unwrap();
162 let profile_tier = if !self.profile_tiers.is_empty() {
163 unwrapped_perm.get(3).unwrap()
164 } else {
165 ""
166 };
167 let rc_index = if !self.profile_tiers.is_empty() { 4 } else { 3 };
168 let settings = AmfSettings {
169 usage: unwrapped_perm.get(0).unwrap(),
170 quality: unwrapped_perm.get(1).unwrap(),
171 profile: unwrapped_perm.get(2).unwrap(),
172 profile_tier,
173 rate_control: unwrapped_perm.get(rc_index).unwrap(),
174 gpu: self.gpu,
175 };
176
177 self.permutations.push(settings.to_string());
178 }
179
180 return &self.permutations;
181 }
182
183 fn run_standard_only(&mut self) -> &Vec<String> {
184 // reset index, otherwise we won't be able to iterate at all

Calls 3

is_emptyMethod · 0.80
nextMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected