aboutsummaryrefslogtreecommitdiff
path: root/evc
diff options
context:
space:
mode:
Diffstat (limited to 'evc')
-rwxr-xr-xevc/scripts/gen15
-rwxr-xr-xevc/scripts/stream-lq5
-rwxr-xr-xevc/scripts/stream-nodebug7
-rw-r--r--evc/src/codec/encode.rs7
4 files changed, 19 insertions, 15 deletions
diff --git a/evc/scripts/gen b/evc/scripts/gen
index 8fd53dd..1cf4493 100755
--- a/evc/scripts/gen
+++ b/evc/scripts/gen
@@ -1,9 +1,10 @@
-#/bin/fish
+#!/bin/fish
set w $argv[1]
set h $argv[2]
-ffmpeg -i $argv[3] -to 10 -vf scale={$w}x{$h},fps=30 -f rawvideo -pixel_format rgb24 > samples/raw
-LOG=info cargo run --release --bin encode -- -W {$w} -H {$h} < samples/raw > samples/encoded
-LOG=info cargo run --release --bin decode -- < samples/encoded > samples/decoded
-LOG=info cargo run --release --bin decode -- --debug < samples/encoded > samples/decoded-debug
-ffmpeg -y -framerate 30 -video_size {$w}x{$h} -pixel_format rgb24 -f rawvideo -i samples/decoded samples/decoded.mp4
-ffmpeg -y -framerate 30 -video_size {$w}x{$h} -pixel_format rgb24 -f rawvideo -i samples/decoded-debug samples/decoded-debug.mp4
+set t $argv[3]
+ffmpeg -hide_banner -i $argv[4] -to {$t} -vf scale={$w}x{$h},fps=30,format=rgb24 -f rawvideo pipe:1 |
+ LOG=info cargo run --release --bin encode -- -W {$w} -H {$h} > samples/encoded
+LOG=info cargo run --release --bin decode -- < samples/encoded |
+ ffmpeg -hide_banner -y -framerate 30 -video_size {$w}x{$h} -pixel_format rgb24 -f rawvideo -i pipe:0 samples/decoded.mp4
+LOG=info cargo run --release --bin decode -- --debug < samples/encoded |
+ ffmpeg -hide_banner -y -framerate 30 -video_size {$w}x{$h} -pixel_format rgb24 -f rawvideo -i pipe:0 samples/decoded-debug.mp4
diff --git a/evc/scripts/stream-lq b/evc/scripts/stream-lq
deleted file mode 100755
index 300800a..0000000
--- a/evc/scripts/stream-lq
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/fish
-ffmpeg -i $argv[1] -vf scale=920x550,fps=30,format=rgb24 -f rawvideo pipe:1 2>/dev/null |
- LOG=info cargo run --release --bin encode -- -W 920 -H 550 |
- LOG=info cargo run --release --bin decode -- --debug |
- ffplay -framerate 30 -video_size 920x550 -pixel_format rgb24 -f rawvideo pipe:0 2>/dev/null
diff --git a/evc/scripts/stream-nodebug b/evc/scripts/stream-nodebug
new file mode 100755
index 0000000..8193654
--- /dev/null
+++ b/evc/scripts/stream-nodebug
@@ -0,0 +1,7 @@
+#!/bin/fish
+set w $argv[1]
+set h $argv[2]
+ffmpeg -hide_banner -i $argv[3] -vf scale={$w}x{$h},fps=30,format=rgb24 -f rawvideo pipe:1 |
+ cargo run --release --bin encode -- -W {$w} -H {$h} |
+ cargo run --release --bin decode -- |
+ ffplay -hide_banner -framerate 30 -video_size {$w}x{$h} -pixel_format rgb24 -f rawvideo pipe:0
diff --git a/evc/src/codec/encode.rs b/evc/src/codec/encode.rs
index 9ebbda1..7322fea 100644
--- a/evc/src/codec/encode.rs
+++ b/evc/src/codec/encode.rs
@@ -14,9 +14,10 @@ pub fn encode_block(view: View<&Frame>, prev: View<&Frame>, config: &EncodeConfi
} else if config.translate {
let mut best_diff = f64::INFINITY;
let mut best_translation = Vec2::ZERO;
- for x in [-32, -16, -8, -4, -2, -1, 0, 1, 2, 4, 8, 16, 32] {
- for y in [-32, -16, -8, -4, -2, -1, 0, 1, 2, 4, 8, 16, 32] {
- let translation = Vec2 { x, y };
+ const OFFSETS: &[isize] = &[-64, -32, -16, -8, -4, -2, -1, 0, 1, 2, 4, 8, 16, 32, 64];
+ for x in OFFSETS {
+ for y in OFFSETS {
+ let translation = Vec2 { x: *x, y: *y };
let diff = View::diff(&view, &prev.offset(translation)) / view.area() as f64;
if diff < best_diff {
best_translation = translation;