forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on b4eb44d812302e026a0749eec2aad153defb738c

Today

Revert "ec-aac SBR: downsampled SBR (ext rate < 2*core, e.g. al_sbr_sr_48_2_fsaac48 ASC 11 90 56 e5 98) ran the 64-band doubling chain with band tables at the 48 kHz ext rate: ours 2048/AU and band-table errors (no sideinfo rows, ours 1001472 = cap at 489 AUs x 2048 vs ffmpeg 1148 x 1024). ffmpeg (aacsbr_template.c 1147/1683/1418): sbr->sample_rate = 2*core for tables, downsampled = ext_sample_rate < sbr->sample_rate -> 32-band synthesis with the decimated window (ds[n]=c[2n]), 32 output samples/slot. Fix: parser rate always 2*core, SbrChain::set_downsampled, Synthesis::downsampled (N=32, v 640, shift -0.5 matching our analysis phase; python replica of analysis->synth32 corr 0.995 at lag 289 vs 0.9967 for the 64-band pair), k2 clamped to 32, LFE bypass uses the same bank. Also QMF_WINDOW[384] and [512] had the wrong sign vs ffmpeg us/ds tables (ffmpeg flips at 385/513, mirror-symmetric with 128/256; ours at 384/512; table now equals ffmpeg's us and ds to 1e-10), pinned sum updated 81.46300943655164 -> 82.21187106118578. cargo check -p ec-aac --all-targets clean; tests not run"Ahmet Kaan Gümüş · b3f487f
Revert "ec-aac SBR: downsampled SBR (ext rate < 2*core, e.g. al_sbr_sr_48_2_fsaac48 ASC 11 90 56 e5 98) ran the 64-band doubling chain with band tables at the 48 kHz ext rate: ours 2048/AU and band-table errors (no sideinfo rows, ours 1001472 = cap at 489 AUs x 2048 vs ffmpeg 1148 x 1024). ffmpeg (aacsbr_template.c 1147/1683/1418): sbr->sample_rate = 2*core for tables, downsampled = ext_sample_rate < sbr->sample_rate -> 32-band synthesis with the decimated window (ds[n]=c[2n]), 32 output samples/slot. Fix: parser rate always 2*core, SbrChain::set_downsampled, Synthesis::downsampled (N=32, v 640, shift -0.5 matching our analysis phase; python replica of analysis->synth32 corr 0.995 at lag 289 vs 0.9967 for the 64-band pair), k2 clamped to 32, LFE bypass uses the same bank. Also QMF_WINDOW[384] and [512] had the wrong sign vs ffmpeg us/ds tables (ffmpeg flips at 385/513, mirror-symmetric with 128/256; ours at 384/512; table now equals ffmpeg's us and ds to 1e-10), pinned sum updated 81.46300943655164 -> 82.21187106118578. cargo check -p ec-aac --all-targets clean; tests not run"

This reverts commit d8db6262615fcd98c2b226b0357869639a98f115.
Revert "ec-aac: drop doc comments added in d8db6262 (no comments in code); code unchanged, cargo check -p ec-aac --all-targets clean"Ahmet Kaan Gümüş · 0c091c3
Revert "ec-aac: drop doc comments added in d8db6262 (no comments in code); code unchanged, cargo check -p ec-aac --all-targets clean"

