Codex协助将ULC解码器移植至N64
作者使用Codex将ULC参考解码器逐段转换为面向Nintendo 64 RSP的RSPL代码,并继续优化生成的汇编和流水线调度。作者称,最终解码器可处理44.1 kHz立体声音频,码率接近Opus,CPU与RSP占用分别约为4%和5%。该解码器已合入Libdragon预览分支。
该项目展示了AI辅助代码转换与优化如何支持资源高度受限的底层硬件移植,但相关性能数据仅由作者自行报告。
— Tuesday, November 3rd 2026
Sorry for the clickbait title. I promise this post delivers: 44100 Hz stereo with near-Opus bitrates using about 4% of the N64’s CPU time.
But first, some history: The options for playing and storing audio data on the N64 were dire. The PlayStation could just stream uncompressed redbook audio straight from the CD. On the N64, cartridge space was at a premium and time on the 93 MHz CPU was limited.
Worse, access to the vector co-processor, the RSP, was guarded by Nintendo for the longest time. Nintendo's own platform library, Libultra, internally used the RSP for various graphics and sound-related tasks, but Nintendo didn't allow third-party developers to directly write code for it.
Libultra provided some functions to transparently play back compressed audio using an ADPCM scheme (adaptive differential pulse code modulation). The RSP handled decompression on the fly, just before the audio was sent to the output buffer.
This works well enough and cuts the space needed for a sample by a factor of 4. Still, a 5-minute stereo audio track at 44100 Hz will land at about 12MB – way too much for an N64 cartridge, even when you cut the sample rate in half. The whole Mario 64 ROM is just 8MB in total. The biggest N64 games were 64MB.
#ULC#Nintendo 64#Libdragon#Codex#RSPL#Opus#ADPCM#Mario 64#Conker's Bad Fur Day#Xibalba 64