Commit 18ad2b5e authored by Romain Vimont's avatar Romain Vimont Committed by Romain Vimont

Simplify BlockContext logic

Rewrite conditions to make them easier to read.
parent db58658a
...@@ -1638,17 +1638,9 @@ impl BlockContext { ...@@ -1638,17 +1638,9 @@ impl BlockContext {
} }
fn skip_context(&mut self, bo: BlockOffset) -> usize { fn skip_context(&mut self, bo: BlockOffset) -> usize {
let above_skip = if bo.y > 0 { let above_skip = bo.y > 0 && self.above_of(bo).skip;
self.above_of(bo).skip as usize let left_skip = bo.x > 0 && self.left_of(bo).skip;
} else { above_skip as usize + left_skip as usize
0
};
let left_skip = if bo.x > 0 {
self.left_of(bo).skip as usize
} else {
0
};
above_skip + left_skip
} }
pub fn set_skip(&mut self, bo: BlockOffset, bsize: BlockSize, skip: bool) { pub fn set_skip(&mut self, bo: BlockOffset, bsize: BlockSize, skip: bool) {
...@@ -1719,13 +1711,9 @@ impl BlockContext { ...@@ -1719,13 +1711,9 @@ impl BlockContext {
(above_intra || left_intra) as usize (above_intra || left_intra) as usize
} }
} }
(true, _) | (_, true) => (true, false) => if self.above_of(bo).is_inter() { 0 } else { 2 },
2 * if has_above { (false, true) => if self.left_of(bo).is_inter() { 0 } else { 2 },
!self.above_of(bo).is_inter() as usize _ => 0
} else {
!self.left_of(bo).is_inter() as usize
},
(_, _) => 0
} }
} }
......
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