# lane-h265-cu64 r1 — a 64x64 coding tree block may stay one coding unit Until now every 64x64 CTB was forced to split into four 32x32 coding units, so the largest coding unit the encoder could emit was 32x32 whatever `ctb_size` said. This lane lets a 64x64 CTB stay one coding unit. ## What landed - `crates/ec-h265/src/ctu.rs`: `code_cu_64()`. HEVC's largest transform is 32x32 (`MaxTbLog2SizeY` is 5), so a 64x64 intra coding unit's transform tree splits *without* a `split_transform_flag` — the split is inferred from `log2TrafoSize > MaxTbLog2SizeY` (7.4.9.8) — and prediction runs per 32x32 transform block in z-order, each quadrant marked coded before the next one reads its neighbours. The forced split in `code_quadtree` is now conditional on the new flag, and the child buffers widened to a 64x64 CU's four 32x32 luma quadrants. - `crates/ec-h265/src/encoder.rs`: `Config::cu64`, on by default. Only reachable with `ctb_size` 64, and the default `ctb_size` is 32. - `crates/ec-h265/tests/encode.rs`: `EC_H265_CTB` and `EC_H265_CU64` knobs beside `EC_H265_RQT`, so the BD ladder can be run per arm. What a 64x64 CU buys is three split flags and three mode signallings; what it costs is one luma direction for the whole 64x64. ## Gates | Gate | Result | | --- | --- | | `cu64_decodes_bit_exactly` | ffmpeg decodes our stream bit-exactly at 352x288 q32, 256x256 q37 and 130x66 q32, and at the first two the stream differs from the `cu64=0` stream, so the feature really fires | | full `ec-h265` suite | 25 + 15 + 1 + 3 passed, 0 failed | | `cargo clippy --release -p ec-h265 --all-targets` | 0 warnings | At 130x66 the picture holds only two whole 64x64 tree blocks and the search keeps neither, so that shape is kept for partial-CTB coverage with the "it fired" assertion switched off rather than asserted against. ## Mutation kills | Mutation | Killed by | | --- | --- | | a `split_transform_flag` written for the inferred split | `cu64_decodes_bit_exactly` (ffmpeg) | | later quadrants predict from the CU origin instead of their own | `cu64_decodes_bit_exactly` | ## What it is worth (BD-PSNR against x265, four-point ladder q22/26/30/34) | Clip | arm | BD-PSNR | BD-PSNR-YUV | | --- | --- | --- | --- | | ReelC 1080p film @600s | ctb 32 | +0.064 dB | -0.047 dB | | | ctb 64, always split | +0.069 dB | -0.044 dB | | | **ctb 64, cu64** | **+0.071 dB** | **-0.040 dB** | | OBS screen capture 2026-08-25 16-27-54 @2s | ctb 32 | +0.224 dB | +0.086 dB | | | ctb 64, always split | +0.254 dB | +0.114 dB | | | **ctb 64, cu64** | **+0.352 dB** | **+0.219 dB** | Against always splitting a 64x64 tree block, cu64 is worth +0.002 dB on film and +0.098 dB on screen capture; against the shipping `ctb_size` of 32 it is +0.007 dB and +0.128 dB. Both clips are his own. ## Dispositions - `cu64` defaults on, `ctb_size` stays 32: **accepted** for this lane. cu64 cannot fire at 32, so the default is a no-op until the tree size changes. - `ctb_size` 64 now beats 32 on both clips (+0.007 dB film, +0.128 dB screen) but `ctb_32_is_the_faster_tree_at_1080p` guards the speed side: **deferred(a re-measured speed/quality trade at 1080p with cu64 on, which is its own lane)**. - Screen capture is still where our x265 gap lives; this is the second lane in a row that moves that clip more than the film one. ## Not in this lane - Asymmetric or non-square partitions of a 64x64 coding unit. - `part_mode` NxN at 64x64 (the spec does not offer it there). - Inter prediction, which is where a large coding unit pays the most.