View Full Version : HybridFuPP : new 0.84b


FuPP
12th February 2004, 22:43
Here is a script (directly inspired from mf hybridresize) doing resizing + edge, motion and dark areas aware filtering :

- edges are sharply resized (oversharpening is though optional)
- moving areas of each frame are resized with a soft algorithm and spatialy filtered
- dark areas are softly resized and strongly filtered
- other areas are resized with the algorithm of your choice and slightly filtered with a temporal filter.

This function is designed for resizing + filtering, and delivers a sharp image while enabling better compressibility than using bilinear resizing !

You must use avisynth 2.55 load mpeg2dec3, unfilter, undot, fluxsmooth, msharpen (new, since 0.6b) and masktools (v 1.4.14) in your main script (or have them in your avisynth plugin directory)

download avsi 0.84b (2004/03/14) + readme (http://fupp.chez.tiscali.fr/HybridFuPP/HybridFuPP_084_b.zip) (click right on link and save target)

changelog :

0.84b:

- It is now possible to create personal processing chains
- advanced debug mode (displayed with colors, modes can be now combined)
- added a strength parameter for dark areas processing
- more speed
- no more limits concerning final size for chroma and dark (called ‘special’ in 0.7x versions) modes
- deringing (optional) is now done after resizing. Mod 16 size limit concerns now only final size.
- be careful : some parameters have been renamed (ex : special -> dark).
- parameters order has changed ! so be careful if you used unnamed parameters in previous releases : ex hybridFupp(448,320,12,7,10,30,9,32,17,1,5,true,true,true,30,0)

0.80a to 0.83a : not released

0.71b :
- added a threshold parameter for special mode (ie dark areas processing)

0.7b :

- special processing of dark areas (experimental), ie soft resizing + strong filtering (optional). Compressibility : up to 12% more
- It is now possible to choose resizing algorithm for edges
- motion spatial filtering has been re-introduced (because of users request)
- a little bit less speed if dark areas processing is used (activated by default), a little bit more than 0.6b if it is not used


0.6b :

- resizing algorithm and settings can be now selected for picture parts displaying no motion nor edges
- edge detection algorithm changed (uses Msharpen now)
- default values have been changed
- presets have been changed
- it is now possible to override parameters included in a preset
- spatial filtering has been removed when processing motion (offered a very weak compressibility gain)
- general picture quality improvements
- speed improvement

- 0.5b : added presets (low, medium, high, high2)
changed defaults for better quality
changed spatio-temporal filter position in the chain
- 0.4b : add parameters for both spatio-temporal and spatial filtering
changed default value for Edge detection threshold from 15 to 10
chroma smoothing is now done after resizing. Dering is still done before. Will see later...
- 0.3b : errors with non mod16 sources are better managed
- 0.2b : first downloadable version- All feedback will be greatly appreciated -

original script (it has been kept for people who want to understand further discussions, but latest script is included in the downloadable file):



LoadPlugin("C:\video\avsfilters\yv12\mpeg2dec3.dll")
LoadPlugin("C:\video\avsfilters\yv12\masktools.dll")
LoadPlugin("C:\video\avsfilters\yv12\undot.dll")
LoadPlugin("C:\video\avsfilters\yv12\unfilter.dll")
LoadPlugin("C:\video\avsfilters\yv12\fluxsmooth.dll")

mpeg2source("F:\Films\test.d2v",idct=7,cpu2="ooxxox",moderate_h=10,moderate_v=20).crop(24,80,672,416,align=true)
blindpp(quant=2,cpu2="ooooxo",moderate_h=30,moderate_v=50)
HybridFupp(448,320,255,40,12)
colorYUV(off_y=5,gain_y=25,cont_v=-60)
undot()
addBorders(16,128,16,128)


function HybridFupp(clip input, int width, int height, int "sharpness", int "sh1", int "sh2")

{
resizemask = input.edgemask(3,8,255,255,"sobel",Y=3, V=1, U=1).inflate().Levels(0, 1.0, 24, 0, 255).\
BilinearResize(width, height).GreyScale().ConvertToRGB32()

MoMask = motionmask(input,thY1=30,thY2=30,thSD=15,y=3,u=1,v=1).fity2uv().inflate().Levels(0, 1.0, 24, 0, 255).\
BilinearResize(width,height).greyscale().converttorgb32()

soft = input.BilinearResize(width, height)

MEdgesharp = Mask(input.LanczosResize(width, height).unfilter(sh1,sh2).ConvertToRGB32(), resizemask)
MMotionblur = Mask(soft.unfilter(-10,-10).ConvertToRGB32(), MoMask)
Addedgedsharp = Layer(soft.fluxsmooth(3,5).ConvertToRGB32(), MEdgesharp, "add", sharpness)
AddMotionblur = Layer(Addedgedsharp , MMotionblur, "add", 255).converttoyv12()

return AddMotionblur

}



I'm quite happy with results (thanks mf, Kurosu and Manao !)

FuPP

FuPP
13th February 2004, 01:00
I made an avsi version, probably easier to use. Sharpness, sh1 and sh2 are now optional (defaults are 255,40,12)

Remember : avsi files are automatically loaded, so there's no need to load the function in your final script.

1/ avsi file :

the following lines should be copied and pasted in notepad, and then saved as "hybridfupp.avsi" in your avisynth plugins directory (by default : C:\Program Files\AviSynth 2.5\plugins) :

---------------------------------------------------------------------
function HybridFupp(clip input, int width, int height, int "sharpness", int "sh1", int "sh2")

{
sharpness = Default(sharpness, 255)
sh1 = Default(sh1, 40)
sh2 = Default(sh2, 12)

resizemask = input.edgemask(3,8,255,255,"sobel",Y=3, V=1, U=1).inflate().Levels(0, 1.0, 24, 0, 255).\
BilinearResize(width, height).GreyScale().ConvertToRGB32()

MoMask = motionmask(input,thY1=30,thY2=30,thSD=15,y=3,u=1,v=1).fity2uv().inflate().Levels(0, 1.0, 24, 0, 255).BilinearResize(width,height).greyscale().converttorgb32()

soft = input.BilinearResize(width, height)

MEdgesharp = Mask(input.LanczosResize(width, height).unfilter(sh1,sh2).ConvertToRGB32(), resizemask)
MMotionblur = Mask(soft.unfilter(-10,-10).ConvertToRGB32(), MoMask)
Addedgedsharp = Layer(soft.fluxsmooth(3,5).ConvertToRGB32(), MEdgesharp, "add", sharpness)
AddMotionblur = Layer(Addedgedsharp , MMotionblur, "add", 255).converttoyv12()

return AddMotionblur
}
--------------------------------------------------------------------



2/ script examples

ex 1 : crop, 448x320 resizing and addborders are used for svcd specification

LoadPlugin("C:\video\avsfilters\yv12\mpeg2dec3.dll")
LoadPlugin("C:\video\avsfilters\yv12\masktools.dll")
LoadPlugin("C:\video\avsfilters\yv12\unfilter.dll")
LoadPlugin("C:\video\avsfilters\yv12\fluxsmooth.dll")

mpeg2source("F:\Films\test.d2v",idct=7)
crop(24,80,672,416,align=true)
hybridFupp(448,320)
addBorders(16,128,16,128)


ex 2 : similar to previsous post, more optimized for compressibility

LoadPlugin("C:\video\avsfilters\yv12\mpeg2dec3.dll")
LoadPlugin("C:\video\avsfilters\yv12\undot.dll")
LoadPlugin("C:\video\avsfilters\yv12\masktools.dll")
LoadPlugin("C:\video\avsfilters\yv12\unfilter.dll")
LoadPlugin("C:\video\avsfilters\yv12\fluxsmooth.dll")

mpeg2source("F:\Films\test.d2v",idct=7,cpu2="ooxxox",moderate_h=10,moderate_v=20)
crop(24,80,672,416,align=true)
blindpp(quant=2,cpu2="ooooxo",moderate_h=30,moderate_v=50)
hybridFupp(448,320)
undot()
addBorders(16,128,16,128)


Just a last word : I have only used ideas (and code) coming mostly from other people, so I thank them once more !

jkwarras
13th February 2004, 08:45
Wow, thanks a lot for this script, I'll test it as sson as posible :)

If I've undertand correctly (please correct me if I'm wrong), it apply different levels of resizing/bluring/denoising depending on the motion of a frame. So, if for ex. we have an lateral inside car scene, with the driver in front and behind him there's the windows, with all the streets and cars, etc.. passing very quickly. It's that filter keeping the details of the non-moving area (the driver) while bluring the behind scene (moving area: 'paysage' in window)? I mean, applying different levels of denoising/filtering in different parts of the same frame?

If it's this it's incredible!!

One question:

How do you think this script will behave along with the QMF script? This last one is based in motion and apply different levels of denosing/filtering to a *whole* frame.

Regards.

FuPP
13th February 2004, 09:09
1/ Yep ! + edge shapening + non-edge softening (by bilinear resizing)

2/ This is the difference : QMF blurs the whole frame when there's motion. "Mine" blurs only moving parts of picture (so result should be, theoretically speaking, "better").

Didée
13th February 2004, 09:33
AAAAAAAArgh !!

Such a thing is what I wanted to script in the next two weeks or so, I already started with the baselines at end of January.

:(

Okay, over the weekend I'll look closer at it, to find out if we had all the same ideas ...

However, it's very nice to see that people other than mf (and, very seldom, me) are converting good ideas into scripts. Thank you!

[Announcement] And BTW, I'm not completely out of the game: this weekend I'm going to post a little script ... eye candy, time dandy.


FuPP: technical question!

For the same purpose than you, I was playing with "MotionMask" also. But I had non-trivial problems with it:
When using scenechange thresholds low enough to catch the motion just like I wanted it to, THEN very often MotionMask returned black masks in high-motion parts, which is a very bad thing obviously (blurring drops out where you need it the most). IIRC I had to up the SC threshold to something >20~30, or even more (not sure atm). Now I see you use a SC thresh of only (15) ... don't you have problems with high-motion falsly detected as scenechange?

- Didée

FuPP
13th February 2004, 10:03
Yes, calibrating parameters is very touchy. The ones I use gave me good results for the sources I have tested. Maybe you could have a look with these and tell me what happens with samples you've used.

"Such a thing is what I wanted to script in the next two weeks or so, I already started with the baselines at end of January."

Sorry for that... :p

@Kurosu, Manao or Shodan :

I have a technical question too : Is it possible to have Mask function working with YV12 ?

btw, I have had problems using yv12Layer even if source (param1) and mask (param2) are previously converted to yv12. Is it normal ?

jkwarras
13th February 2004, 10:23
Originally posted by FuPP
This is the difference : QMF blurs the whole frame when there's motion. "Mine" blurs only moving parts of picture (so result should be, theoretically speaking, "better").

Cool! Thanks a lot for it, i'll try it :D It seems excellent for my DVD backups!

Well, I'm just guessing here and maybe this isn't of your interest but I think this script will also be really useful for DV filtering with no compressibility purposes. I mean, when you want to filter noise in DV and want to outut it to DV (not to MPEG-4). AS DV Data rate is constant you don't have to care about filesize, just filter efficiently.

As shooting DV is sometimes very difficult and you can get a lot of noise (for ex. on low lighting shooting) on certains scenes and less noisy (but still noisy) on other scenes. The fact is that if you apply denoising to the whole video (like C3D or fluxsmooth) you'll get suboptimal denoising, you can get too much denoising on parts than doesn't need it and get not enough denoising in parts that really need it (and you don't apply enough because you'll also apply too much into the less noisy parts). SO at the end you just have to do it at hand, which is kind of difficult. So, I'm wondering if such a script will be useful for this purposes, turning it into noise based. But maybe noise can be considered as motion. I'm not a programmer, just a final user and independent filmmaker and I really see an use of that, so please, forget about this if you feel is stupid :)

Regards

Mug Funky
13th February 2004, 10:27
hey, cool. i haven't touched video for a week or so, but i'll give this a try when i do.

if you're having trouble with mask and layer, why not use Overlay? fully YV12 masking and stuff... you need the jan 15th binary to get the full benefit (Photoshop style "ink types" like subtract, difference, etc)

FuPP
13th February 2004, 10:32
@jkwarras : you should probably use something like Peachsmoother for that purpose (excellent adaptive filtering by Linsey Dubb).

But I think DV sources are interlaced and I don't know if Peach handle this properly. Btw, you should find some posts in this forum about how filtering interlaced sources using filters that do no handle them natively.

Regards,

FuPP

FuPP
13th February 2004, 10:34
Originally posted by Mug Funky
hey, cool. i haven't touched video for a week or so, but i'll give this a try when i do.

if you're having trouble with mask and layer, why not use Overlay? fully YV12 masking and stuff... you need the jan 15th binary to get the full benefit (Photoshop style "ink types" like subtract, difference, etc)

yes, but what about masks ? (I guess overlay <=> layer ?)

Manao
13th February 2004, 10:50
@FuPP : no need of Mask if your are in YV12 : the Y channel already contains that information.

In fact, mask = Mask(overlay_clip,mask_clip)
Layer(base_clip, mask, "add", 255)Is equivalent toMaskedMerge(base_clip,overlay_clip,mask_clip,Y=3, U=3, V=3)Hence, your code can be changed into function HybridFupp(clip input, int width, int height, int "sharpness", int "sh1", int "sh2")

{
sharpness = Default(sharpness, 255)
sh1 = Default(sh1, 40)
sh2 = Default(sh2, 12)

resizemask = input.edgemask(3,8,255,255,"sobel",Y=3, V=1, U=1).inflate().\
Levels(0, 1.0, 24, 0, 255).Levels(0,1.0,255,0,sharpness).BilinearResize(width, height)

MoMask = motionmask(input,thY1=30,thY2=30,thSD=15,y=3,u=1,v=1).fity2uv().\
inflate().Levels(0, 1.0, 24, 0, 255).BilinearResize(width,height)

soft = input.BilinearResize(width, height)

MEdgesharp = input.LanczosResize(width, height).unfilter(sh1,sh2)
MMotionblur = soft.unfilter(-10,-10)

Addedgedsharp = MaskedMerge(soft.fluxsmooth(3,5), MEdgesharp, resizemask)
AddMotionblur = MaskedMerge(Addedgedsharp , MMotionblur, MoMask )

return AddMotionblur
}Note that the sharpness is used inside a Levels

