MV{ x, y }
}
+#[allow(clippy::cyclomatic_complexity)]
pub fn decode_mb_pred_cabac(cabac: &mut CABAC, slice_hdr: &SliceHeader, mb_type: MBType, sstate: &mut SliceState, mb_info: &mut CurrentMBInfo) {
mb_info.mb_type = mb_type;
let num_l0 = slice_hdr.num_ref_idx_l0_active;
val_mps
};
self.states[idx] = if bit == val_mps {
- TRANS_IDX_MPS[state_idx]
+ TRANS_IDX_MPS[state_idx] + (if val_mps { 0x80 } else { 0 })
} else {
if state_idx == 0 {
val_mps = !val_mps;
}
- TRANS_IDX_LPS[state_idx]
- } + (if val_mps { 0x80 } else { 0 });
+ TRANS_IDX_LPS[state_idx] + (if val_mps { 0x80 } else { 0 })
+ };
self.renorm();
bit
}
}
self.cod_range <<= shift;
self.cod_offset <<= shift;
- self.cod_offset |= u16::from(self.bitbuf >> (16 - shift));
+ self.cod_offset |= self.bitbuf >> (16 - shift);
self.bitbuf <<= shift;
self.bits -= shift;
}
Ok(())
}
+#[allow(clippy::cyclomatic_complexity)]
pub fn decode_mb_pred_cavlc(br: &mut BitReader, slice_hdr: &SliceHeader, mb_type: MBType, sstate: &mut SliceState, mb_info: &mut CurrentMBInfo) -> DecoderResult<()> {
mb_info.mb_type = mb_type;
let num_l0 = slice_hdr.num_ref_idx_l0_active;
blk[2] = t1 + t3;
blk[3] = t1 - t3;
if qp < 6 {
- let mul = i16::from(LEVEL_SCALE[0][qp as usize]);
+ let mul = LEVEL_SCALE[0][qp as usize];
for el in blk.iter_mut() {
*el = el.wrapping_mul(mul) >> 1;
}
} else {
- let mul = i16::from(LEVEL_SCALE[0][(qp % 6) as usize]);
+ let mul = LEVEL_SCALE[0][(qp % 6) as usize];
let shift = qp / 6 - 1;
for el in blk.iter_mut() {
*el = el.wrapping_mul(mul) << shift;
pub fn idct_luma_dc(blk: &mut [i16; 16], qp: u8) {
if qp < 12 {
- let mul = i16::from(LEVEL_SCALE[0][(qp % 6) as usize]);
+ let mul = LEVEL_SCALE[0][(qp % 6) as usize];
let shift = 2 - qp / 6;
let bias = 1 << shift >> 1;
for el in blk.iter_mut() {
*el = el.wrapping_mul(mul).wrapping_add(bias) >> shift;
}
} else {
- let mul = i16::from(LEVEL_SCALE[0][(qp % 6) as usize]);
+ let mul = LEVEL_SCALE[0][(qp % 6) as usize];
let shift = qp / 6 - 2;
for el in blk.iter_mut() {
*el = el.wrapping_mul(mul) << shift;
pub use types::*;
mod pic_ref;
pub use pic_ref::*;
+#[allow(clippy::identity_op)]
+#[allow(clippy::erasing_op)]
+#[allow(clippy::many_single_char_names)]
+#[allow(clippy::range_plus_one)]
mod dsp;
use dsp::*;
mod cabac;
}
}
}
+ #[allow(clippy::cyclomatic_complexity)]
fn handle_macroblock(&mut self, mb_info: &mut CurrentMBInfo) {
let pps = &self.pps[self.cur_pps];
self.ref_pics.truncate(0);
self.long_term.truncate(0);
}
+ #[allow(clippy::cyclomatic_complexity)]
pub fn select_refs(&mut self, sps: &SeqParameterSet, slice_hdr: &SliceHeader, cur_id: u32) {
self.ref_list0.truncate(0);
self.ref_list1.truncate(0);
}
}
-fn form_ref_list(ref_list: &mut Vec<Option<PictureInfo>>, ref_pics: &Vec<PictureInfo>, long_term: &Vec<Option<PictureInfo>>, reord_info: &ReorderingInfo, cur_id: u16, pic_num_mask: u16) {
+fn form_ref_list(ref_list: &mut Vec<Option<PictureInfo>>, ref_pics: &[PictureInfo], long_term: &[Option<PictureInfo>], reord_info: &ReorderingInfo, cur_id: u16, pic_num_mask: u16) {
let mut ref_pic_id = cur_id;
for (&op, &num) in reord_info.reordering_of_pic_nums_idc.iter().zip(reord_info.abs_diff_or_num.iter()).take(reord_info.num_ops) {
if op < 2 {
}
}
+#[allow(clippy::cyclomatic_complexity)]
pub fn parse_sps(src: &[u8]) -> DecoderResult<SeqParameterSet> {
let mut br = BitReader::new(src, BitReaderMode::BE);
let mut sps: SeqParameterSet = unsafe { std::mem::zeroed() };
Ok((first_mb_in_slice, slice_type))
}
+#[allow(clippy::cyclomatic_complexity)]
pub fn parse_slice_header(br: &mut BitReader, sps_arr: &[SeqParameterSet], pps_arr: &[PicParameterSet], is_idr: bool, nal_ref_idc: u8) -> DecoderResult<SliceHeader> {
let mut hdr: SliceHeader = unsafe { std::mem::zeroed() };
}
ctx
}
+ #[allow(clippy::if_same_then_else)]
pub fn predict(&mut self, xpos: usize, ypos: usize, bw: usize, bh: usize, ref_l: usize, diff_mv: MV, ref_idx: PicRef) {
let midx = self.get_cur_blk4_idx(0) + xpos / 4 + ypos / 4 * self.blk4.stride;
let ridx = self.get_cur_blk8_idx(0) + xpos / 8 + ypos / 8 * self.blk8.stride;
}
}
pub fn predict_direct_sub(&mut self, frame_refs: &FrameRefs, temporal_mv: bool, cur_id: u16, blk4: usize) {
- if temporal_mv {
- let (mv0, ref0, mv1, ref1) = self.get_direct_mv(frame_refs, temporal_mv, cur_id, blk4);
- self.get_cur_blk4(blk4).mv = [mv0, mv1];
- self.get_cur_blk8(blk4_to_blk8(blk4)).ref_idx = [ref0, ref1];
- } else {
- let (mv0, ref0, mv1, ref1) = self.get_direct_mv(frame_refs, temporal_mv, cur_id, blk4);
- self.get_cur_blk4(blk4).mv = [mv0, mv1];
- self.get_cur_blk8(blk4_to_blk8(blk4)).ref_idx = [ref0, ref1];
- }
+ let (mv0, ref0, mv1, ref1) = self.get_direct_mv(frame_refs, temporal_mv, cur_id, blk4);
+ self.get_cur_blk4(blk4).mv = [mv0, mv1];
+ self.get_cur_blk8(blk4_to_blk8(blk4)).ref_idx = [ref0, ref1];
}
pub fn get_direct_mv(&self, frame_refs: &FrameRefs, temporal_mv: bool, cur_id: u16, blk4: usize) -> (MV, PicRef, MV, PicRef) {
let (mbi, r1_poc, r1_long) = frame_refs.get_colocated_info(self.mb_x, self.mb_y);
($a:expr) => { if !$a { println!("check failed at {}:{}", file!(), line!()); return Err(DecoderError::InvalidData); } };
}
+#[allow(clippy::too_many_arguments)]
#[cfg(feature="decoder_h264")]
mod h264;
extern crate nihav_core;
extern crate nihav_codec_support;
+#[allow(clippy::collapsible_if)]
+#[allow(clippy::needless_range_loop)]
+#[allow(clippy::useless_let_if_seq)]
mod codecs;
pub use crate::codecs::itu_register_all_decoders;