pl_mpegDC ported running but community help needed

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Twada
DC Developer
DC Developer
Posts: 42
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Wed Jan 20, 2016 4:55 am
Has thanked: 18 times
Been thanked: 53 times

Re: pl_mpegDC ported running but community help needed

Post by Twada »

Ian Robinson wrote: Wed Oct 04, 2023 12:51 pm With my update before been able to watch 1 hour with no sync problems audio with the right encoding.
It is amazing!
This time, I was worried about whether the frame rate was correct because I matched it to the audio time.
I can't wait to see your update.

Your 64bitSQ seems to be faster than KOS's SQ, but how does it work?
These users thanked the author Twada for the post:
Ian Robinson
User avatar
Ian Robinson
DC Developer
DC Developer
Posts: 116
Joined: Mon Mar 11, 2019 7:12 am
Has thanked: 209 times
Been thanked: 41 times

Re: pl_mpegDC ported running but community help needed

Post by Ian Robinson »

Twada wrote: Wed Oct 04, 2023 2:40 pm
Ian Robinson wrote: Wed Oct 04, 2023 12:51 pm With my update before been able to watch 1 hour with no sync problems audio with the right encoding.
It is amazing!
This time, I was worried about whether the frame rate was correct because I matched it to the audio time.
I can't wait to see your update.

Your 64bitSQ seems to be faster than KOS's SQ, but how does it work?
There's no need to try to wait for SQs to finish. SQs always start immediately (if the CPU can't start the SQ right away, because some kind of memory transfer is already happening, the CPU will stall until it can start the SQ). And while the SQ is happening, it's not possible to access the memory bus (if you try to, the CPU will stall until the SQ transfer completes). So there's never a point you can access RAM or an external hardware register before the SQ write completes.

No wait is lot of it.
User avatar
Ian Robinson
DC Developer
DC Developer
Posts: 116
Joined: Mon Mar 11, 2019 7:12 am
Has thanked: 209 times
Been thanked: 41 times

Re: pl_mpegDC ported running but community help needed

Post by Ian Robinson »

I be looking at your update very soon to see if we can solve the it cant play more then 18 mins on hardware. It's playing right thru on demul dcemulator another one of those times.. after 18 mins it gets super slow for a while then freezes crashes.. Problem was time to make a change and test 18 mins of wear on the gdrom drive each time.. Prolly need to setup up my gdemu again as doing this for days and hours at time is bit much..
Twada
DC Developer
DC Developer
Posts: 42
Joined: Wed Jan 20, 2016 4:55 am
Has thanked: 18 times
Been thanked: 53 times

Re: pl_mpegDC ported running but community help needed

Post by Twada »

Ian Robinson wrote: Sat Oct 28, 2023 7:39 pm I be looking at your update very soon to see if we can solve the it cant play more then 18 mins on hardware. It's playing right thru on demul dcemulator another one of those times.. after 18 mins it gets super slow for a while then freezes crashes.. Problem was time to make a change and test 18 mins of wear on the gdrom drive each time.. Prolly need to setup up my gdemu again as doing this for days and hours at time is bit much..
I was able to play a 43 minute video with the last version, Ver0.9.
I can't be sure, but it may be a problem with the accuracy of timer_ms_gettime64().

In the first version, frame rate control was as follows.

Code: Select all

float start_time = (float)timer_ms_gettime64() / 1000.0;
float playing_time = 0.0f;
float frame_time = 1.0f / (float)plm_get_framerate(plm);
...
...
/* Decode */
playing_time = ((float)timer_ms_gettime64() / 1000.0) - start_time;
if ((frame->time - playing_time) < frame_time)
{
    frame = plm_decode_video(plm);
    if (!frame)
        break;
    decoded = 1;
}
The last version does not use timer_ms_gettime64().
I'm just comparing the decoded video and audio times. Therefore, the frame rate may not be uniform.

Code: Select all

sample = plm_decode_audio(plm);
if (sample == NULL)
{
    audio_time += audio_interval;
    break;
}
audio_time = sample->time;
...
...
audio_interval = audio_time;
...
...
/* Decode */
if ((audio_time - audio_interval) >= frame->time)
{
    frame = plm_decode_video(plm);
    if (!frame)
        break;
    decoded = 1;
}
But there's a new problem. As the loading time changes for long videos, we found that there was a difference from the audio_interval that was set at the beginning, causing audio lag.
Also, it didn't come back even after the video ended. I need to fix the termination process.
These users thanked the author Twada for the post:
Ian Robinson
User avatar
Ian Robinson
DC Developer
DC Developer
Posts: 116
Joined: Mon Mar 11, 2019 7:12 am
Has thanked: 209 times
Been thanked: 41 times

