Commit a9159f1a authored by Romain Vimont's avatar Romain Vimont Committed by Thomas Daede

Merge RDO trackers from tiles into FrameState

Tile RDO trackers results need to be aggregated at frame level.
parent 156cc72e
......@@ -2097,13 +2097,16 @@ fn encode_tile_group<T: Pixel>(fi: &FrameInvariants<T>, fs: &mut FrameState<T>)
let initial_cdf = get_initial_cdfcontext(fi);
let mut cdfs = vec![initial_cdf; ti.tile_count()];
let raw_tiles = ti
let (raw_tiles, rdo_trackers): (Vec<_>, Vec<_>) = ti
.tile_iter_mut(fs, &mut blocks)
.map(|(ref mut ctx, cdf)| encode_tile(fi, &mut ctx.ts, cdf, &mut ctx.tb))
.map(|(ref mut ctx, cdf)| {
let raw = encode_tile(fi, &mut ctx.ts, cdf, &mut ctx.tb);
(raw, ctx.ts.rdo.clone())
/* TODO: Don't apply if lossless */
deblock_filter_optimize(fi, fs, &blocks);
......@@ -2126,6 +2129,9 @@ fn encode_tile_group<T: Pixel>(fi: &FrameInvariants<T>, fs: &mut FrameState<T>)
if fi.config.train_rdo {
eprintln!("train rdo");
for rdo_tracker in &rdo_trackers {
if let Ok(mut file) = File::open("rdo.dat") {
let mut data = vec![];
file.read_to_end(&mut data).unwrap();
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