-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Corrupt decoding :( #24
Comments
MAME? Is that the arcade emulator? |
Yes. I’ve some games which need mpeg1.
Can’t get pl_mpeg to work though:(
… On 17 Feb 2022, at 15:04, Bryan Kirk ***@***.***> wrote:
MAME? Is that the arcade emulator?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you authored the thread.
|
I actually fixed this problem in the fork of PL_MPEG I am using for the DOSBox ReelMagic project. Here is the change I made: jrdennisoss/dosboxrm@712f309 What is happening is that sometimes a slice boundary is blown through because the ISO spec allows for a bit of extra '0' padding at the end, but the current version of PL_MPEG is not quite handling this right. I made a patch which guards the slice boundary based on the known last macroblock address for that specific slice. I tested with your MPG file you posted above and this seems to do the trick. |
I created a pull request which should fix this: #26 This awesome library has proved to be invaluable to the project I have been working on, I figure contributing something back is the very least I should do 😄 |
That’s brilliant, thanks for reporting the fix. Thanks again |
For further info, I've just tested this update using 30+ mpeg files which previously suffered massive amounts of corruption and they all decode correctly :) |
but this patch not working on bjork-all-is-full-of-love.mpg |
Oh crap... Good catch @livid123 I'll close the pull request I opened until I fully understand this... Probably need to implement something that truly finds the slice boundary instead of assuming that there is only one macroblock row per slice. |
I've looked at what my working decoder does and it continues processing macro blocks until the next 23 bits are 0. int plm_buffer_no_start_code(plm_buffer_t *self) {
} Edit: In addition to the above the macro processing loop can become as follows |
I FINALLY had a few cycles to take a look at this over lunch today... THANK YOU Paul for a MUCH more in-spec solution than the hack I earlier suggested... Yes I confirm this works on my setup and actually fixes another issues I had too! 😄 I ended up deviating slightly from what you had:
The logic is exactly the same as yours, but I renamed things to better match what ISO/IEC 11172-2 says as its logic is pretty explicit: do ... while the next 23 bits are not zero. Then only after the do/while condition is the start code checked. |
Will you make a new PR soon since you have now fixed the issues that @livid123 and you have found? |
Sure thing: #28 |
Thanks for doing the nicer named solution Jon. Great that it fixes your other issue too. I simply compared your original solution with the decoder I'm using (which is based on the early Berkeley code), doubt I'd have found it otherwise. |
Outstanding work everyone! Thank you so much :) |
Hi,
![000001](https://user-images.githubusercontent.com/98924583/154122551-c416f026-488a-48a3-add1-00f8433057c9.png)
I was looking forward to using this in a m.a.m.e. project but for some reason it doesn't correctly decode the mpg files I've got.
The files are OK, they play with vlc and all other players I've tried including a hardware decoder :(
The decoded data is wrong from frame one :(
I've absolutely no idea how to fault finding on this :(
I've many files all with similar problems. This is the first frame from a file here.
https://drive.google.com/file/d/1_wrjTUzgTOf9hCEqX-G6tlmaoBSp1I2_/view?usp=sharing
Anyone any suggestions or ideas ? Any help is really appreciated.
Thanks
Paul
The text was updated successfully, but these errors were encountered: