]> git.nihav.org Git - nihav.git/blobdiff - nihav-codec-support/src/codecs/h263/decoder.rs
core: fix clippy warnings
[nihav.git] / nihav-codec-support / src / codecs / h263 / decoder.rs
index 1d670323705dfe0a8e451cfa210918498bbb5a27..f5c528ac420e9e0905f88980e0d002c324f83337 100644 (file)
@@ -118,7 +118,7 @@ struct PredCoeffs {
     ver: [[i16; 8]; 6],
 }
 
-const ZERO_PRED_COEFFS: PredCoeffs = PredCoeffs { hor: [[0; 8]; 6], ver: [[0; 8]; 6] };
+const ZERO_PRED_COEFFS: PredCoeffs = PredCoeffs { hor: [[1024, 0, 0, 0, 0, 0, 0, 0]; 6], ver: [[1024, 0, 0, 0, 0, 0, 0, 0]; 6] };
 
 pub const H263DEC_OPT_USES_GOB: u32     = 0x0001;
 pub const H263DEC_OPT_SLICE_RESET: u32  = 0x0002;
@@ -301,6 +301,7 @@ impl H263BaseDecoder {
             bi.mv_f[blk_no]
         }
     }
+    #[allow(clippy::cyclomatic_complexity)]
     fn reconstruct_obmc(&mut self, buf: &mut NAVideoBuffer<u8>, slice_start: usize, start: usize, end: usize, slice_end: bool) -> usize {
         let mut mb_x = start % self.mb_w;
         let mut mb_y = start / self.mb_w;
@@ -348,7 +349,7 @@ impl H263BaseDecoder {
                         } else {
                             if single_mv { cur_mv } else { bi.mv_f[blk + 1] }
                         };
-                    
+
                     let mut obmcbuf = NASimpleVideoFrame::from_video_buf(&mut self.obmc_buf).unwrap();
 
                     if let Some(ref srcbuf) = self.ipbs.get_lastref() {
@@ -404,6 +405,7 @@ impl H263BaseDecoder {
         }
         mb_pos
     }
+    #[allow(clippy::cyclomatic_complexity)]
     pub fn parse_frame(&mut self, bd: &mut BlockDecoder, bdsp: &BlockDSP) -> DecoderResult<NABufferType> {
         let pinfo = bd.decode_pichdr()?;
         let mut mvi = MVInfo::new();
@@ -466,7 +468,7 @@ impl H263BaseDecoder {
 
         let mut sstate = SliceState::new(pinfo.mode == Type::I);
         let mut mb_pos = 0;
-        let apply_acpred = (pinfo.mode == Type::I) && pinfo.plusinfo.is_some() && pinfo.plusinfo.unwrap().aic;
+        let apply_acpred = /*(pinfo.mode == Type::I) && */pinfo.plusinfo.is_some() && pinfo.plusinfo.unwrap().aic;
         if apply_acpred {
             self.pred_coeffs.truncate(0);
             self.pred_coeffs.resize(self.mb_w * self.mb_h, ZERO_PRED_COEFFS);
@@ -511,6 +513,7 @@ impl H263BaseDecoder {
                     if is_b {
                         mvi2.set_zero_mv(mb_x);
                     } else if pinfo.is_pb() {
+                        mvi.predict(mb_x, 0, false, binfo.get_mv2(0), sstate.first_line, sstate.first_mb);
                         mvi2.predict(mb_x, 0, false, binfo.get_mv2(0), sstate.first_line, sstate.first_mb);
                     }
                     if do_obmc {