View Full Version : Resize in Avisynth another approach
SEt
12th February 2015, 01:15
There were plenty of discussions about resizing around Avisynth but it looks like not everything is explored even for standard kernels.
Here was Avisynth with slightly modified resizing implementation. Supports only the following resizes: BilinearResize, BicubicResize, LanczosResize, SincResize, GaussResize and PointResize (this one is unchanged).
There is no visible difference for downscaling, but upscaling looks definitely better to me. Try BicubicResize with b=0, c=1.
Reel.Deel
13th February 2015, 14:22
Interesting, will try it out in the coming days. Would be much easier to compare if this was an actual plugin rather than another version of AviSynth.
SEt
13th February 2015, 16:37
The change is minor – just few lines of code, so making it separate plugin would require too much effort for testing the concept.
As there is no other reaction so far it's probably not interesting to community and further development is uncertain.
wonkey_monkey
13th February 2015, 17:54
A couple of screenshots might elicit more reaction, especially given the lack of other clues as to what might be a good source to show the difference.
Asmodian
13th February 2015, 19:10
I am also interested but have not had any time to do testing. As I never use bicubic or sinc for upscaling my interest is more academic than practical at the moment but I will be playing with it this weekend.
:thanks:
cretindesalpes
13th February 2015, 23:26
Concept, sources: later.
Actually were just waiting for that.
SEt
13th February 2015, 23:57
Updated test version: some more resizers are supported now.
As for examples, my test images are either private that I don't want to post or randomly grabbed from internet that I don't know (nor want to know) how to check "am I allowed to repost it here due to copyright".
Sources are a mess, so until when I have time to clean them (or give up on that...) But idea is quite simple (and not new at all): usually resizing kernel is used to provide weight coefficients by interpreting source pixels as mathematical points. Alternatively, you can interpret source pixels as squares, so to get the weight you find the area under the corresponding part of resizing kernel graph. As you can see, implementation is mostly the same but instead of plain kernel function you use antiderivative of it (so the current mess in the sources and partial support).
Edit: v3 as support should probably be expanded by 0.5 for all kernels, not just Bicubic.
Sparktank
14th February 2015, 00:33
For public domain images, one can try Wikimedia Commons.
Wikimedia Commons is a media file repository making available public domain and freely-licensed educational media content (images, sound and video clips) to all.
Reusing content outside Wikimedia
https://commons.wikimedia.org/wiki/Commons:Reusing_content_outside_Wikimedia
Navigating is quite tasking. A lot of clicks to get anything.
Here's the PNG section.
Anything in bold has content.
https://commons.wikimedia.org/wiki/Category:Image_file_formats
Flickr has some licence browsing.
https://www.flickr.com/creativecommons/
Although, that is only limited to last 100 images in each category.
There's no real random browse. And the advanced search with licence filter enabled requires a word query. Cannot search with a blank entry only for lincece-filtered images.
There's also no way to search by file extension.
Although, you can do a custom google search to find png images with some rights reserved. This gives mixed results with different licences.
"Some rights reserved" site:flickr.com ext:png
Note: That Google has its own "usage rights" when you search images. You have to hit the "search tools" button to see it and change it.
But, I belive their licence check is different, or the places it looks doesn't set a licence as searching in PNG yields few results (worth looking at). While ext:BMP yields far less results.
A few other services out there just link to existing public domain images with a lot of redirecting (Ghostery did not like it).
:mad: I knew image licences were annoying, but never would have imagined it was this tedious!
Any method I pick, there's a lot more clicking since there's a lot of redirecting involved stacked on top of the clicking just to get to the image itself! :mad:
I'm going to spend some time this weekend browsing for a lot of very-public-domain images. There's some really nifty ones out there.
DeviantArt also has some licence filters, too.
Once I get a handful, I'll have look at this resizer.
I imagine the free stuff over at Xiph.org is safe to screenshot for testing purposes.
SEt
14th February 2015, 00:48
I know about Wikimedia but the issue is I don't want to go hunt for specific images that I can repost and double-check all that legal nonsense. If something posted get takedown request – yes, license should be checked, but to check everything before that is insanity.
colours
14th February 2015, 05:39
I know about Wikimedia but the issue is I don't want to go hunt for specific images that I can repost and double-check all that legal nonsense. If something posted get takedown request yes, license should be checked, but to check everything before that is insanity.
So you're not okay with checking the licences on images because you might infringe copyright (because you didn't want to check the licences), but you're okay with violating the GPL by distributing Avisynth without the source?
Funny that.
SEt
14th February 2015, 13:45
Ok, no more violations.
Reel.Deel
15th February 2015, 19:37
FWIW I did some test with a couple of pictures using BicubicResize with b=0, c=1. It seems your modification (v3) is a little softer than the original, but can cut down on aliasing quite a bit (surprise surprise :p).
For the beach house I like the original bicubic a bit more, except in the edges of the house, white boat, and where the grass meets the sky. On the pulley picture I like your modification, the aliasing of the expanded metal is greatly reduced but the belt and the threads on the tensioner are noticeably softer.
Beach house
Mod (https://dl.dropboxusercontent.com/s/83v483csnqu7r0k/Beach%20-%20Mod.png)
Vanilla (https://dl.dropboxusercontent.com/s/5411lqriu2pquk0/Beach%20-%20Vanilla.png)
Pulley
Mod (https://dl.dropboxusercontent.com/s/h0dw20eremtdyqe/Pulley%20-%20Mod.png)
Vanilla (https://dl.dropboxusercontent.com/s/e9w2omoafcnn3es/Pulley%20-%20Vanilla.png)
Also here a zip containing the original and resized pictures: Pictures.7z (https://www.dropbox.com/s/s7mkbbcbjvgrdkd/Pictures.7z?dl=0)
I'm not sure if these pictures are good for testing, regardless, I took these pictures with my camera so I release them under the WTFPL (http://www.wtfpl.net/) license. Enjoy! :)
wonkey_monkey
15th February 2015, 21:47
Taking Beach house mod/vanilla into Photoshop and applying the following to vanilla:
Filter->Blur
Filter->Blur
Edit->Fade Blur... (50%)
results in an image that is close to indistinguishable from mod.
Bloax
16th February 2015, 01:46
Upon close inspection you may notice that the modification (https://dl.dropboxusercontent.com/u/63152810/Screenies/avsresize_mod.png) actually kills the ringing (and mysterious stairstepping ones, too) artifacts that would normally be present (https://dl.dropboxusercontent.com/u/63152810/Screenies/avsresize_unmodded.png).
I also find it hilarious to find hefty copyright/license infringement discussion on a DVD ripping board, in a thread casually discussing possible changes to resizing in a non-commercial application, of all things.
TheFluff
16th February 2015, 03:03
I also find it hilarious to find hefty copyright/license infringement discussion on a DVD ripping board, in a thread casually discussing possible changes to resizing in a non-commercial application, of all things.
This has always been an exceptionally schizophrenic forum in that regard.
SEt
16th February 2015, 05:48
Upon close inspection you may notice that the modification (https://dl.dropboxusercontent.com/u/63152810/Screenies/avsresize_mod.png) actually kills the ringing (and mysterious stairstepping ones, too) artifacts that would normally be present (https://dl.dropboxusercontent.com/u/63152810/Screenies/avsresize_unmodded.png).
Removal of this "mysterious stairstepping" is exactly what caught my attention. Results are definitely softer but that can be countered with post-sharpening or more aggressive b/c settings (hence the primary choice of BicubicResize).
Taking Beach house mod/vanilla into Photoshop and applying the following to vanilla:
Filter->Blur
Filter->Blur
Edit->Fade Blur... (50%)
results in an image that is close to indistinguishable from mod.
Very good observation. Mod image is slightly sharper and still has less artifacts than blurred one but result is very close.
The original question remains: is it good change for resizing behavior that represents more "correct" result and who needs sharper images may apply some advanced post-sharpening, or current is what people are expecting and close results can be attained by post-blurring?
Stereodude
16th February 2015, 23:40
Upon close inspection you may notice that the modification (https://dl.dropboxusercontent.com/u/63152810/Screenies/avsresize_mod.png) actually kills the ringing (and mysterious stairstepping ones, too) artifacts that would normally be present (https://dl.dropboxusercontent.com/u/63152810/Screenies/avsresize_unmodded.png).
You appear to have the images backward in your links and file names. The SEt mod is the softer one without the stairstepping aliasing in the images Reel.Deel posted.
I've noticed the stairstepping / aliasing when scaling blu-ray to DVD with bicubic (catmull rom) and was unsure where / why it came from.
foxyshadis
17th February 2015, 03:32
I'd vote sharper-by-default is more useful in 8-bit, especially since there are already softer filters (spline, gauss), and more-correct is more useful in 16-bit, where later operations can't cause any visible rounding errors.
Obviously that violates the expectation that 16-bit filters are just more precise 8-bit filters, but you'd figure that anyone building a script will work exclusively in one or the other and won't be affected much by the difference. More importantly, it's a pain in the ass to maintain, and backward compatibility is important. An external plugin of "Soft*" filters might work?
colours
17th February 2015, 08:28
I also find it hilarious to find hefty copyright/license infringement discussion on a DVD ripping board, in a thread casually discussing possible changes to resizing in a non-commercial application, of all things.
My comment was tongue-in-cheek, of course. I don't personally care all that much about copyright.
Anyway, if you think of integration as convolution with a box filter, there's an obvious similarity to the b-spline kernels, which are n-fold convolutions of a box filter. This explains a bunch of things, like why it seems blurrier/softer and why it has less aliasing. Of course, you also pay for this with increased complexity and a widened kernel support (by 0.5 destination samples on both sides).
In the case of upsampling, b-spline interpolation (not to be confused with BicubicResize(b=1,c=0)) is most efficiently implemented with a sharpening prefilter, followed by convolution with a b-spline kernel. (Cf. Linear Methods for Image Interpolation (http://www.ipol.im/pub/art/2011/g_lmii/).) Perhaps we could compare b-spline interpolation with these "integrated" kernels. Or maybe even use a similar sharpening prefilter with the "integrated" kernels so they don't suffer from as much blurriness.
foxyshadis: "more correct"? There's no right or wrong when it comes to resamplers. Anyhow, I'm opposed to 8-bit and 16-bit filters that would be reasonably expected to be equivalent (modulo precision) somehow doing different things, even if it's different in only a subtle way.
Katie Boundary
26th February 2015, 22:13
While we're on the subject of AVIsynth resizing filters, is anyone working on a trapezoidal filter that automatically adjusts its shape to the scaling factor (http://entropymine.com/imageworsener/pixelmixing)?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.