What exactly is the issue with YV12Layer ?

@Mug Funky : Overlay accept YV12 as input, but AFAIK, it converts it to RGB before treating it.

Edited : small typo, plus lines too long.

jkwarras
13th February 2004, 10:57
Originally posted by FuPP
@jkwarras : you should probably use something like Peachsmoother for that purpose (excellent adaptive filtering by Linsey Dubb).


I've never tried Peachsmoother, I didn't know it's adaptive filtering (good news), I was using C3D, fluxsmooth and recently Mipsmooth. I'll take a look at this one, thanks for the tip.

Regards

Wilbert
13th February 2004, 10:58
@Mug Funky : Overlay accept YV12 as input, but AFAIK, it converts it to RGB before treating it.]a
No, it converts the clips (including the mask) to YUV 4:4:4. Btw, layer doesn't work correctly in YV12.

bond
13th February 2004, 12:04
hm i dont get it to work :(

i tried both fupps and manaos version, fupps version reports an unrecognized exception in the "MoMask = motionmask..." line, manaos one line below "inflate()..."
(btw why does manao use \ in the MoMask command but fupp doesnt?)

Manao
13th February 2004, 12:08
Bond, you have to update your version of the masktools : http://www.geocities.com/manao47/Filters/masktools-v1.4.9.zip

The \ is used in order to make a line break in the series of instructions, because my line was too long to fit the screen.

bond
13th February 2004, 12:42
thanks manao, i already had this great plugin :)

hm, maybe this is already a known issue (i have to admit i didnt search for it) but it seems the problem is caused by crop (if i comment crop() out it works)

i have a pal dvd source:
crop(2,80,716,418)
HybridFupp(640,256)

edit:
funny, with crop(0,78,720,420) or crop(2,82,716,416) it works

Manao
13th February 2004, 13:09
Your resolution is only mod 2 horizontally. It will work with mod4 resolutions. However, that was not an expected bug, thanks for reporting it. A new version should be released during the afternoon, without the bug ( if I find it ).

FuPP
13th February 2004, 23:10
Hi Manao ! Thanks a lot for your tips !

Originally posted by Manao
What exactly is the issue with YV12Layer ?

Here is a simple example (input is YV12) :

function HybridTest(clip input, int width, int height, int "sharpness", int "sh1", int "sh2")

{

Resizemask = input.edgemask(3,8,255,255,"sobel",Y=3, V=1, U=1).Inflate().Levels(0, 1.0, 24, 0, 255).\
BilinearResize(width, height).ConvertToRGB32()

MEdgesharp = Mask(input.LanczosResize(width, height).ConvertToRGB32(), Resizemask).Converttoyv12()

Resized_input = Input.Bilinearresize(width,height)

Addedgedsharp = yv12Layer(Resized_input, MEdgesharp, "add", sharpness)

return Addedgedsharp

}

This returns me an error : YV12Layer : Image formats don't match


Regards,
FuPP

bond
13th February 2004, 23:45
funny when i color the motion parts red (with .ConvertToRGB32().RGBAdjust(5,1,1,1) ) i see an effect i could describe as ghosting, meaning if a person moves also parts get blurred where the person was a frame before altough it isnt there anymore...
why that?


FuPP,
can you plz tell me why you also choose to add level(), inflate(), greyscale() aso and not only used edge/motionmask and a resizefilter?

thanks :)

morsa
14th February 2004, 00:50
Any before and after images to see its effect?

FuPP
14th February 2004, 02:44
Here is a new avsi. This one enables you to show Edge detection mask (with debug = 1), show motion mask (with debug = 2), change motion detection threshold, (parameter M_Thr) and change scene change detection threshold for motion detection (parameter M_SCD).

Of course you still can change edge sharpning strength using parameter Sharpness, change unfilter strength (for sharpening only, for now...) with sh1 and sh2 parameters.


1/ AVSI

the following lines should be copied and pasted in notepad, and then saved as "hybridfupp.avsi" in your avisynth plugins directory (by default : C:\Program Files\AviSynth 2.5\plugins) :



Function HybridFupp(clip input, int width, int height, int "sharpness", int "sh1", int "sh2", int "M_Thr", int "M_SCD", int "debug")

{
global input = input
global width = width
global height = height
global sharpness = sharpness
global sh1 = sh1
global sh2 = sh1
global M_Thr = M_Thr
global M_SCD = M_SCD

Sharpness = Default(sharpness, 255)
M_Thr = Default(M_Thr, 30)
M_SCD = Default(M_SCD, 15)
sh1 = Default(sh1, 40)
sh2 = Default(sh2, 12)

Blank = BlankClip(1,width,height,color=$FFFFFF,pixel_type="YV12")

Frame = (debug == 1) ? MaskedMerge(input.Bilinearresize(width,height), Blank, RM(input,width, height, sharpness)) : \
(debug == 2) ? MaskedMerge(input.BilinearResize(width,height), Blank, MM(input,width, height, M_Thr, M_SCD)) : \
FuPP(input,width, height,sharpness,sh1,sh2,M_Thr,M_SCD)


return Frame
}



function FuPP(clip input, int width, int height, int "sharpness", int "sh1", int "sh2", int "M_Thr", int "M_SCD")
{

RM = RM(input,width, height, sharpness)
MM = MM(input,width, height, M_Thr, M_SCD)

Soft = input.BilinearResize(width, height)

MEdgesharp = input.LanczosResize(width, height).unfilter(sh1,sh2)
MMotionblur = soft.unfilter(-10,-10)

Addedgedsharp = MaskedMerge(soft.fluxsmooth(3,5), MEdgesharp, RM)
AddMotionblur = MaskedMerge(Addedgedsharp , MMotionblur, MM )

return AddMotionblur
}



function RM(clip i,Int w,Int h, Int s)
{
ResizeMask = i.edgemask(3,8,255,255,"sobel",Y=3, V=1, U=1).inflate().\
Levels(0, 1.0, 24, 0, 255).Levels(0,1.0,255,0,s).BilinearResize(w, h)

return ResizeMask
}



function MM(clip i,Int w,Int h, Int m_s, Int m_scd)
{

MoMask = motionmask(i, thY1= m_s, thY2= m_s, thSD= M_scd, y=3, u=1, v=1).fity2uv().\
inflate().Levels(0, 1.0, 24, 0, 255).BilinearResize(w, h)

return MoMask
}





2/ examples

a/ hybridFupp(448,320,220,36,10,20,16,debug=2)

means :

width = 448 (resizing)
height = 320 (resizing)
Edge sharpening strength = 220
unfilter(36,10)
motion threshold = 30
scene change detection = 16
Please show me motion mask, FuPP (debug = 2)


b/ hybridFupp(448,320,255,40,12,30,15,debug=0)

means : hybridFuPP(448,320) cause you are using default parameters.


3/ To do

- Didée is right. there's room for motion detection improvement, as the algo seems to fail time to time.
- Make parameters for edge detection threshold, for fluxsmooth and unfilter (for the bluring part) : easy to do, so probably for very soon.
- Go to bed.


Regards,

FuPP

Inc
14th February 2004, 09:21
I can't get it work ! :(

Avisynth Vers. 2.54
Masktools: masktools_25_dll_20040110.zip

My script

LoadPlugIn("C:\Programme\AviSynth 2.5\pluginsExtra\MaskTools.dll")
AVISource("H:\vdubcap.avi")
Hybridfupp(480,576,255,40,12,30,15,debug=0)

First in my case I have to load "masktools.dll" from another folder instead of beeing autoloaded by avs in the avs 2.5 plugins folder.

Then if I run that script Vdubmod outputs the following error:
"Motionmask does not have a anmed argument "thY1"
(_tvpv, line 64)
(_tvpv, line 35)
(_tvpv, line 23)

Any idea?

FuPP
14th February 2004, 10:11
You should use masktools 1.4.9

You'll find the new version here (http://www.geocities.com/manao47/Filters/masktools-v1.4.9.zip) ( As always, right click, copy adress and paste it if it doesn't work the first time )

FuPP

bond
14th February 2004, 10:14
fupp,
maybe you want to have a look at the question i posted in my last post!?

FuPP
14th February 2004, 10:54
@Bond : Oops ! did not see your previous post, sorry.

Inflate is used in order to get larger edges in the mask. Without it, sharp resizing of edges wouldn't be efficient.

Greyscale was only for testing purposes and I had forgotten to remove it before posting the first time. (NB : in the new version, you can see masks using debug parameter).

Levels : I honestly can't remember why I have put that (I've made so many tests) ; I think they can be removed except one, due to Manao modifications (used for parameter sharpness).


I can't see the ghosting effect you describe. Could you please have a look with debug=2 ?


@manao : Pictures ? Why not... I will try to post today.


FuPP

bond
14th February 2004, 11:10
thanks a lot :)

i forgot one thing: why did you use fity2uv()?


ad ghosting:
to make it visible what i meant with the ghosting effect i described, have a look at these pictures (http://8ung.at/bond/ghosting.zip) imho showing it very well
look at the left hand of agent smith, he is moving it from the left to the right and imho its very good visible how the place where the hand was 1 frame before is still blurred in the current frame too

for ghosting1 i used .ConvertToRGB32().RGBAdjust(5,1,1,1) to color the areas and Layer(), as you used it in your first script, as maskedmerge needs yv12 input (red is the motionarea, yellow are the edges, blue is nomo-noedg (labeled as soft by fupp))
edit: its also there with .ConvertToRGB32().RGBAdjust(5,1,1,1).ConvertToYV12() and maskedmerge

the same result with ghosting2, using fupps latest script and debug=2

Inc
14th February 2004, 11:16
Thanks for the link - it works! Right testing now. :)

Didée
14th February 2004, 12:15
Originally posted by bond
funny when i color the motion parts red (with .ConvertToRGB32().RGBAdjust(5,1,1,1) ) i see an effect i could describe as ghosting, meaning if a person moves also parts get blurred where the person was a frame before altough it isnt there anymore...
why that?
This I noticed also when I was preparing a similar script ;) (my attention was initially drawn by the sword fights of LOTR, where the effect was really obvious.)

But it is not surprising at all. The used calculation of motion is very basic: it works by either something like frame differencing, or by evaluating a comb mask between current/next frame - I didn't look into the source, but the result is just the same:
imagine a fast moving object, that is located in the left part of the current frame, and in the right part of the next frame. Building the difference between these two frames will return a difference in *both* locations of the object, but on the current frame.
This is absolutely normal, and there is nothing to do about the matter without implementing a real motion tracking algorithm. Which probably would be painfully slow.
One possibility could be to use the scene change detection not on the complete frame, but instead do a windowed search. Then, each "window" that has a difference > threshold from the temporal neighbored window could be excluded. But this would raise other problems, related to the block-based decisions.

- Didée

bond
14th February 2004, 12:50
Originally posted by Didée
Building the difference between these two frames will return a difference in *both* locations of the objectah yes of course, stupid me :D


btw your comments about the scene threshold are very valid (too), in my test clip (matrix1) i think the best would be 22 or 23, above that too often the scene changes werent detected
25 is imho the absolute maximum, but of course its a question of personal preference:
at first sight i would say i prefer better scene change detection than better high-motion blurring (cause this avoids that whole frames after scene changes get blurred, cause the scene change wasnt detected) and because the codec can still blurr the high-motion itself but it cant sharpen the falsely blurred not detected scene changes

i am currently testing if this "scene change blurring" can be seen anyway (if not i will go up with this value), maybe someone else already has extensively tested this and can report findings?

FuPP
14th February 2004, 15:29
SCD : I'm doing some tests because I think that 25 is too strong too. I think that good values are between 19 and 25.

btw : the question you raise aboute SCD (is it visible ?) is the same for ghosting effect. I would be quite surprised if you can see an obvious quality lost.

I'm still working on tweaking, and default values will probably be changed in next version.

Thanks everybody for the time you give for testing.

Regards,

FuPP

mf
14th February 2004, 16:04
Why is SCD necessary for a mask filter? Since when did that become logical? :) If MotionMask is only giving you a 1-bit mask, try YV12Subtract to create a motion mask, which should give you variations. I might dig into it :).

pjotor
14th February 2004, 17:03
anybody know how to fix this?

Avisynth open failure:
Evaluate: operands of '==' and '!=' must be comparable
(hybrv, line 23)

LoadPlugin("D:\DVD Tools\GordianKnot\mpeg2dec3.dll")
LoadPlugin("D:\DVD Tools\GordianKnot\masktools.dll")
LoadPlugin("D:\DVD Tools\GordianKnot\unfilter.dll")
LoadPlugin("D:\DVD Tools\GordianKnot\undot.dll")
LoadPlugin("D:\DVD Tools\GordianKnot\fluxsmooth.dll")
mpeg2source("D:\Mission Impossible 2\mi2.d2v")
crop(12,84,698,404,align=true)
Undot()
hybridFupp(640,256)

For some reason it works fine when using debug=1.
Debug=0 and debug=2 returns:
Avisynth open failure:
Evaluate: unrecognised exception!
(hybrv, line 64)
(hybrv, line 23)

Inc
14th February 2004, 17:06
Yepp, that happened to me too, it seems that you must define "debug" in the command.

FuPP
14th February 2004, 17:24
Oops ! Forgot that in default definitions. Will fix that in next release.

For now, I'm doing compression tests...

FuPP

bond
14th February 2004, 17:39
Originally posted by FuPP
the question you raise aboute SCD (is it visible ?) is the same for ghosting effect. I would be quite surprised if you can see an obvious quality lost.exactly and nope, its not visible in high-motion scenes (even with unfilter(-150,-150))
in low motion it is for a short time if very strong blurring values are used (-150), with -30 i couldnt really spot the difference anymore (tough its of course visible by a frame to frame compare)

I think that good values are between 19 and 25.hm from my test described above imho the most important thing to look at is if the scene changes are detected in low motion (i want to avoid having blurry low motion frames, even if i dont see them)

i will stay with 23 (dark scenes/movies need a lower value)

bond
14th February 2004, 18:50
fupp,
why do you take as value for manipulating the edges your sharpness value and not the thresholds of the edgemask()?
is there any special reason why you choose "sobel" and 3,8 for edgemask?

