From 0a346b8372140b56bf65a6df1c00e2cd6c6cdf86 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 17 Dec 2022 18:01:51 +0100 Subject: small optimizations and info binary --- evc/src/codec/encode/mod.rs | 16 ++++++++++------ evc/src/codec/encode/simple.rs | 5 +++++ 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'evc/src/codec/encode') 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::::ZERO, } diff --git a/evc/src/codec/encode/simple.rs b/evc/src/codec/encode/simple.rs index cabbc15..2a971af 100644 --- a/evc/src/codec/encode/simple.rs +++ b/evc/src/codec/encode/simple.rs @@ -45,6 +45,11 @@ pub fn fast( } }; + probe(offset + Vec2 { x: 8, y: 0 }); + probe(offset + Vec2 { x: -8, y: 0 }); + probe(offset + Vec2 { x: 0, y: 8 }); + probe(offset + Vec2 { x: 0, y: -8 }); + probe(offset + Vec2 { x: 1, y: 0 }); probe(offset + Vec2 { x: -1, y: 0 }); probe(offset + Vec2 { x: 0, y: 1 }); -- cgit v1.2.3-70-g09d2