if !br.read_bool()? {
nib1 = br.read(4)?;
}
- new_cbp = new_cbp | (nib1 << 4);
+ new_cbp |= nib1 << 4;
if !br.read_bool()? {
nib1 = br.read(4)?;
}
- new_cbp = new_cbp | (nib1 << 8);
+ new_cbp |= nib1 << 8;
if !br.read_bool()? {
nib1 = br.read(4)?;
}
let mut buf;
self.key_frame = pkt.is_keyframe();
- let bufret = alloc_video_buffer(self.info.get_properties().get_video_info().unwrap(), 5);
- if let Err(_) = bufret { return Err(DecoderError::InvalidData); }
- let bufinfo = bufret.unwrap();
+ let bufinfo = alloc_video_buffer(self.info.get_properties().get_video_info().unwrap(), 5)?;
buf = bufinfo.get_vbuf().unwrap();
self.decode_frame_new(&mut br, &mut buf, pkt.is_keyframe())?;
transform: Transform::None,
version_b: false,
len: 0,
- quants: quants,
+ quants,
bands: [MAX_BANDS + 1; 26],
num_bands: 0,
duration: 0,
if br.read_bool()? {
let len = br.read(3)? as usize;
let mut present: [bool; 16] = [false; 16];
- for i in 0..len+1 {
+ for i in 0..=len {
self.syms[i] = br.read(4)? as u8;
present[self.syms[i] as usize] = true;
}
let len = br.read(2)? as usize;
let mut syms: [u8; 16] = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
let mut tmp: [u8; 16] = [0; 16];
- for bits in 0..len+1 {
+ for bits in 0..=len {
let size = 1 << bits;
for arr in syms.chunks_mut(size * 2) {
let mut ptr0 = 0;
let q_index = if let Some(qidx) = q { qidx } else { br.read(4)? as usize };
let qmat = &quant_matrices[q_index];
block[0] = block[0].wrapping_mul(qmat[0]) >> 11;
- for idx in coef_idx.into_iter().take(coef_count) {
+ for idx in coef_idx.iter().take(coef_count) {
block[scan[*idx]] = block[scan[*idx]].wrapping_mul(qmat[*idx]) >> 11;
}
if let Some(bbuf) = bufret {
buf = bbuf;
} else {
- let bufret = alloc_video_buffer(self.info.get_properties().get_video_info().unwrap(), 4);
- if let Err(_) = bufret { return Err(DecoderError::InvalidData); }
- let bufinfo = bufret.unwrap();
+ let bufinfo = alloc_video_buffer(self.info.get_properties().get_video_info().unwrap(), 4)?;
buf = bufinfo.get_vbuf().unwrap();
self.key_frame = true;
self.hams.add_frame(buf);
buf = self.hams.get_output_frame().unwrap();
}
} else {
- let bufret = alloc_video_buffer(self.info.get_properties().get_video_info().unwrap(), 4);
- if let Err(_) = bufret { return Err(DecoderError::InvalidData); }
- let bufinfo = bufret.unwrap();
+ let bufinfo = alloc_video_buffer(self.info.get_properties().get_video_info().unwrap(), 4)?;
buf = bufinfo.get_vbuf().unwrap();
}
];
pub fn rad_register_all_codecs(rd: &mut RegisteredDecoders) {
- for decoder in RAD_CODECS.into_iter() {
+ for decoder in RAD_CODECS.iter() {
rd.add_decoder(decoder.clone());
}
}
if src.len() > PAL_SIZE {
let mut br = BitReader::new(&src[PAL_SIZE..], src.len() - PAL_SIZE, BitReaderMode::LE);
- let bufret = alloc_video_buffer(self.info.get_properties().get_video_info().unwrap(), 2);
- if let Err(_) = bufret { return Err(DecoderError::InvalidData); }
- bufinfo = bufret.unwrap();
+ bufinfo = alloc_video_buffer(self.info.get_properties().get_video_info().unwrap(), 2)?;
let mut buf = bufinfo.get_vbuf().unwrap();
is_intra = self.decode_frame(&mut br)?;
self.output_frame(&mut buf);
validate!((self.frames > 0) && (tb_num > 0) && (tb_den > 0) && (max_size < fsize));
let mut flags: [u8; 4] = [0; 4];
src.read_buf(&mut flags)?;
- let mut edata: Vec<u8> = Vec::with_capacity(8);
- edata.resize(8, 0);
+ let mut edata: Vec<u8> = vec![0; 8];
let p0 = &mut edata[0..4];
p0.copy_from_slice(&magic);
let p1 = &mut edata[4..][..4];
}
self.frame_pos = Vec::with_capacity(self.frames + 1);
- for _ in 0..self.frames+1 {
+ for _ in 0..=self.frames {
let pos = src.read_u32le()?;
self.frame_pos.push(pos);
}
#[cfg(feature="demuxer_bink")]
mod bink;
-const RAD_DEMUXERS: &[&'static DemuxerCreator] = &[
+const RAD_DEMUXERS: &[&DemuxerCreator] = &[
#[cfg(feature="demuxer_smk")]
&smacker::SMKDemuxerCreator {},
#[cfg(feature="demuxer_bink")]
];
pub fn rad_register_all_demuxers(rd: &mut RegisteredDemuxers) {
- for demuxer in RAD_DEMUXERS.into_iter() {
+ for demuxer in RAD_DEMUXERS.iter() {
rd.add_demuxer(*demuxer);
}
}
validate!(chunk_size > 0);
validate!(payload_size >= chunk_size);
payload_size -= chunk_size;
- let oldpal = self.pal.clone();
+ let oldpal = self.pal;
let mut idx = 0;
let endpos = self.src.tell() + (chunk_size as u64) - 1;
while idx < 256 {
extern crate nihav_core;
#[cfg(feature="decoders")]
+#[allow(clippy::cast_lossless)]
+#[allow(clippy::collapsible_if)]
+#[allow(clippy::excessive_precision)]
+#[allow(clippy::identity_op)]
+#[allow(clippy::needless_range_loop)]
+#[allow(clippy::too_many_arguments)]
+#[allow(clippy::unreadable_literal)]
+#[allow(clippy::useless_let_if_seq)]
pub mod codecs;
#[cfg(feature="demuxers")]
+#[allow(clippy::cast_lossless)]
pub mod demuxers;
\ No newline at end of file