Commit 90bed0bf authored by Romain Vimont's avatar Romain Vimont Committed by Luca Barbato
Browse files

Do not borrow full FrameState for LRF

Once RestorationState will be stored into FrameState, it will not be
possible to borrow a FrameState while its RestorationState is mutably

In particular, this prevents passing a FrameState to a non-const
RestorationState method.

For lrf_optimize_superblock(), which is not implemented yet, just remove
the FrameState parameter.

For lrf_filter_frame(), only borrow the "rec" field instead of the whole
parent 8348794a
......@@ -2716,7 +2716,7 @@ fn encode_tile(fi: &FrameInvariants, fs: &mut FrameState,
// loop restoration must be decided last but coded before anything else
if fi.sequence.enable_restoration {
rs.lrf_optimize_superblock(&sbo, fi, fs, &mut cw);
rs.lrf_optimize_superblock(&sbo, fi, &mut cw);
cw.write_lrf(&mut w, fi, rs, &sbo);
......@@ -2747,7 +2747,7 @@ fn encode_tile(fi: &FrameInvariants, fs: &mut FrameState,
/* TODO: Don't apply if lossless */
if fi.sequence.enable_restoration {
rs.lrf_filter_frame(fs, &pre_cdef_frame, fi.sequence.bit_depth);
rs.lrf_filter_frame(&mut fs.rec, &pre_cdef_frame, fi.sequence.bit_depth);
......@@ -10,7 +10,6 @@
use encoder::Frame;
use encoder::FrameState;
use encoder::FrameInvariants;
use context::ContextWriter;
use context::SuperBlockOffset;
......@@ -443,13 +442,12 @@ impl RestorationState {
pub fn lrf_optimize_superblock(&mut self, _sbo: &SuperBlockOffset, _fi: &FrameInvariants,
_fs: &FrameState, _cw: &mut ContextWriter) {
_cw: &mut ContextWriter) {
pub fn lrf_filter_frame(&mut self, fs: &mut FrameState, pre_cdef: &Frame,
pub fn lrf_filter_frame(&mut self, out: &mut Frame, pre_cdef: &Frame,
bit_depth: usize) {
let cdeffed = &fs.rec.clone();
let out = &mut fs.rec;
let cdeffed = out.clone();
// number of stripes (counted according to colocated Y luma position)
let stripe_n = (self.plane[0].clipped_cfg.height + 7) / 64 + 1;
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