Commit b14c663b authored by Romain Vimont's avatar Romain Vimont Committed by Romain Vimont

Factorize implementation of FrameBlocks setters

Some FrameBlocks setters used the local for_each() method, but some
others reimplemented it manually. Make them also use for_each().
parent 2e9aacda
......@@ -1382,25 +1382,11 @@ impl FrameBlocks {
}
pub fn set_ref_frames(&mut self, bo: BlockOffset, bsize: BlockSize, r: [RefType; 2]) {
let bw = bsize.width_mi();
let bh = bsize.height_mi();
for y in 0..bh {
for x in 0..bw {
self[bo.y + y as usize][bo.x + x as usize].ref_frames = r;
}
}
self.for_each(bo, bsize, |block| block.ref_frames = r);
}
pub fn set_motion_vectors(&mut self, bo: BlockOffset, bsize: BlockSize, mvs: [MotionVector; 2]) {
let bw = bsize.width_mi();
let bh = bsize.height_mi();
for y in 0..bh {
for x in 0..bw {
self[bo.y + y as usize][bo.x + x as usize].mv = mvs;
}
}
self.for_each(bo, bsize, |block| block.mv = mvs);
}
pub fn set_cdef(&mut self, sbo: SuperBlockOffset, cdef_index: u8) {
......
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