Formats: write XMA inverse-transform samples in output order #3702

Open
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/3702 into main
andrewpozdnakov7-jpg commented 2026-11-28 09:26:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T09:26:50Z.


The XMA inverse MDCT writes the even samples forward and the odd samples backward. Pair the two FFT points that produce adjacent output samples, then write both in output order. Each sample keeps its existing arithmetic, cast and scale.

On Windows, I compared the exact main transform and this change in the same release binary. Across 15 alternating pairs of 50,000 transforms, the median improved from 1.384 to 1.294 µs at 128 samples, 2.804 to 2.629 µs at 256 samples, and 5.962 to 5.526 µs at 512 samples. These are timings for the transform stage with generated coefficients.

Each of the 216 generated blocks, including signed zero, subnormal and impulse inputs, matched main bit for bit at the decoder's output scale. The formats suite passed with 46 passed and 5 ignored. Strict Clippy and the asset policy passed.

Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5538719439 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3702). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T09:26:50Z. --- The XMA inverse MDCT writes the even samples forward and the odd samples backward. Pair the two FFT points that produce adjacent output samples, then write both in output order. Each sample keeps its existing arithmetic, cast and scale. On Windows, I compared the exact main transform and this change in the same release binary. Across 15 alternating pairs of 50,000 transforms, the median improved from 1.384 to 1.294 µs at 128 samples, 2.804 to 2.629 µs at 256 samples, and 5.962 to 5.526 µs at 512 samples. These are timings for the transform stage with generated coefficients. Each of the 216 generated blocks, including signed zero, subnormal and impulse inputs, matched main bit for bit at the decoder's output scale. The formats suite passed with 46 passed and 5 ignored. Strict Clippy and the asset policy passed. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change into another commit. AI-assisted with OpenAI Codex.
andrewpozdnakov7-jpg commented 2026-11-28 09:29:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T09:29:59Z.


Windows CI passed on d1ffe0c, including both Clippy configurations and the workspace tests. The release comparison matched all 216 generated blocks bit for bit. With ordinary coefficients, the isolated inverse transform took 6–7% less time across the three supported sizes.

The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7237278540 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3702#issuecomment-7237278540). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T09:29:59Z. --- [Windows CI](https://github.com/Marvisak/VIctory/actions/runs/46130519879/job/140934411684) passed on `d1ffe0c`, including both Clippy configurations and the workspace tests. The release comparison matched all 216 generated blocks bit for bit. With ordinary coefficients, the isolated inverse transform took 6–7% less time across the three supported sizes. The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change into another commit. AI-assisted with OpenAI Codex.
andrewpozdnakov7-jpg commented 2026-11-28 14:30:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T14:30:19Z.


I combined this PR at d1ffe0c with #3746 at 47858da in e5a1928. Both PR heads are direct parents. The fixed-width FFT stages and the output-order writes merged cleanly.

All 280,140 generated sample bits matched both d1ffe0c and main on Windows x86-64. The comparison covered nine sizes and two scales, including the decoder's scale, and inputs with impulses, subnormals and signed zero. Against this PR alone, medians for the combined transform across 12 alternating pairs of 30,000 transforms were 1.508 to 1.356 µs for 128 samples, 3.012 to 2.572 µs for 256, and 6.264 to 5.348 µs for 512. Windows CI on this PR head passed. The combined tree passed the 46 formats tests, with five ignored, strict formats Clippy, and the asset policy.

The merge is available for maintainer review. Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding these changes into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7240719548 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3702#issuecomment-7240719548). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T14:30:19Z. --- I combined this PR at `d1ffe0c` with #3746 at `47858da` in [`e5a1928`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/e5a1928f04958c28f0e7be0fcd06a0a6f1457559). Both PR heads are direct parents. The fixed-width FFT stages and the output-order writes merged cleanly. All 280,140 generated sample bits matched both `d1ffe0c` and `main` on Windows x86-64. The comparison covered nine sizes and two scales, including the decoder's scale, and inputs with impulses, subnormals and signed zero. Against this PR alone, medians for the combined transform across 12 alternating pairs of 30,000 transforms were 1.508 to 1.356 µs for 128 samples, 3.012 to 2.572 µs for 256, and 6.264 to 5.348 µs for 512. [Windows CI on this PR head](https://github.com/Marvisak/VIctory/actions/runs/46130519879/job/140934411684) passed. The combined tree passed the 46 formats tests, with five ignored, strict formats Clippy, and the asset policy. The merge is available for maintainer review. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding these changes into another commit. AI-assisted with OpenAI Codex.
andrewpozdnakov7-jpg commented 2026-11-28 17:20:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T17:20:29Z.


I combined the output-order stores from this PR with #3765's pre-rotation and first FFT stage in 84bae96. Both exact PR heads are direct parents.

Against d1ffe0c, all 524,160 transform samples and 301,056 PCM samples from generated stereo streams matched bit for bit. The isolated transform's median per-pair time fell by 17–18% for 128, 256 and 512 samples. The full decoder's median per-pair throughput was 1.027–1.096 times d1ffe0c across the twelve generated-stream cases.

All 46 active release formats tests, strict Clippy and the asset policy passed. The combined branch is ready for maintainer review. Please retain the Git authors on cherry-pick or rebase.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7242940379 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3702#issuecomment-7242940379). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T17:20:29Z. --- I combined the output-order stores from this PR with #3765's pre-rotation and first FFT stage in [84bae96](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/84bae96e1a962b9ea480ff092932133e737884fb). Both exact PR heads are direct parents. Against d1ffe0c, all 524,160 transform samples and 301,056 PCM samples from generated stereo streams matched bit for bit. The isolated transform's median per-pair time fell by 17–18% for 128, 256 and 512 samples. The full decoder's median per-pair throughput was 1.027–1.096 times d1ffe0c across the twelve generated-stream cases. All 46 active release formats tests, strict Clippy and the asset policy passed. The combined branch is ready for maintainer review. Please retain the Git authors on cherry-pick or rebase. AI-assisted with OpenAI Codex.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3702:upstream-pr/3702'
git switch 'upstream-pr/3702'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3702'
git switch 'upstream-pr/3702'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3702'
git switch 'upstream-pr/3702'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3702'
git switch 'main'
git merge --squash 'upstream-pr/3702'
git switch 'main'
git merge --ff-only 'upstream-pr/3702'
git switch 'main'
git merge 'upstream-pr/3702'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!3702
No description provided.