Commit 93151ecc authored by Romain Vimont's avatar Romain Vimont Committed by Luca Barbato

Make PlaneOffset derive Copy

Like previous commits did for BlockOffset and SuperBlockOffset.
parent 32effc32
...@@ -82,7 +82,7 @@ fn write_b_bench(b: &mut Bencher, tx_size: TxSize, qindex: usize) { ...@@ -82,7 +82,7 @@ fn write_b_bench(b: &mut Bencher, tx_size: TxSize, qindex: usize) {
tx_size, tx_size,
tx_type, tx_type,
tx_size.block_size(), tx_size.block_size(),
&po, po,
false, false,
ac, ac,
0, 0,
......
...@@ -44,8 +44,8 @@ fn bench_get_sad(b: &mut Bencher, bs: &BlockSize) { ...@@ -44,8 +44,8 @@ fn bench_get_sad(b: &mut Bencher, bs: &BlockSize) {
let rec_plane = new_plane::<u16>(&mut ra, w, h); let rec_plane = new_plane::<u16>(&mut ra, w, h);
let po = PlaneOffset { x: 0, y: 0 }; let po = PlaneOffset { x: 0, y: 0 };
let plane_org = input_plane.slice(&po); let plane_org = input_plane.slice(po);
let plane_ref = rec_plane.slice(&po); let plane_ref = rec_plane.slice(po);
b.iter(|| { b.iter(|| {
let _ = let _ =
......
...@@ -230,7 +230,7 @@ pub fn cdef_analyze_superblock<T: Pixel>( ...@@ -230,7 +230,7 @@ pub fn cdef_analyze_superblock<T: Pixel>(
let mut var: i32 = 0; let mut var: i32 = 0;
let in_plane = &in_frame.planes[0]; let in_plane = &in_frame.planes[0];
let in_po = sbo.plane_offset(&in_plane.cfg); let in_po = sbo.plane_offset(&in_plane.cfg);
let in_slice = in_plane.slice(&in_po); let in_slice = in_plane.slice(in_po);
dir.dir[bx][by] = cdef_find_dir(&in_slice.reslice(8 * bx as isize + 2, dir.dir[bx][by] = cdef_find_dir(&in_slice.reslice(8 * bx as isize + 2,
8 * by as isize + 2), 8 * by as isize + 2),
&mut var, coeff_shift) as u8; &mut var, coeff_shift) as u8;
...@@ -290,7 +290,7 @@ pub fn cdef_sb_padded_frame_copy<T: Pixel>( ...@@ -290,7 +290,7 @@ pub fn cdef_sb_padded_frame_copy<T: Pixel>(
out_row[x] = CDEF_VERY_LARGE; out_row[x] = CDEF_VERY_LARGE;
} }
} else { } else {
let in_slice = f.planes[p].slice(&PlaneOffset {x:0, y:offset.y - ipad}); let in_slice = f.planes[p].slice(PlaneOffset {x:0, y:offset.y - ipad});
let in_row = &in_slice[y as usize]; let in_row = &in_slice[y as usize];
// are we guaranteed to be all in frame this row? // are we guaranteed to be all in frame this row?
if offset.x < ipad || offset.x + (sb_size as isize >>xdec) + ipad >= w { if offset.x < ipad || offset.x + (sb_size as isize >>xdec) + ipad >= w {
...@@ -374,9 +374,9 @@ pub fn cdef_filter_superblock<T: Pixel>( ...@@ -374,9 +374,9 @@ pub fn cdef_filter_superblock<T: Pixel>(
let ydec = in_plane.cfg.ydec; let ydec = in_plane.cfg.ydec;
let in_stride = in_plane.cfg.stride; let in_stride = in_plane.cfg.stride;
let in_slice = &in_plane.slice(&in_po); let in_slice = &in_plane.slice(in_po);
let out_stride = out_plane.cfg.stride; let out_stride = out_plane.cfg.stride;
let out_slice = &mut out_plane.mut_slice(&out_po); let out_slice = &mut out_plane.mut_slice(out_po);
let local_pri_strength; let local_pri_strength;
let local_sec_strength; let local_sec_strength;
......
...@@ -1036,7 +1036,7 @@ fn filter_v_edge<T: Pixel>( ...@@ -1036,7 +1036,7 @@ fn filter_v_edge<T: Pixel>(
let level = deblock_level(deblock, block, prev_block, pli, true); let level = deblock_level(deblock, block, prev_block, pli, true);
if level > 0 { if level > 0 {
let po = bo.plane_offset(&p.cfg); let po = bo.plane_offset(&p.cfg);
let mut plane_slice = p.mut_slice(&po); let mut plane_slice = p.mut_slice(po);
plane_slice.x -= (filter_size >> 1) as isize; plane_slice.x -= (filter_size >> 1) as isize;
match filter_size { match filter_size {
4 => { 4 => {
...@@ -1075,8 +1075,8 @@ fn sse_v_edge<T: Pixel>( ...@@ -1075,8 +1075,8 @@ fn sse_v_edge<T: Pixel>(
po.x -= (filter_size >> 1) as isize; po.x -= (filter_size >> 1) as isize;
po po
}; };
let rec_slice = rec_plane.slice(&po); let rec_slice = rec_plane.slice(po);
let src_slice = src_plane.slice(&po); let src_slice = src_plane.slice(po);
match filter_size { match filter_size {
4 => { 4 => {
sse_size4( sse_size4(
...@@ -1139,7 +1139,7 @@ fn filter_h_edge<T: Pixel>( ...@@ -1139,7 +1139,7 @@ fn filter_h_edge<T: Pixel>(
let level = deblock_level(deblock, block, prev_block, pli, false); let level = deblock_level(deblock, block, prev_block, pli, false);
if level > 0 { if level > 0 {
let po = bo.plane_offset(&p.cfg); let po = bo.plane_offset(&p.cfg);
let mut plane_slice = p.mut_slice(&po); let mut plane_slice = p.mut_slice(po);
plane_slice.y -= (filter_size >> 1) as isize; plane_slice.y -= (filter_size >> 1) as isize;
match filter_size { match filter_size {
4 => { 4 => {
...@@ -1178,8 +1178,8 @@ fn sse_h_edge<T: Pixel>( ...@@ -1178,8 +1178,8 @@ fn sse_h_edge<T: Pixel>(
po.x -= (filter_size >> 1) as isize; po.x -= (filter_size >> 1) as isize;
po po
}; };
let rec_slice = rec_plane.slice(&po); let rec_slice = rec_plane.slice(po);
let src_slice = src_plane.slice(&po); let src_slice = src_plane.slice(po);
match filter_size { match filter_size {
4 => { 4 => {
sse_size4( sse_size4(
......
...@@ -953,7 +953,7 @@ fn get_qidx<T: Pixel>(fi: &FrameInvariants<T>, fs: &FrameState<T>, cw: &ContextW ...@@ -953,7 +953,7 @@ fn get_qidx<T: Pixel>(fi: &FrameInvariants<T>, fs: &FrameState<T>, cw: &ContextW
pub fn encode_tx_block<T: Pixel>( pub fn encode_tx_block<T: Pixel>(
fi: &FrameInvariants<T>, fs: &mut FrameState<T>, cw: &mut ContextWriter, fi: &FrameInvariants<T>, fs: &mut FrameState<T>, cw: &mut ContextWriter,
w: &mut dyn Writer, p: usize, bo: BlockOffset, mode: PredictionMode, w: &mut dyn Writer, p: usize, bo: BlockOffset, mode: PredictionMode,
tx_size: TxSize, tx_type: TxType, plane_bsize: BlockSize, po: &PlaneOffset, tx_size: TxSize, tx_type: TxType, plane_bsize: BlockSize, po: PlaneOffset,
skip: bool, ac: &[i16], alpha: i16, rdo_type: RDOType, for_rdo_use: bool skip: bool, ac: &[i16], alpha: i16, rdo_type: RDOType, for_rdo_use: bool
) -> (bool, i64) { ) -> (bool, i64) {
let qidx = get_qidx(fi, fs, cw, bo); let qidx = get_qidx(fi, fs, cw, bo);
...@@ -1068,7 +1068,7 @@ pub fn motion_compensate<T: Pixel>( ...@@ -1068,7 +1068,7 @@ pub fn motion_compensate<T: Pixel>(
some_use_intra |= cw.bc.at(bo.with_offset(-1,-1)).mode.is_intra(); }; some_use_intra |= cw.bc.at(bo.with_offset(-1,-1)).mode.is_intra(); };
if some_use_intra { if some_use_intra {
luma_mode.predict_inter(fi, p, &po, &mut rec.mut_slice(&po), plane_bsize.width(), luma_mode.predict_inter(fi, p, po, &mut rec.mut_slice(po), plane_bsize.width(),
plane_bsize.height(), ref_frames, mvs); plane_bsize.height(), ref_frames, mvs);
} else { } else {
assert!(xdec == 1 && ydec == 1); assert!(xdec == 1 && ydec == 1);
...@@ -1083,28 +1083,28 @@ pub fn motion_compensate<T: Pixel>( ...@@ -1083,28 +1083,28 @@ pub fn motion_compensate<T: Pixel>(
let rf2 = cw.bc.at(bo.with_offset(-1,0)).ref_frames; let rf2 = cw.bc.at(bo.with_offset(-1,0)).ref_frames;
let po2 = PlaneOffset { x: po.x, y: po.y+2 }; let po2 = PlaneOffset { x: po.x, y: po.y+2 };
let po3 = PlaneOffset { x: po.x+2, y: po.y+2 }; let po3 = PlaneOffset { x: po.x+2, y: po.y+2 };
luma_mode.predict_inter(fi, p, &po, &mut rec.mut_slice(&po), 2, 2, rf0, mv0); luma_mode.predict_inter(fi, p, po, &mut rec.mut_slice(po), 2, 2, rf0, mv0);
luma_mode.predict_inter(fi, p, &po1, &mut rec.mut_slice(&po1), 2, 2, rf1, mv1); luma_mode.predict_inter(fi, p, po1, &mut rec.mut_slice(po1), 2, 2, rf1, mv1);
luma_mode.predict_inter(fi, p, &po2, &mut rec.mut_slice(&po2), 2, 2, rf2, mv2); luma_mode.predict_inter(fi, p, po2, &mut rec.mut_slice(po2), 2, 2, rf2, mv2);
luma_mode.predict_inter(fi, p, &po3, &mut rec.mut_slice(&po3), 2, 2, ref_frames, mvs); luma_mode.predict_inter(fi, p, po3, &mut rec.mut_slice(po3), 2, 2, ref_frames, mvs);
} }
if bsize == BlockSize::BLOCK_8X4 { if bsize == BlockSize::BLOCK_8X4 {
let mv1 = cw.bc.at(bo.with_offset(0,-1)).mv; let mv1 = cw.bc.at(bo.with_offset(0,-1)).mv;
let rf1 = cw.bc.at(bo.with_offset(0,-1)).ref_frames; let rf1 = cw.bc.at(bo.with_offset(0,-1)).ref_frames;
luma_mode.predict_inter(fi, p, &po, &mut rec.mut_slice(&po), 4, 2, rf1, mv1); luma_mode.predict_inter(fi, p, po, &mut rec.mut_slice(po), 4, 2, rf1, mv1);
let po3 = PlaneOffset { x: po.x, y: po.y+2 }; let po3 = PlaneOffset { x: po.x, y: po.y+2 };
luma_mode.predict_inter(fi, p, &po3, &mut rec.mut_slice(&po3), 4, 2, ref_frames, mvs); luma_mode.predict_inter(fi, p, po3, &mut rec.mut_slice(po3), 4, 2, ref_frames, mvs);
} }
if bsize == BlockSize::BLOCK_4X8 { if bsize == BlockSize::BLOCK_4X8 {
let mv2 = cw.bc.at(bo.with_offset(-1,0)).mv; let mv2 = cw.bc.at(bo.with_offset(-1,0)).mv;
let rf2 = cw.bc.at(bo.with_offset(-1,0)).ref_frames; let rf2 = cw.bc.at(bo.with_offset(-1,0)).ref_frames;
luma_mode.predict_inter(fi, p, &po, &mut rec.mut_slice(&po), 2, 4, rf2, mv2); luma_mode.predict_inter(fi, p, po, &mut rec.mut_slice(po), 2, 4, rf2, mv2);
let po3 = PlaneOffset { x: po.x+2, y: po.y }; let po3 = PlaneOffset { x: po.x+2, y: po.y };
luma_mode.predict_inter(fi, p, &po3, &mut rec.mut_slice(&po3), 2, 4, ref_frames, mvs); luma_mode.predict_inter(fi, p, po3, &mut rec.mut_slice(po3), 2, 4, ref_frames, mvs);
} }
} }
} else { } else {
luma_mode.predict_inter(fi, p, &po, &mut rec.mut_slice(&po), plane_bsize.width(), luma_mode.predict_inter(fi, p, po, &mut rec.mut_slice(po), plane_bsize.width(),
plane_bsize.height(), ref_frames, mvs); plane_bsize.height(), ref_frames, mvs);
} }
} }
...@@ -1306,7 +1306,7 @@ pub fn luma_ac<T: Pixel>( ...@@ -1306,7 +1306,7 @@ pub fn luma_ac<T: Pixel>(
bo.plane_offset(&fs.input.planes[0].cfg) bo.plane_offset(&fs.input.planes[0].cfg)
}; };
let rec = &fs.rec.planes[0]; let rec = &fs.rec.planes[0];
let luma = &rec.slice(&po); let luma = &rec.slice(po);
let mut sum: i32 = 0; let mut sum: i32 = 0;
for sub_y in 0..plane_bsize.height() { for sub_y in 0..plane_bsize.height() {
...@@ -1359,7 +1359,7 @@ pub fn write_tx_blocks<T: Pixel>( ...@@ -1359,7 +1359,7 @@ pub fn write_tx_blocks<T: Pixel>(
let po = tx_bo.plane_offset(&fs.input.planes[0].cfg); let po = tx_bo.plane_offset(&fs.input.planes[0].cfg);
let (_, dist) = let (_, dist) =
encode_tx_block( encode_tx_block(
fi, fs, cw, w, 0, tx_bo, luma_mode, tx_size, tx_type, bsize, &po, fi, fs, cw, w, 0, tx_bo, luma_mode, tx_size, tx_type, bsize, po,
skip, &ac.array, 0, rdo_type, for_rdo_use skip, &ac.array, 0, rdo_type, for_rdo_use
); );
assert!(!fi.use_tx_domain_distortion || !for_rdo_use || skip || dist >= 0); assert!(!fi.use_tx_domain_distortion || !for_rdo_use || skip || dist >= 0);
...@@ -1413,7 +1413,7 @@ pub fn write_tx_blocks<T: Pixel>( ...@@ -1413,7 +1413,7 @@ pub fn write_tx_blocks<T: Pixel>(
po.y += (by * uv_tx_size.height()) as isize; po.y += (by * uv_tx_size.height()) as isize;
let (_, dist) = let (_, dist) =
encode_tx_block(fi, fs, cw, w, p, tx_bo, chroma_mode, uv_tx_size, uv_tx_type, encode_tx_block(fi, fs, cw, w, p, tx_bo, chroma_mode, uv_tx_size, uv_tx_type,
plane_bsize, &po, skip, &ac.array, alpha, rdo_type, for_rdo_use); plane_bsize, po, skip, &ac.array, alpha, rdo_type, for_rdo_use);
assert!(!fi.use_tx_domain_distortion || !for_rdo_use || skip || dist >= 0); assert!(!fi.use_tx_domain_distortion || !for_rdo_use || skip || dist >= 0);
tx_dist += dist; tx_dist += dist;
} }
...@@ -1444,7 +1444,7 @@ pub fn write_tx_tree<T: Pixel>( ...@@ -1444,7 +1444,7 @@ pub fn write_tx_tree<T: Pixel>(
let po = bo.plane_offset(&fs.input.planes[0].cfg); let po = bo.plane_offset(&fs.input.planes[0].cfg);
let (has_coeff, dist) = encode_tx_block( let (has_coeff, dist) = encode_tx_block(
fi, fs, cw, w, 0, bo, luma_mode, tx_size, tx_type, bsize, &po, skip, ac, 0, rdo_type, for_rdo_use fi, fs, cw, w, 0, bo, luma_mode, tx_size, tx_type, bsize, po, skip, ac, 0, rdo_type, for_rdo_use
); );
assert!(!fi.use_tx_domain_distortion || !for_rdo_use || skip || dist >= 0); assert!(!fi.use_tx_domain_distortion || !for_rdo_use || skip || dist >= 0);
tx_dist += dist; tx_dist += dist;
...@@ -1479,7 +1479,7 @@ pub fn write_tx_tree<T: Pixel>( ...@@ -1479,7 +1479,7 @@ pub fn write_tx_tree<T: Pixel>(
let po = bo.plane_offset(&fs.input.planes[p].cfg); let po = bo.plane_offset(&fs.input.planes[p].cfg);
let (_, dist) = let (_, dist) =
encode_tx_block(fi, fs, cw, w, p, tx_bo, luma_mode, uv_tx_size, uv_tx_type, encode_tx_block(fi, fs, cw, w, p, tx_bo, luma_mode, uv_tx_size, uv_tx_type,
plane_bsize, &po, skip, ac, 0, rdo_type, for_rdo_use); plane_bsize, po, skip, ac, 0, rdo_type, for_rdo_use);
assert!(!fi.use_tx_domain_distortion || !for_rdo_use || skip || dist >= 0); assert!(!fi.use_tx_domain_distortion || !for_rdo_use || skip || dist >= 0);
tx_dist += dist; tx_dist += dist;
} }
......
...@@ -732,7 +732,7 @@ fn wiener_stripe_filter<T: Pixel>(coeffs: [[i8; 3]; 2], fi: &FrameInvariants<T>, ...@@ -732,7 +732,7 @@ fn wiener_stripe_filter<T: Pixel>(coeffs: [[i8; 3]; 2], fi: &FrameInvariants<T>,
stripe_h as isize - start_wi as isize stripe_h as isize - start_wi as isize
}) as usize; }) as usize;
let mut out_slice = out.mut_slice(&PlaneOffset{x: 0, y: start_yi as isize}); let mut out_slice = out.mut_slice(PlaneOffset{x: 0, y: start_yi as isize});
for xi in stripe_x..stripe_x+stripe_w { for xi in stripe_x..stripe_x+stripe_w {
let n = cmp::min(7, crop_w as isize + 3 - xi as isize); let n = cmp::min(7, crop_w as isize + 3 - xi as isize);
...@@ -958,11 +958,11 @@ impl RestorationState { ...@@ -958,11 +958,11 @@ impl RestorationState {
crop_w - x, crop_w - x,
(crop_h as isize - stripe_start_y) as usize, (crop_h as isize - stripe_start_y) as usize,
size, stripe_size, size, stripe_size,
&cdeffed.planes[pli].slice(&PlaneOffset{x: x as isize, &cdeffed.planes[pli].slice(PlaneOffset{x: x as isize,
y: stripe_start_y}), y: stripe_start_y}),
&pre_cdef.planes[pli].slice(&PlaneOffset{x: x as isize, &pre_cdef.planes[pli].slice(PlaneOffset{x: x as isize,
y: stripe_start_y}), y: stripe_start_y}),
&mut out.planes[pli].mut_slice(&PlaneOffset{x: x as isize, &mut out.planes[pli].mut_slice(PlaneOffset{x: x as isize,
y: stripe_start_y})); y: stripe_start_y}));
}, },
RestorationFilter::None => { RestorationFilter::None => {
......
This diff is collapsed.
...@@ -1133,7 +1133,7 @@ impl PredictionMode { ...@@ -1133,7 +1133,7 @@ impl PredictionMode {
} }
pub fn predict_inter<T: Pixel>( pub fn predict_inter<T: Pixel>(
self, fi: &FrameInvariants<T>, p: usize, po: &PlaneOffset, self, fi: &FrameInvariants<T>, p: usize, po: PlaneOffset,
dst: &mut PlaneMutSlice<'_, T>, width: usize, height: usize, dst: &mut PlaneMutSlice<'_, T>, width: usize, height: usize,
ref_frames: [usize; 2], mvs: [MotionVector; 2] ref_frames: [usize; 2], mvs: [MotionVector; 2]
) { ) {
...@@ -1144,7 +1144,7 @@ impl PredictionMode { ...@@ -1144,7 +1144,7 @@ impl PredictionMode {
ref_frames[1] > INTRA_FRAME && ref_frames[1] != NONE_FRAME; ref_frames[1] > INTRA_FRAME && ref_frames[1] != NONE_FRAME;
fn get_params<'a, T: Pixel>( fn get_params<'a, T: Pixel>(
rec_plane: &'a Plane<T>, po: &PlaneOffset, mv: MotionVector rec_plane: &'a Plane<T>, po: PlaneOffset, mv: MotionVector
) -> (i32, i32, PlaneSlice<'a, T>) { ) -> (i32, i32, PlaneSlice<'a, T>) {
let rec_cfg = &rec_plane.cfg; let rec_cfg = &rec_plane.cfg;
let shift_row = 3 + rec_cfg.ydec; let shift_row = 3 + rec_cfg.ydec;
...@@ -1159,7 +1159,7 @@ impl PredictionMode { ...@@ -1159,7 +1159,7 @@ impl PredictionMode {
x: po.x + col_offset as isize - 3, x: po.x + col_offset as isize - 3,
y: po.y + row_offset as isize - 3 y: po.y + row_offset as isize - 3
}; };
(row_frac, col_frac, rec_plane.slice(&qo).clamp().subslice(3, 3)) (row_frac, col_frac, rec_plane.slice(qo).clamp().subslice(3, 3))
}; };
if !is_compound { if !is_compound {
......
...@@ -32,7 +32,7 @@ pub struct PlaneConfig { ...@@ -32,7 +32,7 @@ pub struct PlaneConfig {
} }
/// Absolute offset in pixels inside a plane /// Absolute offset in pixels inside a plane
#[derive(Debug)] #[derive(Clone, Copy, Debug)]
pub struct PlaneOffset { pub struct PlaneOffset {
pub x: isize, pub x: isize,
pub y: isize pub y: isize
...@@ -248,24 +248,24 @@ impl<T: Pixel> Plane<T> { ...@@ -248,24 +248,24 @@ impl<T: Pixel> Plane<T> {
} }
} }
pub fn slice(&self, po: &PlaneOffset) -> PlaneSlice<'_, T> { pub fn slice(&self, po: PlaneOffset) -> PlaneSlice<'_, T> {
PlaneSlice { plane: self, x: po.x, y: po.y } PlaneSlice { plane: self, x: po.x, y: po.y }
} }
pub fn mut_slice(&mut self, po: &PlaneOffset) -> PlaneMutSlice<'_, T> { pub fn mut_slice(&mut self, po: PlaneOffset) -> PlaneMutSlice<'_, T> {
PlaneMutSlice { plane: self, x: po.x, y: po.y } PlaneMutSlice { plane: self, x: po.x, y: po.y }
} }
pub fn as_slice(&self) -> PlaneSlice<'_, T> { pub fn as_slice(&self) -> PlaneSlice<'_, T> {
self.slice(&PlaneOffset { x: 0, y: 0 }) self.slice(PlaneOffset { x: 0, y: 0 })
} }
pub fn as_mut_slice(&mut self) -> PlaneMutSlice<'_, T> { pub fn as_mut_slice(&mut self) -> PlaneMutSlice<'_, T> {
self.mut_slice(&PlaneOffset { x: 0, y: 0 }) self.mut_slice(PlaneOffset { x: 0, y: 0 })
} }
#[inline] #[inline]
pub fn edged_slice(&self, po: &PlaneOffset, left_edge: usize, top_edge: usize) -> EdgedPlaneSlice<'_, T> { pub fn edged_slice(&self, po: PlaneOffset, left_edge: usize, top_edge: usize) -> EdgedPlaneSlice<'_, T> {
debug_assert!(po.x >= 0); debug_assert!(po.x >= 0);
debug_assert!(po.y >= 0); debug_assert!(po.y >= 0);
let left_edge = left_edge.min(po.x as usize); let left_edge = left_edge.min(po.x as usize);
...@@ -274,7 +274,7 @@ impl<T: Pixel> Plane<T> { ...@@ -274,7 +274,7 @@ impl<T: Pixel> Plane<T> {
x: po.x - left_edge as isize, x: po.x - left_edge as isize,
y: po.y - top_edge as isize, y: po.y - top_edge as isize,
}; };
EdgedPlaneSlice { ps: self.slice(&edged_po), left_edge, top_edge } EdgedPlaneSlice { ps: self.slice(edged_po), left_edge, top_edge }
} }
#[inline] #[inline]
......
...@@ -257,8 +257,8 @@ fn compute_distortion<T: Pixel>( ...@@ -257,8 +257,8 @@ fn compute_distortion<T: Pixel>(
let mut distortion = match fi.config.tune { let mut distortion = match fi.config.tune {
Tune::Psychovisual if w_y >= 8 && h_y >= 8 => { Tune::Psychovisual if w_y >= 8 && h_y >= 8 => {
cdef_dist_wxh( cdef_dist_wxh(
&fs.input.planes[0].slice(&po), &fs.input.planes[0].slice(po),
&fs.rec.planes[0].slice(&po), &fs.rec.planes[0].slice(po),
w_y, w_y,
h_y, h_y,
fi.sequence.bit_depth fi.sequence.bit_depth
...@@ -266,8 +266,8 @@ fn compute_distortion<T: Pixel>( ...@@ -266,8 +266,8 @@ fn compute_distortion<T: Pixel>(
} }
Tune::Psnr | Tune::Psychovisual => { Tune::Psnr | Tune::Psychovisual => {
sse_wxh( sse_wxh(
&fs.input.planes[0].slice(&po), &fs.input.planes[0].slice(po),
&fs.rec.planes[0].slice(&po), &fs.rec.planes[0].slice(po),
w_y, w_y,
h_y h_y
) )
...@@ -292,8 +292,8 @@ fn compute_distortion<T: Pixel>( ...@@ -292,8 +292,8 @@ fn compute_distortion<T: Pixel>(
let po = bo.plane_offset(&fs.input.planes[p].cfg); let po = bo.plane_offset(&fs.input.planes[p].cfg);
distortion += sse_wxh( distortion += sse_wxh(
&fs.input.planes[p].slice(&po), &fs.input.planes[p].slice(po),
&fs.rec.planes[p].slice(&po), &fs.rec.planes[p].slice(po),
w_uv, w_uv,
h_uv h_uv
); );
...@@ -314,8 +314,8 @@ fn compute_tx_distortion<T: Pixel>( ...@@ -314,8 +314,8 @@ fn compute_tx_distortion<T: Pixel>(
let po = bo.plane_offset(&fs.input.planes[0].cfg); let po = bo.plane_offset(&fs.input.planes[0].cfg);
sse_wxh( sse_wxh(
&fs.input.planes[0].slice(&po), &fs.input.planes[0].slice(po),
&fs.rec.planes[0].slice(&po), &fs.rec.planes[0].slice(po),
w_y, w_y,
h_y h_y
) )
...@@ -342,8 +342,8 @@ fn compute_tx_distortion<T: Pixel>( ...@@ -342,8 +342,8 @@ fn compute_tx_distortion<T: Pixel>(
let po = bo.plane_offset(&fs.input.planes[p].cfg); let po = bo.plane_offset(&fs.input.planes[p].cfg);
distortion += sse_wxh( distortion += sse_wxh(
&fs.input.planes[p].slice(&po), &fs.input.planes[p].slice(po),
&fs.rec.planes[p].slice(&po), &fs.rec.planes[p].slice(po),
w_uv, w_uv,
h_uv h_uv
); );
...@@ -722,7 +722,7 @@ pub fn rdo_mode_decision<T: Pixel>( ...@@ -722,7 +722,7 @@ pub fn rdo_mode_decision<T: Pixel>(
let rec = &mut fs.rec.planes[0]; let rec = &mut fs.rec.planes[0];
let po = bo.plane_offset(&rec.cfg); let po = bo.plane_offset(&rec.cfg);
get_intra_edges( get_intra_edges(
&rec.edged_slice(&po, 1, 1), &rec.edged_slice(po, 1, 1),
tx_size, tx_size,
fi.sequence.bit_depth, fi.sequence.bit_depth,
&fs.input.planes[0].cfg, &fs.input.planes[0].cfg,
...@@ -735,7 +735,7 @@ pub fn rdo_mode_decision<T: Pixel>( ...@@ -735,7 +735,7 @@ pub fn rdo_mode_decision<T: Pixel>(
let rec = &mut fs.rec.planes[0]; let rec = &mut fs.rec.planes[0];
let po = bo.plane_offset(&rec.cfg); let po = bo.plane_offset(&rec.cfg);
luma_mode.predict_intra( luma_mode.predict_intra(
&mut rec.mut_slice(&po), &mut rec.mut_slice(po),
tx_size, tx_size,
fi.sequence.bit_depth, fi.sequence.bit_depth,
&[0i16; 2], &[0i16; 2],
...@@ -743,8 +743,8 @@ pub fn rdo_mode_decision<T: Pixel>( ...@@ -743,8 +743,8 @@ pub fn rdo_mode_decision<T: Pixel>(
&edge_buf &edge_buf
); );
let plane_org = fs.input.planes[0].slice(&po); let plane_org = fs.input.planes[0].slice(po);
let plane_ref = rec.slice(&po); let plane_ref = rec.slice(po);
( (
luma_mode, luma_mode,
...@@ -907,14 +907,14 @@ pub fn rdo_cfl_alpha<T: Pixel>( ...@@ -907,14 +907,14 @@ pub fn rdo_cfl_alpha<T: Pixel>(
(-16i16..17i16) (-16i16..17i16)
.min_by_key(|&alpha| { .min_by_key(|&alpha| {
let edge_buf = get_intra_edges( let edge_buf = get_intra_edges(
&rec.edged_slice(&po, 1, 1), &rec.edged_slice(po, 1, 1),
uv_tx_size, uv_tx_size,
bit_depth, bit_depth,
&input.cfg, &input.cfg,
Some(PredictionMode::UV_CFL_PRED) Some(PredictionMode::UV_CFL_PRED)
); );
PredictionMode::UV_CFL_PRED.predict_intra( PredictionMode::UV_CFL_PRED.predict_intra(
&mut rec.mut_slice(&po), &mut rec.mut_slice(po),
uv_tx_size, uv_tx_size,
bit_depth, bit_depth,
&ac.array, &ac.array,
...@@ -922,8 +922,8 @@ pub fn rdo_cfl_alpha<T: Pixel>( ...@@ -922,8 +922,8 @@ pub fn rdo_cfl_alpha<T: Pixel>(
&edge_buf &edge_buf
); );
sse_wxh( sse_wxh(
&input.slice(&po), &input.slice(po),
&rec.slice(&po), &rec.slice(po),
uv_tx_size.width(), uv_tx_size.width(),
uv_tx_size.height() uv_tx_size.height()
) )
...@@ -1237,11 +1237,11 @@ fn rdo_loop_plane_error<T: Pixel>(sbo: SuperBlockOffset, fi: &FrameInvariants<T> ...@@ -1237,11 +1237,11 @@ fn rdo_loop_plane_error<T: Pixel>(sbo: SuperBlockOffset, fi: &FrameInvariants<T>
if !skip { if !skip {
let in_plane = &fs.input.planes[pli]; let in_plane = &fs.input.planes[pli];
let in_po = sbo.block_offset(bx<<1, by<<1).plane_offset(&in_plane.cfg); let in_po = sbo.block_offset(bx<<1, by<<1).plane_offset(&in_plane.cfg);
let in_slice = in_plane.slice(&in_po); let in_slice = in_plane.slice(in_po);
let test_plane = &test.planes[pli]; let test_plane = &test.planes[pli];
let test_po = sbo_0.block_offset(bx<<1, by<<1).plane_offset(&test_plane.cfg); let test_po = sbo_0.block_offset(bx<<1, by<<1).plane_offset(&test_plane.cfg);
let test_slice = &test_plane.slice(&test_po); let test_slice = &test_plane.slice(test_po);
let xdec = in_plane.cfg.xdec; let xdec = in_plane.cfg.xdec;
let ydec = in_plane.cfg.ydec; let ydec = in_plane.cfg.ydec;
...@@ -1282,7 +1282,7 @@ pub fn rdo_loop_decision<T: Pixel>(sbo: SuperBlockOffset, fi: &FrameInvariants<T ...@@ -1282,7 +1282,7 @@ pub fn rdo_loop_decision<T: Pixel>(sbo: SuperBlockOffset, fi: &FrameInvariants<T
for p in 0..3 { for p in 0..3 {
let po = sbo.plane_offset(&fs.rec.planes[p].cfg); let po = sbo.plane_offset(&fs.rec.planes[p].cfg);
let PlaneConfig { width, height, .. } = lrf_input.planes[p].cfg; let PlaneConfig { width, height, .. } = lrf_input.planes[p].cfg;
for (rec, inp) in fs.rec.planes[p].slice(&po).rows_iter().zip(