Commit 3da4937e authored by Vladimir Kazakov's avatar Vladimir Kazakov Committed by Josh Holmer
Browse files
parent 36d075f2
......@@ -44,4 +44,4 @@ jobs:
- cargo doc --verbose
- rustup component add clippy
- cargo clippy --version
- cargo clippy -- -D warnings -A clippy::absurd_extreme_comparisons -A clippy::cast_lossless -A clippy::cast_ptr_alignment -A clippy::collapsible_if -A clippy::cyclomatic_complexity -A clippy::erasing_op -A clippy::get_unwrap -A clippy::identity_op -A clippy::if_same_then_else -A clippy::len_zero -A clippy::manual_memcpy -A clippy::needless_range_loop -A clippy::neg_multiply -A clippy::new_without_default -A clippy::new_without_default_derive -A clippy::precedence -A clippy::ptr_arg -A clippy::single_match -A clippy::too_many_arguments -A clippy::trivially_copy_pass_by_ref -A clippy::type_complexity -A clippy::unreadable_literal -A clippy::unused_io_amount -A clippy::useless_let_if_seq -A clippy::verbose_bit_mask -A clippy::while_let_loop --verbose
- cargo clippy -- -D warnings -A clippy::absurd_extreme_comparisons -A clippy::cast_lossless -A clippy::cast_ptr_alignment -A clippy::collapsible_if -A clippy::cyclomatic_complexity -A clippy::erasing_op -A clippy::get_unwrap -A clippy::identity_op -A clippy::if_same_then_else -A clippy::len_zero -A clippy::manual_memcpy -A clippy::needless_range_loop -A clippy::neg_multiply -A clippy::new_without_default -A clippy::new_without_default_derive -A clippy::precedence -A clippy::ptr_arg -A clippy::too_many_arguments -A clippy::trivially_copy_pass_by_ref -A clippy::type_complexity -A clippy::unreadable_literal -A clippy::unused_io_amount -A clippy::verbose_bit_mask --verbose
......@@ -142,20 +142,15 @@ fn main() {
ctx.set_limit(cli.limit as u64);
loop {
match process_frame(&mut ctx, &mut cli.io.output, &mut y4m_dec, y4m_enc.as_mut()) {
Ok(frame_info) => {
for frame in frame_info {
progress.add_frame(frame);
let _ = if cli.verbose {
writeln!(err, "{} - {}", frame, progress)
} else {
write!(err, "\r{} ", progress)
};
}
},
Err(_) => break,
};
while let Ok(frame_info) = process_frame(&mut ctx, &mut cli.io.output, &mut y4m_dec, y4m_enc.as_mut()) {
for frame in frame_info {
progress.add_frame(frame);
let _ = if cli.verbose {
writeln!(err, "{} - {}", frame, progress)
} else {
write!(err, "\r{} ", progress)
};
}
if !ctx.needs_more_frames(progress.frames_encoded() as u64) {
break;
......
......@@ -365,18 +365,16 @@ pub fn cdef_filter_superblock(fi: &FrameInvariants,
let local_pri_strength;
let local_sec_strength;
let mut local_damping: i32 = cdef_damping + coeff_shift;
let local_dir: usize;
if p==0 {
let local_dir = if p == 0 {
local_pri_strength = adjust_strength(cdef_pri_y_strength << coeff_shift, var);
local_sec_strength = cdef_sec_y_strength << coeff_shift;
local_dir = if cdef_pri_y_strength != 0 {dir as usize} else {0};
if cdef_pri_y_strength != 0 { dir as usize } else { 0 }
} else {
local_pri_strength = cdef_pri_uv_strength << coeff_shift;
local_sec_strength = cdef_sec_uv_strength << coeff_shift;
local_damping -= 1;
local_dir = if cdef_pri_uv_strength != 0 {dir as usize} else {0};
}
if cdef_pri_uv_strength != 0 { dir as usize } else { 0 }
};
unsafe {
cdef_filter_block(out_slice.offset_as_mutable(8*bx>>xdec,8*by>>ydec),
......
......@@ -365,12 +365,11 @@ fn deblock_size4(
let q0 = p[pitch * 2] as i32;
let q1 = p[pitch * 3] as i32;
if mask4(p1, p0, q0, q1, bd - 8) <= level {
let x;
if nhev4(p1, p0, q0, q1, bd - 8) <= level {
x = filter_narrow4_4(p1, p0, q0, q1, bd - 8);
let x = if nhev4(p1, p0, q0, q1, bd - 8) <= level {
filter_narrow4_4(p1, p0, q0, q1, bd - 8)
} else {
x = filter_narrow2_4(p1, p0, q0, q1, bd - 8);
}
filter_narrow2_4(p1, p0, q0, q1, bd - 8)
};
stride_copy(p, &x, pitch);
}
s += stride;
......
......@@ -1496,15 +1496,14 @@ fn encode_partition_bottomup(
// Code the whole block
// TODO(yushin): Try move PARTITION_NONE to below partition loop
if !must_split {
let mut cost: f64 = 0.0;
if bsize.gte(BlockSize::BLOCK_8X8) && is_square {
let cost = if bsize.gte(BlockSize::BLOCK_8X8) && is_square {
let w: &mut dyn Writer = if cw.bc.cdef_coded {w_post_cdef} else {w_pre_cdef};
let tell = w.tell_frac();
cw.write_partition(w, bo, PartitionType::PARTITION_NONE, bsize);
cost =
(w.tell_frac() - tell) as f64 * fi.lambda / ((1 << OD_BITRES) as f64);
}
(w.tell_frac() - tell) as f64 * fi.lambda / ((1 << OD_BITRES) as f64)
} else {
0.0
};
let pmv_idx = if bsize.greater_than(BlockSize::BLOCK_32X32) {
0
......@@ -2084,11 +2083,10 @@ pub fn encode_frame(fi: &mut FrameInvariants, fs: &mut FrameState) -> Vec<u8> {
let mut packet = Vec::new();
if fi.show_existing_frame {
write_obus(&mut packet, fi, fs).unwrap();
match fi.rec_buffer.frames[fi.frame_to_show_map_idx as usize] {
Some(ref rec) => for p in 0..3 {
if let Some(ref rec) = fi.rec_buffer.frames[fi.frame_to_show_map_idx as usize] {
for p in 0..3 {
fs.rec.planes[p].data.copy_from_slice(rec.frame.planes[p].data.as_slice());
},
None => (),
}
}
} else {
if !fi.intra_only {
......
......@@ -1147,14 +1147,28 @@ impl PredictionMode {
};
if !is_compound {
match fi.rec_buffer.frames
[fi.ref_frames[ref_frames[0] - LAST_FRAME] as usize]
{
Some(ref rec) => {
let (row_frac, col_frac, src) =
get_params(&rec.frame.planes[p], po, mvs[0]);
put_8tap(
dst,
if let Some(ref rec) = fi.rec_buffer.frames[fi.ref_frames[ref_frames[0] - LAST_FRAME] as usize] {
let (row_frac, col_frac, src) = get_params(&rec.frame.planes[p], po, mvs[0]);
put_8tap(
dst,
src,
width,
height,
col_frac,
row_frac,
mode,
mode,
fi.sequence.bit_depth
);
}
} else {
let mut tmp: [AlignedArray<[i16; 128 * 128]>; 2] =
[UninitializedAlignedArray(), UninitializedAlignedArray()];
for i in 0..2 {
if let Some(ref rec) = fi.rec_buffer.frames[fi.ref_frames[ref_frames[i] - LAST_FRAME] as usize] {
let (row_frac, col_frac, src) = get_params(&rec.frame.planes[p], po, mvs[i]);
prep_8tap(
&mut tmp[i].array,
src,
width,
height,
......@@ -1165,32 +1179,6 @@ impl PredictionMode {
fi.sequence.bit_depth
);
}
None => ()
}
} else {
let mut tmp: [AlignedArray<[i16; 128 * 128]>; 2] =
[UninitializedAlignedArray(), UninitializedAlignedArray()];
for i in 0..2 {
match fi.rec_buffer.frames
[fi.ref_frames[ref_frames[i] - LAST_FRAME] as usize]
{
Some(ref rec) => {
let (row_frac, col_frac, src) =
get_params(&rec.frame.planes[p], po, mvs[i]);
prep_8tap(
&mut tmp[i].array,
src,
width,
height,
col_frac,
row_frac,
mode,
mode,
fi.sequence.bit_depth
);
}
None => ()
}
}
mc_avg(
dst,
......
......@@ -1705,10 +1705,11 @@ mod native {
// initialized to zero for filling out the missing coeffs.
let mut temp_in: [i32; 64] = [0; 64];
for (raw, clamped) in input_slice.iter().zip(temp_in.iter_mut()) {
let mut val = *raw;
if rect_type.abs() == 1 {
val = round_shift(*raw * INV_SQRT2, SQRT2_BITS);
}
let val = if rect_type.abs() == 1 {
round_shift(*raw * INV_SQRT2, SQRT2_BITS)
} else {
*raw
};
*clamped = clamp_value(val, range);
}
txfm_fn(&temp_in, buffer_slice, range);
......
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