Skip to content

Convert OMG4 conversion script from Python to TypeScript#2

Open
Copilot wants to merge 4 commits into
mainfrom
copilot/convert-script-to-typescript
Open

Convert OMG4 conversion script from Python to TypeScript#2
Copilot wants to merge 4 commits into
mainfrom
copilot/convert-script-to-typescript

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 4, 2026

The scripts/xz_to_omg4.py converter was written in Python — wrong language for a TypeScript project. Rewrites the full .xz.omg4 pipeline in TypeScript, places it in /src/lib/ alongside existing readers/writers, and wires it into the CLI.

New modules (src/lib/omg4/)

  • pickle-helpers.ts — Extracts numpy ndarrays from pickleparser output (float16→float32 conversion, latin1 bytes decoding, shape/dtype handling)
  • huffman.ts — Bitstream decoder compatible with dahuffman's code_table format
  • mlp.ts — CPU-side FullyFusedMLP forward pass, sinusoidal frequency encoding, unisphere contraction, quaternion normalization
  • convert-omg4.ts — Orchestrator: LZMA decompress → pickle parse → VQ decode → per-frame MLP inference → pack binary .omg4
  • writers/write-omg4.ts — FileSystem-integrated writer wrapping the converter

CLI integration

  • .xz registered as input format, .omg4 as output format
  • --omg4-frames, --omg4-fps, --omg4-time-min, --omg4-time-max global options
  • Bypasses normal DataTable pipeline when .xz → .omg4 path detected
splat-transform comp.xz scene.omg4
splat-transform --omg4-frames 60 --omg4-fps 30 comp.xz scene.omg4

Dependencies

  • @napi-rs/lzma — LZMA/XZ decompression (Rust NAPI bindings)
  • pickleparser — Python pickle format parser (pure JS)

Both marked as external in rollup config since they're Node.js-specific.

Tests

16 tests covering pickle helpers, Huffman decoding, MLP math, and end-to-end .xz → .omg4 conversion with a synthetic checkpoint fixture.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 3 commits March 4, 2026 03:41
- Add missing JSDoc @param descriptions and @returns declarations
- Reorder function definitions to fix no-use-before-define errors
- Remove async from convertOmg4 (no await expressions)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: sipkode <19314267+sipkode@users.noreply.github.com>
Co-authored-by: sipkode <19314267+sipkode@users.noreply.github.com>
Copilot AI changed the title [WIP] Convert OMG4 script to TypeScript for command line use Convert OMG4 conversion script from Python to TypeScript Mar 4, 2026
@sipkode sipkode marked this pull request as ready for review March 4, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants