aboutsummaryrefslogtreecommitdiff
path: root/evc
diff options
context:
space:
mode:
Diffstat (limited to 'evc')
-rwxr-xr-xevc/scripts/gen2
-rwxr-xr-xevc/scripts/stream6
-rw-r--r--evc/src/block.rs16
-rw-r--r--evc/src/view.rs2
4 files changed, 16 insertions, 10 deletions
diff --git a/evc/scripts/gen b/evc/scripts/gen
index 2160b9a..9754079 100755
--- a/evc/scripts/gen
+++ b/evc/scripts/gen
@@ -1,4 +1,4 @@
#/bin/fish
cargo run --release --bin encode -- -W 1920 -H 1080 < samples/raw > samples/encoded
cargo run --release --bin decode -- < samples/encoded > samples/decoded
-ffmpeg -framerate 30 -video_size 1920x1080 -pixel_format rgb24 -f rawvideo -i samples/decoded samples/decoded.mp4
+ffmpeg -y -framerate 30 -video_size 1920x1080 -pixel_format rgb24 -f rawvideo -i samples/decoded samples/decoded.mp4
diff --git a/evc/scripts/stream b/evc/scripts/stream
index 73dca01..2db33b9 100755
--- a/evc/scripts/stream
+++ b/evc/scripts/stream
@@ -1,6 +1,6 @@
#!/bin/fish
-ffmpeg -i ~/videos/eddie-woo.mp4 -to 10 -vf scale=1920x1080,fps=30,format=rgb24 -f rawvideo pipe:1 |
+ffmpeg -i ~/videos/eddie-woo.mp4 -to 10 -vf scale=1920x1080,fps=30,format=rgb24 -f rawvideo pipe:1 2>/dev/null |
cargo run --release --bin encode -- -W 1920 -H 1080 |
- cargo run --release --bin decode |
- ffplay -framerate 30 -video_size 1920x1080 -pixel_format rgb24 -f rawvideo
+ cargo run --release --bin decode -- |
+ ffplay -framerate 30 -video_size 1920x1080 -pixel_format rgb24 -f rawvideo pipe:0 2>/dev/null
\ No newline at end of file
diff --git a/evc/src/block.rs b/evc/src/block.rs
index 98e3b54..a3d040d 100644
--- a/evc/src/block.rs
+++ b/evc/src/block.rs
@@ -30,7 +30,7 @@ impl Block {
a.write(sink)?;
b.write(sink)?;
}
- BlockInner::Reference { translation } => {
+ BlockInner::Reference { translation: _ } => {
sink.put(2u8)?;
// sink.put(*translation)?;
}
@@ -42,14 +42,20 @@ impl Block {
let inner = match source.get::<u8>()? {
0 => BlockInner::Literal(source.get()?),
1 => BlockInner::Split(Box::new({
- let subsize_left = if size.0 > size.1 {
+ let vert = size.0 > size.1;
+ let asize = if vert {
(size.0 / 2, size.1)
} else {
(size.0, size.1 / 2)
};
- let subsize_right = (size.0 - subsize_left.0, size.1 - subsize_left.1);
- let a = Block::read(source, subsize_left)?;
- let b = Block::read(source, subsize_right)?;
+ let bsize = if vert {
+ (size.0 - size.0 / 2, size.1)
+ } else {
+ (size.0, size.1 - size.1 / 2)
+ };
+
+ let a = Block::read(source, asize)?;
+ let b = Block::read(source, bsize)?;
[a, b]
})),
2 => BlockInner::Reference {
diff --git a/evc/src/view.rs b/evc/src/view.rs
index f37e57c..9c4778b 100644
--- a/evc/src/view.rs
+++ b/evc/src/view.rs
@@ -112,7 +112,7 @@ impl View<&mut Frame> {
pub fn set_pixels(&mut self, pixels: &Vec<Pixel>) {
for x in 0..self.size.0 {
for y in 0..self.size.1 {
- self[(x, y)] = pixels[x + y * self.size.0]
+ self[(x, y)] = pixels[x * self.size.1 + y]
}
}
}