X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-duck%2Fsrc%2Fcodecs%2Fon2avc.rs;h=d65dbd668f2de6c563575c9b691a9a90660882b2;hb=47933c6d7ef4dc3ca6d549199081c67cea324c36;hp=f3e757d1dbc024dfa267969023b13fa9ed7e79ca;hpb=ce742854b2912b880fb3d3e330042b049dac8504;p=nihav.git diff --git a/nihav-duck/src/codecs/on2avc.rs b/nihav-duck/src/codecs/on2avc.rs index f3e757d..d65dbd6 100644 --- a/nihav-duck/src/codecs/on2avc.rs +++ b/nihav-duck/src/codecs/on2avc.rs @@ -220,7 +220,7 @@ impl AVCDecoder { scale = br.read(7)? as i16; first = false } else { - scale += br.read_cb(&self.codebooks.scale_cb)? as i16; + scale += i16::from(br.read_cb(&self.codebooks.scale_cb)?); validate!((scale >= 0) && (scale < 128)); } self.scales[cur_band] = scale as u8; @@ -331,6 +331,7 @@ impl AVCDecoder { } Ok(()) } + #[allow(clippy::cyclomatic_complexity)] fn synth_channel(&mut self, chno: usize, dst: &mut [f32]) { let coeffs = &mut self.coeffs[chno]; let delay = &mut self.delay[chno]; @@ -490,12 +491,12 @@ macro_rules! synth_step0_template { fn $name(src: &[f32], dst: &mut [f32], step: usize, off: usize, sp: &SynthParams) { for i in 0..step { for j in 0..sp.p0 { - dst[i] += ((src[j] as f64) * $tab[sp.idx][j][i]) as f32; + dst[i] += (f64::from(src[j]) * $tab[sp.idx][j][i]) as f32; } } for i in 0..step { for j in 0..sp.p1 { - dst[$size - step + i] += ((src[sp.p0 + off + j] as f64) * $tab[sp.idx][sp.p0 + j][i]) as f32; + dst[$size - step + i] += (f64::from(src[sp.p0 + off + j]) * $tab[sp.idx][sp.p0 + j][i]) as f32; } } } @@ -511,7 +512,7 @@ fn synth_step1(src: &[f32], dst: &mut [f32], size: usize, stride: usize, step: u { let mut pos = step - 1; for _ in 0..off { - let scale = src[p0] as f64; + let scale = f64::from(src[p0]); p0 += 1; pos &= size - 1; for i in 0..pos.min(step) { @@ -683,7 +684,7 @@ fn synth_generic(src: &[f32], dst: &mut [f32], tmpbuf: &mut [f32; COEFFS * 2], i (&mut dst[..size]).copy_from_slice(&src[..size]); let mut order_idx = 0; synth_recursive(dst, tmpbuf, size, order, &mut order_idx, false); - for i in 0..COEFFS { dst[i] *= 0.125; } + for el in dst.iter_mut().take(COEFFS) { *el *= 0.125; } } fn synth1024(dsp: &mut SynthDSP, src: &[f32], dst: &mut [f32], tmpbuf: &mut [f32; COEFFS * 2], is_40khz: bool) { @@ -1048,6 +1049,12 @@ impl NADecoder for AVCDecoder { } } +impl NAOptionHandler for AVCDecoder { + fn get_supported_options(&self) -> &[NAOptionDefinition] { &[] } + fn set_options(&mut self, _options: &[NAOption]) { } + fn query_option_value(&self, _name: &str) -> Option { None } +} + pub fn get_decoder_500() -> Box { Box::new(AVCDecoder::new(500)) }