also i dont really understand why you added FitY2UV only to the motionmask but not to edgemask?

Chainmax
14th February 2004, 20:59
Sorry to be such a n00b, but what exactly does this filter do (in layman's terms,please)? What other filters (if any) is it comparable to and how does it stack up against them?

FuPP
14th February 2004, 21:02
Hi bond,

Fity2uv has already been removed for next version (not used anymore).

Sobel seems more sensitive. Of course, you can try other ones and let me know.

Sharpness parameter comes from original Hybridresize. I can remove it if people feel it not necessary.

3,8 came from my previous tests. I am probably going to change default 8 -> 15, and create a parameter for it.


Cheers,

Fupp

FuPP
14th February 2004, 21:05
Chainmax,

I don't know, but it looks so good ! ;)

FuPP
14th February 2004, 21:10
ok,

I suppose you have read thread title and first posts...

this filter attempts to use best resizing method, and apply adapted filters by detecting edges and motion parts of each frame.

Moreover, it has been especially designed to deliver a sharp picture, though you can tweak parameters and reduce sharpness.

You should therefore get a sharp and denoised picture, with maximum compressibility.

Hope I've been clear.

FuPP

PS : it a kind of mix with Msharpen and NoMoSmooth

bond
14th February 2004, 21:28
Originally posted by FuPP
Sharpness parameter comes from original Hybridresize. I can remove it if people feel it not necessary.i wondered because in your first version the sharpness value of 255 means that 100% of the edgemask is overlayed over the "soft" image
lower values would lead to a mixture of soft and edges, meaning at 128 50% of the edgemask would be soft and 50% sharpened (plz correct me if i misunderstood this)

now this isnt a bad thing of course for finetuning (would be also usable for the motionmask), tough imho the main paramters are the thresholds of the edgemask, as these define how many edges are detected and used for sharpening

3,8 came from my previous tests. I am probably going to change default 8 -> 15, and create a parameter for it.i wonder if it makes sense to define two different values
as i understand it everything under 3 is not detected as edge, over 8 is detected as edges and in between there is some transition from 0% to 100%
but i very much doubt that this transition is used. ie if i define unfilter(20,20), how much unfilter is used at a value of 5 (0,0 or 20,20 or 12,5;12,5?)?
i think 5 (or everything below 8) is not detected as 100% sharpness (meaning unfilter(0,0) gets used) and therefore it only makes sense to use the same value for both thresholds (as you did for motionmask too)
ie 8,8 would be correct for this example (plz correct me if i am wrong)

Originally posted by Chainmax
Sorry to be such a n00b, but what exactly does this filter do (in layman's terms,please)?it blurres high motion parts of a frame and sharpens the edges of the same frame

all in all i would say you can have more sharpness at the same (or even more) compressibility

What other filters (if any) is it comparable to and how does it stack up against them?there is nothing comparable to this atm i think!?

FuPP
14th February 2004, 21:39
"it only makes sense to use the same value for both thresholds"

Yep, with so weak values, you are probably right.

FuPP
14th February 2004, 22:03
Question : I don't manage to find a very good filter for moving parts. unfilter seems to be the efficient but not sufficiently, for my taste.

I've tested : edeen, dctfilter, blindpp

Any suggestions (spatial filters only...) ?

Didée
14th February 2004, 22:37
Gentlemen,

I see very much talking about unfilter() in this thread. Be careful with using unfilter()!! It is OK to be used on the whole frame; if you use it on parts of a frame only, you should be aware of what you are actually doing ...

Since ever, unfilter() has had these two side-effects:

1. It adds a tiny little amount of noise to the picture. This is not a problem.
2. It darkens the picture! :eek:

Try the following sequence on any source:

interleave(last, last.unfilter(-5,-5)).assumeFPS(4)

You'll clearly see the effect of the lightness jumping up'n down. As my rule of thumb, one should always use unfilter(h,v).lumafilter(2) to compensate for it.

Some may call me picky - but when overlaying a naked unfilter()ed frame onto another through a mask, you are altering the image in an unhomogeneous way. The effect might be hardly visible, but one should be aware of it at least.

- Didée


/wents away, rubbing his hands about the scenechange confusion ...

mf
14th February 2004, 22:45
Didee, same thing as with legacy mfToon version 0.4x and lower. My unsharp mask was pretty bad (I didn't think out of the box, or maybe I thought too much out of the box) and produced something that also darkened the image. Now normally this wouldn't be a problem, but on some instable systems the entire frame darkening would "leak" through, though it should theoretically be impossible (only happen on the cartoon edges). What resulted was a flood of bugreports on strange flickering, that I never encountered myself ;). When I finally got the issue myself I got annoyed and went out to make mfToon v0.5, which of course (:rolleyes:) fixed the issue :D.

FuPP
14th February 2004, 22:59
"2. It darkens the picture!"

Didn't know that. And Tom never fixed it ? :confused:

FuPP
14th February 2004, 23:04
This is probably stupid but I can't see the flickering effect you describe doing your test.

my version is 0.1.5, 16/01/03

:confused: again...

FuPP

Didée
14th February 2004, 23:06
It was mentioned long, long time ago - but no-one ever was bothered. Okay, mask/overlay operations were pretty seldom used by that time. And, moreover, these two effects were important parts of the solution of the "dark-blocking" puzzle. THAT was the thing bothering us ...

- Didée


[edit, after simultaneous posting]

Okay, take this! :)

stackvertical( last .coloryuv(analyze=true).subtitle("orig"),
\ last.unfilter(-5,-5).coloryuv(analyze=true).subtitle("unfilter"),
\ last.blur(.4) .coloryuv(analyze=true).subtitle("blur"))

FuPP
15th February 2004, 00:41
OK, new version

Remember : you have to load mpeg2dec3, unfilter, undot, fluxsmooth and masktools (1.4.9)
in your main script for this to work.

1/ Parameters

input : your clip
width : x for resizing
height : y for resizing
E_Thr (0..255) : Edge detection threshold
sharp_x (-100..100) : horizontal sharpening strength
sharp_y (-100..100) : vertical sharpening strength
M_Thr (0..255) : motion detection threshold
M_SCD (0..255) : scene change detection threshold (used for motion detection)
chroma (true/false) : will smooth chroma
dering (true/false) : will... dering
debug (0, 1 or 2) : display edge detection or motion maps

all are optional except width and height


defaults :

E_Thr : Default = 15
sharp_x : Default = 40
sharp_y : Default = 12
M_Thr : Default = 30
M_SCD : Default = 17
chroma : Default = true
dering : Default = false
debug : Default = 0 (no debug)

syntax :

HybridFupp(clip , int width, int height, int E_Thr, int sharp_x, int sharp_y, int M_Thr, int M_SCD,
bool chroma, bool dering, int debug)

example :

hybridFupp(448,320,12,30,9,32,15,true,true,0)

to show motion mask : hybridFupp(448,320,debug=2)
to show edge mask : hybridFupp(448,320,debug=1)


2/ the Avsi file

See first post for download

Code is now here for info



Function HybridFupp(clip input, int width, int height, int "E_Thr", int "sharp_x",\
int "sharp_y", int "M_Thr", int "M_SCD", \
bool "chroma", bool "dering", int "debug")

{
global input = input
global width = width
global height = height
global E_Thr = E_Thr
global sharp_x = sharp_x
global sharp_y = sharp_y
global M_Thr = M_Thr
global M_SCD = M_SCD
global chroma = chroma
global dering = dering

E_Thr = Default(E_Thr, 15)
M_Thr = Default(M_Thr, 30)
M_SCD = Default(M_SCD, 17)
sharp_x = Default(sharp_x, 40)
sharp_y = Default(sharp_y, 12)
chroma = Default(chroma, true)
dering = Default(dering, true)
debug = Default(debug, 0)

Blank = BlankClip(1,width,height,color=$FFFFFF,pixel_type="YV12")

Frame = (debug == 1) ? MaskedMerge(input.Bilinearresize(width, height), Blank, RM(input, width, height, E_Thr)) \
: (debug == 2) ? MaskedMerge(input.BilinearResize(width, height), Blank, MM(input, width, height, M_Thr, M_SCD)) \
: FuPP(input, width, height, E_thr, sharp_x, sharp_y, M_Thr, M_SCD, chroma, dering)

return Frame
}

function FuPP(clip input, int width, int height, int "E_Thr", int "sharp_x", int "sharp_y", int "M_Thr", int "M_SCD", \
bool "chroma", bool "dering")
{

input = input.undot()

input = (chroma == true) ? input.blindpp(quant=16, cpu2="ooxxox", moderate_h=10, moderate_v=20) : input
input = (dering == true) ? input.blindpp(quant= 2, cpu2="ooooxo", moderate_h=30, moderate_v=50) : input

RM = RM(input, width, height, E_Thr)
MM = MM(input, width, height, M_Thr, M_SCD)

Soft = input.BilinearResize(width, height)

MEdgesharp = input.LanczosResize(width, height).unfilter(sharp_x, sharp_y).lumafilter(2)
MMotionblur = soft.unfilter(-5, -5).lumafilter(2)

Addedgedsharp = MaskedMerge(soft.fluxsmooth(3, 5), MEdgesharp, RM)
AddMotionblur = MaskedMerge(Addedgedsharp ,MMotionblur, MM )

return AddMotionblur
}

function RM(clip i,Int w,Int h, Int e_th)
{

ResizeMask = EdgeMask(i, 0, e_th, 255, 255, "sobel", Y=3, V=1, U=1).Inflate().BilinearResize(w, h)
return ResizeMask
}

function MM(clip i,Int w,Int h, Int m_th, Int scd)
{

MoMask = MotionMask(i, thY1= m_th, thY2= m_th, thSD= scd, y=3, u=1, v=1).Inflate().BilinearResize(w, h)
return MoMask
}




Any feedback about quality and compression would be really appreciated

Cheers,

FuPP

edit : typos + Motion SCD default changed to 17, dering default to false

bond
15th February 2004, 12:13
thanks didée for pointing out the unfilter darkening!

i played around with the lumafilter, and in my sample lumafilter(2) lightened up the frame too much, 1 would match the source better here :B

but all in all the question is:
does this high-mo/edges darkening hurt the quality? does it hurt the codec doing his job as it should? or are there any other potential problems?

what other good and fast (!) spatial smoothing (i dont do sharpening) filter can be recommended for useage?


another question are the thresholds of the edgemask: EdgeMask(0, e_th, 255, 255)
i would be interested if someone can say if the part between 0 and e_th is used for edgetreatement or not in fupps script?
and if yes, how?

mf
15th February 2004, 12:51
FuPP, could you explain why you do global vars? Unexpected problems could arise.

FuPP
15th February 2004, 13:57
Here are some screenshots (for morsa... and others !) + compression test (compression reference = lanczos)

clip is dvd source, 4486 frames. Compression is mpeg2


BilinearResize(512,320) // compression ratio : 0.96

http://fupp.chez.tiscali.fr/HybridFuPP/BILINEAR.png


BicubicResize(512,320,0,0.6) // compression ratio : 0.99

http://fupp.chez.tiscali.fr/HybridFuPP/BICUBIC06.png


LanczosResize(512,320) // compression ratio : 1.0

http://fupp.chez.tiscali.fr/HybridFuPP/LANCZOS.png


hybridfUpp(512,320) // compression ratio 0.95

http://fupp.chez.tiscali.fr/HybridFuPP/HYBRID.png

FuPP
15th February 2004, 14:07
Originally posted by bond
thanks didée for pointing out the unfilter darkening!
does this high-mo/edges darkening hurt the quality? does it hurt the codec doing his job as it should? or are there any other potential problems?

I think that Didée means that mixing darker parts with normal parts in the same picture could simply be visible


what other good and fast (!) spatial smoothing (i dont do sharpening) filter can be recommended for useage?
hem... I'm afraid this is the question I raise a few posts above :D


another question are the thresholds of the edgemask: EdgeMask(0, e_th, 255, 255)
i would be interested if someone can say if the part between 0 and e_th is used for edgetreatement or not in fupps script?
and if yes, how?
values between 0 and e_th will be considered as edges. But I'm not sure I get your question...

FuPP
15th February 2004, 14:22
Hi mf !

Thanks again for your very good ideas and scripting skills. HybridFuPP was mostly a hack of Hybridresize when I began to work on it !

Originally posted by mf
FuPP, could you explain why you do global vars? Unexpected problems could arise.

It is quite strange : formerly, my sub functions did not seem to work without it. Because of your post, I've made some other test and it seems to work without global declarations now. Maybe because I use the same variable names in HybridFupp anf FuPP functions now, or a simple mistake at one moment.

What kind of unexpected problems are you talking about ?

Regards,

FuPP

bond
15th February 2004, 15:35
Originally posted by FuPP
values between 0 and e_th will be considered as edges.why are you so sure about that? i am not
in fact if your statement would be true than your 0->e_th setting would mean that all detectable edges are considered as edges, but my tests show me thats not the case...

in the masktools readme it says:
1) EdgeMask(th1=[0..255],th2=[0..255],string)
- th1: threshold under which component value is set to 0
- th2: threshold under which component value is set to the derivative
value, and above which it's set to 255

Edgemask now takes 4 thresholds (2 for luma and 2 for chroma)

11) MotionMask(clip clip, int thY1, int thY2, int thC1, int thC2, int thSD)
- If the frame isn't detected as a scenechange, it calculates for each pixel a basic 'motion', ranging from 0 ( no motion ) to 255 ( full motion ).
If this motion is under th1, the pixel is set to 0, if it is over th2, pixel is set to 255, if in between, it is set to the value of motion. ( so threshold work like EdgeMask )so to me this means that everything above the second threshold is detected as 100% sharpness (which means lanczosresize is used)
between the first and the second threshold its a some sort of "mixture" depending how strong the detected sharpness is...

for me this raises the (imho very important) question:

does it resize with lanczos between threshold 1 and 2 or not?

imo there are only two possible answers:
1) no
2) yes, it is a mixture between "soft" and "MEdgesharp", depending on the detected sharpness strength

mf
15th February 2004, 15:44
Global variables are as they're called, global for the entire AVS script and its children. You can get naming conflicts, though I think it's handled pretty well in AVS.

