//! Code and data for easier development of NihAV decoders.
-#[allow(clippy::cast_lossless)]
-#[allow(clippy::identity_op)]
-#[allow(clippy::too_many_arguments)]
-#[allow(clippy::unreadable_literal)]
pub mod codecs;
#[cfg(feature="dsp")]
-#[allow(clippy::excessive_precision)]
-#[allow(clippy::identity_op)]
-#[allow(clippy::manual_memcpy)]
-#[allow(clippy::needless_range_loop)]
-#[allow(clippy::unreadable_literal)]
pub mod dsp;
pub mod data;
#[allow(clippy::identity_op)]
-#[allow(clippy::many_single_char_names)]
pub mod imgwrite;
#[allow(clippy::too_many_arguments)]
pub mod test;
#[cfg(feature="vq")]
-#[allow(clippy::needless_range_loop)]
pub mod vq;
extern crate nihav_core;
const OUTPUT_PREFIX: &str = "assets/test_out/";
+type PossibleDecoder = Option<(Box<NADecoderSupport>, Box<dyn NADecoder>)>;
+
/*fn open_wav_out(pfx: &str, strno: usize) -> WavWriter {
let name = format!("assets/{}out{:02}.wav", pfx, strno);
let mut file = File::create(name).unwrap();
let mut br = ByteReader::new(&mut fr);
let mut dmx = create_demuxer(dmx_f, &mut br).unwrap();
- let mut decs: Vec<Option<(Box<NADecoderSupport>, Box<dyn NADecoder>)>> = Vec::new();
+ let mut decs: Vec<PossibleDecoder> = Vec::new();
for i in 0..dmx.get_num_streams() {
let s = dmx.get_stream(i).unwrap();
let info = s.get_info();
let mut br = ByteReader::new(&mut fr);
let mut dmx = create_demuxer(dmx_f, &mut br).unwrap();
- let mut decs: Vec<Option<(Box<NADecoderSupport>, Box<dyn NADecoder>)>> = Vec::new();
+ let mut decs: Vec<PossibleDecoder> = Vec::new();
for i in 0..dmx.get_num_streams() {
let s = dmx.get_stream(i).unwrap();
let info = s.get_info();
let mut br = ByteReader::new(&mut fr);
let mut dmx = create_demuxer(dmx_f, &mut br).unwrap();
- let mut decs: Vec<Option<(Box<NADecoderSupport>, Box<dyn NADecoder>)>> = Vec::new();
+ let mut decs: Vec<PossibleDecoder> = Vec::new();
let mut found = false;
for i in 0..dmx.get_num_streams() {
let s = dmx.get_stream(i).unwrap();
let mut br = ByteReader::new(&mut fr);
let mut dmx = create_demuxer(dmx_f, &mut br).unwrap();
- let mut decs: Vec<Option<(Box<NADecoderSupport>, Box<dyn NADecoder>)>> = Vec::new();
+ let mut decs: Vec<PossibleDecoder> = Vec::new();
for i in 0..dmx.get_num_streams() {
let s = dmx.get_stream(i).unwrap();
let info = s.get_info();
let mut closest_idx = *low_idx;
let mut closest_dist = std::u32::MAX;
let low_centr = self.clusters[*low_idx].centroid;
- for i in 0..dst.len() {//low_u.iter() {
- if i == *low_idx || used[i] {
+ for (i, (&used, cluster)) in used.iter().zip(self.clusters.iter()).take(dst.len()).enumerate() {
+ if i == *low_idx || used {
continue;
}
- let dist = self.clusters[i].centroid.dist(low_centr);
+ let dist = cluster.centroid.dist(low_centr);
if closest_dist > dist {
closest_dist = dist;
closest_idx = i;