Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.


Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Thread Tools Search this Thread Display Modes
Old 23rd January 2022, 09:13   #1  |  Link
Registered User
Join Date: Aug 2020
Posts: 4
Perceptually Based Downscaling of Images (pseudo-implementation)

Hello everyone.
I couldn't help to attract my attention to the "Perceptually Based Downscaling of Images (needs implementation)" post, which is linked on avisynth's resize article.
I also started using vapoursynth, which have a ton of useful and curious functions and plugins, some of them SSIM and SSIM downsample. The latter is a pseudo implementation based upon the original –ztireli and Gross' paper.
Thanks to having a native SSIM, I was able to make tests for the perceptual resizing; for that, I used an image from the DPID Supplemental Material:

Vanilla had a score of 0.78107535635354
After that, I made some kind of approximation (which you can see here) and I've got as result 0.870382479581167, by using box pre-resizing and a smooth parameter of 0.4285

And this is how it should look

As you can see, muvsfunc's SSIM downsampler is really close to the intended one, but is somewhat darker... it might be useful to use gamma aware resizing, but as we don't have the original transfer information of this image, we would be guessing it and it would result on an inaccurate image.

As a side note, I also used another implementation, using the "SSimDownscaler" shader from mpv on vsplacebo, and was guided by iamscum's mpv guide, thus using gaussian as an auxiliar resizer: 0.8378410553123103

Last edited by Macross96; 1st February 2022 at 01:17. Reason: Adding more decimals to final approximation
Macross96 is offline   Reply With Quote
Old 25th January 2022, 16:02   #2  |  Link
Registered User
Selur's Avatar
Join Date: Oct 2001
Location: Germany
Posts: 7,347
Have you looked at it using https://github.com/WolframRhodium/VapourSynth-dpid ?
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 26th January 2022, 01:13   #3  |  Link
Registered User
Join Date: Dec 2005
Location: Germany
Posts: 1,796
Here are some additional links to check out
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 27th January 2022, 18:42   #4  |  Link
Registered User
Join Date: Aug 2020
Posts: 4
About DPID:
I haven't tried to make tests with WolframRhodium's implementation, but I guess the results are really close to what is shown on the DPID Supplemental Material.
EDIT: So... yeah, apparently, WolframRhodium's dpid implementation is actually different from the one that is shown on the original website. Thus, I also tried to be as closest to the original paper.

SSIM= 0.778898928176204 with B-Spline (bicubic: b=1, c=0)

Origina DPID Lambda=.5:

About AreaResize:
By editing WolframRhodium's SSIM_downsample to resize via AreaResize, I've got this:

SSIM= 0.872122076019878 smooth= .427279
The closest I've seen before getting into more decimals or manually converting to linear light.

Last edited by Macross96; 26th March 2022 at 07:32. Reason: Clarifying more about "AreaResize" adn exploring DPID
Macross96 is offline   Reply With Quote
Old 14th February 2022, 01:28   #5  |  Link
Registered User
Join Date: Aug 2020
Posts: 4
About linear and srgb transfer resize...

After trying to guess the transfer info by using SSIM, I figured out that the most accurate result was "240m" (SSIM=0.999999992133779).
Thanks to that, I could make some testing... and here are the results:
Box filter, smooth=0.75194, SSIM=0.931384846830042, srgb

Box filter, smooth=0.317681, SSIM=0.970661757426569, linear

In an attempt to make a conclusion, the linear and srgb results are somewhat disappointing, as the srgb ends up being neutral, because the darker and lighter tone are more preserved than the neutral ones, the latter ones are smoothed. Meanwhile, the linear one is slightly overbright, the darker tones are worse preserved in favor to preserve the lighter ones.

EDIT: Yeah, I pointed out what Robidoux did pointed out years ago,(if you want to squeeze out your source, may as well use linear+cie primaries), although, by the time you figure out a source's transfer and primaries color data and converted them to linear rgb+ciexyz/ciergb, would be simpler and more versatile to just use area resize+SSIM downscaler.
Atlhough, It may be benefitial for some scripts and sources, I wouldn't recommend it unless you have enough resources to squeeze and enough patience and time to figure out all your source's color info.

Last edited by Macross96; 7th March 2022 at 03:49. Reason: Re-investigate downscaling documentation and grammar correction
Macross96 is offline   Reply With Quote

downscaling, downsize, dpid, resize, ssim

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 07:03.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.