Commit 703c7a4a authored by Romain Vimont's avatar Romain Vimont Committed by Thomas Daede

Encode tiles provided by iterator

Encode the tiles from each tile context provided by the TilingInfo tile
iterator.
parent 57228ecf
......@@ -2090,13 +2090,17 @@ fn get_initial_cdfcontext<T: Pixel>(fi: &FrameInvariants<T>) -> CDFContext {
}
fn encode_tile_group<T: Pixel>(fi: &FrameInvariants<T>, fs: &mut FrameState<T>) -> Vec<u8> {
let mut fc = get_initial_cdfcontext(fi);
let mut blocks = FrameBlocks::new(fi.w_in_b, fi.h_in_b);
let mut ts = fs.as_tile_state_mut();
let mut tb = blocks.as_tile_blocks_mut();
let ti = &fi.tiling;
let initial_cdf = get_initial_cdfcontext(fi);
let mut cdfs = vec![initial_cdf; ti.tile_count()];
let data = encode_tile(fi, &mut ts, &mut fc, &mut tb);
let raw_tiles = ti
.tile_iter_mut(fs, &mut blocks)
.zip(cdfs.iter_mut())
.map(|(mut ctx, cdf)| encode_tile(fi, &mut ctx.ts, cdf, &mut ctx.tb))
.collect::<Vec<_>>();
/* TODO: Don't apply if lossless */
deblock_filter_optimize(fi, fs, &blocks);
......@@ -2129,10 +2133,12 @@ fn encode_tile_group<T: Pixel>(fi: &FrameInvariants<T>, fs: &mut FrameState<T>)
fs.t.print_code();
}
fs.cdfs = fc;
// for now, always keep the CDF from the first tile
fs.cdfs = cdfs[0];
fs.cdfs.reset_counts();
data
// single tile for now
raw_tiles[0].clone()
}
fn encode_tile<'a, T: Pixel>(
......
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