From aab9c3ed18cdf7ad64057c33a6f139cfc1c4d16e Mon Sep 17 00:00:00 2001
From: Luca Barbato <lu_zero@gentoo.org>
Date: Tue, 25 Sep 2018 12:53:25 +0200
Subject: [PATCH] get_sad does not need mutable PlaneSlices anymore

---
 benches/me.rs |  6 +++---
 src/me.rs     | 14 +++++++-------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/benches/me.rs b/benches/me.rs
index 94a4c13b..51d32528 100644
--- a/benches/me.rs
+++ b/benches/me.rs
@@ -41,11 +41,11 @@ fn bench_get_sad(b: &mut Bencher, bs: &BlockSize) {
   let rec_plane = new_plane(&mut ra, w, h);
   let po = PlaneOffset { x: 0, y: 0 };
 
-  let mut plane_org = input_plane.slice(&po);
-  let mut plane_ref = rec_plane.slice(&po);
+  let plane_org = input_plane.slice(&po);
+  let plane_ref = rec_plane.slice(&po);
 
   b.iter(|| {
-      let _ = me::get_sad(&mut plane_org, &mut plane_ref, bsw, bsh);
+      let _ = me::get_sad(&plane_org, &plane_ref, bsw, bsh);
   })
 }
 
diff --git a/src/me.rs b/src/me.rs
index 1bae412e..003b710d 100644
--- a/src/me.rs
+++ b/src/me.rs
@@ -17,7 +17,7 @@ use FrameState;
 
 #[inline(always)]
 pub fn get_sad(
-  plane_org: &mut PlaneSlice, plane_ref: &mut PlaneSlice, blk_h: usize,
+  plane_org: &PlaneSlice, plane_ref: &PlaneSlice, blk_h: usize,
   blk_w: usize
 ) -> u32 {
   let mut sum = 0 as u32;
@@ -64,10 +64,10 @@ pub fn motion_estimation(
 
       for y in (y_lo..y_hi).step_by(2) {
         for x in (x_lo..x_hi).step_by(2) {
-          let mut plane_org = fs.input.planes[0].slice(&po);
-          let mut plane_ref = rec.frame.planes[0].slice(&PlaneOffset { x, y });
+          let plane_org = fs.input.planes[0].slice(&po);
+          let plane_ref = rec.frame.planes[0].slice(&PlaneOffset { x, y });
 
-          let sad = get_sad(&mut plane_org, &mut plane_ref, blk_h, blk_w);
+          let sad = get_sad(&plane_org, &plane_ref, blk_h, blk_w);
 
           if sad < lowest_sad {
             lowest_sad = sad;
@@ -117,10 +117,10 @@ pub fn motion_estimation(
               );
             }
 
-            let mut plane_org = fs.input.planes[0].slice(&po);
-            let mut plane_ref = tmp_plane.slice(&PlaneOffset { x: 0, y: 0 });
+            let plane_org = fs.input.planes[0].slice(&po);
+            let plane_ref = tmp_plane.slice(&PlaneOffset { x: 0, y: 0 });
 
-            let sad = get_sad(&mut plane_org, &mut plane_ref, blk_h, blk_w);
+            let sad = get_sad(&plane_org, &plane_ref, blk_h, blk_w);
 
             if sad < lowest_sad {
               lowest_sad = sad;
-- 
GitLab