Commits
Commits on
59483b88cedbfc050ba9efe4bc970025b86d7c062026-08-23
perf(h264): try Intra_4x4 in P pictures at every presetAhmet Kaan Gümüş · f0a6733
perf(h264): try Intra_4x4 in P pictures at every preset The BD-PSNR gate against x264 put us 2.992 dB behind on a 3840x1608 clip from the library at Preset::Fast, and 1.587 dB behind at Preset::Balanced. Ablating the four places the two presets differ shows the whole difference sits in one of them: allowing Intra_4x4 in P pictures reads -1.557 dB on its own, while a 48-sample search range (-3.039 dB), the half-macroblock partitions (-3.009 dB) and the subpel refinement (-3.035 dB) each land inside the noise of the -2.992 dB baseline. So Intra_4x4 is now tried in P pictures at every preset. The cost is about 5% encode time (21.75 s against 20.67 s for the 24-picture measurement), which is what a 1.4 dB rate-quality move is worth. Against x264 on that clip we now spend 5-10% more bits instead of 19%, at 0.3-1.3 dB lower PSNR instead of 1.0-1.7 dB. The synthetic floor moves with the default: -5.202 dB to -5.140 dB, and the constant is retightened to -5.25. No test in the repo pins encoder bytes, so nothing else re-pins.
test(h264): gate on content prediction can win, not on noiseAhmet Kaan Gümüş · 5370748
test(h264): gate on content prediction can win, not on noise The default clip for `bd_psnr_vs_x264` was `Clip::render`, whose per-sample noise field is incompressible. On it x264 reads as 2x cheaper mostly by throwing residual away -- at QP 30 it spends 224k bits to our 672k and lands 0.5 dB *below* us -- so the BD-PSNR there measured how willing each encoder is to abandon noise, not how well either predicts. The tell: our `Preset::Balanced` scored worse (-3.861 dB) than `Preset::Fast` (-2.640 dB) on that clip while scoring much better on real content. `Clip::render_smooth` replaces it for this test: gradients, a sinusoidal texture band and a box translating by sub-sample amounts, no noise. Its signature now matches the library clip's -- we spend 34-48% more bits and land 0.6-2.1 dB lower at the same quantiser -- and the floor moves to -5.40 dB from a -5.202 dB measurement. The other tests keep `render`, which is the right source for them. `EC_H264_PRESET_BALANCED` joins `EC_H264_GOP` as a diagnostic knob: on the 3840x1608 library clip Balanced is -1.587 dB against Fast's -2.992 dB for 40% more encode time, so over a dB of the P-picture distance is search effort our default preset declines to spend.
fix(h264/test): match x264's quantiser, and split the gap intra vs interAhmet Kaan Gümüş · cd63f57
fix(h264/test): match x264's quantiser, and split the gap intra vs inter
The gate as committed asked x264 for a constant QP and did not get one:
x264's CQP mode scales the I-picture quantiser by `ipratio` (1.4 by
default), so its I pictures were coded finer than the QP under test.
That flattered x264 on the intra side and made the whole comparison a
different-quantiser comparison. `ipratio=1.0:pbratio=1.0:qcomp=1.0:
chroma-qp-offset=0` pins it; the synthetic BD-PSNR moves from -2.442 dB
to -2.640 dB, and the floor with it.
With the quantiser actually matched, `EC_H264_GOP` splits the distance.
On the 3840x1608 clip from the library:
GOP 10 : -2.992 dB, ours +19% bits at 1.1-1.7 dB lower PSNR
GOP 1 : -0.749 dB, ours +2-4% bits at 0.4-0.8 dB lower PSNR
So the intra path is close and roughly two thirds of the distance is in
P pictures: our inter path searches 16x16 only at `Preset::Fast`
(halves at Balanced, never 8x8 sub-partitions) with no rate-distortion
subpel refinement, and a worse prediction costs both bits and PSNR at
the same quantiser. That is the next lane's target, now measured
instead of assumed.
Ours is also read off ffmpeg's decode of our own stream rather than off
the encoder's reconstruction, matching how x264 is read; the two are
asserted equal within 0.05 dB.test(h264): BD-PSNR gate against x264, the encoder's first referenceAhmet Kaan Gümüş · 5e93348
test(h264): BD-PSNR gate against x264, the encoder's first reference The repo could measure the H.264 decoder against ffmpeg, the FLAC and ALAC encoders against their references, and the audio encoders against libopus/libvorbis, but the H.264 encoder only against itself: the `transform_8x8` BD-PSNR test compares flag-on to flag-off, not us to anyone. `bd_psnr_vs_x264` supplies the missing anchor. Both curves are (bits, luma PSNR against the same source pictures) over QP 22/26/30/34, and both are measured on decoder output rather than on an encoder's own reconstruction, so the two halves are read the same way; ours additionally asserts that its reconstruction and its decoded stream agree within 0.05 dB, which turns a silent drift between the encoder and the decoder into a failure here. x264 is matched to what our encoder actually codes -- Main profile (CABAC, no 8x8 transform), one reference, no B pictures, the same GOP -- with adaptive quantisation, psy and scenecut off so both spend bits by the same rule. Effort is each encoder's own default: our `Preset::Fast` against x264's `-preset medium`. First measurements: -2.442 dB on the synthetic clip (352x288, 24 pictures) and -2.961 dB on a 3840x1608 clip from the library, where we spend 14-19% more bits and land 1-2 dB lower at the same QP. The synthetic number becomes the floor at -2.60 dB so the distance can only shrink; a clip named by EC_H264_CLIP prints but does not gate, its content not being pinned. The test runs by default rather than behind `#[ignore]`, because an invisible test rots. The picture-extraction half of `real_clip_t8x8_bd_psnr` moves out to `clip_sources` and is shared, unchanged in behaviour.
test(survey/r1): encoder-vs-reference gap rankingAhmet Kaan Gümüş · f8a771e
test(survey/r1): encoder-vs-reference gap ranking Ranks every encoder in the tree by distance from the reference it replaces, measured inline this batch rather than quoted from lane reports. Worst first: ec-h264 has no encoder-vs-reference gate at all (x264 is invoked in conformance.rs only to PRODUCE streams for decoder tests), so its rate- quality distance is unmeasured while the transform_8x8 default-on decision waits on it. Second, ec-vorbis trails libvorbis by 0.0027 corr at its worst row where ec-opus now leads libopus on all 14 of its own -- and vorbis loses exactly the rows where it spends fewer bits than the reference (nik@96 -1.60%, reelo@96 -1.43%) and wins the ones where it spends more (reelm +2.74%, hein +2.05%), which is a steady under-spend, not a transient. Below those: ec-mp3's VBR row passes its bar by 0.00014, the thinnest margin in the repo; ec-image is -0.03 dB on WebP vs the incumbent; ec-aac, ec-flac and ec-alac are at or ahead of their references (flac encodes 3.9% smaller than ffmpeg, alac is bit-exact on 8/8). Every default suite is green with no unexplained skips. The report lists what could not run and why -- the env-gated SBR anchors (both run by hand for this survey), the EC_H264_CLIP-gated BD-PSNR test, and the ~12-minute opus gate whose numbers are the re-measurement from 41cf1d1.
test(aac/sbr): noise-fraction anchor summed core bands into a "whole-HF" ratioAhmet Kaan Gümüş · dccdbb8
test(aac/sbr): noise-fraction anchor summed core bands into a "whole-HF" ratio `sbr_actual_noise_fraction` is env-gated (it sets process env vars mid-run, which is unsound alongside parallel tests), so no default run executes it. Run by hand it FAILED: "whole-HF realized noise fraction regressed to 0.0397 (round-44 fix floor is 0.17)". Nothing regressed. Every band above the crossover realizes 0.15-0.27 of its energy as injected noise, right where round-42/44 left it; the total was diluted. `bin_level_conviction`'s rows start at `MIN_BAND` = 14 on ITS band scale (rate/256, so ~2412 Hz), while this stream's crossover is QMF band 14 on the OTHER scale (rate/128, 4823 Hz) -- the same integer, two scales. The dozen core-decoded rows that opens with carry an order of magnitude more energy than the SBR-generated ones (6.4e4 vs ~5e3) and, by definition, zero injected noise, so averaging them in dragged the ratio to 0.0397. The total now starts at the stream's own crossover, taken from the lowest QMF band the bookkeeping table holds (which IS `kx`), so a future QMF-mapping change cannot silently invalidate it the way a constant did. It reads 0.1774 -- round-44 measured 0.1770 on this file -- and the assertion passes untouched at its original 0.17 floor. Noise injection is also still doing work: zeroing it costs 0.000847 of full-band correlation against the reference. Both anchors' SKIP lines now print the exact command that runs them, since being invisible to default runs is what let a stale instrument sit unread. `sbr_instrument_anchor_controls` was run too, and passes: ours-vs-ours 1.0000, reference-vs-remux 1.0000, reference vs itself at a 64-sample offset 0.9317 mean / 0.3323 min (the coherence floor the instrument itself imposes). Suite: 16 passed, 0 failed (54.1s).
test(aac/sbr): stride-1 lag search; the 0.40 core-only row was the instrumentAhmet Kaan Gümüş · 4aa4b5f
test(aac/sbr): stride-1 lag search; the 0.40 core-only row was the instrument `core_only_matches_reference` printed `ch0: lag 1015, corr 0.402349` for reeln in an otherwise green suite. The core is fine: the asserted reference gate scores that file's below-5kHz band 0.999988, and `full_chain_low_band_matches_own_core` scores this very core-only PCM 0.998 against our own full chain. A stride-1 sweep of the lag range shows the pair correlating 0.999845 at lag 481 -- ffmpeg's resampler delay, the same lag FMJ reads. The search was missing it. Both `best_lag_correlation_ex` and `robust_lag_topk` stepped their coarse pass by `SEARCH_STRIDE` (11) and then refined around the best (or top-K) coarse scorer. A correlation peak between two decodes of the same audio is often one sample wide -- here 0.9998 at 481, 0.94 at 479 -- so no grid point (the grid is 4 mod 11; 481 is 8 mod 11) saw anything but the noise floor, and the refinement was pointed by a ranking of noise. FMJ, same instrument and same true lag, happened to land a noise-ranked candidate inside its refine window and read correctly, so the failure was luck-dependent rather than file-dependent. Both coarse passes now step by 1 (~33M multiply-adds at the narrow bound, cheaper than the top-K refinement it replaces), and the diagnostic low-passes both sides at 0.9 * crossover first, since only the reference side -- ffmpeg's full SBR reconstruction resampled down to the core rate -- can hold anything above the crossover at all. Class sweep: the sibling copies in ec-aac/obs_real_content.rs, ec-matroska/matroska.rs and ec-ac3/encode_matrix.rs were already stride-1; sbr_real_library.rs held the only strided searches in the tree. Suite: 16 passed, 0 failed (53.4s). Every printed row is unchanged or better; the four core-only rows now read 0.999779-0.999999.
Merge branch 'lane-opus-reell3': libopus importance[] for the tf ViterbiAhmet Kaan Gümüş · e9d01ed
Merge branch 'lane-opus-reell3': libopus importance[] for the tf Viterbi The lane's premise (a startup pre-echo behind reell@96's err_ratio 4.499) was wrong; lanes/opus-reell-r3.report.md records the measurement that refutes it. What ships is the faithfulness fix the investigation surfaced: the tf Viterbi now gets dynalloc_analysis's importance[] instead of a flat 13.
feat(opus): tf Viterbi gets libopus importance[] from dynalloc_analysisAhmet Kaan Gümüş · 95bb40e
feat(opus): tf Viterbi gets libopus importance[] from dynalloc_analysis tf_analysis() was called with importance[i] = 13 for every band, a stand-in constant. libopus derives it in dynalloc_analysis (celt_encoder.c:1176-1189) as floor(.5 + 13*exp2(min(follower[i], 4))), with a flat 13 only on the early-return path, and calls dynalloc_analysis before the tf decision. Both now match: the call moved ahead of tf_res (it reads only band_log_e, so the move is state-safe) and it fills importance[]. Metric-neutral on the 14-row library gate (corr moves <= 0.0001, err_ratio unchanged, RATE/DROPOUT green); it ships as reference faithfulness. Also corrects the module doc, which still described TF_ANALYSIS as false, and records in lanes/opus-reell-r3.report.md that the reell@96 err_ratio premise was wrong: our decode before the first attack is quieter than the reference by orders of magnitude, not pre-echoing.
docs(opus): err_map header names its own source tagAhmet Kaan Gümüş · b53cc33
docs(opus): err_map header names its own source tag The map test was generalised to any gate source (EC_ERRMAP_SRC/_KBPS/_TAG) but still printed a hardcoded "her@" header, so a reell or reelo map claimed to be her's. Header now uses the tag; module doc updated to match.
test(opus-reell/r3): err_map_vs_libopus reell@96 err_ratio 4.499Ahmet Kaan Gümüş · 9cc74b7Browse files
test(opus-reell/r3): error map generalised to any gate sourceAhmet Kaan Gümüş · 19ef3ae
test(opus-reell/r3): error map generalised to any gate source her_err_map_96k -> err_map_vs_libopus; EC_ERRMAP_SRC / EC_ERRMAP_KBPS / EC_ERRMAP_TAG select source, rate and output file, her@96 defaults kept.
Merge branch 'lane-opus-her': her@96 opus_compare error map, premise supersededAhmet Kaan Gümüş · f521fd8Browse files
docs(opus-her/r1): premise superseded by lane-opus-64; residual namedAhmet Kaan Gümüş · 9b54a5f
docs(opus-her/r1): premise superseded by lane-opus-64; residual named
Merge branch 'lane-h264rd3': bS derivation extracted, inter trial deblocking measured and rejectedAhmet Kaan Gümüş · ba7f553Browse files
refactor(h264rd/r3): extract decoder bS derivation; inter trial deblocking rejectedAhmet Kaan Gümüş · d3d7ad4
refactor(h264rd/r3): extract decoder bS derivation; inter trial deblocking rejected bs_side/bs_between extracted from boundary_strength (8.7.2.1 in one place); ssd_mb_deblocked parametrised by a bs closure, intra trials pass intra_bs. Output byte-identical to r2. The chartered change — derived per-edge bS in the inter cost4/cost8 trial — regressed the 720p clip in all three measured variants (+0.818/+0.794/+0.821 vs +0.827 dB BD-PSNR; obs flat): the trial's pre-filter neighbour aprons make weak inter strengths (bS 1/2) model noise. Reverted per charter; numbers in lanes/h264rd-r3.report.md.
Merge branch 'lane-h264rd2': deblock-aware intra 4x4 trial distortion + real-clip BD harnessAhmet Kaan Gümüş · 5208ad8Browse files
docs(h264rd/r2): lane report — deblock-aware intra trial, +0.03 dB film BDAhmet Kaan Gümüş · 9fc5978Browse files
feat(h264rd/r2): deblock-aware intra 4x4 trial distortionAhmet Kaan Gümüş · bb59e0b
feat(h264rd/r2): deblock-aware intra 4x4 trial distortion The transform_8x8 intra trial judged candidates by pre-filter SSD, which prices the 4x4 candidate as if the bS-3 edges its extra transforms create cost nothing under the loop filter every decoder runs. ssd_mb_deblocked copies the candidate macroblock with 4-sample left/top aprons into a scratch, filters it exactly as deblock_picture will - bS 4 on macroblock edges when a neighbour exists, bS 3 on internal edges, the 4/12 luma edges skipped for the 8x8 candidate as the decoder's internal() gate does, verticals before horizontals, this qp, zero offsets - and SSDs that instead. Chroma stays pre-filter (never 8x8-transformed, cannot separate candidates); the flag-off path keeps ssd_luma + rough bits untouched. Real clips, BD-PSNR flag-on vs flag-off q22/26/30/34: natural 720p film +0.796 -> +0.827 dB obs 1440p capture -0.007 -> -0.000 dB
test(h264rd/r2): real-clip BD-PSNR harness for transform_8x8Ahmet Kaan Gümüş · 04d77cb
test(h264rd/r2): real-clip BD-PSNR harness for transform_8x8 One #[ignore]d test in the existing encode.rs binary: EC_H264_CLIP names a file, ec-mp4 + the crate decoder yield the first 30 pictures 1 s apart, and a q22/26/30/34 sweep (gop 10, CABAC, full size) prints the flag-on vs flag-off BD-PSNR and 8x8 MB share. Asserts nothing: the number gates the lane, not the suite. Baselines on the two lane clips (post-3165e8c pricing): natural 720p film BD +0.796 dB, 8x8 share 13.5% obs 1440p capture BD -0.007 dB, 8x8 share 1.9%
Merge branch 'lane-opus-silkq4': libopus stereo SILK mid/side rate splitAhmet Kaan Gümüş · de1d687Browse files
Merge branch 'lane-opus-silkq': 12k divergence diagnostics (r1/r2)Ahmet Kaan Gümüş · 3e24efaBrowse files
feat(opus-silkq/r3): libopus reservoir decay + gain-step bound in SILK rate loopAhmet Kaan Gümüş · 18042b3
feat(opus-silkq/r3): libopus reservoir decay + gain-step bound in SILK rate loop Debt-only bit reservoir decayed over 500 ms, gain search bounded to +-9 steps around an EMA-carried operating point, 5 kbps target floor, mid-heavy stereo split. Hybrid CELT min bytes 8 -> 3 (16k packets no longer expand). Speech gate: 12k .8081 -> .8526, 16k .8606 -> .8646 at +3.3% rate (was +12.9%), 24k .9036 -> .9146, 32k .9210 -> .9391. Stereo-SILK 16k synthetic floor .35 -> .33 (regression named in test).
docs(opus-silkq/r1): voiced threshold sweep recorded; not the 12k mechanismAhmet Kaan Gümüş · 6d12ee1
docs(opus-silkq/r1): voiced threshold sweep recorded; not the 12k mechanism
wip(opus-silkq/r1): SILK decoder index oracle; ours-vs-libopus per-frame table for worst secondsAhmet Kaan Gümüş · 8eefeccBrowse files
wip(opus-silkq/r1): per-second SILK diagnostic; pitch-continuity variant (off, measured harmful)Ahmet Kaan Gümüş · 9ba7193Browse files
Merge branch 'lane-opus-mode': libopus mode/bandwidth selectorAhmet Kaan Gümüş · c2b907eBrowse files
feat(opus-mode/r1): libopus VoIP/Audio mode and bandwidth thresholdsAhmet Kaan Gümüş · bb2f32f
feat(opus-mode/r1): libopus VoIP/Audio mode and bandwidth thresholds Mode/bandwidth selection ported from opus_encoder.c (mode_thresholds blended by voice_est, voice/music bandwidth tables, SILK>WB -> hybrid, 40/60 ms cap). Speech gate rows are now all-auto with a MODE GATE; 4/4 rows pick the same mode as ffmpeg libopus on real speech (lanes/opus-mode-r1.sweep.txt).
Merge branch 'lane-opus-silk': SILK/speech-rate library gate vs libopus (instrumented r2)Ahmet Kaan Gümüş · 6df4861Browse files
test(opus-silk/r2): symmetric decode, lag assert, band-limited ref, ref modeAhmet Kaan Gümüş · 2417616Browse files
test(opus-silk/r1): SILK library gate vs libopus on real speechAhmet Kaan Gümüş · 11f9cfeBrowse files
Merge branch 'lane-opus-trim': continuous alloc_trim port rejected again on top of compute_vbr (record only)Ahmet Kaan Gümüş · 6a058a0Browse files
docs(opus-trim/r2): rejected continuous trim-value port — all 14 rows regress in both A (with tf term) and B (without)Ahmet Kaan Gümüş · 570e4f9Browse files
Merge branch 'lane-opus-vbr': libopus compute_vbr ported wholeAhmet Kaan Gümüş · 187c193
Merge branch 'lane-opus-vbr': libopus compute_vbr ported whole 14-row library gate: ours ahead of libopus on every row at equal size (reelm@64 +.0038 -> -.0007, hein@64 +.0022 -> -.0014); rate within -1%. TF boost kept x1 by measurement (report in lanes/opus-vbr-r1.report.md).
feat(opus-vbr/r1): keep TF boost x1 by measurement; lane report + 14-row sweepAhmet Kaan Gümüş · a31c8b1
feat(opus-vbr/r1): keep TF boost x1 by measurement; lane report + 14-row sweep
feat(opus-vbr/r1): lastCodedBands moves at most one band per frame (libopus)Ahmet Kaan Gümüş · eee0a69Browse files
feat(opus-vbr/r1): port libopus compute_vbr whole (stereo_saving, temporal VBR, tf x2, floor depth)Ahmet Kaan Gümüş · 567ea1dBrowse files
wip(opus-vbr/r1): stereo_saving/spec_avg state, dynalloc returns max_depthAhmet Kaan Gümüş · 27e5266Browse files
lanes(opus-trim/r1): record rejected libopus alloc_trim_analysis port (gate −.002..−.003 on 10/14 rows)Ahmet Kaan Gümüş · 730a563Browse files
feat(opus-int/r1): intensity band from libopus equiv_rate + hysteresis_decisionAhmet Kaan Gümüş · 9c017b0
feat(opus-int/r1): intensity band from libopus equiv_rate + hysteresis_decision Replaces the 1.0-era effective_rate ladder with the 1.3.1 formula and threshold/hysteresis tables, shared by the VBR target and the stereo decision so CBR frames get it too. 14-row gate corr-neutral (±.0001).
Merge branch 'lane-opus-sp': spreading_decision port + tf_analysis onAhmet Kaan Gümüş · 501c871Browse files
feat(opus-sp/r1): enable tf_analysis; lane report + 14-row sweepAhmet Kaan Gümüş · 187bef2
feat(opus-sp/r1): enable tf_analysis; lane report + 14-row sweep
feat(opus-sp/r1): port libopus spreading_decision (tonal/hf averages, tapset, spread_weight)Ahmet Kaan Gümüş · 7a1f515
feat(opus-sp/r1): port libopus spreading_decision (tonal/hf averages, tapset, spread_weight) Decoder-seen spread histogram on long frames, ours vs libopus: reelm [0,12,3442,739] vs [0,0,3303,910]; hein [1,20,3800,151] vs [0,0,3809,138] (was a constant SPREAD_NORMAL). Gate reelm,hein,her,reell: corr within .0001 of lane-opus-sb, reelm@64 err_ratio .69 -> .65.