diff options
Diffstat (limited to 'evc/src/codec/encode/mod.rs')
-rw-r--r-- | evc/src/codec/encode/mod.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/evc/src/codec/encode/mod.rs b/evc/src/codec/encode/mod.rs index 2ccac64..336f298 100644 --- a/evc/src/codec/encode/mod.rs +++ b/evc/src/codec/encode/mod.rs @@ -69,15 +69,19 @@ pub fn encode_block(view: View<&Frame>, prev: View<&Frame>, config: &EncodeConfi let config = unsafe { std::mem::transmute::<_, &'static EncodeConfig>(config) }; // only bother to do multithreading, when the block is big. - let (a, b) = both_par( - || encode_block(av, ap, config), - || encode_block(bv, bp, config), - config.max_threads, - ); + let (a, b) = if view.area() > 100 { + both_par( + || encode_block(av, ap, config), + || encode_block(bv, bp, config), + config.max_threads, + ) + } else { + (encode_block(av, ap, config), encode_block(bv, bp, config)) + }; if a.is_literal() && b.is_literal() { Block::Literal(view.pixels()) - } else if a.is_ref_without_translation() && b.is_ref_without_translation() { + } else if Block::identical_ref(&a, &b) { Block::Reference { translation: Vec2::<isize>::ZERO, } |