aboutsummaryrefslogtreecommitdiff
path: root/evc/src/codec/decode.rs
blob: f4559c898bf32ce13cdadfee7a1663612415ada4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::{block::Block, frame::Frame, view::View};

pub fn decode_block(block: &Block, mut target: View<&mut Frame>, prev: View<&Frame>) {
    match &block {
        Block::Literal(pixels) => target.set_pixels(pixels),
        Block::Split(box [a, b]) => {
            let [at, bt] = target.split_mut_unsafe();
            let [ap, bp] = prev.split();
            decode_block(a, at, ap);
            decode_block(b, bt, bp);
        }
        Block::Reference { translation: _ } => target.copy_from(&prev),
    }
}