Skip to content
Permalink
Browse files

Parallelize tile encoding

Use par_iter_mut() from Rayon to call encode_tile() for each tile
context in parallel.
  • Loading branch information...
rom1v authored and tdaede committed Apr 18, 2019
1 parent 036c421 commit 156cc72edf03b5605844b4ecae84dee647fda221
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/encoder.rs
@@ -33,6 +33,7 @@ use crate::header::*;
use arg_enum_proc_macro::ArgEnum;
use bitstream_io::{BitWriter, BigEndian};
use bincode::{serialize, deserialize};
use rayon::iter::*;
use std;
use std::{fmt, io, mem};
use std::io::Write;
@@ -2100,7 +2101,7 @@ fn encode_tile_group<T: Pixel>(fi: &FrameInvariants<T>, fs: &mut FrameState<T>)
.tile_iter_mut(fs, &mut blocks)
.zip(cdfs.iter_mut())
.collect::<Vec<_>>()
.iter_mut()
.par_iter_mut()
.map(|(ref mut ctx, cdf)| encode_tile(fi, &mut ctx.ts, cdf, &mut ctx.tb))
.collect::<Vec<_>>();

0 comments on commit 156cc72

Please sign in to comment.
You can’t perform that action at this time.