Commit f571c632 authored by Monty's avatar Monty Committed by Luca Barbato

Add Loop Restoration filtering code

This commit adds the Wiener and Sgrproj filter modes of loop resotration.
They're not currently enabled, but they are tested.
No functional change.
parent 242003cd
......@@ -3029,7 +3029,7 @@ impl ContextWriter {
symbol_with_update!(self, w, 0, &mut self.fc.lrf_sgrproj_cdf);
}
RESTORE_SWITCHABLE => {
symbol_with_update!(self, w, RESTORE_NONE as u32, &mut self.fc.lrf_switchable_cdf);
symbol_with_update!(self, w, 0, &mut self.fc.lrf_switchable_cdf);
}
RESTORE_NONE => {}
_ => unreachable!()
......@@ -3041,7 +3041,8 @@ impl ContextWriter {
symbol_with_update!(self, w, 1, &mut self.fc.lrf_sgrproj_cdf);
}
RESTORE_SWITCHABLE => {
symbol_with_update!(self, w, RESTORE_SGRPROJ as u32, &mut self.fc.lrf_switchable_cdf);
// Does *not* write 'RESTORE_SGRPROJ'
symbol_with_update!(self, w, 2 as u32, &mut self.fc.lrf_switchable_cdf);
}
_ => unreachable!()
}
......@@ -3071,7 +3072,8 @@ impl ContextWriter {
symbol_with_update!(self, w, 1, &mut self.fc.lrf_wiener_cdf);
}
RESTORE_SWITCHABLE => {
symbol_with_update!(self, w, RESTORE_WIENER as u32, &mut self.fc.lrf_switchable_cdf);
// Does *not* write 'RESTORE_WIENER'
symbol_with_update!(self, w, 1, &mut self.fc.lrf_switchable_cdf);
}
_ => unreachable!()
}
......
......@@ -2770,7 +2770,7 @@ fn encode_tile(sequence: &mut Sequence, fi: &FrameInvariants, fs: &mut FrameStat
}
/* TODO: Don't apply if lossless */
if sequence.enable_restoration {
rs.lrf_filter_frame(fs, &pre_cdef_frame, &cw.bc, bit_depth);
rs.lrf_filter_frame(fs, &pre_cdef_frame, bit_depth);
}
}
......@@ -2796,7 +2796,7 @@ fn write_tile_group_header(tile_start_and_end_present_flag: bool) ->
pub fn encode_frame(sequence: &mut Sequence, fi: &mut FrameInvariants, fs: &mut FrameState) -> Vec<u8> {
let mut packet = Vec::new();
let mut rs = RestorationState::new(sequence, &fs.input);
let mut rs = RestorationState::new(sequence, fi, &fs.input);
if fi.show_existing_frame {
//write_uncompressed_header(&mut packet, sequence, fi).unwrap();
write_obus(&mut packet, sequence, fi, fs, &rs).unwrap();
......
This diff is collapsed.
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