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. |
12th February 2015, 01:15 | #1 | Link |
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. |
13th February 2015, 16:37 | #3 | Link |
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. |
13th February 2015, 19:10 | #5 | Link |
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.
|
13th February 2015, 23:26 | #6 | Link |
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
Join Date: Feb 2009
Location: No support in PM
Posts: 712
|
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding |
13th February 2015, 23:57 | #7 | Link |
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. |
14th February 2015, 00:33 | #8 | Link |
47.952fps@71.928Hz
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 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. |
14th February 2015, 00:48 | #9 | Link |
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.
|
14th February 2015, 05:39 | #10 | Link | |
Registered User
Join Date: Mar 2014
Posts: 308
|
Quote:
Funny that.
__________________
Say no to AviSynth 2.5.8 and DirectShowSource! |
|
15th February 2015, 19:37 | #12 | Link |
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 |
16th February 2015, 01:46 | #14 | Link |
The speed of stupid
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. |
16th February 2015, 05:48 | #16 | Link | ||
Registered User
Join Date: Aug 2007
Posts: 374
|
Quote:
Quote:
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? |
||
16th February 2015, 23:40 | #17 | Link | |
Registered User
Join Date: Dec 2002
Location: Region 0
Posts: 1,436
|
Quote:
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. |
|
17th February 2015, 03:32 | #18 | Link |
ангел смерти
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? |
17th February 2015, 08:28 | #19 | Link | |
Registered User
Join Date: Mar 2014
Posts: 308
|
Quote:
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! |
|
26th February 2015, 22:13 | #20 | Link |
Registered User
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. |
Thread Tools | Search this Thread |
Display Modes | |
|
|