MCPcopy Create free account
hub / github.com/Recordscript/recordscript / set_quality

Method set_quality

libs/scrap/src/common/vpxcodec.rs:215–228  ·  view source on GitHub ↗
(&mut self, quality: Quality)

Source from the content-addressed store, hash-verified

213 }
214
215 fn set_quality(&mut self, quality: Quality) -> ResultType<()> {
216 let mut c = unsafe { *self.ctx.config.enc.to_owned() };
217 let (q_min, q_max, b) = Self::convert_quality(quality);
218 if q_min > 0 && q_min < q_max && q_max < 64 {
219 c.rc_min_quantizer = q_min;
220 c.rc_max_quantizer = q_max;
221 }
222 let bitrate = base_bitrate(self.width as _, self.height as _) * b / 100;
223 if bitrate > 0 {
224 c.rc_target_bitrate = bitrate;
225 }
226 call_vpx!(vpx_codec_enc_config_set(&mut self.ctx, &c));
227 Ok(())
228 }
229
230 fn bitrate(&self) -> u32 {
231 let c = unsafe { *self.ctx.config.enc.to_owned() };

Callers

nothing calls this directly

Calls 1

base_bitrateFunction · 0.85

Tested by

no test coverage detected