From c4a3d04162856fd316bc11afd277852a48dce826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Dec 2026 15:11:52 +0300 Subject: [PATCH] S9: drop EncoderConfig::inter_lambda_scale; default 1.0 makes the multiply an exact no-op --- crates/ec-h265/examples/hevc_gop.rs | 7 ------- crates/ec-h265/src/enc_p.rs | 2 +- crates/ec-h265/src/encoder.rs | 9 --------- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/crates/ec-h265/examples/hevc_gop.rs b/crates/ec-h265/examples/hevc_gop.rs index 041fb524..8b5ec1b9 100644 --- a/crates/ec-h265/examples/hevc_gop.rs +++ b/crates/ec-h265/examples/hevc_gop.rs @@ -93,13 +93,6 @@ fn run() -> Result<(), String> { cfg.keep_recon = true; // Optional trailing flags: `sh` turns sign data hiding on. cfg.sign_hiding = args.iter().skip(9).any(|a| a == "sh"); - // Sweep override of the P-mode decision lambda scale (experiments only). - if let Some(v) = std::env::var("EC_INTER_LAMBDA_SCALE") - .ok() - .and_then(|v| v.parse::().ok()) - { - cfg.inter_lambda_scale = v; - } // Experiments: worker threads and the P-picture wavefront (`0` or `off`). if let Some(v) = std::env::var("EC_H265_THREADS") .ok() diff --git a/crates/ec-h265/src/enc_p.rs b/crates/ec-h265/src/enc_p.rs index 6241ccde..54bfca45 100644 --- a/crates/ec-h265/src/enc_p.rs +++ b/crates/ec-h265/src/enc_p.rs @@ -624,7 +624,7 @@ impl<'a> PCoder<'a> { bd, qpd, qpc, - lambda: lambda_for(qpd) * enc.cfg.inter_lambda_scale, + lambda: lambda_for(qpd), // The search measures SAD on 8-bit samples, so its lambda is the 8-bit one. search_lambda: lambda_for(qp).sqrt(), sign_hiding: enc.cfg.sign_hiding, diff --git a/crates/ec-h265/src/encoder.rs b/crates/ec-h265/src/encoder.rs index 40334659..9efc8ac9 100644 --- a/crates/ec-h265/src/encoder.rs +++ b/crates/ec-h265/src/encoder.rs @@ -266,14 +266,6 @@ pub struct EncoderConfig { /// against off, the single continuous substream the sequential coder writes. /// Off also makes P pictures single-threaded. pub inter_wpp: bool, - /// Scale on the lambda the P-picture mode decisions use, against - /// `lambda_for(qp)` (the intra lambda, in squared-error units per bit). The - /// motion search uses `sqrt(lambda_for(qp))` instead, because it costs SAD. - /// - /// Measured with `scripts/hevc-bdrate.sh` (ffmpeg PSNR, bframes=0 x265 - /// anchor, 352x288, QPs 22/27/32/37), BD-rate against x265: +21.9% at scale 1, - /// +23.4% at 1/4, +28.9% at 1/16. Scale 1 is the default. - pub inter_lambda_scale: f64, /// Whether a sequence with P pictures (`keyint > 1`) codes its IDR pictures with the /// fast intra tool set: no RDOQ, one full-RD intra candidate, no NxN split, no transform /// skip trial, no transform-tree split. An IDR is one picture in `keyint`, so what @@ -337,7 +329,6 @@ impl EncoderConfig { keep_recon: false, keyint: 1, inter_wpp: true, - inter_lambda_scale: 1.0, gop_fast_idr: true, bit_depth: 8, speed: Preset::Default,