FuPP
15th February 2004, 17:06
Originally posted by bond
[B]why are you so sure about that? i am not
in fact if your statement would be true than your 0->e_th setting would mean that all detectable edges are considered as edges, but my tests show me thats not the case...[B]

Because I answered too quickly : values above e_th are considered as edges (and not between both threshold) :rolleyes:

In fact I can't see any difference when playing with threshold1. Did you test it ?

FuPP

PS : Could someone give me feedback about visual quality and efficiency in general ?

FuPP
15th February 2004, 18:31
download avsi b0.2 (2004/02/15) + readme available here (http://fupp.chez.tiscali.fr/HybridFuPP/HybridFupp_b0_2.zip)

right click + save target to download

bond
15th February 2004, 18:52
Originally posted by FuPP
In fact I can't see any difference when playing with threshold1. Did you test it ?yep, i tested it and imo everything between threshold1 and 2 is not detected/used as edges, meaning it doesnt make sense to use different values for thres1 and thres2

well i am asking about other peoples opinions on this issue because i am not 100% sure...

PS : Could someone give me feedback about visual quality and efficiency in generali would say it is nice :)

the main danger imo, people really have to look at, is that faces with some motion get too much blurred -> ugly results
meaning everyone beaware that M_Thr isnt too low!!!

my settings atm are:
EdgeMask(2,2,255,255,"sobel",y=3,u=1,v=1)
MotionMask(25,25,255,255,22,y=3,u=1,v=1)

i would say, over the thumb, i get with these settings little less sharpness as with lanczos-only (of course) with ~5% more compressibility (i dont sharpen with unfilter)
or the other way round i get more sharpness as with neutralbicubic-only (of course) with ~5% less compressibility

OBcecado
15th February 2004, 19:11
Hi, i am attempting to test this new script, but i got into a error that seems to be in the script.
I'm using the lastest versions of the plugins and using latest 30/1/04 avisynth sh0dan's cvs build.
I'm using the following script:


LoadPlugin("C:\avsplugins\mpeg2dec3.dll")
LoadPlugin("C:\avsplugins\masktools.dll")
LoadPlugin("C:\avsplugins\unfilter.dll")
LoadPlugin("C:\avsplugins\undot.dll")
LoadPlugin("C:\avsplugins\fluxsmooth.dll")
mpeg2source("C:\samples\t2.d2v")
hybridfupp(688, 288)
crop(20,70,698,436)
I get the following error:
(hybrv, line 58)
(hybrv, line 33)
(hybrv, line 18)
(c:\samples\t2.avs, line 7)





Thanks in advance for any help.

FuPP
15th February 2004, 19:49
the main danger imo, people really have to look at, is that faces with some motion get too much blurred -> ugly results
meaning everyone beaware that M_Thr isnt too low!!!

That is the reason why I wonder if I am not goint to remove unfilter(-5,-5), as compressibility gain is not so much.
By the way, I have tested settings about motion you describe in your post (25,25,...22) even more aggressive than default ones. So it is probably a matter of taste, or more probably of source.

About edgemask settings, yours are very, very aggressive : edges are detected everywhere. This is here surely a matter of taste ;)

Happy you find it usefull.

FuPP

FuPP
15th February 2004, 19:58
@OBcecado

Could you confirm me, please, that you use hybridFuPP.avsi v0.2 (downloaded by direct link, see posts above) and you are using masktools 1.4.9 ?

I can't reproduce your error.

FuPP

bond
15th February 2004, 20:08
Originally posted by FuPP
That is the reason why I wonder if I am not goint to remove unfilter(-5,-5), as compressibility gain is not so much.nah i wouldnt do that!
imo the most important thing in this script is motion blurring, without this its only half the fun ;)

also i think 30,30 is very conservative, not much will be blurred anyways
also i am using unfilter(-15,-15) - i mean if i dont see the details in the motion parts anyways, i can also blur more...

So it is probably a matter of taste, or more probably of source.yes it surely depends on the source
i mean i surely wouldnt use 2,2 for lotr on 1cd or so :D

OBcecado
15th February 2004, 20:10
Yes, i'm using those versions of the plugins.
Been trying some different settings but still no luck.
With that 0.2 the errors are on lines: 20 35 60.

bond
15th February 2004, 20:26
hm i am still using a script similar to the first ones (not the avsi version)
but with 0.2 i also have problems like OBcecado with the input settings which work with my other script tough (maybe the fancy debug, chroma, dering stuff is cousing problems with some resolutions?)

try a pal dvd source with
crop(2,82,716,416)
HybridFupp(640,256)

FuPP
15th February 2004, 20:40
In your case, this probably because blindpp (used for chroma smoothing + dering) needs mod16 resolutions. But OBCEcado seems to use HybridFuPP with 720x576 (cropping is done afterwards ; though this is maybe not a good idea). So... :confused:

bond
15th February 2004, 20:47
Originally posted by FuPP
In your case, this probably because blindpp (used for chroma smoothing + dering) needs mod16 resolutions.hm i dont get it, isnt 640,256 mod16? :confused:

Dreassica
15th February 2004, 20:52
640,256 is but the script uses teh blindpp before the resize it seems as i get the error as well, until i comment out the crop. which in your case isnt mod16 then.

bond
15th February 2004, 20:54
thanks ;)

Chainmax
15th February 2004, 21:15
FuPP, would it be possible to put blindPP after the resize? I'd love to try this in my current Simpsons rip, but the frame sizes I get after cropping aren't MOD16.

FuPP
15th February 2004, 21:40
@chainmax : did you try to put chroma=false and dering=false ?

I will investigate further in a few time.

FuPP

ps : this filter has not been optimized for animes, this is probably the problem :D

