Loobinex / keeperfx-unofficial

KeeperFX - Unofficial release
60 stars 7 forks source link

Movie scaling #197

Closed eddebaby closed 4 years ago

eddebaby commented 4 years ago

Scales the smacker movies to fill the user's chosen resolution.

The scaling options are configured in keeper.cfg:

RESIZE_MOVIES=OFF ; no scaling of videos
RESIZE_MOVIES=ON ; {TEMPORARY to ease testing/compatibility with launcher} - same as FIT below.
RESIZE_MOVIES=FIT ; fit to fullscreen, using letterbox and pillarbox as necessary
RESIZE_MOVIES=STRETCH ; stretch to fill fullscreen - ignores aspect ratio difference between source and destination
RESIZE_MOVIES=CROP ; fill fullscreen and crop to avoid letterboxes or pillarboxes (mainting original aspect ratio)
RESIZE_MOVIES=FITPP ; FIT to fullscreen, but use the largest integer scale with black borders ("perfect pixels")

Extra modes:

RESIZE_MOVIES=4BY3 ;  stretch 320x200 to 4:3 (aspect ratio correction) - then "FIT" to fullscreen
RESIZE_MOVIES=4BY3PP ; 4BY3 mode, but use 5x/6x integer scale (resolutions lower than 1600x1200 will have a cropped image, as this is the lowest valid resolution). 

; 4BY3 mode will only affect 320x200 content. Otherwise FIT mode is implied.

(See https://www.gamasutra.com/blogs/FelipePepe/20150423/241730/No_MSDOS_games_werent_widescreen_Tips_on_correcting_aspect_ratio.php for the "why" of 4 by 3 scaling mode, I am just hypothesising that this applies to Dungeon Keeper content, I have seen no confirmation) Some users might want this anyway, regardless of whether it is correct:

eddebaby commented 4 years ago

The nearest neighbour approach might not be the best approach for non-integer scaling, so I will look in to that further (as some of this logic may be beneficial for other scaling situations).

The results from this initial pull request seem acceptable - I find no performance hit, nor any errors.

Loobinex commented 4 years ago

Could FITPP not just as easily be named 'PIXELPERFECT'?

eddebaby commented 4 years ago

Yes, probably a better name

Loobinex commented 4 years ago

Beyond the rename, do you consider this Pull ready?

eddebaby commented 4 years ago

I do, the scaling results are perfectly adequate, I personally do not notice the video to be any more artefacted than the source with any of the scaling modes. And the pixelperfect mode is exactly as the source, just X times bigger "pixels".

The only outlier is that this replaces the functionality of RESIZE_MOVIES, so the launcher should probably be changed before merging? If you agree, I'll do that first, otherwise I'll do it soon. Additionally, I currently have ON=FIT for backwards compatibility, if this is undesired I should remove that too (anyone with RESIZE_MOVIES=ON in the cfg will not get scaled movies, until they correct it).

I would like to visit the scaling in the future, to see if I can add anti-aliasing, smoothing, interlacing etc - but I don't see those as required or needed.