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 Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 15th June 2003, 09:09   #1  |  Link
JohnMK
Registered User
 
Join Date: Sep 2002
Location: Seattle
Posts: 551
Denoising/Increasing compressibility with BilinearResize()

Let's say I want to gain some compressibility. BilinearResize is a bit blurrier than other resizers given its anti-aliasing nature, and enhances compressibility. Wouldn't it be better to use BilinearResize than C3D or another denoiser/smoother, if speed is valuable, for the purpose of smoothing/gaining compressibility?
JohnMK is offline   Reply With Quote
Old 15th June 2003, 10:22   #2  |  Link
bilu
Registered User
 
bilu's Avatar
 
Join Date: Oct 2002
Location: Portugal
Posts: 1,182
That's what MipSmooth is all about:

http://forum.doom9.org/showthread.php?s=&threadid=53548

without killing too much detail as Bilinear alone could have made.

Bilu
bilu is offline   Reply With Quote
Old 15th June 2003, 10:52   #3  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
My personal preference is to use lanczos/bicubic resizing and use filters to gain compressability.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 16th June 2003, 18:09   #4  |  Link
Piper
Registered User
 
Piper's Avatar
 
Join Date: Jul 2002
Location: Canada
Posts: 196
As have I. Recently however I've been using BiCublinResize in place of Lanczos, but not for increased compressibility (although it may be minor side effect) but because I like how it looks when downsizing after TomsMoComp when compared to the other common resize filters.

I would be interested in a general compressibility comparison with BiCublin and others however.
Piper is offline   Reply With Quote
Old 17th June 2003, 15:09   #5  |  Link
DDogg
Retired, but still around
 
DDogg's Avatar
 
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
Don't forget undot() and Deen(), used with Lanzos or bicubic if it is appropriate for your source. I get an average reduction of 3 points of Q in CCE without any major side effects video quality wise with only a small speed decrease.
DDogg is offline   Reply With Quote
Old 17th June 2003, 16:42   #6  |  Link
mf
·
 
mf's Avatar
 
Join Date: Jan 2002
Posts: 1,729
"Oops I did it again"

I made another AVISynth function that utilizes masks. This one tries to do what JohnMK describes, and is as usual horribly slow at it . It resizes detail areas with LanczosResize, and nondetail areas with BilinearResize, with configurable sharpness. It's a completely untested concept, I just whacked it together in no-time. So if anyone's interested just test it, I won't.


Here it is, HybridResize!
http://mf.onthanet.com/avisynth/HybridResize-0.1.avs

Usage example:
Import("HybridResize-0.1.avs")
HybridResize(320, 240)


Parameters:
sharpness - controls the resize sharpness. 0-255, default 255.

Dependencies: MaskTools.

Have fun testing!
mf is offline   Reply With Quote
Old 17th June 2003, 17:08   #7  |  Link
Piper
Registered User
 
Piper's Avatar
 
Join Date: Jul 2002
Location: Canada
Posts: 196
Nice. I look forward to trying that.

Is this not the same concept that Bicublin uses with BiCubic & BiLinear? Adjusting sharpness is a nice feature add as well.
Piper is offline   Reply With Quote
Old 17th June 2003, 17:27   #8  |  Link
mf
·
 
mf's Avatar
 
Join Date: Jan 2002
Posts: 1,729
Quote:
Originally posted by Piper
Nice. I look forward to trying that.

Is this not the same concept that Bicublin uses with BiCubic & BiLinear? Adjusting sharpness is a nice feature add as well.
I thought Bicublin used Bicubic sizing for luma and bilinear for chroma, I could be wrong though. Because of some crazy chroma lag bug in EdgeMask only luma is processed, and chroma is simply copied from the LanczosResize.
mf is offline   Reply With Quote
Old 17th June 2003, 17:34   #9  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
@Piper/mf: mf is right about bicublin. It does however use a simpler algorithm for scaling, which doesn't provide the same level of filtering as AviSynth - thus greater speed - sometimes at the cost of subjective quality.

It is much more similar to mSmooth. I don't expect this to give much different compression results - as the soft areas are quite smooth - even with lanczos. You should try using msmooth to generate a mask for you, instead of using the resizer.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 17th June 2003, 17:44   #10  |  Link
mf
·
 
