From 8c8e6deb185af1462e0d4920434230695c307520 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 17:10:44 +0000 Subject: [PATCH] Increase H264/H265 bitrate multipliers to improve image quality - H265: Increase base multiplier from 1.5x to 2.0x (33% more bitrate) - H264: Increase base multiplier from 2.0x to 2.5x (25% more bitrate) - Also adjusted high-bitrate decay factors proportionally - At 1080p Balanced quality: H265 now uses ~2777 kbps (was 2084) - Fixes issue where H265 had worse quality than VP8 software codec Co-authored-by: rustdesk <71636191+rustdesk@users.noreply.github.com> --- libs/scrap/src/common/hwcodec.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libs/scrap/src/common/hwcodec.rs b/libs/scrap/src/common/hwcodec.rs index 17eda7f3c..f3d28d953 100644 --- a/libs/scrap/src/common/hwcodec.rs +++ b/libs/scrap/src/common/hwcodec.rs @@ -264,17 +264,21 @@ impl HwRamEncoder { 5.0 } } else if h264 { + // Increased base multiplier from 2.0 to 2.5 to improve image quality + // while maintaining H264's compression efficiency + if base > threshold { + 1.0 + 1.5 / (1.0 + (base - threshold) * decay_rate) + } else { + 2.5 + } + } else { + // H265: Increased base multiplier from 1.5 to 2.0 to fix poor image quality + // H265 should be more efficient than H264, but needs sufficient bitrate if base > threshold { 1.0 + 1.0 / (1.0 + (base - threshold) * decay_rate) } else { 2.0 } - } else { - if base > threshold { - 1.0 + 0.5 / (1.0 + (base - threshold) * decay_rate) - } else { - 1.5 - } }; (base * factor) as u32 }