Broken Sword MPEG performance
Moderator: ScummVM Team
- robinwatts
- ScummVM Developer
- Posts: 84
- Joined: Sat Apr 07, 2007 5:16 pm
- Location: Hook Norton, Oxfordshire, UK
Broken Sword MPEG performance
Hi all,
I 'rebought' Broken Sword 1 and 2 last week, and started to play with them at the weekend.
It's interesting to see that the current "Sold Out" pack of BS1 and BS2 (that I picked up for 3.99UKP online - bargain) is actually based on scummvm :)
The cutscenes are encoded at 640x400, and so struggle to play even on the fastest WinCE devices. Not only that, but given the screens are only 320x200, they carry way more information that can actually be displayed. So I thought, wouldn't it be nice to recompress them to 320x200, save all the memory/disc space, reduce the amount of CPU time they take to render etc?
So, thanks to the scripts on Arisme's site, that's what I did. The cutscenes now weigh in at 7Meg rather than 30 or so.
The only problem is that they now only occupy the middle quarter of the screen - turns out that they are decoded at 320x200, and then scaled back down to 1/4 of their size (because that's what the game does with all the graphics).
I had a poke around in the code, and I discovered that the code has the ability to scale up MPEG by a factor of 2 or 3, but it isn't quite wired in correctly to work in this instance - so I tweaked it a bit, and I now have my 320x200 movies being decoded to 320x200, scaled up on plotting to be 640x400 and then being scaled back down to 320x200. Not exactly ideal, but it does mean we get the same quality for less processing power and a quarter of the memory used.
Testing this, however, I found that it still played too slowly, so I've tweaked the plotYUV functions to be faster; same (semi-braindead) algorithm, and still in C, but just coded a bit more tightly, and I get realtime playback on my MDA Vario II.
I've raised a patch (1705747) with the YUV speedups alone in. There should be nothing contentious in that review, so hopefully it'll get adopted without too much discussion.
Once that is in, I'll raise a patch with the fix to the scaling thing - I can imagine that this will need more discussion and testing on the other ports.
Hopefully the upshot should be that the broken sword cutscenes play at their real speed while filling the screen.
Robin
I 'rebought' Broken Sword 1 and 2 last week, and started to play with them at the weekend.
It's interesting to see that the current "Sold Out" pack of BS1 and BS2 (that I picked up for 3.99UKP online - bargain) is actually based on scummvm :)
The cutscenes are encoded at 640x400, and so struggle to play even on the fastest WinCE devices. Not only that, but given the screens are only 320x200, they carry way more information that can actually be displayed. So I thought, wouldn't it be nice to recompress them to 320x200, save all the memory/disc space, reduce the amount of CPU time they take to render etc?
So, thanks to the scripts on Arisme's site, that's what I did. The cutscenes now weigh in at 7Meg rather than 30 or so.
The only problem is that they now only occupy the middle quarter of the screen - turns out that they are decoded at 320x200, and then scaled back down to 1/4 of their size (because that's what the game does with all the graphics).
I had a poke around in the code, and I discovered that the code has the ability to scale up MPEG by a factor of 2 or 3, but it isn't quite wired in correctly to work in this instance - so I tweaked it a bit, and I now have my 320x200 movies being decoded to 320x200, scaled up on plotting to be 640x400 and then being scaled back down to 320x200. Not exactly ideal, but it does mean we get the same quality for less processing power and a quarter of the memory used.
Testing this, however, I found that it still played too slowly, so I've tweaked the plotYUV functions to be faster; same (semi-braindead) algorithm, and still in C, but just coded a bit more tightly, and I get realtime playback on my MDA Vario II.
I've raised a patch (1705747) with the YUV speedups alone in. There should be nothing contentious in that review, so hopefully it'll get adopted without too much discussion.
Once that is in, I'll raise a patch with the fix to the scaling thing - I can imagine that this will need more discussion and testing on the other ports.
Hopefully the upshot should be that the broken sword cutscenes play at their real speed while filling the screen.
Robin
- robinwatts
- ScummVM Developer
- Posts: 84
- Joined: Sat Apr 07, 2007 5:16 pm
- Location: Hook Norton, Oxfordshire, UK
- robinwatts
- ScummVM Developer
- Posts: 84
- Joined: Sat Apr 07, 2007 5:16 pm
- Location: Hook Norton, Oxfordshire, UK
I just idly went looking for the Broken Sword cutscenes in dxa format, and I can't find them.
The only tool I can see to create .dxa files appears to be encode_dxa, and that needs to convert from a directory full of .png files - such as that given by the RAD game tools.
BUT if you don't have the original cutscenes in smacker format, it's a bit of a git...
Does anyone have a copy of the broken sword 1 cutscenes please? Either in original smacker format, or encoded in .dxa format please?
(My original BS1 is for the playstation, so probably has the files in a different format. My "rebought" BS1 and 2 have them in MPEG format :( )
Thanks,
Robin
The only tool I can see to create .dxa files appears to be encode_dxa, and that needs to convert from a directory full of .png files - such as that given by the RAD game tools.
BUT if you don't have the original cutscenes in smacker format, it's a bit of a git...
Does anyone have a copy of the broken sword 1 cutscenes please? Either in original smacker format, or encoded in .dxa format please?
(My original BS1 is for the playstation, so probably has the files in a different format. My "rebought" BS1 and 2 have them in MPEG format :( )
Thanks,
Robin
heh. as far as I know DXA is based on the format the PlayStation cutscenes are inrobinwatts wrote: (My original BS1 is for the playstation, so probably has the files in a different format. My "rebought" BS1 and 2 have them in MPEG format )
plus DXA cutscenes available from http://sourceforge.net/project/showfile ... p_id=37116
clem
- robinwatts
- ScummVM Developer
- Posts: 84
- Joined: Sat Apr 07, 2007 5:16 pm
- Location: Hook Norton, Oxfordshire, UK
Found the first one as:
http://prdownloads.sourceforge.net/scum ... scenes.zip
The second one is supposedly available as:
http://prdownloads.sourceforge.net/scum ... scenes.zip
but I can't make it work. I've got the source files for the second one though.
These do seem huge though - 58Meg for the first one, compared to 30Meg for the fullsize MPEG ones.
If anyone has the original smacker BS1 files to hand, I'd be interested in seeing them, as I'd like to recompress them to 320x200 and see if I can pull the same doubling trick as for the MPEG ones...
Thanks,
Robin
http://prdownloads.sourceforge.net/scum ... scenes.zip
The second one is supposedly available as:
http://prdownloads.sourceforge.net/scum ... scenes.zip
but I can't make it work. I've got the source files for the second one though.
These do seem huge though - 58Meg for the first one, compared to 30Meg for the fullsize MPEG ones.
If anyone has the original smacker BS1 files to hand, I'd be interested in seeing them, as I'd like to recompress them to 320x200 and see if I can pull the same doubling trick as for the MPEG ones...
Thanks,
Robin
- robinwatts
- ScummVM Developer
- Posts: 84
- Joined: Sat Apr 07, 2007 5:16 pm
- Location: Hook Norton, Oxfordshire, UK
- eriktorbjorn
- ScummVM Developer
- Posts: 3561
- Joined: Mon Oct 31, 2005 7:39 am
oops, you're right - I just remembered it was some SMK replacement on another OS and didn't think of Feeble using that tooeriktorbjorn wrote:I thought it was based on the cutscene format for the Macintosh and Amiga versions of The Feeble Files.clem wrote:heh. as far as I know DXA is based on the format the PlayStation cutscenes are in
- robinwatts
- ScummVM Developer
- Posts: 84
- Joined: Sat Apr 07, 2007 5:16 pm
- Location: Hook Norton, Oxfordshire, UK
[quote="clem"]DXA are larger than mpeg because DXA is a lossless format
[/quote]
True, but then MPEG is attempting to code 24bpp, and DXA only 8bpp. After posting, I also spotted that that archive contains the audio in .fla format, which accounts for some space too :)
[quote="clem"]
I'll try to upload the contents of SMACKSHI, since mpeg and DXA can be shared I guess there's nothing wrong with uploading the SMKs as well
clem[/quote]
Fab, thanks!
Robin
[/quote]
True, but then MPEG is attempting to code 24bpp, and DXA only 8bpp. After posting, I also spotted that that archive contains the audio in .fla format, which accounts for some space too :)
[quote="clem"]
I'll try to upload the contents of SMACKSHI, since mpeg and DXA can be shared I guess there's nothing wrong with uploading the SMKs as well
clem[/quote]
Fab, thanks!
Robin
here we go!robinwatts wrote: If anyone has the original smacker BS1 files to hand, I'd be interested in seeing them, as I'd like to recompress them to 320x200
http://www.unet.univie.ac.at/~a0200586/ ... ackshi.zip
(note that not all smks have the same resolution, ie some are 640x400 and some are smaller) I don't know why that happened but I assume that they all were supposed to be 640x400
- Adventureguy
- Posts: 162
- Joined: Sun Dec 25, 2005 4:09 pm
- Location: Karlsruhe, Germany
I've tried both Broken Sword games with reencoded DXA videos on my Pocket PC and I must say it works great! The videos do run faster now than the old videos of the download site did. Before , the audio ran always faster the the video itself. Now audio and video are in sync, with a let's say max. gap of 1-2 seconds. That's a big improvement!
- robinwatts
- ScummVM Developer
- Posts: 84
- Joined: Sat Apr 07, 2007 5:16 pm
- Location: Hook Norton, Oxfordshire, UK
Now, I'm confused.
I decoded the smacker files to PNGs, rescaling them to 320x200. I then reencoded those PNGs back into dxa files.
I've got a local patch to the DXA decoder source here that means the 320x200 patches decode to fill the screen on a WinCE device. I'll prepare that for submission over the weekend.
So, dead chuffed, I packed my new dxa files up to upload to http://www.wss.co.uk/scumm/ - and then I see that the zip file is only marginally smaller than the existing DXA files ones (which I *think* has all the movies at 640x400). How come?
Some of the movies actually encode to be larger at 320x200 than they are in the archive.
As I say, I'm confused...
Robin
I decoded the smacker files to PNGs, rescaling them to 320x200. I then reencoded those PNGs back into dxa files.
I've got a local patch to the DXA decoder source here that means the 320x200 patches decode to fill the screen on a WinCE device. I'll prepare that for submission over the weekend.
So, dead chuffed, I packed my new dxa files up to upload to http://www.wss.co.uk/scumm/ - and then I see that the zip file is only marginally smaller than the existing DXA files ones (which I *think* has all the movies at 640x400). How come?
Some of the movies actually encode to be larger at 320x200 than they are in the archive.
As I say, I'm confused...
Robin