Opened 16 years ago

Closed 16 years ago

Last modified 19 months ago

#8310 closed patch

sword2 cutscenes

Reported by: SF/roever Owned by: SF/ender
Priority: normal Component: Engine: Sword2
Keywords: Cc:
Game: Broken Sword 2

Description

I've done some work on the Broken Sword 2 Animations.

The current code works as following: the animations are compressed to mp2 elementary streams. Additionally I've generated palette files that assign 256 color paletted to images sequances. These palettes were taken from the original animations. The player does now take the output of the mp2lib and reduces these to a palette index using a lookup table. This is relatively fast and gives satisfying results except for areas that are extremely comic like. Here we get artefacts.

The lookup table for the color reduction process is calculated while playing.

The appended patch includes the player. You still have to modify the config.mak to include the path to the mpeg2.h include and the lib. The 2 new files I added are extra.

The patch will make scummvm play the intro as long as the speech is going. The music of the animation is missing for the music to work we need more features in the mixer. We need to find out how far a sample has been played. I could not find the necessary functions.

I've prepared all animations. All together they are about 34 Mb. If someone wants to test the patch he only needs the intro files which are about 10 Mb.

All right I hope I've written enough to make you decide on wether you want to go this way or not.

Andreas

Ticket imported from: #874510. Ticket imported from: patches/415.

Attachments (2)

mpg2anims.tar.gz (4.8 KB ) - added by SF/roever 16 years ago.
mpeg2 player files version 2
patch (2.4 KB ) - added by SF/roever 16 years ago.
Fix for bug 884568

Download all attachments as: .zip

Change History (15)

by SF/roever, 16 years ago

Attachment: mpg2anims.tar.gz added

mpeg2 player files version 2

comment:1 by SF/roever, 16 years ago

Update: The patch now also plays the background music but this is not really synchronized with the video. The mixer misses some information for that.

I also fixed a few bugs and removed old code.

The intro plays well now.

comment:2 by SF/ender, 16 years ago

Assigning to myself :)

comment:3 by SF/ender, 16 years ago

Owner: set to SF/ender

comment:4 by SF/khalek, 16 years ago

can this be closed now?

also I think the videos need to re-encoding due to all the mpeg artifacts in the current ones

comment:5 by SF/roever, 16 years ago

Re-encoding wont help much as long as we stay with the current scheme (mpeg 2 compression + palettization) The mpeg2 will always introduce some artfacts around the lines the animation have in the cartoon parts of the images. These will get highlighted because of inaccuracies in the color selection. I had to make some speed <-> quality decisions that ecspecially show in the cartoon parts.

comment:6 by SF/khalek, 16 years ago

how much of a speed difference does it make to have higher quality video?

comment:7 by SF/ender, 16 years ago

Quite a bit as each frame will have to be re-dithered.

As I've said before, just use overlays on >8bit systems to avoid having to do the conversion in the first place. Full quality, no speed impact.

comment:8 by SF/roever, 16 years ago

My idea (hope) was that the differences introduced by mpeg are not too big. Then I took the palettes that the original animation used and hoped that when I take the color value returned from mpeg and find the best fittint palette entry that that is the same as in the smacker animation.

mpeg returns 3 values per pixel (actually 6 bytes per 4 pixel but that doesn't matter here) that would lead t a lookup of 256*256*256 bytes. calculateing suche a big lookup in between the frames takes too long, so I quantisized the values by dividing by 8.

You should be able to change that if you change the SHIFT value in animation.h. The lower the value, the less the color distortion but the more time is required to calculate the lookup table. A value one less required 8 times as much memory and time for the calculation. The parameter has not influence on the display speed.

As Ender said. A 32 bit overlay would be best for our purposes as the current scheme is quite expensive because the frame gets copied serveral times with color conversion.

comment:9 by Kirben, 16 years ago

The current code seems to have problems playing back a cutscene with a 640 x 480 resolution, check bug #884568.

comment:10 by SF/roever, 16 years ago

Oops can not append a file in the buglist, so I put it here. It's for bug 884568.

by SF/roever, 16 years ago

Attachment: patch added

Fix for bug 884568

comment:11 by SF/ender, 16 years ago

Status: newclosed

comment:12 by SF/ender, 16 years ago

About time to close this, I hope :)

comment:13 by digitall, 19 months ago

Component: Engine: Sword2
Game: Broken Sword 2
Note: See TracTickets for help on using tickets.