FuPP
15th February 2004, 23:05
new version (see post #1 for download)

b0.3 : better error management for non mod16 sources

I'm not sure this is a good idea to put blinpp after resizing, as proposed by chainmax, because it would blur too much when dering=true. Could though be ok for chroma smoothing. What is your opinion ?

Dreassica
16th February 2004, 00:02
Maybe u should increase the moderate_h/v settings on it then to compensate for it.

FuPP
16th February 2004, 01:00
New version : 0.4b (see post #1 for downloading)

- 0.4b : add parameters for both spatio-temporal and spatial filtering
changed default value for Edge detection threshold from 15 to 10
chroma smoothing is now done after resizing. Dering is still done before. Will see later...
- 0.3b : errors with non mod16 sources are better managed
- 0.2b : first downloadable version

DarkNite
16th February 2004, 10:29
Your script work has simplified my encoding life, at least as far as action movies are concerned. Thank you.

If only I could figure out that ever elusive PerfectAnime() function... :D

FuPP
16th February 2004, 12:11
Many thanks for your feedback, Darknite. Not only action movies are concerned, because of edge detection and best resizing algorithm selection.

About animes : did you try mf scripts ?

As tuning default values is quite hard, I would be grateful if people could try and play with debug=1 or debug=2 and tell me their feelings about edge and motion detection using default values (as Bond did)

Cheers,

FuPP

kempfand
16th February 2004, 14:02
I am very keen to try this script on DV-AVI, eventually using MipSmooth (instead of FluxSmooth) with different MipSmooth-settings for the 3 options (edges, motion, other parts), and leaving out the resize (although I recognize that resize can do a very good job with some types of flickering with DV-AVI's).

Kind regards,
Andreas

bond
16th February 2004, 14:11
fupp,
i saw you used lumafilter(4) in 0.4b, does this high value gave you good results in your tests? as i wrote above in my test lumafilter(1) was the closer to the source than lumafilter(2)...

btw. i talked to syskin about the unfilter darkening and he said it can (of course) badly influence the codecs performance if the difference is too strong...

i think we really should try to find an alternative spatial smoothing filter for hybridfupp!
maybe we should use mergechroma(blur(1.3)), but with higher blurring values or dnr2()...
anything wrong with these or any other suggestions?

pjotor
16th February 2004, 16:03
Originally posted by FuPP I'm not sure this is a good idea to put blinpp after resizing, as proposed by chainmax, because it would blur too much when dering=true.
This is how I do it. Is this a bad idea?
1. crop
2. lanczosresize - to a size that is a tiny bit smaller than crop values (to get mod16)
3. hybridfupp - to final size

bond
16th February 2004, 18:18
Originally posted by pjotor
Is this a bad idea?yes, this is a bad idea cause than you will resize twice
better crop in a way you get mod16

mf
16th February 2004, 19:46
*yawn* BlindPP is made for real MPEG content, not resized/cropped/whatevered video. So just run BlindPP before any cropping, and if it's not mod16 use AddBorders (only right/bottom, macroblocks start at the left-top). It isn't so important for deringing but for deblocking you want the block borders to be in the right place. Why is this an issue in the first place? For DVDrips you're better off using MPEG2Dec3's internal PP, cause it tailors to the frame quant.

FuPP
16th February 2004, 20:30
Originally posted by mf
*yawn* BlindPP is made for real MPEG content, not resized/cropped/whatevered video. So just run BlindPP before any cropping, and if it's not mod16 use AddBorders (only right/bottom, macroblocks start at the left-top). It isn't so important for deringing but for deblocking you want the block borders to be in the right place. Why is this an issue in the first place? For DVDrips you're better off using MPEG2Dec3's internal PP, cause it tailors to the frame quant.

Yes, but I only use deblocking to smooth chroma and bad block matching doesn't seem visible. It is though still efficient and enables compressibility gain.

FuPP
16th February 2004, 20:34
Originally posted by bond
fupp,
i saw you used lumafilter(4) in 0.4b, does this high value gave you good results in your tests? as i wrote above in my test lumafilter(1) was the closer to the source than lumafilter(2)...

btw. i talked to syskin about the unfilter darkening and he said it can (of course) badly influence the codecs performance if the difference is too strong...

i think we really should try to find an alternative spatial smoothing filter for hybridfupp!
maybe we should use mergechroma(blur(1.3)), but with higher blurring values or dnr2()...
anything wrong with these or any other suggestions?

Yes, on sources I have tested lumafilter(4) was better. But it's open !

About spatial filtering : why do you want to merge blured chroma, and let luma as it is ?

FuPP

FuPP
16th February 2004, 20:35
Originally posted by kempfand
I am very keen to try this script on DV-AVI, eventually using MipSmooth (instead of FluxSmooth) with different MipSmooth-settings for the 3 options

Tell me please about results !

FuPP
16th February 2004, 20:41
I was wondering about creating presets (something like quality = low, medium, high, very high). I was also wondering about enabling resizing algorithm choice for parts involving no motion nor edges.

What are your opinions ?

FuPP

bond
16th February 2004, 20:42
Originally posted by FuPP
About spatial filtering : why do you want to merge blured chroma, and let luma as it is ?because mergechroma(blur()) is very popular, but my tests show that it isnt usable for strong bluring anyways

FuPP
16th February 2004, 20:54
Originally posted by bond
because mergechroma(blur()) is very popular

Yes, but it is used the way I use blindpp(quant=16, cpu2="ooxxox", moderate_h=10, moderate_v=20), to smooth chroma (please mf, don't hit me ;) ), though I think that blur() would be less efficient.

I did not test that intensively though, but I will. Could be more "in the standards" than blindpp.

FuPP

FuPP
17th February 2004, 02:17
New version (see post #1 for download)

- 0.5b : added presets (low, medium, high, high2)
changed defaults for better quality
changed spatio-temporal filter position in the chain

FuPP

wh00t
18th February 2004, 00:59
sorry in advance if my question might be foolish or sth, but i'm trying to use fupp's script on one of my avi's and the result is kind of not-smooth-at-all (looks like dropped frames..although audio is clean/smooth) when testing the avs with wmp 6.4 aswell as when converting it into a fake-avi using makeavis or vfapi. so my question(s) would be:

- is it possible that it might be caused by low system resources due to those filtering etc. .. so that it would be turn out fine after encoding
into mpg-2 in the end

or

- could it be a script error, so that i shouldn't bother encoding it using current settings

script looks like this:

LoadPlugIn("..\MPEG2Dec3.dll")
LoadPlugIn("..\undot.dll")
LoadPlugIn("..\unfilter.dll")
LoadPlugIn("..\fluxsmooth.dll")
LoadPlugIn("..\MaskTools.dll")
AVISource("..\some.avi")
Hybridfupp(480,480,preset="high")
converttoyuy2()
Undot()

any help would be appreciated. thanks

ps.

and yes, i should have all required versions along with proper links in the script

FuPP
18th February 2004, 01:26
Hmmm. Could ask you about your system, but I am not convinced this is the problem. Could you tell us more about your source (type, size, and so on) ?

Pentium 90 could though be a problem...

FuPP !

wh00t
18th February 2004, 01:39
my system is:

amd 1.4ghz (thunderbird)
512MB SDRAM
w2k-sp4 professional
..


source (size: 173mb) is:

vid:

xvid @ 23.97 fps
512x384 (1.33:1) [=4:3] resolution
876 kb/s, Qf 0.186 bits/pixel

audio:

MPEG-1 Layer 3 @ 127 kb/s, monophonic VBR (48000Hz)

xvid-codec installed would be v1 beta2

hope that helps

oh.. and btw.

AviFileSource("..\some.avi")
LanczosResize(480,480)
ConvertToYUY2()

works perfect/smooth

DarkNite
18th February 2004, 02:05
Well, wh00t, I don't think there are many systems out there that could run that filterchain in realtime (which is what you're attempting to do with those methods of previewing). Encode a test clip, (using the Trim() function if you have to) and then check playback of encoded mpeg file. I think you'll see it's just a matter of way too much happening in the filterchain for your system to play it back to you in realtime.

BTW, FuPP, yes I've tried/use most of mf's work, and I'm still anxiously awaiting his AddRainbows() - could be named Trigun() imho - function. ;)

/me goes back to looking for PerfectAnime()

mf
18th February 2004, 13:31
Originally posted by DarkNite
/me goes back to looking for PerfectAnime()
It is possible, using some smart SSIM functions and a two-pass system. I'd say go ahead and script it. I won't do it cause it's way too ambitious and I don't even need it.

Oh, and a thing to ponder about for FuPP and bond, if Unfilter's convolution darkens the image, would it not also cause chroma darkening? LumaFilter() won't do then.. :sly:

bond
18th February 2004, 13:37
Originally posted by mf
Oh, and a thing to ponder about for FuPP and bond, if Unfilter's convolution darkens the image, would it not also cause chroma darkening? LumaFilter() won't do then..hm good question :mad:
but i already bugged trbarry to have a look if he can resolve this darkening issue in unfilter anyways, cause this would surely be the best option

FuPP
18th February 2004, 14:01
I even did not know that unfilter darkened something 2 days ago. So don't ask me about chroma !

If it is a rounding problem, and if chroma is concerned, picture would be more red or more green I think. So maybe chroma is ok.

mf
18th February 2004, 15:12
Even the chroma is not hard to fix ;). Just use:
i = last
p = 4
y = i.Greyscale().LumaFilter(p)
u = i.UToY().LumaFilter(p)
v = i.VToY().LumaFilter(p)
YToUV(u, v, y)

You can replace p = 4 with the lumafilter value that works for you. And you're right that darkening chroma would shift it towards green, for U is G<->B and V is G<->R.

alky
18th February 2004, 15:59
i capture analog tv usinf hauppauge 250 and recode to divx for storage... i made some comparison shots:

http://web00020.ipax.tk/video

since the captured mpegs arent that sharp every bit of detail is important to me and the still tests look pretty good... i ll do some video test encoding with this script in the next days....

Didée
18th February 2004, 16:45
alky:

While you're at testing, uuuh... *cough* (http://forum.doom9.org/showthread.php?s=&threadid=70916) ... can't speak no more now, more to come soon.
Going to search my cough syrup now. :)

- Didée

Yoda900
19th February 2004, 22:09
for somereason none of the presets work, only thing i can use is hybridFupp(448, 320). I have all the necessary filters needed and i have loaded them into the script but when i try to use any presets vdub crashes?:confused: Is this a bug or am i doing something wrong?

FuPP
19th February 2004, 22:38
Really don't know at this moment. All I can say is that it works ok for some other people, but I guess it does not help you so much. What I can deal with you is to wait next version (brings quality improvements and should come very soon). We will then have a look on this basis.

Regards,

FuPP

PS : did you try with virtualdub or virtualdubmod? Because I suspect instability with this last one (I use it a lot to test and have crashes, time to time).

Yoda900
21st February 2004, 02:20
I tried this with vdub, vdubmod, nandub even. Still no luck :(

New and improved version sounds nice though ^_^

FuPP
21st February 2004, 02:42
Will post probably tomorrow. I have finished but need to change the doc.

You can though post your script now, I will have look !

FuPP

wh00t
21st February 2004, 03:05
hm..

Yoda900, well script is working for the most, so it probably might be sth wrong on your side. I personally have no probs loading it into vdub/-mod/nandub myself.. maybe you could give us a look on your settings (like FuPP suggested)

FuPP
21st February 2004, 23:59
New version (see post #1 for downloading)

You must load mpeg2dec3, unfilter, undot, fluxsmooth, msharpen (new, since 0.6b) and masktools (v 1.4.9) in your main script (or have them in your avisynth plugin directory)

0.6b :

- resizing algorithm and settings can be now selected for picture parts displaying no motion nor edges
- edge detection algorithm changed (uses Msharpen now)
- default values have been changed
- presets have been changed
- it is now possible to override parameters included in a preset
- spatial filtering has been removed when processing motion (offered a very weak compressibility gain)
- general picture quality improvements
- speed improvement

Enjoy !

Cheers,

FuPP

echo-kk
22nd February 2004, 20:26
@FuPP
I cannot download 0.6b -> I get a 'site is not accessible' (my french isn't very good) error.

If you could provide an alternative url I'd be glad to test the newest version.

echo

FuPP
22nd February 2004, 20:44
click RIGHT on link and save target ;)

Regards,

FuPP

FuPP
22nd February 2004, 20:47
@echo (and all...)

I've included english and french readme in latest version. It could be a good start to learn french :D

FuPP

FuPP
22nd February 2004, 23:34
One thing : people that would wish to copy and paste some lines from the doc could encounter some issues : because I did not use double-quotes, which is the correct syntax for string type variables, as preset for instance, but two simple quotes (because of typos problems). I'm going to fix that very soon and will include the corrected doc in the package.

Regards,
FuPP

toliman
26th February 2004, 04:46
ive looked at the results so far, it's very smooth in terms of CPU usage, and it balances the sharpen + motion which is good for my current project of turning average quality ~700kbit xvid to dvd.

the speed is very decent. instead of having to perform variations of undot / Blockbuster / fluxsmooth / Convolution3D over the entire video, i like the idea of using a mask. reading futher and seeing mf's (infamous) scripts for artifact removal, there's a lot of scope for the future, in detecting and analysing video that i never expected.

not being a guru, it seems to me, this filter seems the ideal way to remove most blur/motion artifacts that won't encode well, IMHO making it ideal for that hallowed position of all-industrious all-purpose generic filter for mpeg-2/4 compressibility.

or another discussion on why one needs a veritable carpenter's toolchest of fine, akward tools instead of a dremel (cough).

is there a way to modify the script it so that it doesnt require manually entering the target height/width variables, (by default, detecting them from the input clip) for integrating better with other common avs filters, ... e.g. autoGK or FACAR ?

koszopal
26th February 2004, 08:12
here's my comp. with SharpResize/IIP/Hypp (http://koszopal.fm.interia.pl/movie/comp.htm) :)
koszopal

FuPP
26th February 2004, 12:39
Originally posted by toliman

is there a way to modify the script it so that it doesnt require manually entering the target height/width variables, (by default, detecting them from the input clip) for integrating better with other common avs filters, ... e.g. autoGK or FACAR ?

Could you develop please as I don't use the tools you quote

FuPP

FuPP
26th February 2004, 12:43
Originally posted by koszopal
here's my comp. with SharpResize/IIP/Hypp (http://koszopal.fm.interia.pl/movie/comp.htm) :)
koszopal

Hi,

What settings did you use for HybridFuPP ?

Btw, I'm not sure that HybridFuPP plays in the same category than Didée's one (awesome picture, Didée !). If you want to be sure, add speed and compressibility tests when comparing all these tools.

regards,
FuPP

Didée
26th February 2004, 13:26
Originally posted by FuPP
Originally posted by toliman

is there a way to modify the script it so that it doesnt require manually entering the target height/width variables, (by default, detecting them from the input clip) for integrating better with other common avs filters, ... e.g. autoGK or FACAR ?
Could you develop please as I don't use the tools you quote

FuPP
Not needed. He's asking for something like

# only pseudo-code here

function foo(clip input, ...)
{
orig_width = input.width
orig_height = input.height

... function's work ...

Resize(orig_width,orig_height)
}

Loose comment:

>> Btw, I'm not sure that HybridFuPP plays in the same category than Didée's one

For sure they don't. iip & me will loose every possible race! ;)

- Didée

koszopal
26th February 2004, 19:07
@fupp
just simple
hybridfupp(640, 352)

FuPP
26th February 2004, 19:56
Koszopal,

Thanks a lot for your answer. Please, if you have little time, try with preset = "high", and have a look on compressibility too, when comparing to other filters.

acrespo
26th February 2004, 20:03
@FuPP

I am not sure about one thing: Are presets about source quality or output quality?
For example, if I have a video with low analog quality it's mean preset="low" (because I have a low quality video) or preset="high" (because I want a high quality final video)?

FuPP
26th February 2004, 20:26
Originally posted by acrespo
@FuPP

I am not sure about one thing: Are presets about source quality or output quality?


Very good question ! They are about output quality. Because filtering in HybridFuPP is more to gain compressibility rather than remove efficiently visible noise ("low" means : more compressible), except maybe dering which both remove ringing artefacts and helps compressibility.

But I could add in the future filters that are more efficient for removing noise (as an option, of course). But be aware it will then impact speed...

Regards,

FuPP

FuPP
27th February 2004, 00:21
Originally posted by toliman
is there a way to modify the script it so that it doesnt require manually entering the target height/width variables, (by default, detecting them from the input clip) for integrating better with other common avs filters, ... e.g. autoGK or FACAR ?

Done (but not sure it will be usefull...) Will be available when next version will be released

Thanks for using HybridFuPP !

toliman
27th February 2004, 05:28
well, i worked on it a little myself.
in a hack kind of way.

i tried to use FACAR for automating overscan borders/filters, but it is too wieldy + inaccurate... so instead, i'm going to rebuild a compact HyFuPP avs script for a DVD2SVCD frameserver, using GripCrop/Resize/Borders to add the overscan borders for tv/dvd-output.

i stripped/modified the presets, and dering/chroma from the existing script, so it would adapt to !mod16 sources. if i spend more time working in, rather than around avisynth, i'll put the mod16 detect/workaround code back in.

i'll keep my eyes peeled for the next update.

koszopal
27th February 2004, 08:35
@fupp
here a simple comp :
resizer bytes comp
1)bicubic 43343872 0,881539487
2)blinear 42426363 0,862878939
3)lancosz 49168384 1
4)sharp 56518656 1,149491836
5)hypp 41986048 0,853923692
6)iip 50640896 1,029948351
koszopal
PS xvid rc2 1pass const quant 2
PPS i'll try with present=high

FuPP
27th February 2004, 12:50
Originally posted by toliman
well, i worked on it a little myself.
in a hack kind of way.

i tried to use FACAR for automating overscan borders/filters, but it is too wieldy + inaccurate... so instead, i'm going to rebuild a compact HyFuPP avs script for a DVD2SVCD frameserver, using GripCrop/Resize/Borders to add the overscan borders for tv/dvd-output.

i stripped/modified the presets, and dering/chroma from the existing script, so it would adapt to !mod16 sources. if i spend more time working in, rather than around avisynth, i'll put the mod16 detect/workaround code back in.

i'll keep my eyes peeled for the next update.

ok, I think I did not get you last time and what I did is not what you want. I think now you want something that automatically crop and so on. I'm not very familiar with this (as I don't use Gripxxx). I will though have a look. Stay tuned...

FuPP

FuPP
29th February 2004, 11:47
New version 0.7b See post #1 for download

0.7b :
- special processing of dark areas (experimental), ie soft resizing + strong filtering (optional). Compressibility : up to 12% more
- It is now possible to choose resizing algorithm for edges
- motion spatial filtering has been re-introduced (because of users request)
- a little bit less speed if dark areas processing is used (activated by default), a little bit more than 0.6b if it is not used

NB : Toliman request has not been (yet) taken into acccount in this version.

FuPP

bond
29th February 2004, 14:45
lo fupp

nice idea with the dark area handling but i think that maybe the value of 60 (binarize) is too high, meaning too many parts of the frame will be blindpp'ed
maybe something like 40 would better in my sample

also what do you think about merging the edgesmask after the darkmask? that way it would be avoided that too many details in medium-dark areas (detected as darkness) get lost?


also i saw that you now use ColorYUV(off_y = 3) to reduce the darkening of unfilter and not lumafilter anymore
again the same as with lumafilter i get different results than you with coloyuv, for me a value of 1 would match the source better. i think this value is pretty much depending on the source :(

also i got a message from trbarry that he is busy at the moment and will not be able to fix unfilters darkening behaviour soon :(


btw: was there a special reason why you replaced inflate with expand in the motionmask?

FuPP
29th February 2004, 17:04
Hi Bond,

binarize threshold depends a lot of the source : a parameter will be therefore added.

about place of dark parts processing, I have to test more...

inflate/expand : I have recently done a lot of tests with another motion detection engine, maybe Expand comes frome these tests. I will have a look !

Regards,

FuPP

Manao
29th February 2004, 17:10
I guess the expand / inflate inversion comes from the bug you found in inflate(), and from the remark that inflate / expand were swapped in the documentation.

FuPP
29th February 2004, 17:24
parameter added : special_Thr (will be renamed later). Default = 40, instead of 60 as previously.

Find unofficial 0.71b here (http://fupp.chez.tiscali.fr/HybridFuPP/HybridFuPP_071_b.zip)

@manao : I really can't remember : too much testing !!!

FuPP

bond
29th February 2004, 17:57
/me is confused now :D

1) is now inflate or expand more usable to make the mask on which it is used bigger?
2) what bug in inflate?
3) i dont really get what binarize does?
i thought it divides the picture into two parts: dark and bright, but my tests show it doesnt :D
it seems more to somehow higher/lower the indensity of the used processing on the whole frame...

edit: ok reading the whole doc is a good idea :D
it seems that by default binarize processes the everything except the dark areas, with "upper=true" only the dark ones are used

can someone plz clarify this and excuse my dumbness ;)

Manao
29th February 2004, 18:05
The first and last line were not properly computed in inflate. Expand and inflate are still usable to make the mask bigger, but now inflate will also make it bigger on the first and last rows.

Binarize behavior is simple : with upper = false, all the pixels under the threshold are set to 0, and over to 255. With upper = true, it's the contrary.

In the first case, the higher the threshold, the lesser the number of pixels set to 255. In the second case, it's the contrary.

bond
29th February 2004, 18:12
Originally posted by Manao
The first and last line were not properly computed in inflate. Expand and inflate are still usable to make the mask bigger, but now inflate will also make it bigger on the first and last rows.so expand doesnt handle the first/last rows?

Binarize behavior is simple : with upper = false, all the pixels under the threshold are set to 0, and over to 255. With upper = true, it's the contrary.

In the first case, the higher the threshold, the lesser the number of pixels set to 255. In the second case, it's the contrary.yep thanks i figured out that i had to use "upper=true" already

bond
29th February 2004, 18:19
hm there seems to be a bug with binarize (ok i know i have to be carefull with bugreports :D )

i use RGBAdjust(5, 1, 1, 1) to color the darkmask
now when i load the avs (upper=true) in vdm the whole first two frames are colored red whereas from the third one on this changes and only the dark areas are red (as it should be)

Manao
29th February 2004, 18:33
What I said wasn't clear. Expand was already working fine, but inflate didn't. Now both work fine. However, if both can be used to enlarge a mask, they have different behavior :

Expand will give a pixel the value of it's higher neighbour ( including itself ), whereas Inflate will give the value of the mean of the surrounding pixels, if that mean is higher than the original pixel ( else it left it untouched ).

