pl_mpeg icon indicating copy to clipboard operation
pl_mpeg copied to clipboard

Skipped frames (or samples) when decoding the Intro of Space Ace (CD-i)

Open Slamy opened this issue 3 months ago • 1 comments

Hello.

I've decided to use this library for the MPEG decoding of an FPGA based replication of a Philips CD-i. It works great so far and I think, the library is certainly clean.

Today I've noticed that the MP2 decoding has some issues when confronted with the Space Ace Intro. Since Github won't let me upload anything here, I've prepared a Dropbox folder.

https://www.dropbox.com/scl/fo/unt6a8130jm213ruiiauf/AKDO2YQj-krv6SN1tS5FJ0w?rlkey=j6v1lgz043s2o6hflwtebjrny&st=rivh9dzh&dl=0

It contains the raw MPEG audio stream from the CD and an audacity project. The audacity file has 2 tracks. One with a recording from ./pl_mpeg_player_sdl and another is a direct import of the mpg file into audacity. I don't know which library it uses to do that but it is certainly more correct.

I wasn't sure whether I would be able to debug this so I guess I can at least open an issue to let you know of a problem like this.

Edit: To explain the audacity project more, both recordings are aligned so starting from second 6 one will notice the discrepancy.

Slamy avatar Sep 27 '25 21:09 Slamy

Ok, I think I understand the problem.

https://github.com/phoboslab/pl_mpeg/blob/88fb66ff38849ba2de4ced8de7b545744e8887a7/pl_mpeg.h#L4048

The headers of the stream go like this

ff fd a2 40
ff fd a0 40
ff fd a2 50
ff fd a2 00 <-- This is the issue. The mode has changed.

It seems that the mode change is handled as an error here. Is a change of the header allowed according to standard?

Slamy avatar Sep 28 '25 13:09 Slamy