diff options
Diffstat (limited to 'evc/src/codec/decode.rs')
-rw-r--r-- | evc/src/codec/decode.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/evc/src/codec/decode.rs b/evc/src/codec/decode.rs new file mode 100644 index 0000000..9dc6a69 --- /dev/null +++ b/evc/src/codec/decode.rs @@ -0,0 +1,18 @@ +use crate::{ + block::{Block, BlockInner}, + frame::Frame, + view::View, +}; + +pub fn decode_block(block: &Block, mut target: View<&mut Frame>, prev: View<&Frame>) { + match &block.inner { + BlockInner::Literal(pixels) => target.set_pixels(pixels), + BlockInner::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); + } + BlockInner::Reference { translation: _ } => target.copy_from(&prev), + } +} |