For the bugreport, I'm going to a party right now, so could you please meanwhile post an avs script, because I didn't understand what you're doing. And also, consider that MaskedMerge merge each channel independently, and that by default, U and V are left untouched, and that in Binarize, all planes are processed by default ( In fact, I strongly suspect (Edit : read "I strongly doubt there is" )a bug in binarize, the function is too simple for that, however the behavior of MaskedMerge is really tricky )

bond
29th February 2004, 18:48
i uploaded samples showing the behaviour here (http://8ung.at/bond/red.zip)

1.png shows how frame #1 and 2 look like
2.png shows frame #3+

(btw how can i color the black parts, as i assume they are also treated like the visible red colored parts?)

this is the used testing script:

LoadPlugin("C:\...\mpegdecoder.dll")
LoadPlugin("C:\...\MaskTools.dll")
LoadPlugin("C:\...\SimpleResizeYV12.dll")

mpegsource("C:\...\movie.d2v")
trim(136757,145073)
crop(2,82,716,416)
HybridFupp(640,256,255)

function HybridFupp(clip input, int width, int height, int "sharpness")

{
resizemask = input.SimpleResize(width,height).edgemask(2,2,255,255,"sobel",y=3,u=1,v=1).inflate().ConvertToRGB32()
MoMask = input.SimpleResize(width,height).motionmask(25,25,255,255,22,y=3,u=1,v=1).inflate().converttorgb32()
DarkMasked = input.SimpleResize(width,height).Binarize(threshold=35,upper=true).Deflate().converttorgb32()

soft = input.SimpleResize(width, height).ConvertToRGB32()
MEdgesharp = Mask(input.SimpleResize(width, height).ConvertToRGB32(), resizemask)
MMotionblur = Mask(input.SimpleResize(width, height).ConvertToRGB32(), MoMask)
Dark = Mask(input.SimpleResize(width,height).ConvertToRGB32().RGBAdjust(5, 1, 1, 1), DarkMasked)

Addedgedsharp = Layer(soft, MEdgesharp, "add", sharpness)
AddMotionblur = Layer(Addedgedsharp , MMotionblur, "add", 255)
AddDarkblur = Layer(AddMotionblur , Dark, "add", 255)
return AddDarkblur
}

Originally posted by Manao
What I said wasn't clear. Expand was already working fine, but inflate didn't. Now both work fine. However, if both can be used to enlarge a mask, they have different behavior :

Expand will give a pixel the value of it's higher neighbour ( including itself ), whereas Inflate will give the value of the mean of the surrounding pixels, if that mean is higher than the original pixel ( else it left it untouched )ok i see, there is a big difference between inflate and expand
expand enlarges the mask _a lot_ more than inflate, too much for my taste (even if i lower the sharpening thresold) inflate with lower threshold seems somehow more accurate imho

btw hope you enjoyed the party ;)

FuPP
29th February 2004, 22:46
You seem to have a very strange version of HybridFuPP... ;)

Manao
1st March 2004, 01:20
I did enjoy it :)

For your issue : from my tests, the error do not come from Binarize. It comes from :
- deflate / inflate, used with default parameters ( which means that u = v = 1, so U and V planes are unpredictable )
- the combo converttorgb32 / mask, which seems not to put the luma of the mask into the alpha of the clip.

But it's late, I may be wrong. We'll see tomorrow.

Manao
1st March 2004, 10:20
At last, I found the what was happening.

It's not in the masktools however, it's in greyscale(), which doesn't have the same behavior in RGB32 and in YV12. By that, I mean the following ( input is a YV12 clip )input.binarize(upper=true,threshold=1).greyscale()
is totally identical to
input.binarize(upper=true,threshold=1,u=-128).greyscale()
but not to
input.binarize(upper=true,threshold=1).converttorgb32().greyscale()
and neither to
input.binarize(upper=true,threshold=1,u=-128).converttorgb32().greyscale()
which also differs from third one.
It's not a bug, it's just that switching from one color space to another is not a lossless operation, not only in regards to rounding.

So what was happening for you was that after the inflate(), you could not know what was in the U and V planes. It happened to have non zero value, which disturbed the creation of the Mask( which is a greyscale put in the alpha plane ). Hence, your mask was greyish, not black and white, hence all your picture was sometime redish.

You can avoid that by specifying inside the inflate / deflate, either u=-0 and v=-0, or u=3 and v=3 ( the first one is faster )

Edit : And, BTW, did you know that :mask = input.createmask().converttorgb32()
soft = input.blur(1).converttorgb32()
maskedclip = Mask(soft,mask)
return Layer(input.converttorgb32(),maskedclip,"add",255)is (almost) equivalent tomask = input.createmask()
soft = input.blur(1)
return input.MaskedMerge(soft,mask,y=3,u=3,v=3)Except for the rounding approximations ? But it's a lot faster, because there are no color conversions

m0rtal
1st March 2004, 10:30
link to the 0.71b leads to Error 403 page:

Le site demandé n'est pas accessible par cette url.
Le webmaster du site n'a pas nommé correctement sa page d'accueil.

Translate:

The required site is not accessible by this URL.
The webmaster of the site did not name its banner page correctly.

Manao
1st March 2004, 10:33
Right clic on the link, save as. Also, purge your browser's cache because it'll still remember that the link leads to error.htm.

m0rtal
1st March 2004, 10:38
Manao
done, thanks for help! :thanks:

bond
1st March 2004, 16:05
Originally posted by Manao
You can avoid that by specifying inside the inflate / deflate, either u=-0 and v=-0, or u=3 and v=3 ( the first one is faster ) hm when using .Deflate(u=-0,v=-0) or with u,v=3 i the all frames are red :(

And, BTW, did you know that... yes, i only use layer() for testing cause i cant use .RGBAdjust(5, 1, 1, 1) with maskedmerge(), which requires YV12 input...

do you know a nice way to color the masks with YV12?

Manao
1st March 2004, 17:27
Sorry for the u = v = -0, it was u = v = -128. With u = v = -0, the mask ( after converttorgb32().greyscale() is not black & white, but dark grey & light grey ), that's why you still were getting a redish clip.

To color a mask in YV12, there are afaik no other solutions than converting to rgb32 and then going back to yv12. But you can do it that way : red = input.converttorgb32().rgbadjust(5,1,1,1).converttoyv12()
mask = input.createmask()
return input.MaskedMerge(red,mask,y=3,u=3,v=3)It will still be faster than doing all the operation in RGB32, because data are easier to manipulate, also because there are twice less data to handle, and because you're converting only one clip to rgb.

bond
1st March 2004, 17:43
Originally posted by Manao
Sorry for the u = v = -0, it was u = v = -128. With u = v = -0, the mask ( after converttorgb32().greyscale() is not black & white, but dark grey & light grey ), that's why you still were getting a redish clip.worked, thanks :)

hm last question: is this problem only there because i did the color conversion and therefore will not happen with yv12 only or should i use .Deflate(u=-128,v=-128) also with YV12/maskedmerge?

Manao
1st March 2004, 17:53
It is due to color conversions. In YV12, MaskedMerge is a lot more powerful than Layer, since it allows three different masks, one for each planes, and you can choose the ones being considered. So you don't have to care about u and v parameters of previous filters in the chain if in MaskedMerge, you keep these two planes intact.

bond
1st March 2004, 18:07
ok thanks

to sum it up: simply deflate() is enough for hybridfupp

FuPP
1st March 2004, 19:58
@Bond

Why are you still using conversions ? I don't use them anymore since 0.2b !

About greyscale : it seems to me that you had asked why I used it, and I had answered you it was not necessary (I used it formerly to visualize mask during tests, and I had forgotten to remove it). Is there any specific reason you still use it ?

Regards,
FuPP

bond
1st March 2004, 22:19
Originally posted by FuPP
Why are you still using conversions ? I don't use them anymore since 0.2b ! as i said simply to be able to mark he different masks with adjustrgb
with the final script i will use maskmerge() of course

About greyscale : it seems to me that you had asked why I used it, and I had answered you it was not necessary (I used it formerly to visualize mask during tests, and I had forgotten to remove it). Is there any specific reason you still use it ?hm, where do i use it?

FuPP
2nd March 2004, 00:56
hum, it seems I have read the posts too quickly (I was in a hurry when I did) : I missed your explanations about RGBadjust and have been confused by Manao explanation :

It's not in the masktools however, it's in greyscale(), which doesn't have the same behavior in RGB32 and in YV12.

Sorry for that ;)

Regards,
FuPP

bond
5th March 2004, 21:39
i played now with the filtering of dark scenes (via binarize()) and it seems to work fine

for testing i choose unfilter(-150,-150), i didnt try blindpp() cause i dont use mpeg2dec3, but mpegdecoder (fupp, is there a special reason why you chose blindpp for dark mask filtering?)

my results with this unfilter setting, binarize(threshold=35) and putting the darkmask on top of/after the edge and motion mask i got a compressibility increase of about 6%
when comparing the script output with the one not using darkmasking its of course seeable that some dark parts are strongly smoothed but i wonder if these details could be seen anyways? also if these details are somewhere in the background...

hope some people do testing and report their findings (any other opinions how to best filter dark areas?) as i think this masking stuff and hybridfupp is simply great :)

kwag
6th March 2004, 03:24
@FuPP,

Please take a look at my second post here: http://www.kvcd.net/forum/viewtopic.php?t=9063&postdays=0&postorder=asc&start=64


-kwag

Manao
6th March 2004, 09:37
@all : I think he is currently in holidays, so you'll have to wait a little.

bond
6th March 2004, 10:18
lo kwag

maybe i am blind, but i dont see what you see on these screenshots :confused:
can you plz describe a little bit better what you mean :)

but from your description i think you mean a ghosting effect, which can be due to some too strong temporal filtering (too high fluxsmooth values, which shouldnt be the case with the "high" preset tough)

also troubles can happen with scene changes if the scene change value is not right set to detect the scene change:
the lower the scene change value the more often scene changes are detected/the less (high-)motion is detected as motion but as scene change (meaning you get lower compressibility)
if the value is too high every high-motion is detected as motion and therefore blurred as it should be, but also the scene changes are detected as high-motion and not as scene changes and therefore the scene change frame is blurred strongly
you see its a trade-off :(

in the latest script fupp uses by default 33 as scenechange threshold, which is pretty strong (meaning high-motion is detected correctly, but scene changes are not)
i use a value of 22

kwag
6th March 2004, 10:52
Originally posted by bond
[B]lo kwag

maybe i am blind, but i dont see what you see on these screenshots :confused:
can you plz describe a little bit better what you mean :)
Hi bond,

Look at the the second picture, and you'll see the "halo" of the planet from the first picture. But it's not present on the third picture.

but from your description i think you mean a ghosting effect, which can be due to some too strong temporal filtering (too high fluxsmooth values, which shouldnt be the case with the "high" preset tough)I used the FuPP script with default values, and "high" preset".
No other filters were added.

also troubles can happen with scene changes if the scene change value is not right set to detect the scene change: That could have been the case if I had encoded something, and then seen the artifact. But those screenshots were taken by capturing the video frame from VirtualDub, after opening the FuPP .avs script directly.

-kwag

bond
6th March 2004, 11:06
Originally posted by kwag
Look at the the second picture, and you'll see the "halo" of the planet from the first picture. But it's not present on the third picture.hm ok if i zoom in 500% or so i see the halo a little bit, but i doubt this can be seen during playback anyways? also its only on 1 frame
but yes its there, hm maybe thats caused by fluxsmooth? try replacing ".FluxSmooth(ST_Str, -1)" in the .avsi with ".TemporalCleaner(3,6)" and try again plz (you will have to load the temporalcleaner dll too)

That could have been the case if I had encoded something, and then seen the artifact. But those screenshots were taken by capturing the video frame from VirtualDub, after opening the FuPP .avs script directly.no need to encode something, all these effects are caused by avisynth filtering not by the encoding process

itcth
7th March 2004, 04:52
I have DV avi footage to be encoded to VCD.Please advice any modification in your great HybridFupp function.

Regards,http://www.itctechnology.com/pic/poosit.gif

Chainmax
7th March 2004, 23:28
So, for a script that contains the following lines (among others):

crop(10,4,704,472,align=true)
aWarpSharp(depth=16.0,cm=1)

Using HybridFuPP(640,480,preset="high") would be ok, right? Or maybe should I set sharp_x and sharp_y to 0?

rds_correia
9th March 2004, 23:29
Hi guys,
I came from kvcd.net and I'd like to give hybridfupp a shoot with mencoder for win32 and ffvfw.
Both encoders are still, a bit, on early stages but are giving me pretty nice results on mpeg2 high bitrates.
But when I try to download from the first page of this thread I get a homepage in french saying that the name of the page is probably mispelled.
Also I tried to load this Masktools 1.4.13 but I've only found 1.4.9 until now.
Could somebody give me a hand?
Cheers and thanks

Manao
9th March 2004, 23:35
Have a look here : http://forum.doom9.org/showthread.php?s=&threadid=67232

Or directly here : http://www.geocities.com/manao47/Filters/masktools-v1.4.14.zip ( right click on the link and copy and paste the link in your adress bar )

rds_correia
9th March 2004, 23:43
Wow,
That was fast Manao. Thanks :)
One thing I think I didn't make clear is that I also can't download HybridFupp, too.
That is the one displaying the French homepage.
Could you help me downloading it from another location?
Thanks pal

DarkWave
9th March 2004, 23:47
hi,

i just found this thread and started to do some samples, but all i get is an error:

http://members.lycos.co.uk/darkwavesforum/pics/fupp.jpg

my main-script looks like this:
# PLUGINS
LoadPlugin("C:\PROGRA~1\dvd\GordianKnot\MPEG2Dec3.dll")
LoadPlugin("C:\PROGRA~1\dvd\GordianKnot\undot.dll")
LoadPlugin("C:\PROGRA~1\dvd\GordianKnot\FluxSmooth.dll")
LoadPlugin("C:\PROGRA~1\dvd\GordianKnot\UnFilter.dll")
LoadPlugin("C:\PROGRA~1\dvd\GordianKnot\MSharpen.dll")
LoadPlugin("C:\PROGRA~1\dvd\GordianKnot\MaskTools.dll")
#
# SOURCE
mpeg2source("E:\some-film-name\sample\sample.d2v")
#
# CROPPING
crop(0,0,720,576)
#
# HybridFuPP
hybridFupp(640, 352, preset="high")

