]> git.nihav.org Git - nihav.git/blobdiff - nihav-itu/src/codecs/h264/mb_recon.rs
h264: make some structures shareable
[nihav.git] / nihav-itu / src / codecs / h264 / mb_recon.rs
index e78c134ee13a21272028292ebdafa0b732406095..eb32792d6d8369ef65864766a48ae45ab5f2197c 100644 (file)
@@ -2,7 +2,7 @@ use nihav_core::frame::*;
 use nihav_codec_support::codecs::MV;
 use super::{CurrentMBInfo, I4X4_SCAN};
 use super::dsp::*;
-use super::pic_ref::FrameRefs;
+use super::pic_ref::SliceRefs;
 use super::slice::{SliceHeader, WeightInfo, DEF_WEIGHT_INFO};
 use super::types::*;
 
@@ -244,6 +244,7 @@ fn do_p_mc(frm: &mut NASimpleVideoFrame<u8>, xpos: usize, ypos: usize, w: usize,
     }
 }
 
+#[allow(clippy::match_like_matches_macro)]
 fn do_b_mc(frm: &mut NASimpleVideoFrame<u8>, mode: BMode, xpos: usize, ypos: usize, w: usize, h: usize, mv0: MV, ref_pic0: Option<NAVideoBufferRef<u8>>, weight0: &WeightInfo, mv1: MV, ref_pic1: Option<NAVideoBufferRef<u8>>, weight1: &WeightInfo, mc_dsp: &mut H264MC) {
     let do_weight = match (mode, weight0.is_weighted(), weight1.is_weighted()) {
             (BMode::L0, true, _) => true,
@@ -367,7 +368,7 @@ fn do_b_mc(frm: &mut NASimpleVideoFrame<u8>, mode: BMode, xpos: usize, ypos: usi
     }
 }
 
-fn get_weights(slice_hdr: &SliceHeader, frame_refs: &FrameRefs, mode: BMode, weight_mode: u8, ref_l0: PicRef, ref_l1: PicRef) -> (WeightInfo, WeightInfo) {
+fn get_weights(slice_hdr: &SliceHeader, frame_refs: &SliceRefs, mode: BMode, weight_mode: u8, ref_l0: PicRef, ref_l1: PicRef) -> (WeightInfo, WeightInfo) {
     let idx_l0 = ref_l0.index();
     let idx_l1 = ref_l1.index();
     if mode != BMode::Bi || weight_mode != 2 {
@@ -417,16 +418,16 @@ fn get_weights(slice_hdr: &SliceHeader, frame_refs: &FrameRefs, mode: BMode, wei
     }
 }
 
-pub fn recon_mb(frm: &mut NASimpleVideoFrame<u8>, slice_hdr: &SliceHeader, mb_info: &CurrentMBInfo, sstate: &mut SliceState, frame_refs: &FrameRefs, mc_dsp: &mut H264MC, weight_mode: u8) {
+pub fn recon_mb(frm: &mut NASimpleVideoFrame<u8>, slice_hdr: &SliceHeader, mb_info: &CurrentMBInfo, sstate: &mut SliceState, frame_refs: &SliceRefs, mc_dsp: &mut H264MC, weight_mode: u8) {
     let xpos = sstate.mb_x * 16;
     let ypos = sstate.mb_y * 16;
 
     match mb_info.mb_type {
         MBType::Intra16x16(_, _, _) => {
-            pred_intra(frm, &sstate, &mb_info);
+            pred_intra(frm, sstate, mb_info);
         },
         MBType::Intra4x4 | MBType::Intra8x8 => {
-            pred_intra(frm, &sstate, &mb_info);
+            pred_intra(frm, sstate, mb_info);
         },
         MBType::PCM => {},
         MBType::PSkip => {
@@ -600,8 +601,8 @@ pub fn recon_mb(frm: &mut NASimpleVideoFrame<u8>, slice_hdr: &SliceHeader, mb_in
     };
     if !mb_info.mb_type.is_skip() {
         if mb_info.mb_type != MBType::Intra4x4 && mb_info.mb_type != MBType::Intra8x8 {
-            add_luma(frm, &sstate, &mb_info);
+            add_luma(frm, sstate, mb_info);
         }
-        add_chroma(frm, &sstate, &mb_info);
+        add_chroma(frm, sstate, mb_info);
     }
 }