This reverts commit 1fd0b3979d821b1c317b17fc782b541cb4daf1bc.
ec-aac test: lag-search window skipped digital silence; own-core reference interpolates linearly. Root cause (measured with pinned ffmpeg, f32le): decoder timing is right, instruments were not. (1) ps_06 is 4x53 AUs; AUs 53-55 of ffmpeg output are digital silence (rms 0 over [108544,112640)). With the now-correct 2048/AU length (434176/ch, = ffmpeg) every lag search anchored at len/4 = 108544 lands exactly there, so corr is noise and the winner sits at the +/-100000 / +/-20000 bound (sbr_real_library_matches_reference, per_au_low_band_divergence, sbr_header_feature_table, synthetic_heaac_matrix ps_06). On main the shorter output moved the window to loud audio, hence the earlier pass. window_start() (single source for 4 copies) advances to the first 4x1024 block louder than 1e-4 of mean power in both signals, unchanged when the base block is loud. (2) full_chain_low_band ps_04 corr 0.964 at lag -961: nearest-neighbor 2x of the core carries a half-sample error; hold-resampling ffmpeg's own ps_04 output gives at best 0.9578 for any decoder, linear interpolation 0.9936 (cm_48_2: 0.9985 -> 0.9999, matches observed 0.9987). upsample_2x is linear; threshold stays 0.99. Also ch0 of a PS stream is not the mono core (ffmpeg ps_06 corr(L,L+R) 0.937 over 10 s), so the comparison stops where the channels first differ (mono_prefix). Decoder evidence: ours vs ffmpeg ps_04 lag 0 corr 1.000000, 52/53 windows exactly 1.0 (1 silent), len 217088 = 106*2048, pre-header AUs included; ps_06 headers only from AU 106. cargo check -p ec-aac --all-targets clean; tests not runAhmet Kaan Gümüş · a62782eBrowse files
Merge branch 'simplify/c-ac3'Ahmet Kaan Gümüş · 5fa31c7Browse files
Merge branch 'simplify/c-truehd'Ahmet Kaan Gümüş · 35cac3aBrowse files
Merge branch 'simplify/c-opus'Ahmet Kaan Gümüş · 61e9e70Browse files
TrueHD tests: adapt to open FATE atmos.thd (128 AUs, 4 substreams, 32-byte ext sync)Ahmet Kaan Gümüş · 0892e43
TrueHD tests: adapt to open FATE atmos.thd (128 AUs, 4 substreams, 32-byte ext sync)

Root cause: oracle.rs first_60_seconds test capped at 60 s and required >= 59 s of
samples, but the open sample is 40960 interleaved samples (128 AUs x 40 frames x 8 ch,
ffmpeg -f s32le gives 163840 bytes). atmos_synth.rs required 1200 AUs and assumed a
3-substream 28-byte sync remux, which the open sample (4 substreams, 32-byte ext sync,
checksum at bytes 30..32 = CRC over 0..28 XOR word 28..30, verified empirically) does not match.

Fix: oracle compares the whole file against ffmpeg, every interleaved sample (all 8 channels)
exact, min 100 AUs. atmos_synth strips the object entry to build a 7.1 stream and rebuilds
Atmos from it (decodes bit-exact to the original); the object-substream test replaces the
4th substream payload in place (0x00 and 0xFF), keeping sizes, and asserts identical PCM.
Object substream is never decoded (decode.rs decoded_substreams = PCM_SUBSTREAMS) and its
payload is not parity-checked, so no check bytes need recomputing.
ec-ac3: mantissas as 2^23 integers, floor-shifted by exponent like ffmpegAhmet Kaan Gümüş · 275e634
ec-ac3: mantissas as 2^23 integers, floor-shifted by exponent like ffmpeg

ffmpeg n8.0 ac3dec.c ac3_decode_transform_coeffs_ch stores each mantissa
(dither included, ac3dec.c:412, 466) as an int at 2^23 full scale and
computes coeffs[freq] = mantissa >> exps[freq] before the float conversion
(1/4194304 gain, ac3dec.c:1290). We multiplied floats by 2^-exp, so
zero-bit dither and small mantissas on quiet bins kept bits ffmpeg drops
(up to 2^-23 per bin, ~20% of a quiet bin). The LFG generator was already
identical (av_lfg_init(0), never reseeded, ac3dec.c:124/156, default
cons_noisegen=false); the mismatch was the rounding, not the noise.

Symmetric levels and the dither now use ffmpeg's integer values
(SYMMETRIC_DEQUANT, ac3dec_data.c:57). AHT and E-AC-3 spx/cpl paths are
unchanged and still float.
ec-opus test: drop doc comment on libopus_untrimmed (no comments in code)Ahmet Kaan Gümüş · 2dcf65f
ec-opus test: drop doc comment on libopus_untrimmed (no comments in code)

Root cause: hybrid_fb_roundtrip judged lag against look_ahead 312; pinned ffmpeg 9.0.2 libopus (32 kbps, 20 ms, fullband, voip) decoded untrimmed gives wav16 lag 298 (corr 0.9994) and lag 312 at corr 0.9167. Fix stays: assert lag within 6 of libopus's own lag. This commit only removes the 3-line doc comment per the no-comments rule.
ec-opus test: judge hybrid FB lag against pinned libopus, not look_aheadAhmet Kaan Gümüş · 4a881f9
ec-opus test: judge hybrid FB lag against pinned libopus, not look_ahead

