Skip to content

Feasibility of accelerated decoding on the N64 #4

Description

@phoboslab

I'm very impressed with quality/bitrate of this codec. I had the thought that it might be a good fit for the N64. I built a quick prototype that runs entirely on the N64 CPU, using your C decoder: https://github.com/phoboslab/ulc64/ - this runs in realtime for 44100hz Stereo, but only barely so (tested with the ares emulator).

The N64 has a vector co-processor (RSP) that I thought might be able to handle the IMDCT part of the decoding, but the more I look into it, the more questions I have...

The RSP only has 4kb of DMEM. To do the entire IMDCT without additional DMAs, block size would need to be lowered to at least 1024, assuming int16_t precision and a few hundred bytes of extra data needed. But in your GBA source, the IMDCT is performed at 20(?) bit precision. The RSP can also work with 16.16 fixed point, but that would require another drop in block size to 512. Not great, but still possible, I assume.

Now here's the part that escapes me: The C decoder for ULC uses separate input and output buffers as well as a temp buffer. The lapping could probably remain on the CPU without too much overhead, but is it possible to do the IMDCT for ULC "in place" using just one buffer? Or would it be possible to do the IMDCT in multiple steps with not too many DMAs to the RSP?

As a reference, the LibDragon team ported the Opus IMDCT to the RSP (source rsp_opus_*.S) where the 960 frame size just barely fits. The Opus decode performance is ok for menus/cutscenes, but a bit too demanding for background music in a 3d game.

I have no idea how well ULC would fare on the N64, but I assume it could be more performant than Opus, considering how light-weight it is!?

Do you think this is feasible and would be worth it over Opus, performance wise?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions