Skip to content

Commit

Permalink
Fix style issues
Browse files Browse the repository at this point in the history
Remove `EDGE_` prefix from constant names and use `EdgeFlags::union_all` in
conjunction with constants.
  • Loading branch information
Frank Bossen committed Mar 17, 2024
1 parent d4d5612 commit d358e4e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3575,7 +3575,7 @@ unsafe fn decode_sb(
None => {
let tip = intra_edge.tip(sb128, edge_index);
assert!(hsz == 1);
decode_b(c, t, f, bl, BS_4x4, bp, EdgeFlags::EDGE_ALL_TR_AND_BL)?;
decode_b(c, t, f, bl, BS_4x4, bp, EdgeFlags::ALL_TR_AND_BL)?;
let tl_filter = t.tl_4x4_filter;
t.bx += 1;
decode_b(c, t, f, bl, BS_4x4, bp, tip.split[0])?;
Expand Down Expand Up @@ -3613,7 +3613,7 @@ unsafe fn decode_sb(
}
PARTITION_T_TOP_SPLIT => {
let node = intra_edge.node(sb128, edge_index);
decode_b(c, t, f, bl, b[0], bp, EdgeFlags::EDGE_ALL_TR_AND_BL)?;
decode_b(c, t, f, bl, b[0], bp, EdgeFlags::ALL_TR_AND_BL)?;
t.bx += hsz;
decode_b(c, t, f, bl, b[0], bp, node.v[1])?;
t.bx -= hsz;
Expand All @@ -3627,13 +3627,13 @@ unsafe fn decode_sb(
t.by += hsz;
decode_b(c, t, f, bl, b[1], bp, node.v[0])?;
t.bx += hsz;
decode_b(c, t, f, bl, b[1], bp, EdgeFlags::EDGE_NONE)?;
decode_b(c, t, f, bl, b[1], bp, EdgeFlags::NONE)?;
t.bx -= hsz;
t.by -= hsz;
}
PARTITION_T_LEFT_SPLIT => {
let node = intra_edge.node(sb128, edge_index);
decode_b(c, t, f, bl, b[0], bp, EdgeFlags::EDGE_ALL_TR_AND_BL)?;
decode_b(c, t, f, bl, b[0], bp, EdgeFlags::ALL_TR_AND_BL)?;
t.by += hsz;
decode_b(c, t, f, bl, b[0], bp, node.h[1])?;
t.by -= hsz;
Expand All @@ -3647,7 +3647,7 @@ unsafe fn decode_sb(
t.bx += hsz;
decode_b(c, t, f, bl, b[1], bp, node.h[0])?;
t.by += hsz;
decode_b(c, t, f, bl, b[1], bp, EdgeFlags::EDGE_NONE)?;
decode_b(c, t, f, bl, b[1], bp, EdgeFlags::NONE)?;
t.by -= hsz;
t.bx -= hsz;
}
Expand Down
15 changes: 8 additions & 7 deletions src/intra_edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ impl EdgeFlags {
Self::I420_TOP_HAS_RIGHT,
]);

pub const EDGE_ALL_TR_AND_BL: Self =
Self::union_all([Self::LEFT_HAS_BOTTOM, Self::TOP_HAS_RIGHT]);
pub const ALL_TR_AND_BL: Self = Self::union_all([Self::LEFT_HAS_BOTTOM, Self::TOP_HAS_RIGHT]);

pub const EDGE_NONE: Self = Self::empty();
pub const NONE: Self = Self::empty();

pub const fn union_all<const N: usize>(flags: [Self; N]) -> Self {
let mut i = 0;
Expand Down Expand Up @@ -164,20 +163,22 @@ impl EdgeBranch {
];
let node = EdgeNode { o, h, v };

let h4 = EdgeFlags::LEFT_HAS_BOTTOM.union(
let h4 = EdgeFlags::union_all([
EdgeFlags::LEFT_HAS_BOTTOM,
edge_flags
.intersection(EdgeFlags::I420_TOP_HAS_RIGHT)
.select(matches!(bl, BlockLevel::Bl16x16)),
);
]);

let v4 = EdgeFlags::TOP_HAS_RIGHT.union(
let v4 = EdgeFlags::union_all([
EdgeFlags::TOP_HAS_RIGHT,
edge_flags
.intersection(EdgeFlags::union_all([
EdgeFlags::I420_LEFT_HAS_BOTTOM,
EdgeFlags::I422_LEFT_HAS_BOTTOM,
]))
.select(matches!(bl, BlockLevel::Bl16x16)),
);
]);

let split = [EdgeIndex::root(); 4];

Expand Down

0 comments on commit d358e4e

Please sign in to comment.