Root cause: hybrid_fb_roundtrip asserted the speech correlation lag within
look_ahead(960)=312 +/-6. Pinned ffmpeg 9.0.2 libopus (32 kbps, 20 ms,
fullband, voip, CBR) decoded untrimmed (-flags2 +skip_manual) peaks at lag
298 on wav16-mono-48000 (corr 0.9994; lag 312 corr 0.9167), and 308 on the
synthetic speech (corr 0.928). Our 298 therefore matches libopus; the
constant was wrong. Lag is now asserted within +/-6 of the libopus lag
measured by the same aligned_corr. Library code unchanged.
TrueHD: Atmos directory at 36 bytes, count from num_substreams (ffmpeg mlp_parse.c:71-74,160; mlpdec.c read_access_unit)Ahmet Kaan Gümüş · 731634a
TrueHD: Atmos directory at 36 bytes, count from num_substreams (ffmpeg mlp_parse.c:71-74,160; mlpdec.c read_access_unit)

Root cause, sync.rs AccessUnitHeader::parse: the major sync was fixed at 28 bytes.
ffmpeg mlp_get_major_sync_size adds 2 + 2*(buf[26]>>4) when buf[25]&1 (TrueHD).
atmos.thd AU0 sets buf[25]&1 with buf[26]>>4 == 1, so the directory starts at
36 (4 + 32), not 32. The entry count was inferred from end pointers landing on
the AU length; ffmpeg reads num_substreams (buf[16]>>4) and ignores trailing
bytes. atmos.thd AU25/63/102 end 4 words short of the AU length, so the walk
ran past 4 entries.

Fix: extension-aware major sync length; count from num_substreams, carried in
TrueHdFacts for access units without a major sync; the scanner skips access
units that have no known count. ffmpeg evidence: AU0 4 entries, last end
1092 bytes past dir end 44 = 1136 AU length; sub-entries 246/578/750/1136 with
the extension sync.
ec-aac SBR: FIXVAR/VARVAR trailing relative borders applied in reverse orderAhmet Kaan Gümüş · f958102
ec-aac SBR: FIXVAR/VARVAR trailing relative borders applied in reverse order

sbr_payload.rs parse_grid read the trailing rel borders in wire order but
subtracted the last-read one from the trailing edge. FFmpeg n8.0
aacsbr_template.c read_sbr_grid assigns the first-read rel to t_env[n-1]
(FIXVAR: t_env[bs_num_env-1-i] = t_env[bs_num_env-i] - 2*bits-2, same in
VARVAR). Only differs when there are 2+ trailing rels (num_env >= 3), so a
uniform list hid it. Fix: rel index num_env-1-i in both trailing loops.
TrueHD: directory from major sync count, 32-byte Atmos major sync (ffmpeg 9.0.2 mlp_parse.c/mlpdec.c)Ahmet Kaan Gümüş · 2c05ed8
TrueHD: directory from major sync count, 32-byte Atmos major sync (ffmpeg 9.0.2 mlp_parse.c/mlpdec.c)

Root cause, sync.rs AccessUnitHeader::parse: (1) the major sync was fixed at 28
bytes, but ffmpeg mlp_get_major_sync_size adds 2+2*(buf[26]>>4) bytes when
buf[25]&1 (TrueHD); atmos.thd AU0 has extension bit set, so the directory
started at 32 instead of 36. (2) the entry count was inferred from end pointers
landing on the AU length; ffmpeg reads num_substreams (major sync buf[16]>>4,
mlp_parse.c:160) and ignores trailing bytes, and atmos.thd AU25/63/102 carry
32 words past the last end pointer, so the walk ran past 4 entries.

Fix: length from the extension block; count from num_substreams, carried over
from the last major sync on units without one (TrueHdDecoder::substream_count);
entries past the data are corrupt. Atmos fixture: AU0 4 entries, ends 546w
lands on 1136 bytes; num_substreams=4 with substream_info 0x80 (16-ch).