i downloaded all plugins from warpsharp-directory.

can somebody help?

thx in advance
DarkWave

Manao
10th March 2004, 00:28
rds_correia : the HybridFuPP homepage has the same problem as mine : you can't link directly to a file from outside the website. So you have to right clic & copy the link. The problem is that your navigator will remember that the link leads to the error page, so you have to purge the cache of your navigator ( or use another one ).

DarkWave : your MaskTools dll is not up to date, follow the link I gave a few posts earlier to update it.

DarkWave
10th March 2004, 00:41
@Manao:
thx for your fast help, it works now ;)

i searched the error in mpeg2dec3, because mpeg2dec had the parameter MotionMask, too...

DarkWave

rds_correia
10th March 2004, 00:55
@Manao
I succeeded d/ling it and will try it tomorrow.
Thanks again, Manao.
Cheers

jkwarras
10th March 2004, 11:40
I've been testing this function (0.71b) on 3 films:

- Traffic (2h20) - grainy movie (very grainy on mexico scenes)
- Swimming pool (1h40) - normal film grain
- Haute tension (1h40) - clean

Settings:

- XviD 1.0 RC3: Mpeg, Motion search=6, chroma motion, 3bframes, trellis, adaptative quant, others are default. 2 pass scenario.

- Audio: Vorbis q2.50.

- Objective: 1 XCD -->+- 790 MB. and 640 x XXX resolution (16:9).

After encoding audio, bitrate for video, and hybridFupp preset used was:

- Traffic: 750 kbps - hybridFupp(high)
- Swimming pool: 1050 kbps - hybridFupp(medium)
- Haute tension: 1090 kbps - hybridFupp(medium)

No other filter, denoising applied except Undot() and Lumafilter().

Results:

- Traffic: Low bitrate and really hard to compress film for a 1 XCD target. Result is quite blocky and sharpening 'enhance' compression artefacts and mosquito noise. On Mexico scenes, 'dancing walls' effect is very obvious but heavy film grain is gone. I think using High preset wasn't a good idea, too 'light' denoising for a very hard encoding :)

- Swimming pool and Haute tension: Bitrate medium and +- clean sources. I decided to use the 'Medium' preset, which seems to denoise well, while preserving much details. Didn't try the 'low' preset because the mod16 limitations. Results is a very good encoding, looks good, no block, no 'dancing walls', no mosquito noise :) The only thing I can point out is that sometimes edges are too much oversharpen and we see a little dancing around edges. It's a sort of little mosquito noise. But you must look real close to notice it.

For me, I think the default one, 'medium' is a good one. I keep the preset and adopt the script as 'default' to all my encodes, leaving QMF behind :)

Good work, and thanks for this great script.

Chainmax
11th March 2004, 22:02
I am using the following script in my current encode:

mpeg2source("C:\MPEG-4\Grave of the Fireflies\GotF.d2v")
Telecide(order=1,guide=1,post=2,vthresh=25,blend=false,chroma=true,back=1,bthresh=15)
Decimate(cycle=5,mode=2,quality=3)
Undot()
Dup(threshold=1)
MipSmooth(preset="movieHQ")
hybridFupp(592,320,preset="high")

And when trying to play the avs through media player 6.4 I get this error message:

Script error: there is no function named "UnFilter"
(SSTov, line 91)
(SSTov, line 61)
and points to line 7 of the script. I have the latest MaskTools (1.4.14), if that helps.

FuPP
11th March 2004, 22:45
Which version of HybridFuPP did you use ? Did you put unfilter.dll in your plugin directory or did you load it in a previous part of your script, as explained in the readme file ?

Cheers,
FuPP

Chainmax
11th March 2004, 23:11
I'm using HybridFuPP 0.71b and everything is in the plugins folder. I have read the readme several times, but somehow I missed the line where it says to load the required dlls in a previous part of the script :o.

FuPP
11th March 2004, 23:31
if "everything" (ie unfilter I guess) is in your plugin directory, loading the dll in your script is not required...

Chainmax
12th March 2004, 00:55
I know that. I thought that the readme meant that the DLLs had to be moved away from the plugins folder and loaded manually, so I did. Now I get this error message:

UnFilter: Supports YUY2 color format only
(SSTov, line 91)
(SSTov, line 61)

and again it points to the hybridFupp line :confused:.

Manao
12th March 2004, 01:12
Chainmax : you're trying to use the unfilter dll for avisynth 2.0. ( or at least a version that support only YUY2 ). Update your version of UnFilter.

Chainmax
12th March 2004, 01:23
I downloaded the latest version from Tom Barry's website. I must have unzipped the wrong DLL from the zip file then...

[edit]
Yeah, that was it. Now media player opens it up with and without plugin autoloading. Of course, it does give me an access violation error like the last 3-4 encodes I tried to do :(. That's a ram issue and I can't solve it for now. Thanks for the help anyway :):(.

FuPP
12th March 2004, 01:24
Yep, Manao is right.[edit : oops, Chainmax has answered faster than me !]

@Manao : thanks a lot for support provided during last days !

@all : Thanks a lot once more for your feedback. A new and very powerful version is ready and will be posted very soon. I need to finish the doc first...

Cheers,
FuPP

DarkNite
12th March 2004, 08:01
A new and very powerful version is ready and will be posted very soon.

/me opens Job Manager, presses Abort button and waits patiently

troy
14th March 2004, 05:50
I have a dv avi file I am trying to use this filter with.

I put the hybridfupp.avsi file in
D:\Program Files\AviSynth 2.5\plugins

I tried this script:
----------------------------------------------------------------
Import("D:\Program Files\AviSynth 2.5\plugins\Hybridfupp.avsi")

avisource("D:\russia\test.avi")
converttoyuy2()


LoadPlugin("d:\plugs\mpeg2dec3.dll")
LoadPlugin("d:\plugs\undot.dll")
LoadPlugin("d:\plugs\fluxsmooth.dll")
LoadPlugin("d:\plugs\msharpen.dll")
LoadPlugin("d:\plugs\masktools.dll")
LoadPlugin("d:\plugs\unfilter.dll")

#hybridfupp(448,320,12,7,10,30,9,32,17,1,5,true,true,true,30,0)
hybridfupp(480,480,preset="high")

DoubleWeave().SelectOdd()
--------------------------------------------------------------------
and got this error:
MotionMask: Needs yv12 data
(D:\Program Files\Avisynth 2.5\plugins\Hybridfupp.avsi, line 116)
etc......

If I try this script:

-----------------------------------------------------------------

#Import("D:\Program Files\AviSynth 2.5\plugins\Hybridfupp.avsi")

avisource("D:\russia\test.avi")
converttoyuy2()


LoadPlugin("d:\plugs\mpeg2dec3.dll")
LoadPlugin("d:\plugs\undot.dll")
LoadPlugin("d:\plugs\fluxsmooth.dll")
LoadPlugin("d:\plugs\msharpen.dll")
LoadPlugin("d:\plugs\masktools.dll")
LoadPlugin("d:\plugs\unfilter.dll")

#hybridfupp(448,320,12,7,10,30,9,32,17,1,5,true,true,true,30,0)
hybridfupp(480,480,preset="high")

DoubleWeave().SelectOdd()

-------------------------------------------------------------------

I get the error:
Script error: there is no function named "hybridfupp"
(D:\DOCUME~1\ADMINI~1\Desktop\HYBRID~1.AVS, line 15)

Also am I wasting my time trying to use this filter on a dv avi source?

Manao
14th March 2004, 08:23
troy : "MotionMask needs YV12 data" -> instead of putting a ConvertToYUY2, put a ConvertToYV12

"No function named hybridfupp" : you commented out the loading of the avsi...

FuPP
14th March 2004, 14:42
New version ! see post #1 for downloading

be careful : you must use avisynth 2.55 and masktools 1.4.14

0.84b:

- It is now possible to create personal processing chains
- advanced debug mode (displayed with colors, modes can be now combined)
- added a strength parameter for dark areas processing
- more speed
- no more limits concerning final size for chroma and dark (called ‘special’ in 0.7x versions) modes
- deringing (optional) is now done after resizing. Mod 16 size limit concerns now only final size.
- be careful : some parameters have been renamed (ex : special -> dark).
- parameters order has changed ! so be careful if you used unnamed parameters in previous releases : ex hybridFupp(448,320,12,7,10,30,9,32,17,1,5,true,true,true,30,0)

FuPP

Dreassica
14th March 2004, 16:33
getting error:

Motionmask does not have named argument "thY1"
(tomsv, line 177)
(tomsv, line 100)
(tomsv, line 88)

Using masktools 1.4.14 and avs 2.55, also loaded al needed filters.

my usage: hybridfupp(576,432)

Manao
14th March 2004, 16:43
Dreassica : Which MPEG2DEC version do you use ? 1, 2 or 3 ? If it's the second, then that's why you get an error. This one also have a filter named MotionMask which conflicts with the one in the masktools.

To by pass that, either :
- Use MPEG2DEC3 instead of MPEG2DEC2
- or download the last avisynth's version ( alpha 2.55 from today ), and inside the FuPP script, changes every references to MotionMask by MaskTools_MotionMask.

Dreassica
14th March 2004, 16:47
Well i'll be damned!! I totally forgot to disable that line :)Thnx :D

kwag
15th March 2004, 06:45
Many thanks to "jorel" for pointing out the issues corrected now on FuPP ;)
http://kvcd.net/forum/viewtopic.php?t=9063&postdays=0&postorder=asc&start=128

-kwag

m0rtal
16th March 2004, 15:21
Hey FuPP, why don't you make two packages - with and w/o essential plugins?

FuPP
16th March 2004, 19:43
hmm. I suppose that if I include original packages, all authors would agree... So why not ? I'm going to think about that :)

FuPP

m0rtal
17th March 2004, 07:40
FuPP
thanks! I think it would be very useful :)

FuPP
27th March 2004, 20:02
Originally posted by toliman
i tried to use FACAR for automating overscan borders/filters, but it is too wieldy + inaccurate... so instead, i'm going to rebuild a compact HyFuPP avs script for a DVD2SVCD frameserver, using GripCrop/Resize/Borders to add the overscan borders for tv/dvd-output.


I have had a look to GripFit (ie GripCrop + GripSize + GripBorders) and discovered that it is really easy to use it with HybridFuPP ; you simply have to use GripFit_resize_width and GripFit_resize_height variables as width and height inside the HybridFuPP function call

ex :


GripCrop(480,576,overscan=2,source_anamorphic=true,dest_anamorphic=true)
HybridFuPP(preset = "medium", width = GripFit_resize_width, height = GripFit_resize_height)
GripBorders()


Regards,
FuPP

toliman
28th March 2004, 08:19
thanks for looking into it for me.

i don't spend nearly enough time here to get a comprehensive look at video encoding, there's _always_ something new to learn.

scharfis_brain
4th April 2004, 03:04
I've took a small look into this little script an think, that a Motionmask, created like this:


x=motionmask(clip,params).binarize(th)
mm=overlay(x,x.duplicateframe(0),opacity=0.5).binarize(192)

this will avoid double-contured motion-masking
(ex: a moving ball will become a moving eight or two moving balls within one frame, but only the ball itself is needed)

Fupp, what Du you think about this?

edit: this will also avoid all scenechange-problems!

bond
4th April 2004, 14:31
Originally posted by scharfis_brain
this will avoid double-contured motion-masking

edit: this will also avoid all scenechange-problems!hm sounds great!

will test asap

Didée
4th April 2004, 15:07
scharfis_brain: good idea - seems like some thrown seeds finally germinated ;)

One problem, though: if your ball is moving only half its diameter from one frame to the next (giving the "8" motion mask), then killing out with the "8" frome the next frame will bite away a bit from the ball in the current frame, creating a "half-moon" - like shape ...

But generally, when dealing with temporal related masks, in many cases it's the right idea to black out the mask with its temporal neighbors.

- Didée

scharfis_brain
4th April 2004, 15:27
One problem, though: if your ball is moving only half its diameter from one frame to the next (giving the "8" motion mask), then killing out with the "8" frome the next frame will bite away a bit from the ball in the current frame, creating a "half-moon" - like shape ...

No!

I do an AND-connection between two temporal following motionmasks.
this means, only white pixels in both masks are getting into the outputt mask.

if the ball is moving by half-diameter (or halfradius; that doesn't matter) we have three spatial positions.
position A & B mixed into the first MoMask and position B & C into the following one.

doing an AND-connection between both masks delivers only position B fitting exactly the the ball.

no moon-like-shape here.

am am currently building a deinterlacer upon this masking strategy.
it removes noise in no-motion parts and only deinterlaces the moving parts, unlike conventional deinterlacers that always deal with the double-ball, or eight-ball motionmask.

Didée
4th April 2004, 18:11
Ooops, I did it again:

overlay( x, x.duplicateframe(0), ...)

That produces the "past" clip, lagging 1 frame behind. AND'ing this with the presence clip gives - the right thing, of course! (Opposed to NAND'ing with the "future" mask, as I wrongly assumed above.)

Dunno why I always tend to mix up those clips shifted one frame into past or future, and always must think twice which one is which ... perhaps I'm simply getting old ;) -- (or I spent too much time breeding over temporal edge masking, where the logic is working just the other way round.)

Awaitening ScharfisFineMotionMappedDeinterlace() :)

- Didée

FuPP
6th April 2004, 20:58
Originally posted by scharfis_brain
I've took a small look into this little script an think, that a Motionmask, created like this:


x=motionmask(clip,params).binarize(th)
mm=overlay(x,x.duplicateframe(0),opacity=0.5).binarize(192)

this will avoid double-contured motion-masking
(ex: a moving ball will become a moving eight or two moving balls within one frame, but only the ball itself is needed)

Fupp, what Du you think about this?

edit: this will also avoid all scenechange-problems!
Hi sharfis_brain !

I was away for a few days, this is the reason why I did not answer you. This is very nice from you to have had a look to HybridFuPP !

Actually, I need your help to understand a few things about what you propose :

1/ if C is the current frame, B the previous one, and A the one before B :