mf's Avatar
 
Join Date: Jan 2002
Posts: 1,729
Quote:
Originally posted by sh0dan
It is much more similar to mSmooth. I don't expect this to give much different compression results - as the soft areas are quite smooth - even with lanczos. You should try using msmooth to generate a mask for you, instead of using the resizer.
Yeah, I don't expect miracles either, if you have looked inside my avs you should have seen my comment "Completely untested, probably totally useless." . It was just a crazy idea I had which I impulsively implemented.
mf is offline   Reply With Quote
Old 17th June 2003, 20:19   #11  |  Link
mf
·
 
mf's Avatar
 
Join Date: Jan 2002
Posts: 1,729
Ok, hikke has done some testing for me. Mind you, it's on upsizing, we don't know anything yet about downsizing.

20:09 <@hikke> Lancozresize: 9.16 MB (9,609,216 bytes), Hybridresize: 8.28 MB (8,687,616 bytes)

(that's constant quant 2)

20:11 <@hikke> lancoz has more details (divx3.11 errors), hybrid is nicer to eye, because those errors at stable surfaces aren't so visible

20:36 <@hikke> done that. hybridvlbe - hybridxvid = Total Average PSNR: 40.81

20:37 <@hikke> lanczosvlbe - lanczosxvid = Total Average PSNR: 40.69

20:37 < DeathWolf> so hybrid is better in the end, seems like it's worth it
20:37 < DeathWolf> better comp, better visual qual
20:37 < DeathWolf> all good


Seems nice, so far. Especially since my idea spawned in 10 seconds and it took me 10 minutes to write the script function. Hikke said to test downsizing tomorrow.
mf is offline   Reply With Quote
Old 17th June 2003, 23:36   #12  |  Link
JohnMK
Registered User
 
Join Date: Sep 2002
Location: Seattle
Posts: 551
A 'HybridResize.dll' would be really cool.

Just testing it now, it appears to look really good on a downsize. I don't really have an eye for these things, but at the very least -- it looks good to me. Speed is a little slow, but I hope if this filter becomes popular, maybe some attention would happen here after the filter is stable enough.

Further testing has shown HybridResize gives me almost as much compressibility as BilinearResize. Very impressive. Hopefully that's the desired effect.

Compressibility results (higher number == higher compressibility) for the new James Bond "Die Another Day":

Bilinear: 59%
Hybrid: 57%
Bicubic: 52%
Lanczos: 49%

Yet further testing: the downsized image is blurry where it counts, unfortunately. Almost indiscernable from bilinear.

Last edited by JohnMK; 18th June 2003 at 07:01.
JohnMK is offline   Reply With Quote
Old 18th June 2003, 11:04   #13  |  Link
mf
·
 
mf's Avatar
 
Join Date: Jan 2002
Posts: 1,729
Quote:
Originally posted by JohnMK
Yet further testing: the downsized image is blurry where it counts, unfortunately. Almost indiscernable from bilinear.
I was too careful with the mask. I've now made a new version which should be a lot more aggressive (= sharp). I also added a new parameter:
reverse - soft resize on edges - true/false - default false

You can get it here:
http://mf.onthanet.com/avisynth/HybridResize-0.2.avs

(after hours of pain and agony I finally managed to upload a 958 byte textfile to my ftp server via commandline ftp -_-)
mf is offline   Reply With Quote
Old 18th June 2003, 11:50   #14  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Quote:
Originally posted by mf
I also added a new parameter:
reverse - soft resize on edges - true/false - default false
Ah!
This I wanted to suggest - but when I refreshed this page, you already had it done...
"Inverse sharpening" is something that I've had on my mind for quite some time now. After denoising, usually some of the fine details disappear, and the remaining fine details get softened out. Trying to compensate for that by normal sharpening is not a good idea, because the hard edges will get oversharpened then.
But I never got a final script done, because I was always aware of a flaw in the concept, when it is done with layering: The "mixing" of a sharp and a soft version is not correct. Try to layer some blur(1.3).blur(1.3) with some sharpen(1.0) by 50%, and you see what I mean.
To get the "inverse sharpening" more correct, it would be necessary to perform the strength of the sharpening according to the "edge value" of every pixel in the edge mask. But to do that with AviSynth scripting would be very complex, and extremly sluggish. We'd need a plugin for that ...
However, when working within small ranges of sharpening/blurring, the difference might be hard to notice at all.

- Didée
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 18th June 2003, 12:23   #15  |  Link
Kurosu
Registered User
 
Join Date: Sep 2002
Location: France
Posts: 432
With the available and most commonly used tools, layer("add") in RGB32 already does such job if you properly scale the edgemask and perform a strong sharpening. If I remember well, mode "add" does:
Code:
         (clip2_alpha * strength)
         ------------------------ * (clip2 - clip1)
                   256
output =-------------------------------------------- + clip1
                             256
         (256-(clip2_alpha * strength)/256)*clip2 - (clip2_alpha * strength/256)*clip1
       = -------------------------------------------------------------------------
                                    256
If you use edgemask as clip2_alpha, source as clip2 and sharpened source as clip1, you therefore get a weighed merge between sharpened picture and original, giving you a sharpening effect depending on edge value.

Last edited by Kurosu; 18th June 2003 at 12:44.
Kurosu is offline   Reply With Quote
Old 18th June 2003, 13:26   #16  |  Link
geoffwa
Level 3 Pirate
 
Join Date: Mar 2002
Posts: 45
@mf

The Avisynth filter collection has a newer YV12 version of MaskTools available. Does this work with your scripts or is it borked in some weird and wonderful manner? (getting tired of playing colorspace hopscotch)
geoffwa is offline   Reply With Quote
Old 18th June 2003, 13:43   #17  |  Link
Kurosu
Registered User
 
Join Date: Sep 2002
Location: France
Posts: 432
Quote:
Originally posted by geoffwa
The Avisynth filter collection has a newer YV12 version of MaskTools available.
Where did you see that? 8-P

Last edited by Kurosu; 18th June 2003 at 15:48.
Kurosu is offline   Reply With Quote
Old 18th June 2003, 13:43   #18  |  Link
trbarry
Registered User
 
trbarry's Avatar
 
Join Date: Oct 2001
Location: Gainesville FL USA
Posts: 2,092
Quote:
My personal preference is to use lanczos/bicubic resizing and use filters to gain compressability.
Me too. But for downsizing I'll still use SimpleResize just because it's faster, and then add filters if I need them.

- Tom
__________________
My video filters (still) at www.trbarry.com.
trbarry is offline   Reply With Quote
Old 18th June 2003, 14:29   #19  |  Link
geoffwa
Level 3 Pirate
 
Join Date: Mar 2002
Posts: 45
Quote:
Originally posted by Kurosu
Where did you see that? 8-P
Argh nOOb post!
(my bad)
geoffwa is offline   Reply With Quote
Old 28th June 2003, 05:07   #20  |  Link
r6d2
Graphite mod
 
r6d2's Avatar
 
Join Date: May 2003
Location: Away
Posts: 2,022
Quote:
Originally posted by DDogg
Don't forget undot() and Deen(), used with Lanzos or bicubic if it is appropriate for your source. I get an average reduction of 3 points of Q in CCE without any major side effects video quality wise with only a small speed decrease.
Hi @DDogg,

I just installed 2.52 and attempted to follow your suggestion, but it seems that these filters are only for YV12... Is there a way to use them with 2.52 and CCE?

Thanks in advance.
__________________
MPEG4 quality with MPEG2? - Try the Poor Man's DVD.
FACAR - As seen on TV! - The Complete Idiot's Guide to a good DVD Conversion.
Time is money. Try D2Sroba for DVD2SVCD (FAQ) and save both. All electricity bills supported!
Do you know how much overscan and which resolution your TV has? Find out if NTSC.
Moderator: 1: one who arbitrates 2: one who presides over an assembly, meeting, or discussion
3: a substance (as graphite) used for slowing down neutrons in a nuclear reactor (Webster)
r6d2 is offline   Reply With Quote
Reply


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 04:21.


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