The dead zone is not where the distance to x264 is
Browse files at this commitb25750fe8770f2df954db049c0c2b77383dc2970Parent: 59483b8- docs
- the dead zone is not where the distance to x264 is
2 changed files +34 -4
crates/ec-h264/src/enc/quant.rsmodified+10 -0
| @@ -29,6 +29,16 @@ const MF: [[i32; 3]; 6] = [ | |||
| 29 | /// block at 1/6 — the classic asymmetry, which spends bits where prediction is | 29 | /// block at 1/6 — the classic asymmetry, which spends bits where prediction is |
| 30 | /// weakest. Measured against 1/3 and 1/2 for the inter case on 1080p camera | 30 | /// weakest. Measured against 1/3 and 1/2 for the inter case on 1080p camera |
| 31 | /// and screen-capture clips: 1/6 is level or ahead at matched bitrate. | 31 | /// and screen-capture clips: 1/6 is level or ahead at matched bitrate. |
| 32 | +/// | ||
| 33 | +/// Re-measured 2026-08-23 against x264 with `bd_psnr_vs_x264` on a 3840x1608 | ||
| 34 | +/// clip, sweeping both numerators as sixty-fourths the way x264 spells | ||
| 35 | +/// `--deadzone-intra` / `--deadzone-inter`. The intra offset is the one that | ||
| 36 | +/// matters and ours is the better of the two: x264's 11/64 reads -1.667 dB | ||
| 37 | +/// all-intra where ours (21/64, i.e. 1/3) reads -0.745 dB, with the inter | ||
| 38 | +/// value making no difference to that. The inter offset is inert across the | ||
| 39 | +/// whole useful range -- 6/64, 16/64, 21/64 and 32/64 span -1.571 to | ||
| 40 | +/// -1.532 dB, a 0.04 dB spread, while the bit counts move by 0.8%. So the | ||
| 41 | +/// remaining distance to x264 is not in the dead zone. | ||
| 32 | #[inline] | 42 | #[inline] |
| 33 | fn round_offset(qbits: u32, intra: bool) -> i32 { | 43 | fn round_offset(qbits: u32, intra: bool) -> i32 { |
| 34 | (1i32 << qbits) / if intra { 3 } else { 6 } | 44 | (1i32 << qbits) / if intra { 3 } else { 6 } |
lanes/h264x264-r1.report.mdmodified+24 -4
| @@ -70,7 +70,27 @@ Synthetic default -5.202 -> -5.140 dB, floor retightened to -5.25. Full `ec-h264 | |||
| 70 | reads -1.587 dB against `Fast`'s -1.557 dB — slower and marginally worse. Either its search | 70 | reads -1.587 dB against `Fast`'s -1.557 dB — slower and marginally worse. Either its search |
| 71 | changes need to be replaced with something that measures, or the preset should go. Needs the | 71 | changes need to be replaced with something that measures, or the preset should go. Needs the |
| 72 | user's call because it is public API. | 72 | user's call because it is public API. |
| 73 | -- **The remaining -1.557 dB is still unattributed.** All-intra was -0.749 dB before this fix; | 73 | +- **The remaining -1.557 dB is still unattributed.** All-intra re-measures at -0.749 dB after |
| 74 | - re-measure it now and split the rest between prediction and quantisation. The untested | 74 | + the fix (unchanged -- I pictures always had Intra_4x4), so the split is about 0.75 dB intra |
| 75 | - hypothesis on record: our dead zone is inverted against x264's (ours 1/3 intra, 1/6 inter; | 75 | + and 0.81 dB P-picture coding. |
| 76 | - x264 uses 11/64 intra, 21/64 inter), and we have no trellis/RDOQ and no P_8x8 sub-partitions. | 76 | + |
| 77 | + The dead-zone hypothesis on record -- that ours is inverted against x264's -- was tested and | ||
| 78 | + is **dead**. Sweeping both numerators as sixty-fourths on the same clip: | ||
| 79 | + | ||
| 80 | + | intra, inter (/64) | GOP 10 | all-intra | | ||
| 81 | + |---|---|---| | ||
| 82 | + | ours (21.3, 10.7 equivalent) | -1.557 dB | -0.749 dB | | ||
| 83 | + | 11, 21 (x264's own) | -2.132 dB | -1.667 dB | | ||
| 84 | + | 21, 21 | -1.535 dB | -0.745 dB | | ||
| 85 | + | 11, 11 | -2.128 dB | -1.667 dB | | ||
| 86 | + | 21, 6 | -1.557 dB | -0.745 dB | | ||
| 87 | + | 21, 16 | -1.532 dB | - | | ||
| 88 | + | 21, 32 | -1.571 dB | - | | ||
| 89 | + | ||
| 90 | + The intra offset is the only one that moves the number, and ours is the better of the two by | ||
| 91 | + 0.92 dB all-intra. The inter offset is inert: 6/64 through 32/64 span 0.04 dB while the bit | ||
| 92 | + counts move 0.8%, so the path is reached and simply does not matter. Recorded in | ||
| 93 | + `round_offset`'s doc comment so the sweep is not repeated. | ||
| 94 | + | ||
| 95 | + Still untested, in order of expected size: no trellis/RDOQ (x264 runs `trellis=1` at | ||
| 96 | + `-preset medium`), no P_8x8 sub-partitions, and the intra mode decision itself. | ||