Commit 8348794a authored by Romain Vimont's avatar Romain Vimont Committed by Luca Barbato

Remove unused window()

FrameState::window() requires to copy all FrameState fields, which we
don't necessary want to implement for new fields.

In particular, when making RestorationState a FrameState field, we don't
necessarily want to make it copyable.

Since the method is unused, just remove it, along with Frame::window()
and Plane::window().
parent 330ac9df
......@@ -80,16 +80,6 @@ impl Frame {
}
}
pub fn window(&self, sbo: &SuperBlockOffset) -> Frame {
Frame {
planes: [
self.planes[0].window(&sbo.plane_offset(&self.planes[0].cfg)),
self.planes[1].window(&sbo.plane_offset(&self.planes[1].cfg)),
self.planes[2].window(&sbo.plane_offset(&self.planes[2].cfg))
]
}
}
/// Returns a `PixelIter` containing the data of this frame's planes in YUV format.
/// Each point in the `PixelIter` is a triple consisting of a Y, U, and V component.
/// The `PixelIter` is laid out as contiguous rows, e.g. to get a given 0-indexed row
......@@ -460,19 +450,6 @@ impl FrameState {
segmentation: Default::default(),
}
}
pub fn window(&self, sbo: &SuperBlockOffset) -> FrameState {
FrameState {
input: Arc::new(self.input.window(sbo)),
input_hres: self.input_hres.window(&sbo.plane_offset(&self.input_hres.cfg)),
input_qres: self.input_qres.window(&sbo.plane_offset(&self.input_qres.cfg)),
rec: self.rec.window(sbo),
qc: self.qc,
cdfs: self.cdfs,
deblock: self.deblock,
segmentation: self.segmentation,
}
}
}
#[derive(Copy, Clone, Debug)]
......@@ -2878,36 +2855,6 @@ pub fn update_rec_buffer(fi: &mut FrameInvariants, fs: FrameState) {
mod test {
use super::*;
#[test]
fn frame_state_window() {
let config = EncoderConfig { ..Default::default() };
let seq = Sequence::new(&Default::default());
let fi = FrameInvariants::new(1024, 1024, config, seq);
let mut fs = FrameState::new(&fi);
for p in fs.rec.planes.iter_mut() {
for (i, v) in p
.mut_slice(&PlaneOffset { x: 0, y: 0 })
.as_mut_slice()
.iter_mut()
.enumerate()
{
*v = i as u16;
}
}
let offset = BlockOffset { x: 56, y: 56 };
let sbo = offset.sb_offset();
let fs_ = fs.window(&sbo);
for p in 0..3 {
assert!(fs_.rec.planes[p].cfg.xorigin < 0);
assert!(fs_.rec.planes[p].cfg.yorigin < 0);
let po = offset.plane_offset(&fs.rec.planes[p].cfg);
assert_eq!(
&fs.rec.planes[p].slice(&po).as_slice()[..32],
&fs_.rec.planes[p].slice(&po).as_slice()[..32]
);
}
}
#[test]
fn check_partition_types_order() {
assert_eq!(RAV1E_PARTITION_TYPES[RAV1E_PARTITION_TYPES.len() - 1],
......
......@@ -73,44 +73,6 @@ impl Plane {
}
}
pub fn window(&self, po: &PlaneOffset) -> Plane {
assert!(self.cfg.xorigin >= 0 && self.cfg.yorigin >= 0);
let x = po.x as usize;
let y = po.y as usize;
let xpad = self.cfg.xorigin as usize;
let ypad = self.cfg.yorigin as usize;
let xdec = self.cfg.xdec;
let ydec = self.cfg.ydec;
let xorigin = self.cfg.xorigin - po.x;
let yorigin = self.cfg.yorigin - po.y;
let width = 1 << (6 - xdec);
let height = 1 << (6 - ydec);
let stride = (xpad + width + xpad)
.align_power_of_two(Plane::STRIDE_ALIGNMENT_LOG2 - 1);
let alloc_height = ypad + height + ypad;
let mut data = vec![128u16; stride * alloc_height];
for (d, s) in data
.chunks_mut(stride)
.zip(self.data[(y * self.cfg.stride)..].chunks(self.cfg.stride))
{
let w = d.len().min(s.len() - x);
d[..w].copy_from_slice(&s[x..(x + w)]);
}
Plane {
data,
cfg: PlaneConfig {
stride,
alloc_height,
width,
height,
xdec,
ydec,
xorigin,
yorigin
}
}
}
pub fn pad(&mut self, w: usize, h: usize) {
assert!(self.cfg.xorigin >= 0 && self.cfg.yorigin >= 0);
let xorigin = self.cfg.xorigin as usize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment