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 > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 12th February 2015, 01:15   #1  |  Link
SEt
Registered User
 
Join Date: Aug 2007
Posts: 374
Resize in Avisynth – another approach

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.

Last edited by SEt; 14th February 2015 at 13:45.
SEt is offline   Reply With Quote
Old 13th February 2015, 14:22   #2  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
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.
Reel.Deel is offline   Reply With Quote
Old 13th February 2015, 16:37   #3  |  Link
SEt
Registered User
 
Join Date: Aug 2007
Posts: 374
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.
SEt is offline   Reply With Quote
Old 13th February 2015, 17:54   #4  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
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.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 13th February 2015, 19:10   #5  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,406
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.
Asmodian is offline   Reply With Quote
Old 13th February 2015, 23:26   #6  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Quote:
Originally Posted by SEt View Post
Concept, sources: later.
Actually we’re just waiting for that.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 13th February 2015, 23:57   #7  |  Link
SEt
Registered User
 
Join Date: Aug 2007
Posts: 374
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.

Last edited by SEt; 14th February 2015 at 00:16.
SEt is offline   Reply With Quote
Old 14th February 2015, 00:33   #8  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
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/C...side_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/C...e_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.
Code:
"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).

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!

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.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)

Last edited by Sparktank; 14th February 2015 at 00:41.
Sparktank is offline   Reply With Quote
Old 14th February 2015, 00:48   #9  |  Link
SEt
Registered User
 
Join Date: Aug 2007
Posts: 374
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.
SEt is offline   Reply With Quote
Old 14th February 2015, 05:39   #10  |  Link
colours
Registered User
 
colours's Avatar
 
Join Date: Mar 2014
Posts: 308
Quote:
Originally Posted by SEt View Post
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.
__________________
Say no to AviSynth 2.5.8 and DirectShowSource!
colours is offline   Reply With Quote
Old 14th February 2015, 13:45   #11  |  Link
SEt
Registered User
 
Join Date: Aug 2007
Posts: 374
Ok, no more violations.
SEt is offline   Reply With Quote
Old 15th February 2015, 19:37   #12  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
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 ).
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
Vanilla

Pulley
Mod
Vanilla

Also here a zip containing the original and resized pictures: Pictures.7z
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 license. Enjoy!

Last edited by Reel.Deel; 15th February 2015 at 19:42. Reason: fix link to pulley vanilla
Reel.Deel is offline   Reply With Quote
Old 15th February 2015, 21:47   #13  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
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.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 16th February 2015, 01:46   #14  |  Link
Bloax
The speed of stupid
 
Bloax's Avatar
 
Join Date: Sep 2011
Posts: 317
Upon close inspection you may notice that the modification actually kills the ringing (and mysterious stairstepping ones, too) artifacts that would normally be present.

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.

Last edited by Bloax; 16th February 2015 at 01:50.
Bloax is offline   Reply With Quote
Old 16th February 2015, 03:03   #15  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,100
Quote:
Originally Posted by Bloax View Post
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.
TheFluff is offline   Reply With Quote
Old 16th February 2015, 05:48   #16  |  Link
SEt
Registered User
 
Join Date: Aug 2007
Posts: 374
Quote:
Originally Posted by Bloax View Post
Upon close inspection you may notice that the modification actually kills the ringing (and mysterious stairstepping ones, too) artifacts that would normally be present.
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).

Quote:
Originally Posted by davidhorman View Post
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?
SEt is offline   Reply With Quote
Old 16th February 2015, 23:40   #17  |  Link
Stereodude
Registered User
 
Join Date: Dec 2002
Location: Region 0
Posts: 1,436
Quote:
Originally Posted by Bloax View Post
Upon close inspection you may notice that the modification actually kills the ringing (and mysterious stairstepping ones, too) artifacts that would normally be present.
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.

Last edited by Stereodude; 16th February 2015 at 23:43.
Stereodude is offline   Reply With Quote
Old 17th February 2015, 03:32   #18  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
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?
foxyshadis is offline   Reply With Quote
Old 17th February 2015, 08:28   #19  |  Link
colours
Registered User
 
colours's Avatar
 
Join Date: Mar 2014
Posts: 308
Quote:
Originally Posted by Bloax View Post
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.) 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.
__________________
Say no to AviSynth 2.5.8 and DirectShowSource!
colours is offline   Reply With Quote
Old 26th February 2015, 22:13   #20  |  Link
Katie Boundary
Registered User
 
Katie Boundary's Avatar
 
Join Date: Jan 2015
Posts: 1,048
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?
__________________
I ask unusual questions but always give proper thanks to those who give correct and useful answers.
Katie Boundary is offline   Reply With Quote
Reply

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 20:28.


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