Minor cleanup
This commit is contained in:
parent
17ef2a1abd
commit
cef1cd7495
@ -95,18 +95,17 @@ set -e # stop if an error occurs
|
|||||||
# shellcheck disable=SC2089
|
# shellcheck disable=SC2089
|
||||||
restream_rs="PATH=\"\$PATH:/opt/bin/:.\" restream"
|
restream_rs="PATH=\"\$PATH:/opt/bin/:.\" restream"
|
||||||
listen_port=16789
|
listen_port=16789
|
||||||
ssh_cmd "$restream_rs --listen $listen_port" &
|
ssh_cmd "$restream_rs --port $listen_port --format mono" &
|
||||||
sleep 1 # give some time to restream.rs to start listening
|
sleep 1 # give some time to restream.rs to start listening
|
||||||
receive_cmd="nc $remarkable $listen_port"
|
receive_cmd="nc $remarkable $listen_port"
|
||||||
|
|
||||||
# TODO: return this from stdout
|
# TODO: return this from stdout
|
||||||
width=1872
|
width=1872
|
||||||
height=1404
|
height=1404
|
||||||
pixel_format="gray8"
|
pixel_format="monob"
|
||||||
|
|
||||||
# shellcheck disable=SC2086,SC2090
|
# shellcheck disable=SC2086,SC2090
|
||||||
$receive_cmd |
|
$receive_cmd |
|
||||||
pv |
|
|
||||||
(
|
(
|
||||||
"$output_cmd" \
|
"$output_cmd" \
|
||||||
-vcodec rawvideo \
|
-vcodec rawvideo \
|
||||||
|
16
src/main.rs
16
src/main.rs
@ -8,7 +8,7 @@ use std::{
|
|||||||
io::{BufRead, BufReader, Read, Write},
|
io::{BufRead, BufReader, Read, Write},
|
||||||
net::{TcpListener, TcpStream},
|
net::{TcpListener, TcpStream},
|
||||||
process::Command,
|
process::Command,
|
||||||
time::{Duration, Instant},
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod reduce;
|
mod reduce;
|
||||||
@ -53,10 +53,8 @@ impl Format {
|
|||||||
Self::Gray16be => {
|
Self::Gray16be => {
|
||||||
let mut buf = [0u8; IN_SIZE];
|
let mut buf = [0u8; IN_SIZE];
|
||||||
loop {
|
loop {
|
||||||
let now = Instant::now();
|
|
||||||
src.read_exact(&mut buf)?;
|
src.read_exact(&mut buf)?;
|
||||||
tgt.write_all(&buf[0..IN_SIZE])?;
|
tgt.write_all(&buf[0..IN_SIZE])?;
|
||||||
println!("{:?}", now.elapsed().as_millis());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,12 +62,9 @@ impl Format {
|
|||||||
const OUT: usize = reduce::gray8::out_size(IN_SIZE);
|
const OUT: usize = reduce::gray8::out_size(IN_SIZE);
|
||||||
let mut buf = [0u8; IN_SIZE];
|
let mut buf = [0u8; IN_SIZE];
|
||||||
loop {
|
loop {
|
||||||
let now = Instant::now();
|
|
||||||
src.read_exact(&mut buf)?;
|
src.read_exact(&mut buf)?;
|
||||||
|
|
||||||
reduce::gray8::run(&mut buf);
|
reduce::gray8::run(&mut buf);
|
||||||
tgt.write_all(&buf[0..OUT])?;
|
tgt.write_all(&buf[0..OUT])?;
|
||||||
println!("{:?}", now.elapsed().as_millis());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,12 +72,9 @@ impl Format {
|
|||||||
const OUT: usize = reduce::gray8_simd::out_size(IN_SIZE);
|
const OUT: usize = reduce::gray8_simd::out_size(IN_SIZE);
|
||||||
let mut buf = [0u8; IN_SIZE];
|
let mut buf = [0u8; IN_SIZE];
|
||||||
loop {
|
loop {
|
||||||
let now = Instant::now();
|
|
||||||
src.read_exact(&mut buf)?;
|
src.read_exact(&mut buf)?;
|
||||||
|
|
||||||
reduce::gray8_simd::run(&mut buf);
|
reduce::gray8_simd::run(&mut buf);
|
||||||
tgt.write_all(&buf[0..OUT])?;
|
tgt.write_all(&buf[0..OUT])?;
|
||||||
println!("{:?}", now.elapsed().as_millis());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,12 +82,9 @@ impl Format {
|
|||||||
const OUT: usize = reduce::mono::out_size(IN_SIZE);
|
const OUT: usize = reduce::mono::out_size(IN_SIZE);
|
||||||
let mut buf = [0u8; IN_SIZE];
|
let mut buf = [0u8; IN_SIZE];
|
||||||
loop {
|
loop {
|
||||||
let now = Instant::now();
|
|
||||||
src.read_exact(&mut buf)?;
|
src.read_exact(&mut buf)?;
|
||||||
|
|
||||||
reduce::mono::run(&mut buf);
|
reduce::mono::run(&mut buf);
|
||||||
tgt.write_all(&buf[0..OUT])?;
|
tgt.write_all(&buf[0..OUT])?;
|
||||||
println!("{:?}", now.elapsed().as_millis());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,12 +92,9 @@ impl Format {
|
|||||||
const OUT: usize = reduce::mono_simd::out_size(IN_SIZE);
|
const OUT: usize = reduce::mono_simd::out_size(IN_SIZE);
|
||||||
let mut buf = [0u8; IN_SIZE];
|
let mut buf = [0u8; IN_SIZE];
|
||||||
loop {
|
loop {
|
||||||
let now = Instant::now();
|
|
||||||
src.read_exact(&mut buf)?;
|
src.read_exact(&mut buf)?;
|
||||||
|
|
||||||
reduce::mono_simd::run(&mut buf);
|
reduce::mono_simd::run(&mut buf);
|
||||||
tgt.write_all(&buf[0..OUT])?;
|
tgt.write_all(&buf[0..OUT])?;
|
||||||
println!("{:?}", now.elapsed().as_millis());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user