forge
Explore
Log in

Don't you dare go Hollow

8x8 transform on by default

Browse files at this commit

e6fcc5cc2788e495935cd800044f63dc8e2915b3Ahmet Kaan GümüşParent: d563e2c
  • feat
    • 8x8 transform on by default
Show full message
feat(h264): 8x8 transform on by default

x264 codes the 8x8 transform by default at every preset that reaches
High profile, and measured on the library clips the flag is worth
+0.716 dB BD-PSNR on a 3840x1608 film clip (18.1% of macroblocks take
the 8x8 path) and +0.183 dB on a 2560x1440 screen capture (8.8%).

With it on, the encoder's whole-picture comparison against x264 over
q22/26/30/34 moves from -0.186 dB to +0.513 dB on the film clip and
from -0.482 dB to -0.315 dB on the screen capture.

Every default stream now carries profile_idc 100 and the High-profile
SPS tail. `production_lambda_tracks_transform_mode` asked the default
config for the 4x4 lambda, so it now clears the flag itself first.
crates/ec-h264/src/enc/mod.rsmodified+7 -6
@@ -74,12 +74,12 @@ pub struct EncoderConfig {
7474 pub threads: usize,
7575 /// Quantiser for constant-QP mode (`bitrate` zero).
7676 pub qp: i32,
77- /// 8x8 transform (High profile). Off by default.
77+ /// 8x8 transform (High profile). On by default, as it is in x264.
7878 ///
79- /// When enabled, eligible intra and inter luma macroblocks write
80- /// `transform_size_8x8_flag` and choose the 8x8 path with a squared-error
81- /// rate-distortion cost. Leaving it off preserves the Baseline/Main-profile
82- /// 4x4 path.
79+ /// Eligible intra and inter luma macroblocks write `transform_size_8x8_flag`
80+ /// and choose the 8x8 path with a squared-error rate-distortion cost.
81+ /// Turning it off restricts the stream to the Baseline/Main-profile 4x4
82+ /// path, which costs 0.7 dB BD-PSNR on film and 0.2 dB on screen capture.
8383 pub transform_8x8: bool,
8484 #[cfg(feature = "rd-ablation")]
8585 rd_lambda_standard: bool,
@@ -107,7 +107,7 @@ impl EncoderConfig {
107107 cabac: true,
108108 threads: 0,
109109 qp: 26,
110- transform_8x8: false,
110+ transform_8x8: true,
111111 #[cfg(feature = "rd-ablation")]
112112 rd_lambda_standard: false,
113113 #[cfg(feature = "rd-ablation")]
@@ -994,6 +994,7 @@ mod tests {
994994 #[test]
995995 fn production_lambda_tracks_transform_mode() {
996996 let mut cfg = EncoderConfig::new(640, 480);
997+ cfg.transform_8x8 = false;
997998 assert_eq!(
998999 lambda_for(26, rd_lambda_standard(&cfg)),
9991000 lambda_for(26, false)
crates/ec-h264/tests/encode.rsmodified+1 -1
@@ -913,7 +913,7 @@ fn clip_sources(path: &std::ffi::OsStr, want: usize) -> (usize, usize, Vec<Plane
913913 (w, h, sources)
914914 }
915915
916-/// BD-PSNR of the opt-in `transform_8x8` flag against flag-off on one real
916+/// BD-PSNR of the `transform_8x8` flag (on by default) against flag-off on one real
917917 /// clip from the library, full size, over a QP sweep: the number the synthetic
918918 /// gate above cannot give, because the synthetic clip is content the flag wins
919919 /// on. Prints the per-QP points, the BD-PSNR and the 8x8 macroblock share;