Re: pl_mpegDC ported running but community help needed

Post by Ian Robinson »

I tested now updated playing now over 50 mins https://github.com/ianmicheal/MPEG1-Dec ... 9-19-Tashi
These users thanked the author Ian Robinson for the post:
Twada
User avatar
Ian Robinson
DC Developer
DC Developer
Posts: 116
Joined: Mon Mar 11, 2019 7:12 am
Has thanked: 209 times
Been thanked: 41 times

Re: pl_mpegDC ported running but community help needed

Post by Ian Robinson »

watch whole movie 1 hour 30 no trouble
bandicam 2023-10-30 06-32-03-310.jpg
These users thanked the author Ian Robinson for the post:
GyroVorbis
User avatar
GyroVorbis
Elysian Shadows Developer
Elysian Shadows Developer
Posts: 1874
Joined: Mon Mar 22, 2004 4:55 pm
Location: #%^&*!!!11one Super Sonic
Has thanked: 80 times
Been thanked: 61 times
Contact:

Re: pl_mpegDC ported running but community help needed

Post by GyroVorbis »

So what was the issue with the playback crashing or slowing down after a certain amount of time? There's definitely a race condition in the implementation of timer_ms_gettime64(), and I'm working on a PR right now to fix it... but I guess that wasn't the problem here if it's working for Ian?
These users thanked the author GyroVorbis for the post:
Ian Robinson
User avatar
Ian Robinson
DC Developer
DC Developer
Posts: 116
Joined: Mon Mar 11, 2019 7:12 am
Has thanked: 209 times
Been thanked: 41 times

Re: pl_mpegDC ported running but community help needed

Post by Ian Robinson »

It was the timer for sure it's now stable runs and even releasing memory fine compiled into my program
https://streamable.com/ce1rhk playing on cdr built into my menu code.

Even started recreating old fmv games with out a problem.
These users thanked the author Ian Robinson for the post:
GyroVorbis
User avatar
Ian Robinson
DC Developer
DC Developer
Posts: 116
Joined: Mon Mar 11, 2019 7:12 am
Has thanked: 209 times
Been thanked: 41 times

Re: pl_mpegDC ported running but community help needed

Post by Ian Robinson »

User avatar
GyroVorbis
Elysian Shadows Developer
Elysian Shadows Developer
Posts: 1874
Joined: Mon Mar 22, 2004 4:55 pm
Location: #%^&*!!!11one Super Sonic
Has thanked: 80 times
Been thanked: 61 times
Contact:

Re: pl_mpegDC ported running but community help needed

Post by GyroVorbis »

Guys, I just wanted to post publicly, for those of you not following along with the KOS and kos-ports master branch that pl_mpegDC has officially been approved and added as a kos-pot as libmpeg!

https://github.com/KallistiOS/kos-ports ... er/libmpeg

Thank you to Twada, Ian, BBHoodsta, and everyone who made this possible! Hopefully we will eventually be adding a good example to the KOS repo which shows how to use it. I definitely think everyone who wants to add cutscenes to their game is going to want to include this in their games!
These users thanked the author GyroVorbis for the post (total 2):
Ian RobinsonTwada
Moi
QuakeDev Respected
QuakeDev Respected
Posts: 592
Joined: Thu Mar 14, 2002 1:15 am
Has thanked: 0
Been thanked: 6 times

Re: pl_mpegDC ported running but community help needed

Post by Moi »

Great stuff! Any chance for a VCD player being made out of that library?
These users thanked the author Moi for the post (total 2):
|darc|GyroVorbis
Create your own Dreamcast games using the Quake-Engine:
http://quakedev.dcemulation.org/develop/getstarted.htm
|darc|
DCEmu Webmaster
DCEmu Webmaster
Posts: 16375
Joined: Wed Mar 14, 2001 6:00 pm
Location: New Orleans, LA
Has thanked: 104 times
Been thanked: 91 times
Contact:

Re: pl_mpegDC ported running but community help needed

Post by |darc| »

Moi wrote: Fri Jan 19, 2024 5:43 am Great stuff! Any chance for a VCD player being made out of that library?
I'd wondered the same thing; Ian says he's not interested in making a VCD Player, but it should be a great starting point for anyone who's interested in that
These users thanked the author |darc| for the post (total 2):
GyroVorbisIan Robinson
It's thinking...
Post Reply