a/ motionmask(clip C...) shows the differences between B and C (ie "motion")
b/ C.duplicateframe(0) "shows" frame B
c/ motionmask(clip C.duplicateframe(0)...) shows the differences between A and B
d/ so, 'motionmask(clip C...) AND motionmask(clip C.duplicateframe(0)...)' shows the motion on frame B (ie common parts between motionmask(C..) and motionmask(B..)

=> Question (hope that all previous statements are right :rolleyes: ) : why applying motion mask of frame B on frame C ( = current frame) ?


2/ I can't see :


x=motionmask(clip,params).binarize(th)
mm=overlay(x,x.duplicateframe(0),opacity=0.5).binarize(192)
equivalent to :


x=motionmask(clip,params)
mm = Logic(x,x.duplicateframe(0),"And")
Though, this last one seems to do what you describe (only shows common parts)...

I probably missed something, or simply did not get you :confused: . Don't shout at me ;) !

kind regards,
FuPP

Yuri
8th April 2004, 20:28
hello everybody
First of all, thanks for such a great script!

What could be wrong with my script or anything when trying to open it in VDub
************
LoadPlugin("E:\Program Files\AviSynth 2.5\LoadPluginEx.dll")
LoadPlugin("E:\Program Files\AviSynth 2.5\olds\DustV5.dll")
LoadPlugin("E:\Program Files\AviSynth 2.5\plugins\plug-ins-25\SangNom.dll")
LoadPlugin("E:\Program Files\AviSynth 2.5\plugins\plug-ins-25\mpeg2dec.dll")
LoadPlugin("E:\Program Files\AviSynth 2.5\plugins\plug-ins-25\mpeg2dec3.dll")

SegmentedAVISource("C:\video_0.avi").Trim(0,115448 )

Letterbox(4,12,4,4)
hybridFupp(688,528)
AddBorders(16,24,16,24) #(left,top,right,bottom)
ConvertToYUY2()
**************
I get the message:
----------
Avisynth open failure
Script error: MotionMask does not have a named argument "thY1"
------------
?
the HuPP's script is loaded through the HybridFuPP.avsi from the plugin directory, so are all the necessary filters.

Please help.
Regards.

FuPP
8th April 2004, 20:47
comment 'LoadPlugin("E:\Program Files\AviSynth 2.5\plugins\plug-ins-25\mpeg2dec.dll")'

I believe that there is a 'motionmask' function in this dll that conflicts with the one in masktools.dll

Btw, I can't see why you load all these dlls :confused:

Yuri
8th April 2004, 21:02
FuPP!
Great!
I get it working now! Thanx.

I need(ed) the three filters for splendid scharfis_brain's bobmatcher

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

thank you again.

Zom-B
15th April 2004, 12:01
Hey guys...
Beware of using the new MaskTools v1.4.15.2 with HyperFupp!
VirtualDubMod Crashes by using HybridFupp with this new version of MT (without any comment about MT!!!)...
v 1.4.15 still works fine for me!

Thanks for this nice script!

\Zom-B

Manao
15th April 2004, 12:20
I'll look into it as soon as I can download the latest version of HybridFuPP ( website down for the moment )

Edit : OK, I made a test, and it works, no errors. Could you post a sample please ( version of HybridFuPP, script in which you're using it )

scharfis_brain
15th April 2004, 12:41
@Fupp:

I'd use the overlay().binarize() combo, because I didn't know about the Logic oparation built into masktools.


okay I'll try to explain my thoughts again.

lets assume

A is the prev Frame
B is the curr Frame
C is the next Frame

motionmasking at frame B will return the motionmasking between A & B
motionmasking at frame C will return the motionmasking between B & C

now lets anding those following masks will return only the motion of B, because (A + B) & (B + C) = B

And yes, this Code is correct!
x=motionmask(clip,params)
mm = Logic(x,x.duplicateframe(0),"And")

It equals to my overlaying-binarize code, because if overlaying both masked clips, areas where both clips are white, remain white, while ares where only one of both is white the output will become grey.
binarize will drop the grey to black, et viola we have an AND operation.
choosing a far lower binarize threshold will give us an OR operation, because grey is raised to white!

LigH
15th April 2004, 12:47
Currently, no download possible (403)...

Manao
15th April 2004, 13:07
@scharfis_brain : You can't delete echos created by motionmask. It's inherent to the way the filter is working, and when you try to solve that 'issue', you're making quick assumption. Most of the time, a ball moving moves by less than its diameter. so you indeed have two 'half moons'. But, they are moving between frames, so trying to make and 'And' between them could result in their deleting.

Futhermore, (A+B)&(B+C) != B, in fact it's B + (A&C).

Concerning equivalence of combos using binarize & logic, always prefer logic, it's a lot faster.

@LigH : I put up the latest version on my website, till Fupp's one is up again :

http://www.geocities.com/manao47/Filters/HybridFuPP_084_b.zip

scharfis_brain
15th April 2004, 13:23
Manao: I am using a very similar technique within my intellibob, and it works VERY well, ANDing two following masks!

lets assume the Ball is moving hor. by its half radius.
we are getting an 90 degrees rotated 8-like mask. for the curr. Frame.
where the Shape of the ball of the prev and curr are nixed together.
for the next frame we are getting the same eight-like mask but with the mixed shapes of the curr & next frame.

anding those both mask will only return the ball itself, because the moon-like shapes ath e left (prev) & right(next) are only appearant into ONE of both masks, while the ball itself (curr) is appearant within both masks!

take a look at my intellibob-sample, and you'll see, what I mean!
http://home.arcor.de/scharfis_brain/intellibob/
the 2nd row show normal motionmasking
the 3rd row shows ANDed motionmasking

EDIT :
Futhermore, (A+B)&(B+C) != B, in fact it's B + (A&C).
Oh, yes, I was NEVER good in doing logic formulas!
But: if (A+B)&(B+C) = B + (A&C) and A & C are never true at the same time (A = prev moon and C = next moon) then the result = B without neither A nor C

Zom-B
15th April 2004, 13:43
@ Manao
I used this scipt with HybridFupp 0.84b:

SetMemoryMax(256)
mpeg2source("F:\VIDEO_TS\test.d2v")
crop(0,78,720,420)
VagueDenoiser(threshold=1.0,method=1,nsteps=6,chroma=true)
HybridFuPP(720,288,Preset="High")

I retestet this, after rebooting.
No more problems with the new MT, but I always get an Error message when closing Virtual Dub (v1.5.10.1 build2439),
and here begins the funny part:
get this error allways, even if I open this script
mpeg2source("F:\VIDEO_TS\test.d2v")
This is the error message:

http://www.zom-b.de/bug.jpg

It looks like this problem hasn't to do somethink with MT or HybridFupp, but with my machine/system.
Pardon guys for panik you, and stealing your time :( :( :(

Manao
15th April 2004, 13:56
scharfis_brain : have a look :First mask ( between prev and curr )

xxxxxxx
xxxxx xxxxx
xxxxx xxxxx
xxxxx xxxxx
xxxxx xxxxx
xxxxx xxxxx
xxxxx xxxxx
xxxxxxx

Second mask ( between curr and next )

xxxxxxx
xxxxx xxxxx
xxxxx xxxxx
xxxxx xxxxx
xxxxx xxxxx
xxxxx xxxxx
xxxxx xxxxx
xxxxxxx

Result of the and :

xxx
x x
x x
x x
x x
x x
x x
xxxMotionMask only grabbs moving edges, not moving areas.

Else, I had a look at your script, you may want to replace all your levels / utoy by YV12LUT, it would be faster.

Zom-B : I'm glad the MaskTools aren't the culprit. For your issue, check your memory, don't use VdubMod 1.5.10.1

scharfis_brain
15th April 2004, 14:09
jep, this is exactly, what I meant!
(I've always forget to mention, the I am assuming a texturized ball)
ANDing completely removes the double-shaping.

Manao
15th April 2004, 14:24
Alright, then I understand you. But you'll find it's very difficult to set the thresholds in order to get the motion inside the texture, without having it elsewhere where there are in fact no motion at all, just noise.

FuPP
15th April 2004, 21:41
Hi Sharfis,

I think I have partially solved the "mystery" : using a lower threshold than 192 seems to give me the right "AND - type" mask.

But I still have a problem :

if :

A is the prev Frame
B is the curr Frame
C is the next Frame

and the code is

x=motionmask(B,params)
Logic(x,x.duplicateframe(0),"And")

for me, both motionmask(B) and motionmask(B).duplicateframe(0) give me something before B. So the resulting mask can't be something between A and C, but only between A and B. Once more I probably miss something (about duplicateframe(0), maybe...), but I can't see what.

FuPP

scharfis_brain
16th April 2004, 01:14
try to use trim(1,0) instead of dup(0)

if that doesn't help, you can shift the mask temporarily using
several instances of dup(0) or trim(1,0) after the masking is done.

Chainmax
26th April 2004, 21:32
I can't access SansGrip's page, so I downloaded a fixed version (v1.01) made and posted by Sh0dan in this thread (http://forum.doom9.org/showthread.php?s=&threadid=64831&highlight=fluxsmooth). Will HybridFuPP work with it?

FuPP
27th April 2004, 12:09
I think so. Btw, I'm going to post very soon a new version that does not require Fluxsmooth anymore :)

Regards,
FuPP

scharfis_brain
27th April 2004, 12:42
Fupp, have you got the ANDed Motionmasked working?

FuPP
27th April 2004, 13:01
Yes Sharfis ! Using trim it works fine ! My point was about your use of duplicateframe(0) as I could not get the results you described :) (and as I didn't know that command very well, I couldn't get If I was doing something wrong or not...)

Regards,
FuPP

scharfis_brain
27th April 2004, 13:38
cool.

but, I like the 'c' within my nick :)

please call me scharfi...

FuPP
27th April 2004, 18:11
oops ! sorry for that.

As a punishment, You can forget the last 'P' of mine :)

Regards,
FuP*

Chainmax
27th April 2004, 19:05
I am using HybridFuPP on a 1CD anime rip (Grave of the Fireflies). I will comment on the results as soon as the encode is finished. Do you guys want me to upload a sample and examine the end result too?

Mug Funky
27th April 2004, 19:09
i'd love to see some samples, chain.

all my filtering is theoretical, as i simply don't have time to use most of them in encodes... other people have to use this computer unfortunately.

FuPP
27th April 2004, 19:23
@chainmax

You should probably wait for the new version, coming very soon. I'm finishing the english version of the doc. I will also probably need to do a few tests more. Hope it will be ready before the end of the week.

Regards
FuPP

Chainmax
27th April 2004, 21:36
Well, the second pass will finish in about three hours...will this new version be that much better? The computer I'm encoding on is not mine and I don't know how much longer will I be able to use it.

FuPP
27th April 2004, 22:01
How could it be ? :D

But I hope so ;) I think though that for 3 hours, you can let your encode finish...

Regards,
FuPP

Chainmax
28th April 2004, 01:25
Ok, the encode finished and what do I do? When deleting all the leftover files (the vobs, the audio file, etc) I DELETE THE FREAKING MOVIE!!!!!!!:angry: I guess now I can wait for the new release :mad: :(.

scharfis_brain
28th April 2004, 05:05
Try Norton's Undelete.

FuPP
28th April 2004, 07:38
LOL

Sorry,
FuPP

Chainmax
28th April 2004, 16:51
The computer I made the encode on doesn't have Norton installed and I was stupid enough to install a file recovery program after the accidental deletion.
I had the chance to check out the encode, though. I didn't examine the video closely and my sight isn't trained enough to recognize subtle artifacting, but it seemed pretty nice for a ~820kbps video at 592x320. Once the new HybridFuPP version is out I'll try to encode again and post some samples here. You guys will just have to wait a little longer :).

FuPP, what will you replace FluxSmooth with? Deen? Mipmooth?

Mug Funky
28th April 2004, 17:24
592x320?

next time try 688x384... that's my current fave. very good for noise-free anime (such as that in my avatar), and worked well for "being john malkovich" and "bladerunner"... all 1CD rips with original soundtrack.

sorry to hear about your loss :( i send my condolences to your hard drive :)

Chainmax
28th April 2004, 19:27
688x384 is not an 1.85:1 aspect ratio. Besides, what kind of filtering do you need in order to fit an almost 2 hour movie in one CD anyway? I'd guess it would look awfully blurry, and I really hate blurring. With 592x320, I can get away with just MipSmooth(movieHQ), HybridFuPP(high) and MSharpen().

FuPP
28th April 2004, 21:14
Originally posted by Chainmax
FuPP, what will you replace FluxSmooth with? Deen? Mipmooth?
Deen.
Originally posted by Chainmax
With 592x320, I can get away with just MipSmooth(movieHQ), HybridFuPP(high) and MSharpen().
Do you really use all these filters together ? It seems not necessary. HybridFuPP should be enough, using presets to get more or less spatial and temporal filtering (you can though adjust the parameters if needed) and using E_Str_X and E_Str_Y parameters to get edge enhancement if needed.

Regards,
FuPP

DarkNite
28th April 2004, 23:22
Mmmm... Deen. One of my all time favorites. :)

This new version and some of the DVD's I've recently acquired are going to call for a nice long run of tests. Which will hopefully result in useful feedback, or at least amusing banter.

Chainmax
28th April 2004, 23:26
Well, I don't know how are the plugins used in HybridFuPP. I used MipSmooth(high) in order to hide remaining artifacts, not to increase compressibility. As for MSharpen, I wanted to use the defaults and I don't know how they correspond to the E_Str_X and E_Str_Y parameters, so I set those to 0 and caled MSharpen from outside HybridFuPP.

jorel
29th April 2004, 11:08
Originally posted by DarkNite
Mmmm... Deen. One of my all time favorites. :)


i like Deen too(much). a few days i pm to WarpEnterprises and told about last Deen,i wrote the same to FuPP last month and last year in the Deen thread searching for new version... http://forum.doom9.org/showthread.php?s=&threadid=41643&perpage=20&highlight=deen&pagenumber=2
hey, chronological post and chronological taste for this filter. :)

@ FuPP
FuPP, you will use Deen in HybridFuPP?

@ Mug Funky (excuse me if off-topic here my friends)
can be used in the agc(great too)script?