From 1bfd0701844b8caa1bdd9323cf39bf6ff676f304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 23 Aug 2026 19:10:06 +0300 Subject: [PATCH] perf(h264): size the P_Skip rebate to what skipping actually saves The skip candidate was handed a four-bit rebate. Sweeping it against x264 on three clips puts the flat part of the curve at 0-2 bits: on a 3840x1608 film clip at GOP 10, 0 and 2 read -0.113 and -0.110 dB where 4 reads -0.233 and 8 reads -0.708. The screen capture and the synthetic clip move by 0.01 dB across the same range. Two rather than zero because skipping does save signalling, and two is the top of the flat region. --- crates/ec-h264/src/enc/mb.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/ec-h264/src/enc/mb.rs b/crates/ec-h264/src/enc/mb.rs index daba4d13..821bf7be 100644 --- a/crates/ec-h264/src/enc/mb.rs +++ b/crates/ec-h264/src/enc/mb.rs @@ -653,7 +653,12 @@ fn choose_inter(pic: &Picture, e: &MbEnc<'_>, mb_x: usize, mb_y: usize) -> Inter let skip_cost = { let mut buf = [0u8; 256]; mc_luma(&plane, sx as i32, sy as i32, skip_mv, 16, 16, 16, &mut buf); - satd_block(&e.src.y, sw, sx, sy, &buf, 16, 0, 16, 16) - motion_rate(e, 4.0) + // P_Skip's rebate is the signalling it genuinely saves, and two bits is + // where the measurement is flat: 0 and 2 read -0.113 and -0.110 dB + // BD-PSNR against x264 on the film clip at GOP 10 where the four this + // used to claim reads -0.233 dB and eight reads -0.708 dB. The screen + // capture and the synthetic clip move by 0.01 dB across 0, 2 and 4. + satd_block(&e.src.y, sw, sx, sy, &buf, 16, 0, 16, 16) - motion_rate(e, 2.0) }; let mut best = (PShape::Whole, [mv16, mv16], cost16);