self.skip_flag[i] = false;
}
}
+ #[allow(clippy::cyclomatic_complexity)]
fn calculate_bit_allocation(&mut self, ch_data: &mut IMCChannel, bits: usize, fixed_head: bool, adj_idx: usize) -> DecoderResult<()> {
let mut peak = 0.0;
let mut sidx = soff;
let mut didx = doff;
for _ in 0..h {
- for i in 0..w { self.dbuf[didx + i] = self.sbuf[sidx + i]; }
+ self.dbuf[didx..][..w].copy_from_slice(&self.sbuf[sidx..][..w]);
sidx += stride;
didx += stride;
}
} else {
for i in 0..w { buf[i] = self.dbuf[didx - stride + i]; }
for _ in 0..h {
- for i in 0..w { self.dbuf[didx + i] = buf[i]; }
+ self.dbuf[didx..][..w].copy_from_slice(&buf[..w]);
didx += stride;
}
}
let mut buf: [u8; 8] = [0; 8];
if !topline {
let src = &bufs.dbuf[(off - stride)..(off - stride + bw)];
- for i in 0..bw { buf[i] = src[i]; }
+ buf[..bw].copy_from_slice(&src[..bw]);
} else {
for i in 0..bw { buf[i] = DEFAULT_PIXEL; }
}
let dst = &mut bufs.dbuf[off..][..bw];
- for i in 0..bw { dst[i] = buf[i]; }
+ dst.copy_from_slice(&buf[..bw]);
}
fn copy_line_top4x4(bufs: &mut Buffers, off: usize, stride: usize, topline: bool) {
for i in 0..8 { buf[i] = DEFAULT_PIXEL; }
}
let dst = &mut bufs.dbuf[off..][..8];
- for i in 0..8 {dst[i] = buf[i]; }
+ dst.copy_from_slice(&buf[..8]);
}
fn fill_block8x8(bufs: &mut Buffers, doff: usize, stride: usize, h: usize, topline: bool, firstline: bool) {
didx += stride;
}
for _ in start..h {
- for i in 0..8 { bufs.dbuf[didx + i] = buf[i]; }
+ bufs.dbuf[didx..][..8].copy_from_slice(&buf[..8]);
didx += stride;
}
}
Ok((self.bbuf >> self.bpos) & 0x3)
}
+ #[allow(clippy::cyclomatic_complexity)]
fn decode_cell_data(&mut self, br: &mut ByteReader, cell: IV3Cell,
off: usize, stride: usize, params: CellDecParams, vq_idx: u8) -> DecoderResult<()> {
let blk_w = cell.w * 4 / params.bw;
Ok(BandHeader::new(plane_no, band_no, self.mb_size[band_id], self.blk_size[band_id], self.is_hpel[band_id], inherit_mv, has_qdelta, inherit_qd, band_q, rvmap_idx, num_corr, corr_map, blk_cb, tr, txtype))
}
+ #[allow(clippy::cyclomatic_complexity)]
fn decode_mb_info(&mut self, br: &mut BitReader, pic_hdr: &PictureHeader, band: &BandHeader, tile: &mut IVITile, ref_tile: Option<&IVITile>, mv_scale: u8) -> DecoderResult<()> {
let mut mv_x = 0;
let mut mv_y = 0;
let dptr = buf.get_data_mut().unwrap();
let buf = dptr.as_mut_slice();
for x in 0..8 {
- let a = buf[off - 2 * stride + x] as i16;
- let b = buf[off - 1 * stride + x] as i16;
- let c = buf[off + 0 * stride + x] as i16;
- let d = buf[off + 1 * stride + x] as i16;
+ let a = i16::from(buf[off - 2 * stride + x]);
+ let b = i16::from(buf[off - 1 * stride + x]);
+ let c = i16::from(buf[off + 0 * stride + x]);
+ let d = i16::from(buf[off + 1 * stride + x]);
let diff = (3 * (a - d) + 8 * (c - b)) / 16;
if (diff != 0) && (diff > -24) && (diff < 24) {
- let d1a = (diff.abs() - 2 * (diff.abs() - (strength as i16)).max(0)).max(0);
+ let d1a = (diff.abs() - 2 * (diff.abs() - i16::from(strength)).max(0)).max(0);
let d1 = if diff < 0 { -d1a } else { d1a };
buf[off - 1 * stride + x] = (b + d1).max(0).min(255) as u8;
let dptr = buf.get_data_mut().unwrap();
let buf = dptr.as_mut_slice();
for y in 0..8 {
- let a = buf[off - 2 + y * stride] as i16;
- let b = buf[off - 1 + y * stride] as i16;
- let c = buf[off + 0 + y * stride] as i16;
- let d = buf[off + 1 + y * stride] as i16;
+ let a = i16::from(buf[off - 2 + y * stride]);
+ let b = i16::from(buf[off - 1 + y * stride]);
+ let c = i16::from(buf[off + 0 + y * stride]);
+ let d = i16::from(buf[off + 1 + y * stride]);
let diff = (3 * (a - d) + 8 * (c - b)) / 16;
if (diff != 0) && (diff > -24) && (diff < 24) {
- let d1a = (diff.abs() - 2 * (diff.abs() - (strength as i16)).max(0)).max(0);
+ let d1a = (diff.abs() - 2 * (diff.abs() - i16::from(strength)).max(0)).max(0);
let d1 = if diff < 0 { -d1a } else { d1a };
buf[off - 1 + y * stride] = (b + d1).max(0).min(255) as u8;
impl<'a> BlockDecoder for Intel263BR<'a> {
#[allow(unused_variables)]
+#[allow(clippy::unreadable_literal)]
fn decode_pichdr(&mut self) -> DecoderResult<PicInfo> {
let br = &mut self.br;
let syncw = br.read(22)?;
Ok(())
}
-fn decode_block8x8(br: &mut BitReader, blk_cb: &IVICodebook, rvmap: &RVMap, tables: &TxParams8x8, is_intra: bool, is_2d: bool, prev_dc: &mut i32, quant: u8, coeffs: &mut [i32; 64], transform: &TrFunc) -> DecoderResult<()> {
+#[allow(clippy::cast_lossless)]
+fn decode_block8x8(br: &mut BitReader, blk_cb: &IVICodebook, rvmap: &RVMap, tables: &TxParams8x8, is_intra: bool, is_2d: bool, prev_dc: &mut i32, quant: u8, coeffs: &mut [i32; 64], transform: TrFunc) -> DecoderResult<()> {
let mut idx: isize = -1;
let quant_mat = if is_intra { tables.quant_intra } else { tables.quant_inter };
while idx <= 64 {
(transform)(coeffs);
Ok(())
}
-fn decode_block4x4(br: &mut BitReader, blk_cb: &IVICodebook, rvmap: &RVMap, tables: &TxParams4x4, is_intra: bool, is_2d: bool, prev_dc: &mut i32, quant: u8, coeffs: &mut [i32; 64], transform: &TrFunc) -> DecoderResult<()> {
+#[allow(clippy::cast_lossless)]
+fn decode_block4x4(br: &mut BitReader, blk_cb: &IVICodebook, rvmap: &RVMap, tables: &TxParams4x4, is_intra: bool, is_2d: bool, prev_dc: &mut i32, quant: u8, coeffs: &mut [i32; 64], transform: TrFunc) -> DecoderResult<()> {
let mut idx: isize = -1;
let quant_mat = if is_intra { tables.quant_intra } else { tables.quant_inter };
while idx <= 64 {
dec.decode_mb_info(br, pic_hdr, &band, tile, ref_tile, mv_scale)?;
}
- self.decode_tile(br, &band, tile_no, &tr, &tr_dc)?;
+ self.decode_tile(br, &band, tile_no, tr, tr_dc)?;
let skip_part = tile_end - br.tell();
br.skip(skip_part as u32)?;
} else {
}
}
}
- self.decode_tile(br, &band, tile_no, &tr, &tr_dc)?;
+ self.decode_tile(br, &band, tile_no, tr, tr_dc)?;
}
}
self.bands[bidx] = band;
br.align();
Ok(())
}
- fn decode_tile(&mut self, br: &mut BitReader, band: &BandHeader, tile_no: usize, tr: &TrFunc, transform_dc: &TrFuncDC) -> DecoderResult<()> {
+ fn decode_tile(&mut self, br: &mut BitReader, band: &BandHeader, tile_no: usize, tr: TrFunc, transform_dc: TrFuncDC) -> DecoderResult<()> {
let mut mb_idx = 0;
let mut prev_dc: i32 = 0;
let tile = &mut self.tiles[tile_no];