Skip to content

Add QOI compression #670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[alias]
xtask = "run --package xtask --"

[patch.crates-io]
qoi = { git = "https://github.com/elmarco/qoi-rust.git", branch = "raw" }
31 changes: 31 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ edition.workspace = true
name = "perfenc"
path = "src/perfenc.rs"

[features]
default = ["qoi", "qoiz"]
qoi = ["ironrdp/qoi"]
qoiz = ["ironrdp/qoiz"]

[dependencies]
anyhow = "1.0.98"
async-trait = "0.1.88"
Expand Down
15 changes: 14 additions & 1 deletion benches/src/perfenc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use ironrdp::server::{
};
use tokio::{fs::File, io::AsyncReadExt, time::sleep};

#[allow(clippy::similar_names)]
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), anyhow::Error> {
setup_logging()?;
Expand All @@ -27,7 +28,7 @@ async fn main() -> Result<(), anyhow::Error> {
println!(" --width <WIDTH> Width of the display (default: 3840)");
println!(" --height <HEIGHT> Height of the display (default: 2400)");
println!(" --codec <CODEC> Codec to use (default: remotefx)");
println!(" Valid values: remotefx, bitmap, none");
println!(" Valid values: qoi, qoiz, remotefx, bitmap, none");
println!(" --fps <FPS> Frames per second (default: none)");
std::process::exit(0);
}
Expand All @@ -51,6 +52,10 @@ async fn main() -> Result<(), anyhow::Error> {
flags -= CmdFlags::SET_SURFACE_BITS;
}
OptCodec::None => {}
#[cfg(feature = "qoi")]
OptCodec::Qoi => update_codecs.set_qoi(Some(0)),
#[cfg(feature = "qoiz")]
OptCodec::QoiZ => update_codecs.set_qoiz(Some(0)),
};

let mut encoder = UpdateEncoder::new(DesktopSize { width, height }, flags, update_codecs);
Expand Down Expand Up @@ -171,6 +176,10 @@ enum OptCodec {
RemoteFX,
Bitmap,
None,
#[cfg(feature = "qoi")]
Qoi,
#[cfg(feature = "qoiz")]
QoiZ,
}

impl Default for OptCodec {
Expand All @@ -187,6 +196,10 @@ impl core::str::FromStr for OptCodec {
"remotefx" => Ok(Self::RemoteFX),
"bitmap" => Ok(Self::Bitmap),
"none" => Ok(Self::None),
#[cfg(feature = "qoi")]
"qoi" => Ok(Self::Qoi),
#[cfg(feature = "qoiz")]
"qoiz" => Ok(Self::QoiZ),
_ => Err(anyhow::anyhow!("unknown codec: {}", s)),
}
}
Expand Down
2 changes: 2 additions & 0 deletions crates/ironrdp-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ test = false
default = ["rustls"]
rustls = ["ironrdp-tls/rustls", "tokio-tungstenite/rustls-tls-native-roots"]
native-tls = ["ironrdp-tls/native-tls", "tokio-tungstenite/native-tls"]
qoi = ["ironrdp/qoi"]
qoiz = ["ironrdp/qoiz"]

[dependencies]
# Protocols
Expand Down
3 changes: 3 additions & 0 deletions crates/ironrdp-connector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ doctest = false
test = false

[features]
default = []
arbitrary = ["dep:arbitrary"]
qoi = ["ironrdp-pdu/qoi"]
qoiz = ["ironrdp-pdu/qoiz"]

[dependencies]
ironrdp-svc = { path = "../ironrdp-svc", version = "0.3" } # public
Expand Down
2 changes: 2 additions & 0 deletions crates/ironrdp-pdu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ doctest = false
default = []
std = ["alloc", "ironrdp-error/std", "ironrdp-core/std"]
alloc = ["ironrdp-core/alloc", "ironrdp-error/alloc"]
qoi = []
qoiz = ["qoi"]

[dependencies]
bitflags = "2.4"
Expand Down
6 changes: 3 additions & 3 deletions crates/ironrdp-pdu/src/rdp/capability_sets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ pub use self::bitmap_cache::{
BitmapCache, BitmapCacheRev2, CacheEntry, CacheFlags, CellInfo, BITMAP_CACHE_ENTRIES_NUM,
};
pub use self::bitmap_codecs::{
client_codecs_capabilities, BitmapCodecs, CaptureFlags, Codec, CodecId, CodecProperty, EntropyBits, Guid, NsCodec,
RemoteFxContainer, RfxCaps, RfxCapset, RfxClientCapsContainer, RfxICap, RfxICapFlags, CODEC_ID_NONE,
CODEC_ID_REMOTEFX,
client_codecs_capabilities, server_codecs_capabilities, BitmapCodecs, CaptureFlags, Codec, CodecId, CodecProperty,
EntropyBits, Guid, NsCodec, RemoteFxContainer, RfxCaps, RfxCapset, RfxClientCapsContainer, RfxICap, RfxICapFlags,
CODEC_ID_NONE, CODEC_ID_QOI, CODEC_ID_QOIZ, CODEC_ID_REMOTEFX,
};
pub use self::brush::{Brush, SupportLevel};
pub use self::frame_acknowledge::FrameAcknowledge;
Expand Down
Loading
Loading