forge
Explore
Log in

Don't you dare go Hollow

Share clarity: bits per pixel doubled (AV1/H265 0.12, H264 0.16, VP9 0.14, VP8 0.18) with average = ceiling, BT.709 limited colour tag, decode width from the real contain/cover rect so the viewer samples once

Browse files at this commit

f3f8ae18b7e21aaa7b350441ffae7bc30826d5c9Ahmet Kaan GümüşParent: d3a62ab
  • feat
    • share clarity: bits per pixel doubled (AV1/H265 0.12, H264 0.16, VP9 0.14, VP8 0.18) with average = ceiling, BT.709 limited colour tag, decode width from the real contain/cover rect so the viewer samples once
    • edith 9876fb67 (desktop hint, quality level, CDEF, bilinear chroma)
Show full message
✨ feat: share clarity: bits per pixel doubled (AV1/H265 0.12, H264 0.16, VP9 0.14, VP8 0.18) with average = ceiling, BT.709 limited colour tag, decode width from the real contain/cover rect so the viewer samples once; edith 9876fb67 (desktop hint, quality level, CDEF, bilinear chroma)
crates/client/Cargo.tomlmodified+11 -11
@@ -12,17 +12,17 @@ tokio.workspace = true
12 quinn = { workspace = true, features = ["rustls-ring"] }12 quinn = { workspace = true, features = ["rustls-ring"] }
13 13
14 gpui-kit = { version = "0.11.0", features = ["syntect"] }14 gpui-kit = { version = "0.11.0", features = ["syntect"] }
15-ec-opus = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "511a95b5" }15+ec-opus = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9876fb67" }
16-ec-core = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "511a95b5" }16+ec-core = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9876fb67" }
17-ec-probe = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "511a95b5" }17+ec-probe = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9876fb67" }
18-ec-ogg = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "511a95b5" }18+ec-ogg = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9876fb67" }
19-ec-h264 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "511a95b5" }19+ec-h264 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9876fb67" }
20-ec-vp8 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "511a95b5" }20+ec-vp8 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9876fb67" }
21-ec-flac = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "511a95b5" }21+ec-flac = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9876fb67" }
22-ec-h265 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "511a95b5" }22+ec-h265 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9876fb67" }
23-ec-hw = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "511a95b5" }23+ec-hw = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9876fb67" }
24-ec-vp9 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "511a95b5" }24+ec-vp9 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9876fb67" }
25-ec-av1 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "511a95b5" }25+ec-av1 = { git = "https://git.tahinli.com/Tahinli/edith_codecs.git", rev = "9876fb67" }
26 ureq = "3.5.2"26 ureq = "3.5.2"
27 bytes = "1.12.2"27 bytes = "1.12.2"
28 tracing = "0.1.44"28 tracing = "0.1.44"
crates/client/src/gui/surface.rsmodified+12 -3
@@ -67,11 +67,20 @@ impl Render for Surface {
67 };67 };
68 let network = self.network.clone();68 let network = self.network.clone();
69 let ((user_id, kind), id) = (self.source, self.id);69 let ((user_id, kind), id) = (self.source, self.id);
70+ let aspect = self.frame.as_ref().map_or(WIDE, |frame| {
71+ let size = frame.size(0);
72+ size.width.0 as f32 / size.height.0.max(1) as f32
73+ });
74+ let cover = self.cover;
70 let measure = canvas(75 let measure = canvas(
71 move |bounds, window, _| {76 move |bounds, window, _| {
72- let size = bounds.size;77+ let (width, height) = (f32::from(bounds.size.width), f32::from(bounds.size.height));
73- let width = f32::from(size.width).max(f32::from(size.height) * WIDE);78+ let width = if cover {
74- let width = (width * window.scale_factor()).ceil() as u32;79+ width.max(height * aspect)
80+ } else {
81+ width.min(height * aspect)
82+ };
83+ let width = (width * window.scale_factor()).round() as u32;
75 network.show_share(user_id, kind, id, Some(width));84 network.show_share(user_id, kind, id, Some(width));
76 },85 },
77 |_, _, _, _| {},86 |_, _, _, _| {},
crates/client/src/share/encode.rsmodified+9 -6
@@ -204,6 +204,12 @@ mod hardware {
204 const VULKAN_ATTEMPTS: u32 = 5;204 const VULKAN_ATTEMPTS: u32 = 5;
205 const VULKAN_RETRY: std::time::Duration = std::time::Duration::from_millis(100);205 const VULKAN_RETRY: std::time::Duration = std::time::Duration::from_millis(100);
206 const RATE_BUFFER_MS: u32 = 66;206 const RATE_BUFFER_MS: u32 = 66;
207+ const BT709_LIMITED: ec_hw::types::Colour = ec_hw::types::Colour {
208+ primaries: 1,
209+ transfer: 1,
210+ matrix: 1,
211+ full_range: false,
212+ };
207 213
208 use common::share::Codec;214 use common::share::Codec;
209 215
@@ -212,14 +218,10 @@ mod hardware {
212 218
213 pub struct Encoder(ec_hw::HwEncoder);219 pub struct Encoder(ec_hw::HwEncoder);
214 220
215- fn average(ceiling: u32) -> u32 {
216- ceiling / 3 * 2
217- }
218-
219 impl Encoder {221 impl Encoder {
220 pub fn tune(&mut self, bitrate: u32, fps: u32) {222 pub fn tune(&mut self, bitrate: u32, fps: u32) {
221 report(self.0.tune(ec_hw::Tunings {223 report(self.0.tune(ec_hw::Tunings {
222- bitrate: average(bitrate),224+ bitrate,
223 framerate: (fps, 1),225 framerate: (fps, 1),
224 }));226 }));
225 }227 }
@@ -347,10 +349,11 @@ mod hardware {
347 };349 };
348 let mut config = ec_hw::EncoderConfig::new(codec, settings.width, settings.height);350 let mut config = ec_hw::EncoderConfig::new(codec, settings.width, settings.height);
349 config.framerate = (settings.fps, 1);351 config.framerate = (settings.fps, 1);
350- config.bitrate = average(settings.bitrate);352+ config.bitrate = settings.bitrate;
351 config.gop_size = settings.gop;353 config.gop_size = settings.gop;
352 config.rate_control = ec_hw::RateControlMode::VariableBitrate;354 config.rate_control = ec_hw::RateControlMode::VariableBitrate;
353 config.buffer_ms = Some(RATE_BUFFER_MS);355 config.buffer_ms = Some(RATE_BUFFER_MS);
356+ config.colour = Some(BT709_LIMITED);
354 let encoder = open_vulkan(config, settings.codec)357 let encoder = open_vulkan(config, settings.codec)
355 .or_else(|| report(ec_hw::HwEncoder::open(config, None)))?;358 .or_else(|| report(ec_hw::HwEncoder::open(config, None)))?;
356 tracing::info!(backend = ?encoder.backend(), ?codec, "share hardware encoder opened");359 tracing::info!(backend = ?encoder.backend(), ?codec, "share hardware encoder opened");
crates/common/src/share.rsmodified+4 -4
@@ -31,10 +31,10 @@ impl Codec {
31 31
32 pub fn bits_per_pixel(self) -> f32 {32 pub fn bits_per_pixel(self) -> f32 {
33 match self {33 match self {
34- Self::Vp8 => 0.1,34+ Self::Vp8 => 0.18,
35- Self::H264 => 0.09,35+ Self::H264 => 0.16,
36- Self::Vp9 => 0.07,36+ Self::Vp9 => 0.14,
37- Self::H265 | Self::Av1 => 0.06,37+ Self::H265 | Self::Av1 => 0.12,
38 }38 }
39 }39 }
40 }40 }