Commit befeacb2 authored by Michael Bebenita's avatar Michael Bebenita

Clean up some formatting issues.

parent f14f5e92
......@@ -15,6 +15,7 @@ ignore = [
"src/context.rs", # Partial
# "src/ec.rs", # Clean
"src/lib.rs", # Did not clean yet to avoid conflicts with open PRs.
"src/cdef.rs", # Did not try to clean yet.
# "src/partition.rs", # Clean
# "src/plane.rs", # Clean
# "src/predict.rs", # Clean
......@@ -26,4 +27,7 @@ ignore = [
# "src/bin/rav1repl.rs", # Clean
# "src/util.rs", # Clean
"tests/aom.rs",
"benches/bench.rs",
"benches/predict.rs",
"benches/comparative/predict.rs",
]
......@@ -39,7 +39,8 @@ fn main() {
fi.frame_type =
if fi.number % 30 == 0 { FrameType::KEY } else { FrameType::INTER };
fi.refresh_frame_flags = if fi.frame_type == FrameType::KEY { ALL_REF_FRAMES_MASK } else { 1 };
fi.refresh_frame_flags =
if fi.frame_type == FrameType::KEY { ALL_REF_FRAMES_MASK } else { 1 };
fi.intra_only = fi.frame_type == FrameType::KEY
|| fi.frame_type == FrameType::INTRA_ONLY;
fi.use_prev_frame_mvs = !(fi.intra_only || fi.error_resilient);
......
......@@ -334,7 +334,7 @@ impl Writer {
pub fn literal(&mut self, bits: u8, s: u32) {
for bit in (0..bits).rev() {
self.enc.od_ec_encode_bool_q15((1 & (s >> bit)) == 1, 16384);
self.enc.od_ec_encode_bool_q15((1 & (s >> bit)) == 1, 16384);
}
}
......
......@@ -357,9 +357,9 @@ impl PredictionMode {
if y != 0 {
if self != PredictionMode::H_PRED {
above[1..B::W + 1].copy_from_slice(&dst.go_up(1).as_slice()[..B::W]);
} else if self == PredictionMode::H_PRED && x == 0 {
} else if self == PredictionMode::H_PRED && x == 0 {
for i in 0..B::W {
above[i+1] = dst.go_up(1).p(0, 0);
above[i + 1] = dst.go_up(1).p(0, 0);
}
}
}
......@@ -425,12 +425,12 @@ impl PredictionMode {
PredictionMode::H_PRED => match (x, y) {
(0, 0) => B::pred_h(slice, stride, left_slice),
(0, _) => B::pred_h(slice, stride, above_slice),
(_, _) => B::pred_h(slice, stride, left_slice),
(_, _) => B::pred_h(slice, stride, left_slice)
},
PredictionMode::V_PRED => match (x, y) {
(0, 0) => B::pred_v(slice, stride, above_slice),
(_, 0) => B::pred_v(slice, stride, left_slice),
(_, _) => B::pred_v(slice, stride, above_slice),
(_, _) => B::pred_v(slice, stride, above_slice)
},
PredictionMode::PAETH_PRED =>
B::pred_paeth(slice, stride, above_slice, left_slice, above[0]),
......
......@@ -128,16 +128,18 @@ impl<'a> PlaneMutSlice<'a> {
pub fn offset(&self, add_x: usize, add_y: usize) -> &[u16] {
let new_y = self.y + add_y;
let new_x = self.x + add_x;
&self.plane.data[new_y * self.plane.cfg.stride + new_x ..]
&self.plane.data[new_y * self.plane.cfg.stride + new_x..]
}
pub fn offset_as_mutable(&'a mut self, add_x: usize, add_y: usize) -> &'a mut [u16] {
pub fn offset_as_mutable(
&'a mut self, add_x: usize, add_y: usize
) -> &'a mut [u16] {
let new_y = self.y + add_y;
let new_x = self.x + add_x;
&mut self.plane.data[new_y * self.plane.cfg.stride + new_x ..]
&mut self.plane.data[new_y * self.plane.cfg.stride + new_x..]
}
// FIXME: code duplication with PlaneSlice
// FIXME: code duplication with PlaneSlice
/// A slice starting i pixels above the current one.
pub fn go_up(&'a self, i: usize) -> PlaneSlice<'a> {
......
......@@ -48,27 +48,27 @@ fn sanity() {
}
pub trait Fixed {
fn floor_log2(&self, n: usize) -> usize;
fn ceil_log2(&self, n: usize) -> usize;
fn align_power_of_two(&self, n: usize) -> usize;
fn align_power_of_two_and_shift(&self, n: usize) -> usize;
fn floor_log2(&self, n: usize) -> usize;
fn ceil_log2(&self, n: usize) -> usize;
fn align_power_of_two(&self, n: usize) -> usize;
fn align_power_of_two_and_shift(&self, n: usize) -> usize;
}
impl Fixed for usize {
#[inline]
fn floor_log2(&self, n: usize) -> usize {
self & !((1 << n) - 1)
}
#[inline]
fn ceil_log2(&self, n: usize) -> usize {
(self + (1 << n) - 1).floor_log2(n)
}
#[inline]
fn align_power_of_two(&self, n: usize) -> usize {
self.ceil_log2(n)
}
#[inline]
fn align_power_of_two_and_shift(&self, n: usize) -> usize {
(self + (1 << n) - 1) >> n
}
#[inline]
fn floor_log2(&self, n: usize) -> usize {
self & !((1 << n) - 1)
}
#[inline]
fn ceil_log2(&self, n: usize) -> usize {
(self + (1 << n) - 1).floor_log2(n)
}
#[inline]
fn align_power_of_two(&self, n: usize) -> usize {
self.ceil_log2(n)
}
#[inline]
fn align_power_of_two_and_shift(&self, n: usize) -> usize {
(self + (1 << n) - 1) >> n
}
}
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