View Full Version : iip: Integrated Image Processor, e.g. DVD -> 720p HDTV


Didée
15th February 2004, 20:35
Hello folks,

this is an early version of iip: integrated image processor. (I don't like the name too much, but didn't come up with a better one.)

Its main purpose is upconversion from DVD resolutions to (pseudo-) HDTV resolutions. It should work, however, also for just processing at native input resolution, or even for traditional downsizing. The default parameters are chosen for upconversion, and probably should be adopted for smaller resolutions.
This script aims at natural sources only! For animated/cartoon content, you are probably better of with mf's mftoon & sharpresize.

I wrote this script for the following reasons:
- after denoising a clip, much detail is attenuated also, or even gone away completely.
- DVB broadcasting in Germany is often very poor, and this script is just what I needed for these sources.
- plain fun of fiddling around

So, what does it do exactly?

- it will test your patience! ;)

1. Basic denoising of the clip
2. Sharpen the picture up, excluding already hard edges to avoid oversharpening. This step can be done in a small supersampled stage, to get (a little) finer granularity.
3. Big Supersampling, applying Xsharpen for better edge definition.
4. Now search for edges again. Areas without edges get the original, denoised, not-sharpened picture applied. This should give the best relative compressability for any level of detail enhancement.


The denoising is currently hard-coded to PixieDust. If you want to try any other denoiser, you must change the function itself for now - no hard job, its only one line in the function.
However, in my opinion the dust filters still are offering the best ratio of "compressability/preserved detail", and that's why I've build the whole function around PixieDust.

The basic usage looks like this:
LoadPlugin("path\to\undot.dll") #
LoadPlugin("path\to\MaskTools_v1.4.9.dll") # These plugins
LoadPlugin("path\to\WarpSharp.dll") #
LoadPlugin("path\to\LoadPluginEx.dll") # are required!
LoadPlugin("path\to\dustv5.dll") #

Removed. See update on this thread's page 6 (http://forum.doom9.org/showthread.php?s=&postid=517100#post517100)!

#

As you see, there are quite some parameters to play around with. And you MUST play around with them.
Everything depends in the quality of the input, the final resolution, your taste regarding image quality, and the bitrate you are willing to spend ;)


Parameter description

dest_x, dest_y ,[int]
Obviously, these are specifying the final output resolution.

duststr, dustweight, antiflicker [int],[float 0.0~1.0],
duststr is the denoising level of PixieDust. default is 2, try 1~8 depending on how noisy the source is.
dustweight: instead of using the "dusted" clip, you can mix it back with the raw input image by a percentage of [i]dustweight.
antiflicker: I had other plans for it. For now, it simply calms the picture further down by a weak temporalsoften(). See if you like it better on or off.

ss1_x, ss1_y [float],[float]
These are the supersampling factors for the following sharpening stage. Default is 1.4, try 1.0~2.0. With 1.0 the supersampling is discarded.

detailcontr, contrast_radius, PreSharp ,[int],[float]
These are the values for detail enhancement.
[i]detailcontr is the strength of unsharp masking. Default is 112, try 40~80~160~255~512, this depends on the source quality and your taste.
contrast_radius is the radius for unsharp masking. Default is 2, try 3 and 4 also. This correlated with the supersampling factors above.
PreSharp is simply the value for a sharpen()-command after unsharp masking. Default is 0.8, try 0.0~1.0.
NOTE: to completely disable detail enhancement, set detailcontr=0 and PreSharp=0.0

ss2_x, ss2_y [float],[float]
These are the supersampling factors for the following Xsharpening stage. Default is 3.5 . For downsizing, go not under 4.0. For upsizing, 3.0 might be sufficient.

Xstren, Xlimit ,[int]
These are the strength and limit factors for Xsharpen(). Default is (255,255). If you don't have the patience for big enough supersampling, e.g. for 2* supersampling only, try something like (128,23).

[b]do_subpel
This envokes a sharpen(1.0) on the flat areas, and a blur(1.0) on the edges of the supersampled image, prior to XSharpen().

[b]flatweight [int]
At the very end, the denoised-but-not-sharpened original clip is copied back into the flat areas of the full-processed clip. Through [i]flatweight you can control the strength of this copying process. "0" will return the calmest picture with best compressability. Try values 0~32~64~128.


So, I suggest you play around with all the knobs, and see if you like it.

AviSynth virtuosos might want to play with the levels() commands for the masks. In this area there is probably room for improvement - you are invited.

perhaps upcoming features:
- integrated deringing
- perhaps a better flicker reduction

Have fun


- Didée

Didée
15th February 2004, 20:38
The script.

Copy&paste in you editor, save & import as "iip.avs".

EDIT:
Script removed. See updated version of iiP on page 6 (http://forum.doom9.org/showthread.php?s=&postid=517100#post517100)!

Wilbert
15th February 2004, 21:37
btw, there is still a bug in generalconvolution. (There is no division by the total number of weights ...) I hope Richard has time one day to correct this :)

alky
18th February 2004, 17:58
congratulations: you win!

http://web00020.ipax.tk/video

it preserves very much detail and even adds some compared to just resizing. the sharpening is also not too strong - this should look really good viewed on a normal television.

drawback: i cannot use it as it is since i have to crop black borders from the source before doing anything (pvr250 always adds 8-10 black pixel left/right, even if it gets a normal 4:3 signal) and i almost never get a mod 16 by this. maybe you could integrate cropping in the function?

alky
18th February 2004, 18:29
haha... was i speaking of practical usage?!
a divx5 1st-pass would need ~34 hours for one csi episode...

Soulhunter
18th February 2004, 19:45
A quick test... Hmmm... Yes, a nice script !!!

But I will take a closer look next weekend !!!


Bye

Didée
19th February 2004, 00:19
@ all

Keep in mind this is only the proof-of-concept version of iiP. The next version is almost ready, and delivers even better results. But sorry to kill your illusions - it will NOT deliver those results faster than now ;)

The script has its name for a reason. This is not an image filter. It is an image processor (!).


Wilbert:

Yes, I'm aware of that missing feature. However, for the given purpose, it just doesn't matter - in contrary.
Of course I would *love* to use anything other than the (slow) GeneralConvolution for edge detection. But, with all the bunch of filters that are now delivering edge masks, not one of these is versatile. Either they deliver binary masks only (I need graduaded masks), or they are not pixel-centered (2*2 pseudo kernels of MaskTools), or they cannot consider all 8 surrounding pixels (vector-matrix implementation of Manao within MaskTools), or they are ... simply not implemented (Kurosu mentions the LaPlacian kernel in MaskTool's Readme, but that feature is not in the DLL!).
Perhaps it's time to post on the development forum ...


alky:

Thank you very much for testing, much appreciated. I didn't test it on analog captures at all - bought a DVB-S card some time ago ;)
For the little problems you had - see further down.


Soulhunter:

Good timing. New version will definetly be online at weekend, perhaps even earlier. Perhaps.


Some little tips:

MOD16 issue
This is not too handy, I know. Next version will remove this limit.
For now, if you need other horizontal cropping, you should crop *after* iiP.
Example:
720ish frame, crop 4 at left, 10 at right, destination=640:
iiP(dest_x=654, ...).crop(4,top,-10,-bottom)
Yes, it's cumbersome, and it's not exact, ... it's a workaround for now. There are more evil things in the world.

Speed considerations
Shortly: good processing takes good time :P
You should try&see if, after all, you need Xsharpening + big supersampling. This alone takes huge time, and is most effective only if you are upsizing or keeping DVD resolution. For downsizing, you could probably live without it.
So, if you set ss2_x=ss2_y=1.0 and Xstren=Xlimit=0, things will go quite a bit faster. Still slow, but more bearable.

In case of a 2-pass scenario, it is not a bad idea to discard the ss2 supersampling + Xsharpening in the 1st pass, and do it only in the 2nd pass.

As of now, I am converting a 40min episode with (the upcoming) version, with the abovementioned fast 1st pass.
On my (only) Athlon1800, the first pass took 9.5 hours, second will crunch for about 16-19 hours.
Encoded framesize is 704*528 (anamorphic), upconverted from a 16:9 non-anamorphic source.
Destination ratio of bits/pixel*frame is >> 0.102 << (hello RealMedia ;)), and the test encodings looked ... well, not bad :D


For the next version, deringing will be integrated (and there are some scenes that definetly need this feature!), and the sometimes-appearing flickering of detail is mostly nailed down.

Stay tuned

- Didée

Richard Berg
19th February 2004, 07:05
Originally posted by Wilbert
btw, there is still a bug in generalconvolution. (There is no division by the total number of weights ...) I hope Richard has time one day to correct this :)
Done in the latest CVS. (Thought about doing multiplication too, but I think Overlay would be faster.)

Here's the new internal documentation:
/**
* GeneralConvolution(PClip clip, int divisor=1, int bias=0, string matrix)
* clip = input video
* divisor = divides the output of the convolution (calculated before adding bias)
* bias = additive bias to adjust the total output intensity
* matrix = the kernel (3x3 or 5x5). any kind of whitespace is ok, see example
*
* clip.GeneralConvolution("1 2 3
* 4 5 6
* 7 8 9")
**/

SoonUDie
19th February 2004, 07:12
I worked on something similar for a while, but I've given up for the time being. There are some filters I want to code before I give it another serious go, but I'm not a coder and I don't have a lot of free time right now :/

One thing I'd love but could never code myself would be a superresoultion filter - they regenerate a high resolution image from temporal information. There are a million papers available on the technique, but I haven't seen any effort to make one.

Richard Berg
19th February 2004, 07:19
Actually, that little example at the bottom is very old, and therefore wrong :rolleyes: Now that there are more arguments you have to say 'matrix="..."' or prepend it with '1, 0, "..."'.

mf
19th February 2004, 13:16
Originally posted by Didée
[BAs of now, I am converting a 40min episode with (the upcoming) version, with the abovementioned fast 1st pass.
On my (only) Athlon1800, the first pass took 9.5 hours, second will crunch for about 16-19 hours.[/B]
Thought of VBLE yet? Or don't you have the HD space? :)

Didée
19th February 2004, 13:56
[off-topic]
Originally posted by mf
Thought of VBLE yet? Or don't you have the HD space? :)
Of course that's one of the common procedures. I am used to do things that way too, yes.

My excuses:

1. My HD's are currently cluttered with WAY too much unfinished projects and not-yet-touched DVB captures.

2. I'm short with HD space generally: it's only ~ 500 GB

3. Since this script is fairly new for me, too, I decided to do a conventional 1st-pass and analyze it thourougly afterwards, to see how the actual compressability will turn out, and to be able to perhaps adjust the parameters slightly for the 2nd pass.

I'm going to put 13 episodes of 40~42 minutes each, at 704*528, to one DVD+R. Hence I don't want to make (too) much mistakes with such a crawler script.

Rule#1: First know your tools exactly, *then* start doing the tricks.

BTW, I was almost sure I'll get a kick in the a** from you, mf, for the crap I am scripting here :) :)

[/off-topic]

- Didée

mf
19th February 2004, 13:59
Originally posted by Didée
BTW, I was almost sure I'll get a kick in the a** from you, mf, for the crap I am scripting here :) :)
Yeah, I didn't look too closely yet, but I was tickled for a moment to script a quick hack that *does* allow the denoiser to be chosen ;).

Mug Funky
20th February 2004, 09:34
hmm. i don't use generalconvolution for edge masking, but are there any advantages do just "subtract(last,last.blur(1))" and some leveling or overlaying?

i'm pretty new to edgemasking, but this method works for me in most instances (except for the odd white-dot effect when colours stray outside the CCIR range)

mf
20th February 2004, 13:05
Originally posted by Mug Funky
i'm pretty new to edgemasking, but this method works for me in most instances (except for the odd white-dot effect when colours stray outside the CCIR range)
Fix for that is using YV12Subtract with tol=0 twice and layering them.
Example (semi-avs cause I'm lazy):
dark = yv12subtract(tol=0)
light = invert.yv12subtract(tol=0).invert
layer/overlay/whatever(dark, light, op=lighten)

That worked for me. The idea is that when using tol=0 only the dark values come out for some wicked reason. So if you invert twice you get the light values and then you layer those over the dark ones.

Didée
20th February 2004, 13:07
@ mf:...I was tickled for a moment to script a quick hack that *does* allow the denoiser to be chosen. Now, this is a really BRILLIANT idea:

I'll do the technical art, and you take the punishment of making my stuff more user friendly!

Do we have a deal? :D


originally posted by Mug Funky
i don't use generalconvolution for edge masking, but are there any advantages do just "subtract(last,last.blur(1))" and some leveling or overlaying?
A good idea, Mug Funky - which I had already 2 years ago ... [edit: in November 2002]

Subtract() will leave you with an image centered around Y=127, spreading the differences towards 0 and 255 both. This is not suited for masking (most times).
Almost 2 years ago, I proposed more than once that subtract() badly needed another mode where it returns [no difference]=[0] & [full difference]=[255]. But I was talking to the wind.
Of course it is possible to adjust the 127-centered result of subtract() to what is needed; but these calculations (you need both overlaying and levelling) also need some CPU time, so that doing it from start by GeneralConvolution turns out to be about just the same effort.
Another possibility is to use "adjust.dll" for making subtract()'s output suitable ... works pretty good also, but requires YV12<->YUY2 conversion.
After all, with Convolution I have better control over what's exactly happening. (Keep dreaming of "UltraFastLaPlacianKernelConvolution.DLL" ...)


Regarding iip itself:

New version is ready. Deringing is in. MOD16 is no more required. Sharpening works a little more tasty now (for me). Speed has not improved. Custom denoising is waiting for mf ;)

When I'll return home, I'll have to do a little more fine-tuning on the deringing part - deringing of natural sources with neither destroying nor "forgetting" something is probably a little more complicated than on animee ...

Should go online this night.

One more question:

Much overlaying is going on in this script, and ...

1. Overlay() is (yet) less optimized than MaskTool's functions, speak: it's noticeably slower.

2. MaskedMerge() of MaskTools seems to inheritely have small rounding errors: it may introduce slight color shifts.

What do you prefer ... ?

- Didée

Didée
20th February 2004, 14:06
Oops, didn't see that mf was replying while I was still typing ...

mf:

So one can get it to work that way, okay.

But then, how much faster is [2*subtract]+[invert]+[overlaying]+[SomeThingsMore] compared to GeneralConvolution()??

Plus, the latter still is more exact than this UnsharpMasking-like approach -- but: it is well suited to e.g. create simple deringing masks, agreed.

Should we create a new thread, about edge detection ... :)

- Didée

mf
20th February 2004, 15:44
Actually, I hate putting in the end-user stuff. I just like to release a filter and see the reactions, so I try to put in as much user-configurable stuff as possible. In that sense you could say I'm a fame junkie ;).

And you've given me an idea for an edge mask. It has to do with an old filter in MaskTools that's been a friend of mine for some time... :D Can you guess it?

Didée
20th February 2004, 16:33
I put (little) money on "MaskOverlay()" ? - I didn't try that one myself, not one single time :o

But I do remember the good old times, say a year ago, when we simply posted pure linear scripts, and simply stated "try this!".
Today, we shall produce full-featured functions, that catch every possible user error, are configurable from head to toe, do sing and dance, glow in the dark and defragment your HD in the background.
Oh my Lord. ( partly :) , partly :rolleyes: )

- Didée

mf
20th February 2004, 21:39
It has to do with Inflate :).

Didée
21st February 2004, 16:30
Oh c'mon, mf ... there are a myriad of things you can do by means of edgemasks, and you ask such a question. I'm not THAT good at reading minds (yet).

After having a big struggle in the logo war I'm fighting with "SAT1", and sleeping much longer than I expected, the new version of iiP is ready now. Phew!
I just have to prepare the instructions, so that you all know what do do with it ;)

- Didée

scharfis_brain
21st February 2004, 16:57
After having a big struggle in the logo war I'm fighting with "SAT1"

Please tell me more....

mf
21st February 2004, 18:28
Originally posted by Didée
Oh c'mon, mf ... there are a myriad of things you can do by means of edgemasks, and you ask such a question. I'm not THAT good at reading minds (yet).
Okay, it has to do with Subtract and Dilate! :)

Didée
21st February 2004, 21:28
Okay, here is the new version of iiP.

The changes are:

- input clip is no more required to be MOD16.
- sharpening stage now uses up to three iterations
- masking for detail processing internally slightly adjusted
- subpel operation simplified
- reduced the possible amplifying of pre-existing detail flickering
- added adjustable deringing option
- added debug/visualization option for setting up deringing
- all plane copying operations are now done by "Overlay()", "MaskedMerge()" was giving slight color shifts
- reduced overhead: processing steps that are set to "no-operation" through parameters 0|1|0.0|1.0 respectively, are effectively discarded


iiP uses a good amount of RAM. If you get unexpected AviSynth/Vdub crashes, try setting "SetMemorMax(64)" (at least, better (96) or even (128) ) at the start of your script.


The usage & default parameters now look like this:
(output resolution defaults to input resolution, of course)

iip( dest_x= 704, dest_y= 416,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.00, antiflicker= true,
\ detailcontr1=104, detailcontr2 = 192, contr_radius = 2, PixSharp=0.4,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren=1.58, flatweight = 0,
\ dering = 80, dering_weight= 1.0, dering_floor = 80, dering_bias=0.4,
\ debug= " "
\ )


Updated parameter description:

dest_x, dest_y ,[int]
Obviously, these are specifying the final output resolution.

duststr, dustweight, antiflicker [int],[float],
[i]duststr is the denoising level of PixieDust. Default is 2, try 1~8 depending on how noisy the source is.
dustweight: instead of using the pure "dusted" clip, you can mix it back with the raw input image by a percentage of dustweight.
antiflicker: I had other plans for it. For now, it simply calms the picture further down by a weak temporalsoften(). See if you like it better on or off.

ss1_x, ss1_y [float],[float]
These are the supersampling factors for the following sharpening stage. Default is 1.4, try 1.0~2.0. With 1.0 the supersampling is discarded.

detailcontr1, detailcontr1, contr_radius, PixSharp ,[int],[int],[float]
These are the values for detail enhancement.
[i]detailcontr1 & detailcontr2 are the strengths of two chained unsharp maskings. Default is 108/192, try 40~80~160~255~512. First value should be smaller than the second. (Unless it should be greater.)
contr_radius is the radius for the first unsharp masking. Default is 2, try 3 and 4 also. The second unsharp masking is hardcoded to a radius of 1.
PixSharp is simply the value for a sharpen()-command after unsharp masking. Default is 0.5, try 0.0~1.0.
Setting any of the strength values will discard the respective sharpening step.

ss2_x, ss2_y [float],[float]
These are the supersampling factors for the following Xsharpening stage. Default is 3.5 . For downsizing, it is NOT recommended to drop below 4.0. For upsizing, 3.0 might be sufficient.
Setting both of these to 1.0 will discard the second supersampling step. Remember to also disable subpel, then!!

Xstren, Xlimit ,[int]
These are the strength and limit factors for Xsharpen(). Default is (255,255). If you don't have the patience for big enough supersampling, e.g. for 2* supersampling only, try something like (128,23).
Setting both of these to 0 will discard this step.

[b]subpelstren [float]
This now envokes a "blur(subpelstren)" on the supersampled image, prior to XSharpen(). Default is 1.58, range is from -1.0 (full subpel sharpening) to 1.58 (full subpel smoothing).
The effect is minor, look very close and see for yourself if you want to use it or not. I mostly use it to avoid 'nervous edges' through XSharpen() - it helps stabilizing the picture, especially when the 2nd supersampling factor is not set to the preferred value ;-).
Setting subpelstren=0.0 will discard this step.

flatweight [int]
At the very end, the denoised-but-not-sharpened original clip is copied back into the flat areas of the full-processed clip. Through flatweight you can control the strength of this copying process. "0" will return the calmest picture with best compressability. Try values 0~32~64~128.

dering [int]
The basic strength to use for deringing. This is effectively the parameter for an "unfilter()" command, so the useful range is 5 to 100. Negative values are possible, but not useful at all ;-). Default is 80.
(Clarification: compared to unfilter(), the parameter's sign is reversed.)
Setting this to 0 will discard the deringing step.

dering_bias [float]
This value adjusts how strong the edges in a frame must be to get deringing applied to. Use with [i]debug="dering" to see how affected areas will change. Default is 0.4, reasonable range is 0.2~2.0 (or even more?).

dering_floor
This is a cutoff value, up from here deringing will start to kick in. Set this up also with [i]debug="dering". Default is 80.

dering_weight [float]
Similar to flatweight, this effectively is a percentage of how much of the calculated deringed will be applied to the frame. Default is 1.0.

debug [string]
This has (for now) only one useful value: "dering", which will overlay the deringing mask onto the clip in fine green.
Use this to find appropriate values for dering_bias and dering_floor for your clip.


Notes on usage:

- You should not rely on the default values, since I don't know what material you are going to process.

- all sharpening values must be seen in correlation to the first supersampling stage. The bigger the supersampling, the finer but weaker the sharpening will come out. Example: imagine you were using a supersampling(1) factor of 1.5 and found your favorite sharpening values. Later, you decide to reduce or disable the first supersampling, then you will definetly end up with strong oversharpening if you dont reduce the formerly found values!

- to completely disable detail enhancement, set detailcontr1=0, detailcontr2=0 and PreSharp=0.0. This will make iiP work more similar to the "SharpResize" function by mf, however without seperated color treatment.

- Attention: if you don't use the 2nd supersampling + Xsharpening, remember to set subpelstren=0.0 !!! Else, you will either destroy or over-smooth the clip!


Some more Tips:

- You want to use another base denoiser than PixieDust? Okay, set dustweight=0.0, and use your own denoiser before calling iiP. This is much simplier than bloating the script, still serves the very same effect ;).

- for clean sources (DVD mostly, DVB seldom, analog captures never), you might want to reduce dustweight to 0.75 or 0.5 to retain maximum detail.

- If the source has sufficient "depth sharpness" (can I say this for "Tiefenschärfe" ?), you might set detailcontr1=0, and possibly reduce detailcontr2 in favour to raise PixSharp.
In the opposite case, on muddy sources, you might want to rely even more on detailcontr1, and possibly raise contr_radiusfrom 2 to 3.
BTW, if you want to easily see where sharpening is kicking in, you can set one or both of the detailcontrX-values to something like 500, 1000 or even 2000. Not really useful for encoding, but at least you'll see something ...

- regarding flatweight: I would keep this at 0 as long as PixieDust leaves you with enough recoverable detail - what it will mostly do.
However, if you are using a video compressor that tends to throw blocks on very flat image areas, you might want to raise flatweight to something like 16 through 40. What do I know, see for yourself, please.

- to get the best relative compressability, set dustweight=1.0 and flatweight=0.

- Although it is generally not recommended to use subpel operation without the 2nd supersampling (because then, it is no more 'subpel'), exactly that was giving me surprisingly good results when I tried it on a certain, rather poor source. The result looked smooth, but not blurry. Experimenting is always a good idea.


Hope everything is clear as mud now. :)

- Didée

[edits]
#1 - Only one missing "/" in a tag can make things look pretty strange ...
#2 - typos, some small additions, usage example wasn't really at default values
#3 - usage example still wasn't at defaults. Now it is.

Didée
21st February 2004, 21:35
The new script:

edit 26.02., 0h20m: v0.3b: added workaround for Overlay()'s YV12 UV-bug (color shifting)

edit 28.02., 17h30m: v0.3c: More Speed! (less slow ;) ) Removed critical Overlay()'s, replaced with MaskTools functions
# iip : Integrated Image Processor, v0.3c
#
# (0.3c performs most plane operations (again) through MaskTools (v1.4.9) functions for more speed.
# Some are still done by Overlay(), since modes "lighten" and "exclusion" are only available there.)
#
# Currently includes:
# - Denoising
# - detail enhancement |< while avoiding edge oversharpening, ringing,
# - improved edge definition |< halos, and detail flickering
# - deringing: removes noise around edges,
# moderates pre-existing Edge-Enhancement (dark & bright halos around edges)
#
# It's often able to make the clip, at the same time, sharper & more compressable than the source itself.
# By tweaking the values, you can give more priority to either compressability or sharpness.
#
# ---------------
# | It is slow. |
# ---------------

function iip( clip clp,
\ int "dest_x", int "dest_y",
\ int "duststr", float "dustweight",
\ float "ss1_x", float "ss1_y",
\ int "detailcontr1", int "detailcontr2",
\ int "contr_radius", float "PixSharp",
\ float "ss2_x", float "ss2_y",
\ int "Xstren", int "Xlimit",
\ float "subpelstren", bool "antiflicker",
\ int "flatweight",
\ int "dering", float "dering_weight",
\ int "dering_floor", float "dering_bias",
\ string "debug"
\ )
{
ox = clp.width
oy = clp.height
xcorr=(int(ox/16.0+.9999)*16)-ox
dest_x = default(dest_x, clp.width)
dest_y = default(dest_y, clp.height)
ss1_x = default(ss1_x, 1.414)
ss1_y = default(ss1_x, 1.414)
ss2_x = default(ss2_x, 3.5)
ss2_y = default(ss2_x, 3.5)
duststr = default(duststr, 2)
dustweight = default(dustweight, 1.0)
antiflicker= default(antiflicker, true)
Xlimit = default(Xlimit, 255) # SS<3 ? 23 : 255
Xstren = default(Xstren, 255) # SS<3 ? 216 : 255
detailcontr1= default(detailcontr1, 108)
detailcontr2= default(detailcontr2, 192)
contr_radius= default(contr_radius, 2)
PixSharp = default(PixSharp, 0.5)
subpelstren = default(subpelstren, 1.58)
flatweight = default(flatweight, 0)
dering = default(dering, 80)
dering_bias = default(dering_bias, 0.4)
dering_floor= default(dering_floor, 80)
dering_weight=default(dering_weight, 1.0)
debug = default(debug, "false")

xx_ss1 = int((ox*ss1_x/8)+.5)*8
yy_ss1 = int((oy*ss1_x/8)+.5)*8
xx_ss2 = int(ox*ss2_x/16+.5)*16
yy_ss2 = int(oy*ss2_x/16+.5)*16

antiflicker == true ? clp.temporalsoften(3,2,3,23,2) : clp

dusted=last.addborders(0,0,xcorr,0).converttoyuy2().PixieDust(limit=duststr).converttoyv12().crop(0,0,-xcorr,-0)#.BlindPP(quant=8,cpu=4,moderate_h=45,moderate_v=55)
dusted = (dustweight<1.00) ? Overlay(last, dusted, opacity=dustweight) : dusted

edgebase=dusted.greyscale().bicubicresize(int(ox/1.33/4)*4,int(oy/1.33/4)*4,1.0,0.0).converttorgb()
edgeA = edgebase.\
GeneralConvolution(0,"
-3 -4 -3
-4 28 -4
-3 -4 -3 ").ConvertToYV12()
edgeB = edgebase.levels(0,1.0,255,255,0,false).\
GeneralConvolution(0,"
-3 -4 -3
-4 28 -4
-3 -4 -3 ").ConvertToYV12()

edge1 = Overlay(edgeA,edgeB,mode="lighten").inflate().inflate().inflate().blur(1.58).levels(24,1.0,208,0,255,false)
\ .inflate().inflate().inflate().inflate().greyscale().bicubicResize(xx_ss1,yy_ss1,1.0,0)

edge1b=Overlay(edgeA.levels(dering_floor,1.0,255,0,255,false).expand().inflate(),
\ edgeB.levels(dering_floor,1.0,255,0,255,false).expand().inflate(),
\ mode="Exclusion").levels(31,dering_bias,192,0,int(255*dering_weight),false).deflate().deflate().inflate().inflate().greyscale()

(ss1_x > 1.0 || ss1_y > 1.0) ? dusted.Lanczosresize(xx_ss1,yy_ss1)
\ : dusted

temp = last

detailcontr1 != 0 ? unsharpmask(detailcontr1,contr_radius,0) : NOP
detailcontr2 != 0 ? unsharpmask(detailcontr2, 1,0) : NOP
PixSharp != 0.0 ? sharpen( PixSharp ) : NOP

MaskedMerge(last,temp,edge1,Y=3,U=1,V=1).undot()

dering != 0 ? MaskedMerge(last,last.unfilter(-dering,-dering).lumafilter(1),edge1b.bicubicresize(xx_ss1,yy_ss1),Y=3,U=1,V=1)
\ : NOP

antiflicker == true ? temporalsoften(1,2,3,23,2) : NOP

xx_ss2 != ox && yy_ss2 != oy ? LanczosResize(xx_ss2,yy_ss2) : NOP

subpelstren != 0.0 ? blur(subpelstren) : NOP

Xstren != 0 && Xlimit !=0 ? xsharpen(Xstren,Xlimit) : NOP

LanczosResize(dest_x,dest_y).undot()

edgebase2=last.greyscale().bicubicresize(int(dest_x/1.2/8)*8,int(dest_y/1.2/8)*8,1.0,0.0).converttorgb()
edgeA2 = edgebase.\
GeneralConvolution(0,"
-3 -4 -3
-4 28 -4
-3 -4 -3 ").ConvertToYV12()
edgeB2 = edgebase.levels(0,1.0,255,255,0,false).\
GeneralConvolution(0,"
-3 -4 -3
-4 28 -4
-3 -4 -3 ").ConvertToYV12()
edge2 = overlay(edgeA2,edgeB2,mode="lighten")
\ .inflate().inflate()
\ .levels(24,3.0,192,flatweight,255,false).inflate()
\ .bicubicResize(dest_x,dest_y,1.0,0)
\ .inflate().inflate().blur(1.58).inflate().greyscale()
\ .temporalsoften(1,255,255,23,2)

MaskedMerge(dusted.lanczosresize(dest_x,dest_y),last,edge2,Y=3,U=1,V=1)

debug == "dering" ? overlay(last,blankclip(last,color=$008000),mask=edge1b.bicubicresize(dest_x,dest_y),mode="blend",opacity=dering_weight)
\ : NOP

return(last)
}

#

Soulhunter
21st February 2004, 21:52
Thanks for this toy, now I will play with it... ;)

Bye

Soulhunter
22nd February 2004, 16:09
I get an error with this script... :(

mpeg2source("F:\DVD Backups\Hulk\Hulk.d2v")

LoadPlugin("C:\Programme\AviSynth 2.5\plugins\undot.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\MaskTools_v1.4.9.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\WarpSharp.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\LoadPluginEx.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\dustv5.dll")

Import("C:\Programme\AviSynth 2.5\plugins\iip.avs")

iip( dest_x= 1024, dest_y= 576)
Bye

Didée
22nd February 2004, 16:39
Doctor, I don't know what I'm suffering from, but please give me a curing medicine."

What error do you get, soulhunter? Your report is a little thin ...
Your very script (but different source, of course) works fine here.

If it's some kind of AviSynth read error / access violation, then try
SetMemoryMax( X ), with X > 128 or 160 for testing.

I'm doing much chained steps in there, including mask/overlay operations on big framesizes, holding several of those big frames parallel in memory and mix them together later, - - that kind of stuff. May eat quite some memory ...

[... testing ...]

Yup, that's it:
SetMemoryMax(32): destination 1024*576 -- crashes

SetMemoryMax(64): destination 1024*576 -- OK
destination 1280*720 -- OK
destination 1920*1088 - crashes

SetMemoryMax(96): destination 1920*1088 - OK

Seems we have the culprit. I'll edit the usage description.
(My own script templates all start with SetMemoryMax(192), so I didn't notic that. Sorry.)

- Didée

Soulhunter
22nd February 2004, 20:14
THX, I will see if this medicine helps me... :D

[EDIT1: Ok, now it work's !!!]

[EDIT2: 2h for 4500 frames...]

Bye

Soulhunter
23rd February 2004, 20:35
So, its done...

Sample encode with iip's default settings @ 1024x576 !!!


The Matrix (lobby shootout)

More than 2h encoding time on my 2600XP... :eek:


Result:

- Razor-sharp picture... Nice !!!

- "Near" like no floating wall effect... :)

- Problems (flickering) with sharp edges near detailed arears... :confused:


Overall nice script !!!

But considering the speed factor... :rolleyes:


Bye

Didée
24th February 2004, 09:44
Soulhunter:

Fine that you liked at least the result.
Could you perhaps quickly compare it also in regards to compressability, or filesize @ fixed quant, against the unfiltered source, and perhaps one or two common denoisers? Just to get a *rough* idea about that aspect.

Considering the speed: well, heheh ...

Sophisticated evaluation and treatment of images-in-motion takes much time, simple as that. Look at how much slower XviD is with qpel+vhq4, compared to no-qpel + vhq0! There are worlds between.

Moreover, one of the basic ideas behind this, when starting out, was the supersampled Xsharpen (which I then tried to supply with more details to be sharpened ... iip was born). Now, would you please try out the latest version of mf's SharpResize of the SharpTools? This one does no denoising, nor does it any explicit detail enhancement. But you will find that, regarding the speed, it plays in about the same league ...

Now:

>> Razor-sharp picture... Nice !!!

Answer: :)

>> "Near" like no floating wall effect...

Answer: :D

>> Problems (flickering) with sharp edges near detailed arears...

Answer: Yeah, alas, still.
I have a couple of ideas how to make those problematic areas more steady. (But notice: mostly, this flickering is not really introduced by iip - it's very likely already there in the source, but gets amplified by the script).

I am working on that problem. The question is, which method will work out the best, and which will produce the least amount of additional CPU cycles ... lets see.

BTW, if anyone feels like hosting some short samples of a 704*528 encoded clip @ ~1000 kbps (0.105 bits/pix*frm !) - I'd have some available ;) (but no webspace).

- Didée

mf
24th February 2004, 20:38
Originally posted by Didée
Oh c'mon, mf ... there are a myriad of things you can do by means of edgemasks, and you ask such a question. I'm not THAT good at reading minds (yet).
- Didée
The correct answer was:
Corona Edge Mask (http://forum.doom9.org/showthread.php?s=&threadid=71540)
:D You and Mug Funky gave me the idea of using Inflate and Deflate with Subtract to create an edge mask.

Soulhunter
24th February 2004, 21:11
Originally posted by Didée
Fine that you liked at least the result.
Could you perhaps quickly compare it also in regards to compressability, or filesize @ fixed quant, against the unfiltered source, and perhaps one or two common denoisers? Just to get a *rough* idea about that aspect.
Yeah, its a bit vague... :rolleyes:

Just wait a bit !!!


Bye

Soulhunter
24th February 2004, 22:50
Ok, here is something less vague... ;)


Source: Matrix (PAL) / Lobby shootout chapter / First 1000 frames

Settings: XviD RC2 / Fixed quantizer 2 / MPEG matrix / VHQ1 / 1024x576


Only resized
Size = 30,7 MB / Encoding time was about 01:45 min. (2600XP)

Fluxsmooth(3,5)
Size = 24,7 MB / Encoding time was about 02:05 min. (2600XP)

Peachsmoother & Fluxsmooth(3,5)
Size = 19,3 MB / Encoding time was about 02:25 min. (2600XP)

Convolution3d("moviehq") & Fluxsmooth(3,5)
Size = 23,4 MB / Encoding time was about 02:35 min. (2600XP)

SharpResize & Fluxsmooth(3,5)
Size = 26,4 MB / Encoding time was about 15:20 min. (2600XP)

Peachsmoother
Size = 21,4 MB / Encoding time was about 01:55 min. (2600XP)

Convolution3d("moviehq")
Size = 28,1 MB / Encoding time was about 02:10 min. (2600XP)

SharpResize
Size = 32,2 MB / Encoding time was about 15:05 min. (2600XP)

IIP processing
Size = 32,7 MB / Encoding time was about 25:40 min. (2600XP)


Note1: For all encodes except the SharpResize & IIP one, Lanczos resize was used !!!

Note2: All smoothers where used after the resizing !!!

Note3: I dont take any responsibility for the results !!!

Note4: Want screenshots ??? Then tell me till next weekend !!!


Bye

koszopal
25th February 2004, 09:33
hi
ipp is very good but ive got problem with "red ghost" (see 3 rows and ipp column frames )here (http://koszopal.fm.interia.pl/movie/comp.htm)
koszopal

Didée
25th February 2004, 10:21
Soulhunter:

What? iip at defaults was bigger than the plain lanczos'ed source?

Wait a minute ...

... oh my! Did you simply call "iip(xxx,yyy)" with empty parameters, or did you use the complete "usage script" above posted ?

I just noticed a inconvience: default for dustweight should be 1.0, but in the usage script it is 0.75 ... doesn't do any harm, but won't give the best compressability. At defaults, in my tests so far iip was always smaller, or at least equal in size compared to not-filtering.

Usage script updated, sorry :o


koszopal:

Please, could you describe your "red ghost" problem a little better:
What I see on your web page is:
- source pictures that already look a little red-ish beforehand
- SharpResized pictures that look more greenish than the source
- iip'ed pictures that look similar to the source, color-wise

BTW, was that the new script version, or the older one? The old was giving red-ish pictures caused by MaskedMerge(), which is no more used now.

- Didée

koszopal
25th February 2004, 10:44
ive tryd both i mean
1st) iip( dest_x= 640, dest_y= 352)
and
2nd) iip( dest_x= 640, dest_y= 352,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.00, antiflicker= true,
\ detailcontr1=104, detailcontr2 = 192, contr_radius = 2, PixSharp=0.4,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren=1.58, flatweight = 0,
\ dering = 80, dering_weight= 1.0, dering_floor = 80, dering_bias=0.4,
\ debug= " "
\ )
in both case in frame 32525 ive got "red ghost" :(
ab version
im using new script (version 0.3) just few posts up
and im agree with you that iip is color-wise :)
koszopal
PS hehe and ab speed yes mostly 1fps or below (2200xp) :) (3h for const quant2 xvid rc2 7914 frames sample) :D

koszopal
25th February 2004, 12:40
ive just uploaded a part vob containg this frame (rename .gif to .vob)
get this (http://fire.prohosting.com/koszopal/emma/emmapart.gif)
koszopal

Didée
25th February 2004, 15:17
Will investigate, thanks.

- Didée

Didée
25th February 2004, 22:28
ALERT!

The script indeed produces output with screwed color alignment!.

The bug is confirmed and tracked down. A solution will be posted shortly.

Stay tuned - the bug lies elsewhere, and might affect many other scripts, too!

If anyone has currently any serious work running through iiP, (s)he might abort the job right NOW.

(Sorry for the flood of bolds)

- Didée

Didée
26th February 2004, 00:15
Okay, the miracle's solution.

After inspecting each and every single step in the script closely, I started to tear out my hair because I couldn't nail down anything.

Finally, I found it:

Overlay() shifts the color planes if you process YV12 clips with it!

Now, this is sort of a problem for iip ... As a temporal workaround, I changed the script to do all related internal processing in YUY2 colorspace. This doesn't exacly help the speed, but it's the only solution I can offer quickly.

My initial usage of MaskedMerge() from MaskTools is no solution, since its little inaccurate averaging will produce color changes as well: mostly reddish, sometimes greenish ...

I'll see how to isolate the color planes from the process in a satisfying way, but I don't want to hack that in head-over-heels. So you have to live with the intermediate YUY2 version, for the time being.

As a bonus, I changed the deringing part to work even a little finer than before :)

I'll edit the above posted script in a minute.
Please Copy & Paste the script again.


- Didée,

dropping a tear,

while watching about 120 hours worth of encoding going into the trashbin.

koszopal
26th February 2004, 08:10
@didee
i can confirm with 03b isnt any problems with "red ghosts" , great work :D,also i've updated my SharpResize/IIP/Hypp comp page (http://koszopal.fm.interia.pl/movie/comp.htm)
(added comp version 0.3 and 0.3b and hypp (0.6)
koszopal

Ark
26th February 2004, 09:52
Damn, i've finally solved the LoadPluginEx/Dustv5 loading problem, and suddently a new problem comes up:

When i use iip, Avisynth throws in this error:

Avisynth open failure
Script error: there is no function named "unsharpmask"

I've all the plugins needed and there's no problem in loading them, but this seems to be a plugin missed or something else to my eyes...

Didée
26th February 2004, 11:37
You probably don't have the "right" WarpSharp package, Ark. There is more than one package floating around with then name WarpSharp in it.

Grab the one from this site (http://www.geocities.co.jp/SiliconValley-PaloAlto/2382/), and ....

Bah, I'm talking nonsens! If you are sucessfully using LoadPluginEx, then you have the right package.
Are you really loading the "WarpSharp.dll" plugin at your script's start? You need "WarpSharp" to get "UnsharpMask" ...

- Didée

Ark
27th February 2004, 09:15
@Didèe

Ok, now works fine. It was broken because i wanted to keep the other warpsharp (don't ask me why...) I had, so I've done a subdirectory with the new package, but I forgot to add to the loading path in the .avs this subdir...

Now I want to thank you for this awesome script, I'm testing it with Matrix and if i could use it at more than 1 fps...

I've also a little question: is this script called an "image processor" because it do the same things as a dedicated processor, but in software?

Thanks and keep up improving!

Didée
27th February 2004, 13:42
Well, I have plans in store to speed the script up by a big amount: 1.5 fps should be in reach, perhaps even 2.0 fps on fast machines ...

Seriously, the script will be about 20% faster once it will be (again) using MaskTool's functions, as far as appliable.
Moreover, I have another idea that *could* accelerate the whole thing quite a bit, but I cannot say much about that yet. Have to try the idea first, and it's not that simple to implement. Could perhaps work, perhaps it will not.

See this also in conjunction with you question about the "image processor" terminology:

I have, honestly, no idea at all what dedicated hardware processors are actually doing. :)
It is just like this: the script does (sort of) an analysis where the interesting picture areas are, and performs suited operations to the different kinds of image areas - with some little twists, somewhere inbetween.

Hence I thought "image processor" wouldn't be such a bad name - and, most of all, this name is also a good excuse for the nerve-breaking speed, or better the lack thereof.
Moreover, the script uses *several* techniques to process the source, and nobody forces you to use *all* of them. As described above, you can disable almost every single procedure by setting the approbriate parameters to either 0(.0) resp. 1(.0).
In this respect, iiP could perhaps be seen as a "Mini Processing Suite" - although a little tricky to set up, agreed.
If time allows, there will be implemented even more possibilities to process the picture, like e.g. ***censored***.

All together, it is simply so, that a lot of "expensive" operations have to be done, in order to get a result like that. You simply cannot put your car in your trouser's pocket ...

- Didée

Ark
27th February 2004, 19:12
Thanks for your reply, and i asked that because this script seemed to me to pratically do the same job that do a processor in a dvd-player.

In many high-level dvd-players you can adjust many parameters regarding image quality, like sharpness, or noise reduction, and even in some upscale the resolution to HDTV standard and others (such as 576p, 720p, 1080i/p). There're even dedicated machines that do only this type of operations, taking any video input and pocessing it to a different output (composite<->s-video<->component) while processing it.

These pieces of hardware are usually very expensive, so it's incredible to me that i can have the same function for no cost at all!

Yes, I've to wait a month (for now) to do a backup, but who cares?? The quality is astonishing! :)

Now I think that only time and Didée's work will raise the usability of this script (maybe with a P7 9000mhz..:D ), so I've just to wait quietly.

Didée
28th February 2004, 17:47
Or, better said, less slow ;)

Guys, the workaround version was really slow!

Most of the plane copying functions now are done again by MaskTools, which speeds the whole thing up by quite a little bit, especially when compared to the YUY2/Overlay() version 0.3b ...
The colors are safe.

Functionality and usage stays the same, so the script is still here (http://forum.doom9.org/showthread.php?s=&postid=447991#post447991) on page 2.

Some rough numbers:

( CPU 1533Mhz / clip ~40 min, 704*432 -> 704*528 anamorph )

Overlay()/YV12: ~19:00 hours (buggy)

Overlay()/YUY2: ~25:20 hours

MaskedMerge/YV12: ~14:30 hours


Still slow, of course. But nonetheless a noticeable improvement.

- Didée

Didée
4th March 2004, 09:21
Bug report:

iiP is not yet compatible with AviSynth/03032004!

For the moment, stay with AviSynth/30012004, if you're going to use iiP. I'm adapting the script - but it's a littly tricky...

The good news:
After finishing the changes, iip will gain another 10% of "speed" ;)


Moreover, a friend was so nice to make some webspace available. So, here we have some

Samples of iiP (http://kotisivu.mtv3.fi/ii00i/index.htm)

for those who might be interested.

- Didée

Manao
4th March 2004, 15:01
BTW, considering speed issue, if you're working only in YV12, and if only the luma plane is interesting, the following will be faster than a levels(a,gamma,b,c,d) :YV12LUT(Yexpr = "x a - b a - / 1 gamma / ^ d c - * c +")simply because it doesn't process the chroma planes. It is cheap optimizations, yet, it is 3/2 times faster.

Didée
4th March 2004, 15:29
Ah, thanks for that tip, Manao. Will be used in the next version, and every little bit of improvement helps. (But for development/debugging, I will continue to use the levels()-command for sure. The syntax of YV12LUT gives me headaches, somehow ;) )

However, most of all CPU cycles are spent in the supersampled processing steps, which can hardly be speeded up - unless the related processing happens to appear within a DLL, where some nifty tricks like e.g. "tiling" could be done.
So all improvement of the script is limited:
A simple Resize(x4).Xsharpen.Resize(/4) already runs in the regions of <= 5 fps, and that's without any denoising or sharpening ...

- Didée

scharfis_brain
4th March 2004, 16:12
I've tested iip.

It works great, but:
- it eats up all my memory (256MB) while encoding to m2v. this means the memory gets swapped all the time to HDD while doing the encode.
- a 90min - 4:3 Film, scaled from 704x480 to 704x576 needs about 56 hours (more than two days!) to encode (1pass)

The Quality is really great, if the source is clean.

I've treid it on some heavy compressed clips, but this wasn't a good idea. Iip 'enhanced' the compression artifacts....

Didée
4th March 2004, 17:00
Oh, those are bad numbers, scharfis_brain.

What encoding application are you using? I'm not into mpeg-2 encoding myself - but IIRC, I've heard that CCE seems to request frames in a little unusual matter (either not always linear, or it simply reads too much frames ahead), and such a behaviour is poison for complex scripts.

Did you use some fancy deinterlacing/IVTC processing ;) before calling iiP? That could explain that you ran out of memory.
iiP does use quite some memory, yes. But 256MB should be by far enough to avoid memory swapping to HD!

Assuming you didn't let that encoding finish, you could try again with disabled XSharpening:
ss2_x = ss2_y = 1.0 // Xstren=Xlimit = 0 // subpelstren = 0.0.
You'll loose the "enhancement of 'edge definition'", but just this is the most expensive task in the script - for an improvement that some people are not even able to spot (my Grandma, e.g.) ...

Or, perhaps, try "soft" XSharpening, like
ss2_x = ss2_y = 2.5 // Xstren = 112~192 // Xlimit = 16~31
(Look for very sharp borders and fine skin detail when trying this!)

And be sure to NOT use the workaround-version that was posted for a short time: this one was extraordinarily slow.

Good luck ;)

- Didée,

still laughing about interlaced Homer!


[edit]
I've treid it on some heavy compressed clips, but this wasn't a good idea. Iip 'enhanced' the compression artifacts....
Well, iiP is an 'enhancer', not a 'repairer', that's true!

Soulhunter
9th March 2004, 20:43
Ok, here is a update...


Source: Matrix (PAL) / Lobby shootout chapter / First 1000 frames

Settings: XviD RC3 / Fixed quantizer 2 / MPEG matrix / VHQ1 / 1024x576


LanczosResize(1024,576)
Size = 31,2 MB / Encoding time was about 01:10 min. (2600XP)

Temporalsoften(2,3,3,mode=2,scenechange=5)
Size = 28,7 MB / Encoding time was about 01:22 min. (2600XP)

STMedianFilter(8,12,4,6)
Size = 25,9 MB / Encoding time was about 01:24 min. (2600XP)

Fluxsmooth(3,5)
Size = 25,4 MB / Encoding time was about 01:33 min. (2600XP)

Deen()
Size = 21,2 MB / Encoding time was about 01:35 min. (2600XP)

MipSmooth(preset="MovieHQ2")
Size = 23,5 MB / Encoding time was about 01:52 min. (2600XP)

VagueDenoiser()
Size = 24,7 MB / Encoding time was about 09:07 min. (2600XP)

IIP(Dest_x= 1024, Dest_y= 576)
Size = 32,9 MB / Encoding time was about 17:50 min. (2600XP)


Note1: For all encodes except IIP one, Lanczos resize was used !!!

Note2: All smoothers where used after the resizing !!!

Note3: I dont take any responsibility for the results !!!


Bye

mf
10th March 2004, 12:19
Originally posted by Didée
for an improvement that some people are not even able to spot (my Grandma, e.g.) ...
What, you actually make your grandma undergo a technical video comparison? You cruel cruel man!

Didée
11th March 2004, 16:13
New version: iiP v0.4a

Changes:

* Script adopted to the latest Tools:
-- MaskTools 1.4.14
-- AviSynth 2.55 (03-03-2004)

This required a non-trivial overhaul of all the internal creation & handling of the several masking operations.
Therefore, the achieved effect is not _exactly_ the same as before. The results should be a little more gentle and pleasing as before.
(But I need your feedback, I cannot test all sources in the world by myself ;) )

* The script should now run about 10% 'faster' than before

* added more debug/visualization parameters, to help setting up the values.

The usage and default parameters now look like follows:
iip( dest_x= 704, dest_y= 416,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker= true,
\ detailcontr1=104, detailcontr2 = 208, contr_radius = 2, PixSharp=0.35,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren=1.58, flatweight = 0,
\ dering = 100, dering_weight= 1.0, dering_floor = 30, dering_bias=1.0,
\ debug= "dering | protect | detail | showall | compareH | compareV", cropx=8,cropy=0
\ )

The new debug parameters should speak for themselves, choose either of them. The "cropx/cropy" parameters can be speciyfied to crop a little from the clip's sides, if one wants to compare input & output side-by-side or ontop of each other, and your screen is to small to view all of it ;)

I'm planning to also integrate some parameters (yeah! more parameters!) to take influence on the several masks. I've found, not surprisingly, that sources of different quality require the masks to be altered. The current defaults should work OK on most sources, I hope.

And, PLEASE, remember to play a little with the parameters, especially for the sharpening. What is already much too strong for source A, might be far too less for source B, and the other way round. (Soulhunter: e.g., drop the sharpening values by ~20%, and then look again for the achieved filesize ... )

Looking forward to your results, comments, suggestions, and flames.

- Didée

Didée
11th March 2004, 16:16
The script.



** REMOVED **

I managed to post a development version, acidentially :o

Find the correct version on the next page.

Soulhunter
11th March 2004, 20:34
Originally posted by Didée
And, PLEASE, remember to play a little with the parameters, especially for the sharpening. What is already much too strong for source A, might be far too less for source B, and the other way round. (Soulhunter: e.g., drop the sharpening values by ~20%, and then look again for the achieved filesize ... )

Looking forward to your results, comments, suggestions, and flames.

- Didée No problem, I have some free time next weekend... ;)


But a quick test with your new version gives me an error !!!

Script error: there is no function named "DEdgeMask"
(C:\Blah\iip.avs, line 100)
AviSynth n' MaskTools should be up-to-date... :confused:


Bye

Manao
12th March 2004, 00:05
SoulHunter : your MaskTools version isn't up to date. Check your dll, its version number should be 1.4.14. If it is not, you'll get it here (http://www.geocities.com/manao47/Filters/masktools-v1.4.14.zip) ( right click, copy & paste in address bar as always )

Ark
12th March 2004, 15:50
Thanks Didée for this update, now the average encoding speed is about 1.5 fps (the value always fluctuate around 1.0-2.0) :eek: !!

I've to report a strange "bug" in iip, an artifact that happen on soft areas, very much like a codec pixelization due to low bitrate, with some "macroblocks" appearing.

I've 2 images from Matrix (frame 152467), 640x272, one resized with lanczos, the other with iip, with the mentioned "bug". It's close to Trinity's right shoulder (it's easy to find to my eyes with a 200% zoom), and happen not that much often, only on some frames and in motion it's hardly visible, but i wonder why it happen??

This frame is also a very small example, in some scenes the effect is much more wider, but only happen in a few frames, 1-2-3 consecutive frames, no more.

Since I've no web space, I can send (via e-mail) these images to Didèe or anyone interested to see if I only have this strangeness or not...

And I've the impression that there is more ringing around edges than before in this new version...but this is just an impression...

Anyway, great work Didée!! :)

Soulhunter
12th March 2004, 18:56
Originally posted by Manao
SoulHunter : your MaskTools version isn't up to date. Check your dll, its version number should be 1.4.14. If it is not, you'll get it here (http://www.geocities.com/manao47/Filters/masktools-v1.4.14.zip) ( right click, copy & paste in address bar as always ) Yeah, you are right... :eek:

Much thanks Manao !!!


Bye

Soulhunter
12th March 2004, 21:42
First play-around results...


Source: Matrix (PAL) / Lobby shootout chapter / First 1000 frames

Settings: XviD RC3 / Fixed quantizer 2 / MPEG matrix / VHQ1 / 1024x576




iip(Dest_x= 1024, Dest_y= 576)
Size = 30.6 MB




iip( dest_x= 1024, dest_y= 576,
\ ss1_x = 1.5, ss1_y = 1.5,
\ duststr = 2, dustweight = 1.0, antiflicker= true,
\ detailcontr1=104, detailcontr2 = 208, contr_radius = 2, PixSharp=0.35,
\ ss2_x = 2.5, ss2_y = 2.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren=1.58, flatweight = 0,
\ dering = 100, dering_weight= 1.0, dering_floor = 30, dering_bias=1.0,
\ debug= "dering | protect | detail | showall | compareH | compareV", cropx=8,cropy=0
\ )
Size = 29.7 MB




iip( dest_x= 1024, dest_y= 576,
\ ss1_x = 1, ss1_y = 1,
\ duststr = 3, dustweight = 1.0, antiflicker= true,
\ detailcontr1=100, detailcontr2 = 200, contr_radius = 2, PixSharp=0.25,
\ ss2_x = 2, ss2_y = 2,
\ Xstren = 255, Xlimit = 255,
\ subpelstren=1.58, flatweight = 0,
\ dering = 150, dering_weight= 1.0, dering_floor = 30, dering_bias=1.0,
\ debug= "dering | protect | detail | showall | compareH | compareV", cropx=8,cropy=0
\ )
Size = 28.6 MB




iip( dest_x= 1024, dest_y= 576,
\ ss1_x = 2, ss1_y = 2,
\ duststr = 3, dustweight = 1.0, antiflicker= true,
\ detailcontr1=100, detailcontr2 = 150, contr_radius = 2, PixSharp=0.25,
\ ss2_x = 4, ss2_y = 4,
\ Xstren = 255, Xlimit = 255,
\ subpelstren=1.50, flatweight = 16,
\ dering = 100, dering_weight= 1.0, dering_floor = 30, dering_bias=1.0,
\ debug= "dering | protect | detail | showall | compareH | compareV", cropx=8,cropy=0
\ )
Size = 23.4 MB




Note1: For all encodes except IIP one, Lanczos resize was used !!!

Note2: All smoothers where used after the resizing !!!

Note3: I dont take any responsibility for the results !!!



Bye

Didée
13th March 2004, 14:10
STOP!

As the big fool I am, I somehow managed to post a *development* version of iiP, instead of the correct one. Shame on me! (I should learn to give my working files better suited names ;) ).

The correct version will be posted shortly - I first have to double/triple/quadruple check that it's really the correct one. O_~

originally posted by Ark
And I've the impression that there is more ringing around edges than before in this new version...but this is just an impression...

Your impression was perfectly right. Most of the internal masking was in an unsuited state.


Soulhunter: So your tests were a little b0rked, sorry ...

[BTW: To whom belongs that eye now? I give up! Perhaps Madonna (eyebrow!), perhaps Mrs. Feldbusch? Have no clue, really.]


- Didée

Didée
13th March 2004, 17:03
Now, here we have a new, correct(!), version of iiP.

Since the time when I posted the (wrong) last version, the masking has undergone some more refinement. I think it is working really well now: When checking it on a clean DVD source (LOTR TTT is my current test case), I found no special issues (but lot of exitement). Same goes for some mostly clean, but very soft DVB captures (Enterprise), where e.g. some *text* suddenly arised out of what formerly was nothing more than a blue blob on a computer console.

Try it, I like the results a lot now.

The parameter battery has changed a little, so here we go:

Usage & default parameters:
iip( dest_x= 800, dest_y= 480,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker= false,
\ detailcontr1=104, detailcontr2 = 192, contr_radius = 2, PixSharp=0.4,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren=1.58, flatweight = 0,
\ protect_floor= 8, protect_bias = 16,
\ dering = 100, dering_weight= 1.0, dering_floor = 8, dering_bias=16,
\ debug= "protect | detail | dering | showall | compareV | compareH",
\ cropx=64, cropy=32
\ )

New parameters are "protect_floor" and "protect_bias".
"dering_bias" has changed from FLOAT to an INT parameter.
"dering_floor" now has a different scale than in previous versions.

dering_floor [int]
As before, this is a value controlling at which "strength-of-detail" the deringing part will start to kick in. Default is "8", useful range is from 0 to about 32.

dering_bias [int]
This still controls how quickly the strength of the de-ringing process will raise as the strength-of-detail raises. Higher values will apply more deringing.
Default is "16", useful range is from about 4 up to infinite (almost).
The effect gets saturated with higher values. You will see big changes in the mask when changing this in the range of 0 ~ 16; beyond of 64, the mask will stay almost the same.

protect_floor [int]
This controls at wich level of detail-strength in the source the applied sharpening will start to get attenuated. Default is "8", useful range is from 0 to [something]. From my experiences so far, keep it in the range of 0 ~ 16.

protect_bias [int]
Again, this controls how quickly the attenuation of the applied sharpening will raise with the strength of detail. Higher values will protect more detail from oversharpening (but reduce the effective overall amount of sharpening).
Default is "16", useful range is IMO 4 ~ 64. With high values, this will saturate similar to "dering_bias".

I suggest you to use either of the "debug" possibilities, preferable the "showall" option, to get an idea of how changing any parameters will influence the process.

Note #1:
Alas, this version is again a tad slower then the previously posted wrong version. But it's still "much" ;) faster than the older versions using GeneralConvolution.
Big thanks go to Kurosu for inventing, and not less to Manao for further developping and continuous bugfixing the MaskTools.

Note #2:
I won't lie it away: there is one sort of "image feature" that sometimes gets a little degraded in quality. Namely, if there are objects that are out of the camera's focus, then it may happen that sharp borders of the object, that are blurry due to being out-of-focus, get some pixelazation.
If you discover something like this and feel distracted, you can try to alter the deringing parameters to catch those borders also - but you will loose a lot on the small detail parts, where deringing would be too strong, then.
Any tries to avoid this, without hurting the overall gain, would be much too time consuming to be applicable through an AviSynth script, though. It would require to distinguish between out-of-focus objects, gradients, and features that are simply not as sharp as they should be.
Anyone feels like coding a neural network ? :D


Have fun, and patience as well


- Didée

Didée
13th March 2004, 17:09
** I love my browser. ***

Didée
13th March 2004, 17:10
The script: iiP, v0.4b

edit 03-18-2004: fixed faulty calculation of supersampling values. (Didn't do any harm, but X/Y supersampling was not independendly possible as it should've been)

# iip : Integrated Image Processor, v0.4b
##
# Currently includes:
# - Denoising
# - detail enhancement |< while avoiding edge oversharpening, ringing,
# - improved edge definition |< halos, and detail flickering
# - deringing: removes noise around edges,
# moderates pre-existing Edge-Enhancement (dark & bright halos around edges)
#
# It's often able to make the clip, at the same time, sharper & more compressable than the source itself.
# By tweaking the values, you can give more priority to either compressability or sharpness.
#
# ---------------
# | It is slow. |
# ---------------
#

function Ylevels(clip clp, int a, float gamma, int b, int c, int d)
{ wicked="x "+string(a)+" - "+string(b)+" "+string(a)+" - / 1 "+string(gamma)+" / ^ "+string(d)+" "+string(c)+" - * "+string(c)+" +"
# Reminder: Yexpr = "x a - b a - / 1 gamma / ^ d c - * c +"
# return( clp.subtitle(wicked) )
return( clp.YV12LUT(Yexpr = wicked) )
}


function iip( clip clp,
\ int "dest_x", int "dest_y",
\ int "duststr", float "dustweight",
\ float "ss1_x", float "ss1_y",
\ int "detailcontr1", int "detailcontr2",
\ int "contr_radius", float "PixSharp",
\ float "ss2_x", float "ss2_y",
\ int "Xstren", int "Xlimit",
\ float "subpelstren", bool "antiflicker",
\ int "flatweight",
\ int "protect_floor",int "protect_bias",
\ int "dering", float "dering_weight",
\ int "dering_floor", float "dering_bias",
\ string "debug",
\ int "cropx", int "cropy"
\ )
{
ox = clp.width
oy = clp.height
xcorr=(int(ox/16.0+.9999)*16)-ox
dest_x = default(dest_x, clp.width)
dest_y = default(dest_y, clp.height)
ss1_x = default(ss1_x, 1.414)
ss1_y = default(ss1_y, 1.414)
ss2_x = default(ss2_x, 3.5)
ss2_y = default(ss2_y, 3.5)
duststr = default(duststr, 2)
dustweight = default(dustweight, 1.0)
antiflicker= default(antiflicker, true)
Xlimit = default(Xlimit, 255) # SS<3 ? 23 : 255
Xstren = default(Xstren, 255) # SS<3 ? 216 : 255
detailcontr1= default(detailcontr1, 108)
detailcontr2= default(detailcontr2, 192)
contr_radius= default(contr_radius, 2)
PixSharp = default(PixSharp, 0.4)
subpelstren = default(subpelstren, 1.58)
flatweight = default(flatweight, 0)
protect_floor=default(protect_floor, 8)
protect_bias= default(protect_bias, 16)
dering = default(dering, 100)
dering_floor= default(dering_floor, 8)
dering_bias = default(dering_bias, 16)
dering_weight=default(dering_weight, 1.0)
debug = default(debug, "Mickey Mouse")
cropx = default(cropx, 40)
cropy = default(cropy, 20)

cropx=int(cropx/4)*4
cropy=int(cropy/4)*4
xx_ss1 = int(ox*ss1_x/16+.5)*16
yy_ss1 = int(oy*ss1_y/16+.5)*16
xx_ss2 = int(ox*ss2_x/16+.5)*16
yy_ss2 = int(oy*ss2_y/16+.5)*16

# still waiting for the other idea
antiflicker == true ? clp.temporalsoften(3,2,3,23,2) : clp

#---------------------------------------------------------------------------------------------------------------------
# Base denoising by PixieDust
#
dusted=last.addborders(0,0,xcorr,0).converttoyuy2().PixieDust(limit=duststr).converttoyv12().crop(0,0,-xcorr,-0)#.BlindPP(quant=8,cpu=4,moderate_h=40,moderate_v=60)
dusted = (dustweight<1.00) ? Overlay(last, dusted, opacity=dustweight) : dusted

#---------------------------------------------------------------------------------------------------------------------
# Build EdgeMask to protect already sharp detail from oversharpening
#
YV12subtract( dusted.sharpen(1.0), dusted.blur(1.0).blur(1.0) )
edge0 = bicubicResize(xx_ss1,yy_ss1,-1.0,1.0)
\ .YV12LUT(Yexpr="x 128 - abs "+string(protect_floor)+" - "+string(protect_bias)+" *")
\ .deflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1).blur(1.58)

#---------------------------------------------------------------------------------------------------------------------
# Build DeRing'ing Mask
#
edge1b = yv12subtract( expand(Y=3,U=1,V=1).expand(Y=3,U=1,V=1).blur(1.58),
\ expand(Y=3,U=1,V=1).inpand(Y=3,U=1,V=1) )
\ .bicubicResize(xx_ss1,yy_ss1,-1.0,1.0)
\ .yv12LUT(Yexpr="x 128 - abs "+string(dering_floor)+" - "+string(dering_bias)+" *")
\ .deflate(Y=3,U=1,V=1).blur(1.58)

#---------------------------------------------------------------------------------------------------------------------
# 1st supersampling stage to perform sharpening at
#
(ss1_x > 1.0 || ss1_y > 1.0) ? dusted.Lanczosresize(xx_ss1,yy_ss1)
\ : dusted

temp = last

# iterative sharpening, currently only 3-fold: its slow enough ...
detailcontr1 != 0 ? unsharpmask(detailcontr1,contr_radius,0) : NOP
detailcontr2 != 0 ? unsharpmask(detailcontr2, 1,0) : NOP
PixSharp != 0.0 ? sharpen( PixSharp ) : NOP

MaskedMerge(last,temp,edge0,Y=3,U=1,V=1,useMMX=true).undot()

#---------------------------------------------------------------------------------------------------------------------
# DeRing'ing of sharpen'ed clip
#
dering != 0 ? MaskedMerge(last,last.unfilter(-dering,-dering),edge1b.bicubicresize(xx_ss1,yy_ss1),Y=3,U=1,V=1,useMMX=true)
\ : NOP

# still waiting for the other idea
antiflicker == true ? temporalsoften(1,2,3,23,2) : NOP

#---------------------------------------------------------------------------------------------------------------------
# 2nd supersampling stage to perform SubPel operation & XSharpening at
#
xx_ss2 != ox && yy_ss2 != oy ? LanczosResize(xx_ss2,yy_ss2) : NOP

subpelstren != 0.0 ? blur(subpelstren) : NOP

Xstren != 0 && Xlimit !=0 ? xsharpen(Xstren,Xlimit) : NOP

LanczosResize(dest_x,dest_y).undot()

#---------------------------------------------------------------------------------------------------------------------
# Build new EdgeMask of the enhanced clip
#
# Note: in the following expression, replacing "levels" by the faster "Ylevels" [-> YV12LUT] delivers *very* different
# results: Gamma is somehow b0rked, then. But it works correctly in the other places in this script !?!

edge2 = bicubicresize(int(dest_x/1.75/16+.5)*16,int(dest_y/1.75/16+.5)*16,1.0,.0)
\ .DEdgeMask(0,255,0,255,"-5 -7 -5 -7 48 -7 -5 -7 -5",Y=3,U=1,V=1,useMMX=true,setdivisor=true,divisor=1)
\ .levels( (23+int(detailcontr1/15+detailcontr2/30+PixSharp*15)), 4.0,128,flatweight,255,false)
\ .bicubicResize(dest_x,dest_y,1.0,0)
\ .inflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1)
\ .blur(1.58).greyscale()
\ .inflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1)
\ .temporalsoften(1,63,63,255,2)

#---------------------------------------------------------------------------------------------------------------------
# Put original de-noised & not-sharpened clip into areas still appearing flat, after all that sharpening
#
MaskedMerge(dusted.lanczosresize(dest_x,dest_y),last,edge2,Y=3,U=1,V=1,useMMX=true)

#---------------------------------------------------------------------------------------------------------------------
# Visualizations
#
debug == "dering" ? overlay(last,blankclip(last,color=$008000),mask=edge1b.bicubicresize(dest_x,dest_y),mode="blend",opacity=dering_weight)
\ : NOP
debug == "protect" ? overlay(last,blankclip(last,color=$008000),mask=edge0.bicubicresize(dest_x,dest_y),mode="blend",opacity=0.75)
\ : NOP
debug == "detail" ? overlay(last,blankclip(last,color=$008000),mask=edge2.bicubicresize(dest_x,dest_y),mode="blend",opacity=0.75)
\ : NOP
debug == "compareH" ? stackhorizontal(clp.lanczosresize(dest_x,dest_y).crop(cropx,0,-cropx,-0).addborders(0,0,4,0,color=$800000).subtitle("Original"),
\ last.crop(cropx,0,-cropx,-0).subtitle("iiP") )
\ : NOP
debug == "compareV" ? stackvertical(clp.lanczosresize(dest_x,dest_y).crop(0,cropy,-0,-cropy).addborders(0,0,0,4,color=$800000).subtitle("Original"),
\ last .crop(0,cropy,-0,-cropy).subtitle("iiP") )
\ : NOP
debug == "showall" ? stackvertical( stackhorizontal( edge0 .greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,4,4,color=$800000).subtitle("Protection of sharp edges"),
\ edge1b.greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,0,4,color=$800000).subtitle("DeRing'ing") ),
\ stackhorizontal( edge2 .greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,4,0,color=$800000).subtitle("Detail areas"),
\ last .crop(cropx,cropy,-cropx,-cropy).subtitle("iiP") ) )
\ : NOP

return(last)
}

#

Soulhunter
13th March 2004, 20:48
Well... :rolleyes:


Source: Matrix (PAL) / Lobby shootout chapter / First 1000 frames


Settings: XviD RC3 / Fixed quantizer 2 / MPEG matrix / VHQ1 / 1024x576




iip( dest_x= 1024, dest_y= 576,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker= false,
\ detailcontr1=104, detailcontr2 = 192, contr_radius = 2, PixSharp=0.4,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren=1.58, flatweight = 0,
\ protect_floor= 8, protect_bias = 16,
\ dering = 100, dering_weight= 1.0, dering_floor = 8, dering_bias=16,
\ debug= "protect | detail | dering | showall | compareV | compareH",
\ cropx=64, cropy=32
\ )
Size = 40.1 MB




iip( dest_x= 1024, dest_y= 576,
\ ss1_x = 2, ss1_y = 2,
\ duststr = 3, dustweight = 1.0, antiflicker= true,
\ detailcontr1=100, detailcontr2 = 150, contr_radius = 2, PixSharp=0.25,
\ ss2_x = 3, ss2_y = 3,
\ Xstren = 255, Xlimit = 255,
\ subpelstren=1.58, flatweight = 32,
\ protect_floor= 8, protect_bias = 16,
\ dering = 100, dering_weight= 1.0, dering_floor = 8, dering_bias=16,
\ debug= "protect | detail | dering | showall | compareV | compareH",
\ cropx=64, cropy=32
\ )
Size = 25.8 MB




iip( dest_x= 1024, dest_y= 576,
\ ss1_x = 2, ss1_y = 2,
\ duststr = 3, dustweight = 1.0, antiflicker= false,
\ detailcontr1=150, detailcontr2 = 200, contr_radius = 2, PixSharp=0.5,
\ ss2_x = 4, ss2_y = 4,
\ Xstren = 255, Xlimit = 255,
\ subpelstren=1.58, flatweight = 0,
\ protect_floor= 8, protect_bias = 16,
\ dering = 100, dering_weight= 1.0, dering_floor = 8, dering_bias=16,
\ debug= "protect | detail | dering | showall | compareV | compareH",
\ cropx=64, cropy=32
\ )
Size = 32.4 MB




iip( dest_x= 1024, dest_y= 576,
\ ss1_x = 1.5, ss1_y = 1.5,
\ duststr = 5, dustweight = 1.0, antiflicker= false,
\ detailcontr1=104, detailcontr2 = 192, contr_radius = 2, PixSharp=0.4,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren=1.5, flatweight = 32,
\ protect_floor= 8, protect_bias = 16,
\ dering = 150, dering_weight= 1.0, dering_floor = 8, dering_bias=16,
\ debug= "protect | detail | dering | showall | compareV | compareH",
\ cropx=64, cropy=32
\ )
Size = 37.6 MB




Bye

Mango Madness
17th March 2004, 13:54
I get excellent results with this filter when attempting to create the utmost quality encodes. I think it's time, though, that you provided a package with documentation (I like pdf :cool: ) , the avs file, and perhaps even the filters needed.

Lycaon
17th March 2004, 15:24
Didée, thank you for this great script :)

Which plugin and version is responsible for the "UNFILTER" command. I'm getting an error at that line that the "Unfilter" command isn't specified. I used Tom's plugin to fix it, but this wasn't included in the plugin list on the first page.

There are sooooo many different versions of these plugins running around it would help to know which ones are being used.

One other question, what bitrates are people using for these encodes?

Thanks,

Lycaon

Didée
17th March 2004, 16:29
Small silent update:

Due to an unlucky ordering of two parameters, the simple default usage like "iiP()" or "iiP(1280,544)" would throw an error. This is now corrected. Functionality stays the same (for now).


Mango Madness:
At least the documentation is a good idea, I know. That will be the very first thing I'll do, as soon as I got bored from too much spare time (read: perhaps somewhen this year, around christmas or so ...)


Lycaon:
Welcome to the forum!
Yes, indeed I forgot to mention the unfilter plugin by tbarry. The usual problem: with growing experience, one tends to forget about some basic things ... sorry!

Well, two examples for bitrates I'm producing with iiP:

1. 704*528 @ 1000~1100 kbps -- 16:9 widescreen anamorph, with removed TV overscan, like the examples linked above. Sources are DVB captures.

2. 960*528 @ ~2700 kbps -- non-standard "720p cinemascope anamorph", at which I am making backups of my LOTR SEE DVDs ... oh, did I say backups?


- Didée


edit: what the heck is 1280p? 720p!

scharfis_brain
17th March 2004, 23:34
found a bug accoring to the supersampling - paramters ss_1 and ss_2

the y value is always overridden.

It doesn't matter which value I am using for y. It's always the x - value used instead.

I think its just a copy-&-paste-bug

within the default-section and some lines deeper, when calculating the ss-values

Didée
18th March 2004, 00:16
:stupid:

Script corrected. Thanks, Scharfi!

But now, someone explain me one thing:

Why does xyz = default(abc, whatever) always overide xyz, even if xyz is passed explicitely (and named) to the function? Shouldn't default() only kick in if xyz is *not* passed to the function, i.e. if it is not defined?

I'll start over again with the section "My first AviSynth script". :) :(

- Didée

scharfis_brain
18th March 2004, 00:32
very simple to explain!

funtion test(int a, int b)
{ a = default(a,3)
b = default(a, 4)
return b
}

always returns a, because of default's correct behaviour :)

a = default(a, 3)
returns 3 to a , if a is not defined. Else it returns a to a

b = default(a, 4)
returns 4 to b , if a is not defined. Else it returns a to b.

Hehe. Easy, isn't it?

EDIT:
please edit those lines, too:

x_ss1 = int(ox*ss1_x/16+.5)*16
yy_ss1 = int(oy*ss1_x/16+.5)*16
xx_ss2 = int(ox*ss2_x/16+.5)*16
yy_ss2 = int(oy*ss2_x/16+.5)*16

into
x_ss1 = int(ox*ss1_x/16+.5)*16
yy_ss1 = int(oy*ss1_y/16+.5)*16
xx_ss2 = int(ox*ss2_x/16+.5)*16
yy_ss2 = int(oy*ss2_y/16+.5)*16

EDITed 2nd default-line!
(a copy-paste-mistake!)

scharfis_brain
18th March 2004, 01:26
I've abused iip as VHS-postprocessor.

With great succes!

The settings, I used:
iip( 768,432, duststr=8,
\ detailcontr1=256,detailcontr2=0,contr_radius = 3,
\ ss1_x=1.4,ss1_y=3.0,
\ ss2_x=3.0,ss2_y=5.0
\ )

Source (4-time multiple capture without denoising)
http://home.arcor.de/scharfis_brain/samples/ET-VHS-LP-src.jpg

iip-processed:
http://home.arcor.de/scharfis_brain/samples/ET-VHS-LP-iip.jpg

btw. It is PAL VHS-LongPlay.
Recorded some weeks ago with a Grundig-Vivance 43 VCR.

DarkNite
18th March 2004, 09:49
Thank you scharfis_brain! That post was so educational for me. One of those classic doom9 forum gems that just spill out here and there and help clarify that question that once made your mind feel as if it were a lumpy serving of Cream O' Wheat.

Sometimes after a long day of auditing, inventory control, and various feats of spreadsheet magic that somehow make money matters work out in the end, the finer points of scripting in avisynth seem to blur together into a single mass of incoherent mental noise.

Many thanks to Didée as well, for all his hard work and ideas.

The one encode I've actually finished using iiP was amazing and well worth the time to encode. Definitely superior quality when compared to the filterchain I was using for that source prior to iiP.

Now to restart this ~47 hour encode and get back to my coffee.

mf
18th March 2004, 11:49
Bad scharfi. You've oversharpened your VHS thing. It has haloing.

-- Halo police

Didée
18th March 2004, 12:14
Originally posted by mf
It has haloing. Yep.
You've oversharpened your VHS thing.Nope.

There is no Haloing in that screenshot that is introduced by the sharpening process. It's the haloing already present in the source (well, VHS...) that didn't get surpressed well enough. I assume the deringing parameters could've been set so as to catch a wider range. But perhaps the currently available tweaking possibilities are not sufficient.

In any case, one thing we could really need is a *real* "anti-EE" filter, similar to the "FixVHSoverSharp"-filter.
The idea to search for peaks at dark-light-transitions is already there. It has only to be coded by someone.

BTW, script of iiP v0.4d was corrected one more time :rolleyes:. Now X/Y supersampling can be performed independendly, as it was intended since the beginning.
(But isn't it cute? Scharfis_brain reports "copy'n'paste errors", and while reporting, he makes ... copy'n'paste errors :) )

- Didée

dbzgundam
30th March 2004, 01:59
I'm getting an error about no "YV12Subtract" filter.... Huh?

Didée
30th March 2004, 08:12
dbzgundam:

I'll try first with a dumb question ;) :

Do you have the latest MaskTools (http://forum.doom9.org/showthread.php?s=&threadid=67232), and are you loading that plugin at the beginning of your script?

malkion
30th March 2004, 13:24
Didee, dumb question.

What would happen if u changed all instances of bicubic to lanczos4 in iip script? Would u recommend it? You get a sharper picture yes?

Didée
30th March 2004, 15:02
Originally posted by malkion
What would happen if u changed all instances of bicubic to lanczos4 in iip script? Would u recommend it? You get a sharper picture yes?
Well, try it out and see what happens ... :)

Seriously: No, please DON'T do THAT!

All instances of "BicubicResize" are used in mask creation procedures exclusively. And these parts took me some long nights to tune, up to the point where I *think* they work best - and this involves the different bicubic's along with their kernel parameters (either sharp, or soft, or inbetween). You will find e.g. something like "inflate.deflate.blur()" somewhere in the script. This seems to be a waster of CPU cycles - but it's there for some reason, indeed.
So: of course you are invited to experiment! But poking around in the blue will probably not get you very far.

What you *could* exchange are the two instances of "LanczosResize", as these are the only ones that do scale the original image data.
BUT: you won't get a sharper picture by doing so. Lanczos4 uses a larger kernel than Lanczos3; therefore it samples a little more accurate, and a little *softer*.

I didn't try it myself up to now, but I would assume the following: When using Lanczos4 instead of Lanczos3, with all other parameters exactly the same, you won't notice much difference in sharpness, but the compressability perhaps would get a tad better.

But then - for that reason, I played with "inverse hybrid resizing", if I may say so: bicubic for the already sharp image features, lanczos for the flat areas. This allowed either to use higher sharpening values without getting artefacts, or to get a compressability boost of 5%~15% depending on the source, wohoo ... but it was *extraordinarily* slow, and so I dropped the idea again.
Instead I started thinking of something else. I guess I'm not the only one hating halos around edges? ;)

- Didée


EDIT:

Correction: Did some measurments about lanczos3 and lanczos4. Lanczos4 produces a sharper picure than lanczos3. But for plain resizing jobs, the difference is neglectable.

Mango Madness
31st March 2004, 19:11
Just wondering if work is continuing on this function as I know you had previewed .85a on the other forums.

Didée
1st April 2004, 00:55
Wrong thread, Mango Madness ;)

HybridFupp might jump from 0.84b to 0.85a, but not iiP from 0.4 ...

- Didée

Mango Madness
1st April 2004, 02:30
haha, doh! :rolleyes:

dbzgundam
1st April 2004, 22:08
ok...... I have the latest MaskTools, but that doesn't help.

Now I'm getting an error stating some VERY strange characters!
Here's what I mean:

http://www.esenet.com/baka/avserror.JPG

That line six is simply the loadplugin command for Masktools. :mad:

Soulhunter
1st April 2004, 22:18
Post the script... ;)


Bye

Didée
2nd April 2004, 09:38
dbzgundam:

I remember to have seen that error before (shudder). But what was it, what was it ...

IIRC it was related to either WarpSharp.dll or DustV5.dll. Note that older versions of the WarpSharp package needed some additional DLLs from within "71.cab" floating around somewhere.

Do the following simple scripts work for you:

XYZsource( YourSource )
UnsharpMask( 127,1,0 )

and

XYZsource( YourSource )
ConvertToYUY2().PixieDust(2).ConvertToYV12()

?

Didée

stickboy
2nd April 2004, 17:51
That error message appears when LoadPluginEx from the WarpSharp package fails. (LoadPluginEx is Japanese, hence the "strange" characters.)

Remove LoadPluginEx temporarily to see a normal error message in English.

Didée
25th June 2004, 12:12
Probably this weekend, I'm about to post a new version of iiP.

I've put some additional features in:

- better edge protection - makes deringing unnecessary on many sources
- optional WarpSharping for Luma (supersampled) - makes picture a tad more gracile when upsizing the source
- optional chroma WarpSharp - often useful for sources with "bleeding colors"
- optional border exclusion for sharpening - many sources already contain artefacts in these regions

BlindDeHalo() is not yet implemented. (I still use it as seperate pre-processor on some sources.)

The bad news is: it doesn't run faster than before ...

The good news: it doesn't run much slower than before.


And just to remind you what iiP is doing at all: One more example from my Enterprise DVB captures.

Source.crop(8,72,-8,-72).LanczosResize(704,528) :
http://img21.imageshack.us/img21/6518/ENT_1x09_sourcelanczos.png

Source.crop(8,72,-8,-72).iiP(704,528) :
http://img21.imageshack.us/img21/939/ENT_1x09_sourceiiP.png


Notes:

Yes, the original source is really that blurry! Regarding the fact it was originally shot with HDTV cams (AFAIK), it is a big shame what they are giving to the viewer, at least here in Germany. Isn't it?

The above is sort of a worst-case example. This is an *honest* comparison. While the general improvement should be very obvious, you'll also notice that some small artefacts were enhanced. I just cannot guarantee to catch everything with the protection masks, alas.
However, I could also show you many screenshots without any artefacts, just to brag about my script ;)

Originally, there was also a big annoying station logo in the clip :D


- Didée

koszopal
25th June 2004, 14:24
@didee
great :) i cant wait gimme,gimme !!!! ;)
but with previous i ve got problems :(
here is sample
source.crop(10,12,700,548).LanczosResize(624,336)
http://pics.xs.to/pics/04065/02_source1.png
source.crop(10,12,700,548).iip(624,336)
http://pics.xs.to/pics/04065/02_iip.png
something is wrong with old lady face :(( i can agree that hears and hut is sharper but face is blurred and dont look nice in montion too , it look unnatural:(()
and something is wrong i think with left edge of lady :((
and here is same with LimitedSharpen
source.crop(10,12,700,548).LimitedSharpen().lanczosresize(624,336)
http://pics.xs.to/pics/04065/02_limited.png
koszopal
ps few sec. of source vob (rename .gif to .vob ):Dsource (http://fire.prohosting.com/koszopal/sns/sns_old.gif)
pps forgive my my poor english i hope u understand that i mean
-- changed server to host images

Didée
25th June 2004, 15:16
Sure I understand you :)

For some reason I can't get access to your screenshots - might be a problem with my company's server, it behaves a little strange today.
But I got your VOB snipplet, and can have a look at it later.

Anyway, with calling iiP(624,336) you simply use the default values for all parameters. And as stated a several times, the defaults cannot suit *all* sources.
That's why there is e.g. the debug="showall" option to help you finding *your* values for *your* source ... ;)

I guess the problem is that the area in question simply is too flat. I cannot allow insane sharpening down to the zero level, because then the result would come out ugly as well, and compressability would shoot through the roof, too. (mf tried that with his "UnSmooth()" script, but that one wasn't a big hit for just that reason.)

Just a blind try: Give a shot on
iip( dest_x=624, dest_y=336,
\ duststr = 0, dustweight = 0.75,
\ ss1_x = 1.415, ss1_y = 1.415,
\ detailcontr1=127, detailcontr2= 160, contr_radius=2, PixSharp = 0.4,
\ ss2_x = 3.5, ss2_y = 3.5,
\ subpelstren = 1.0, antiflicker=false,
\ Xstren = 255, Xlimit=255,
\ flatweight = 100,
\ protect_floor = 8, protect_bias = 12,
\ dering = 60, dering_floor = 8, dering_bias = 8,
\ debug="compareV", cropx=16, cropy=16
\ )

*Try* these settings - but don't *encode* with them ;)

- Didée


[edit]

Ah! Now I have your screenshots, too - the links are OK.

But now, on this crappy office desktop, I've the bright sun both in my face and on my monitor, and really cannot see *anything* at all :devil:

koszopal
25th June 2004, 16:05
@didee
thx :)
with your setting looks like
http://img9.imageshack.us/img9/8771/02_iip_your.png
without compression of coz :D
but .. didnt tried with iip(624,336) it was a shortcut :)
i ve tryed searching my values but didnt founded best.. :((
with your settings is a liitle better in this area face isn't as flat as was before.
koszopal
ps my previous script:
iip( dest_x= 640, dest_y= 352,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.00, antiflicker= true,
\ detailcontr1=108, detailcontr2 = 192, contr_radius = 2, PixSharp=0.5,
\ ss2_x = 5.0, ss2_y = 5.0,
\ Xstren = 255, Xlimit = 255,
\ subpelstren=1.58, flatweight = 16,
\ protect_floor= 16, protect_bias = 64,
\ dering = 100, dering_weight= 2.0, dering_floor = 32, dering_bias=64,
\ debug=" "
\ )
with

Thracks
25th June 2004, 19:28
Pardon me for my lack of understanding.. I'm new at AVISynth.

Would I copy the script on page 2 into a .avs file, and then call it from one of my own scrips?

For example, I wanted to call a source file (.d2v), run a resize and change the FPS.

1. Call the d2v importer DLL
2. Run the lanczos4 resizer
3. Change the FPS
4. THEN call your filter?
5. Import my AVS script into CCE

This script would be great from upsizing a mildly noisy source, wouldn't it? For example, a telecined piece?

DarkNite
26th June 2004, 09:41
You can skip step 2. You can designate the destination size in the call using the dest_x (width) and dest_y (height) variables.

Soulhunter
26th June 2004, 20:59
Yummy, a new version of IIP !!!

After my next CQM comparison, I will do a(nother) Reloaded HQ encode... ;)

Btw, the right answer to the "eye riddle" (remember ???) was -> Jessica Alba <- (the Dark Angel chick) !!!


Bye

Thracks
26th June 2004, 21:14
I'm having some trouble.

Here's my script:


LoadPlugin("undot.dll") #
LoadPlugin("MaskTools.dll") # These plugins
LoadPlugin("WarpSharp.dll") #
LoadPlugin("LoadPluginEx.dll") # are required!
LoadPlugin("dustv5.dll") #
LoadPlugin("DGDECODE.dll") #Call the DVD2AVI frameserve plugin
mpeg2source("hp3tc.d2v") #Calls the frameserved .d2v project
AssumeFPS(23.976) #25 FPS -> 23.976
Import("iip.avs") #run IIP
iip( dest_x=1024, dest_y=576,
\ duststr = 0, dustweight = 0.75,
\ ss1_x = 1.415, ss1_y = 1.415,
\ detailcontr1=127, detailcontr2= 160, contr_radius=2, PixSharp = 0.4,
\ ss2_x = 3.5, ss2_y = 3.5,
\ subpelstren = 1.0, antiflicker=false,
\ Xstren = 255, Xlimit=255,
\ flatweight = 100,
\ protect_floor = 8, protect_bias = 12,
\ dering = 60, dering_floor = 8, dering_bias = 8,
\ debug="compareV", cropx=16, cropy=16
\ )
# ADDITIONAL INSTRUCTIONS
# When the file is finished, run pulldown.exe on it for DVD compatability

And import it into CCE or VDubMod, it says:

YV12LUT does not have a named argument "Yexpr" (iip.avs, line 95)

And I can't figure out what that means?

If it's of relevance, my .d2v file is a segment of 23.976 FPS progressive mpeg2 footage.

Didée
26th June 2004, 23:39
Soulhunter:

Sure I remember!! But I had little chance - I never watched Dark Angel ...
But now that you revealed the solution, I will sleep much better again :D


Thracks:

Strange. Your script looks basically correct. Are you sure to use the most recent version of MaskTools? You need MaskTools v1.4.16 or better - check Manao's plugin page (http://www.geocities.com/manao47/Filters/)
Hmh, you're loading "DGDecode.dll" (a 2.5 plugin) *after* you loaded "LoadPluginEx.dll". This works with *some* versions of LoadPluginEx, but not with all. For security, please load DGDecode before LoadPluginEx. (Or is this an old version for AviSynth 2.0 I don't remember?)

BTW, your posted settings will produce extremely high bitrate. Do you own a dual-layer DVD burner yet ...


--------

Hrmpfh. Just when I thought the new version was ready for final clean-up, I suddenly had another idea for the deringing mask. Of course I had to evaluate this one first, since the deringing masking always was the part giving me the most grief ;)

WIP.

- Didée

malkion
26th June 2004, 23:39
You know Didee, one of these days you're just going to have to show us how to use the debugger to find our values for our sources...;)

Thracks
27th June 2004, 01:25
Thanks for the reply, Didée. :)

I know the settings will produce an extremely large piece. But this one isn't going for a DVD, I was merely editing one of my PAL SVCD -> NTSC DVD scripts to use IIP. So there are some holdovers of that (Like the pulldown.exe comments).

I'll give your suggestions a go. Thanks!

//EDIT:

Now it says

There is no function named unfilter (IIP.avs, line 125)

:(

I moved DGDecode first, and made sure to update my masktools package to the one you suggested.

//EDIT 2:

Fixed. All about loading the unfilter plugin eh? Heh.

Didée
27th June 2004, 22:39
It's ready.

Right now I cannot explain that baby - I have to step back from my PC for a few hours, for some reason.
Brief explanations are available in the script's header.

However, here is the new script: iiP, v.0.5



Script relocated to the next page - for better readability & flow of the thread.

Soulhunter
28th June 2004, 00:53
SetMemoryMax(256)

Import("C:\Programme\AviSynth 2.5\plugins\IIP.avs")

LoadPlugin("C:\Programme\AviSynth 2.5\plugins\undot.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\MaskTools.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\WarpSharp.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\LoadPluginEx.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\dustv5.dll")

mpeg2source("C:\Dokumente und Einstellungen\Soulhunter\Desktop\Temporal\test4\test4.d2v")

iip( dest_x= 1024, dest_y= 576,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.4,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = true, warp_UV = false,
\ debug= "showall | compareH/V | protect | dering",
\ cropx=32, cropy=16
\ )


Script error: yv12subtract does not have a named argument "wideRange" -> IIP.avs, line 161...

Didée
28th June 2004, 01:38
masktools-v1.4.16.zip (http://www.geocities.com/manao47/Filters/)

malkion
28th June 2004, 03:12
Didee, great job! :cool:

The new routine looks cool. Much softer than previous editions of iip.
Further testing on its way now. Thanks.

DarkNite
28th June 2004, 08:03
I agree, nice additions, and great script overall.

Oh, and I now present you with the The Most Visually Appealing Hyperlink of the Doom9 Forums Award for 2004. Kudos ;)

Didée
28th June 2004, 16:17
I re-arranged this post for better readability of the thread.


Full function call for iiP v.0.5a:
iip( dest_x= XXX, dest_y= YYY,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1= 104, detailcontr2 = 208, contr_radius = 2, PixSharp=0.38,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.58, flatweight = 0,
\ protect_floor = 0, protect_bias = 16,
\ dering = -80, dering_weight= 1.0, dering_floor = 8, dering_bias=12,
\ detail_floor = 10, EQ = 2,
\ warp_Y = false, warp_UV = false, exborder = false,
\ debug= "protect | dering | compareH|V | showall",
\ cropx=64, cropy=32
\ )


The script:
# iip : Integrated Image Processor, v.0.5a
#
#
# ---------------
# | It is slow. |
# ---------------
#
# New in v.0.5 :
#
# EQ [int] : Edge quality. 0=deaktivated (don't do that!!!), 1=standard (as formerly), 2=better'n'slower, 3=evenbetter'n'evenslower
# Note: when using EQ = 2|3, then it's a good idea to *DEACTIVATE* deringing in iiP (don't hit the dog twice).
#
# warp_Y, warp_UV [bool] additional Luma & Chroma Warping.
#
# Luma warping should make the picture more 'gracile' when upsizing to bigger resolution, e.g. DVD -> HDTV.
# For same resolution or downsizing, it may (?) help for sources with distorted detail. Or it may not - YMMV.
#
# Chroma warping helps on sources with bleeding colors (e.g. Enterprise: on the uniforms, the red stripes are bleeding into
# the blue cloth, which looks *very* ugly [like an aquarell that's gotten wet]. It looks much better with chroma warping.)
# On clean sources, chroma warping is a waste of CPU cycles.
#
# exborder [bool] : exclude outmost 8-pixel-border from sharpening (gradient masked)
#
# dering: old method: called with positive values for "dering"
# new method: called with negative values for "dering" (better, but slower)
#
# detail_floor [int] : was formerly hardcoded, now user-definable. default 20.
#

function Ylevels(clip clp, int a, float gamma, int b, int c, int d)
{ wicked="x "+string(a)+" - "+string(b)+" "+string(a)+" - / 1 "+string(gamma)+" / ^ "+string(d)+" "+string(c)+" - * "+string(c)+" +"
# Reminder: Yexpr = "x a - b a - / 1 gamma / ^ d c - * c +"
# return( clp.subtitle(wicked) )
return( clp.YV12LUT(Yexpr = wicked) )
}

function FineEdge( clip clp, int "div" )
{
logic( clp.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5", setdivisor=true, divisor=div)
\ ,clp.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5", setdivisor=true, divisor=div), "max", Y=3,U=1,V=1 )
}

function iip( clip clp,
\ int "dest_x", int "dest_y",
\ int "duststr", float "dustweight",
\ float "ss1_x", float "ss1_y",
\ int "detailcontr1", int "detailcontr2",
\ int "contr_radius", float "PixSharp",
\ float "ss2_x", float "ss2_y",
\ int "Xstren", int "Xlimit",
\ float "subpelstren", int "flatweight",
\ bool "antiflicker1", bool "antiflicker2",
\ int "protect_floor",int "protect_bias",
\ int "dering", float "dering_weight",
\ int "dering_floor", float "dering_bias",
\ int "detail_floor",
\ int "EQ", bool "exborder",
\ bool "warp_Y", bool "warp_UV",
\ string "debug",
\ int "cropx", int "cropy"
\ )
{
ox = clp.width
oy = clp.height
xcorr=(int(ox/16.0+.9999)*16)-ox
ycorr=(int(oy/ 8.0+.9999)* 8)-oy
dest_x = default(dest_x, clp.width)
dest_y = default(dest_y, clp.height)
ss1_x = default(ss1_x, 1.414)
ss1_y = default(ss1_y, 1.414)
ss2_x = default(ss2_x, 3.5)
ss2_y = default(ss2_y, 3.5)
duststr = default(duststr, 2)
dustweight = default(dustweight, 1.0)
antiflicker1= default(antiflicker1, true)
antiflicker2= default(antiflicker2, true)
Xlimit = default(Xlimit, 255) # SS<3 ? 23 : 255
Xstren = default(Xstren, 255) # SS<3 ? 216 : 255
detailcontr1= default(detailcontr1, 104)
detailcontr2= default(detailcontr2, 208)
contr_radius= default(contr_radius, 2)
PixSharp = default(PixSharp, 0.4)
subpelstren = default(subpelstren, 1.58)
flatweight = default(flatweight, 0)
protect_floor=default(protect_floor, 0)
protect_bias= default(protect_bias, 16)
dering = default(dering, -80)
dering_floor= default(dering_floor, 8)
dering_floor= dering<0 ? dering_floor*2 : dering_floor
dering_bias = default(dering_bias, 16)
dering_weight=default(dering_weight, 1.0)
detail_floor= default(detail_floor, 20)
EQ = default(EQ, 2)
EQ = (EQ>3) ? 3 : EQ
exborder = default(exborder, false)
warp_Y = default(warp_Y, false)
warp_UV = default(warp_UV, false)
debug = default(debug, "Mickey Mouse")
cropx = default(cropx, 40)
cropy = default(cropy, 20)

cropx=int(cropx/4)*4
cropy=int(cropy/4)*4
xx_ss1 = int(ox*ss1_x/16+.5)*16
yy_ss1 = int(oy*ss1_y/16+.5)*16
xx_ss2 = int(ox*ss2_x/16+.5)*16
yy_ss2 = int(oy*ss2_y/16+.5)*16
xx_small = int(ox/(abs(dering)/80+1.0)/16+.5)*16 + 32
yy_small = int(oy/(abs(dering)/80+1.0)/16+.5)*16 + 16

# Now I have the other idea - but it's too slow, yet
clp = antiflicker1 == true ? clp.temporalsoften(2,2,3,23,2) : clp

#---------------------------------------------------------------------------------------------------------------------
# Base denoising by PixieDust
#
dusted = clp.addborders(0,0,xcorr,ycorr).converttoyuy2().PixieDust(limit=duststr).converttoyv12().crop(0,0,-xcorr,-ycorr)
dusted = (dustweight==0.0) ? clp
\ : ( dustweight<1.00 ? Overlay(clp, dusted, opacity=dustweight)
\ : dusted )

soft=dusted.bicubicresize(xx_small,yy_small,.2,.4).bicubicresize(xx_ss1,yy_ss1,1.0,.0)

#---------------------------------------------------------------------------------------------------------------------
# Build EdgeMask to protect already sharp detail from oversharpening
#
YV12subtract( dusted.sharpen(0.6).sharpen(0.6), dusted.blur(1.0).blur(1.0) )

edge00 = bicubicResize(xx_ss1,yy_ss1,-1.0,1.0)
edge0=edge00
\ .YV12LUT(Yexpr="x 128 - abs "+string(protect_floor)+" - "+string(protect_bias)+" *")
\ .deflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1).blur(1.58)
edge00 = edge00.yv12lut(yexpr="x 128 - 2 *").expand(Y=3,U=1,V=1).blur(1.58)

#---------------------------------------------------------------------------------------------------------------------
# Build DeRing'ing Mask: +++ OLD ROUTINE +++
#
dering > 0 ? expand(Y=3,U=1,V=1) : NOP
edge1b = dering > 0
\ ? yv12subtract( expand(Y=3,U=1,V=1).blur(1.58),
\ inpand(Y=3,U=1,V=1),tol=1,wideRange=true )
\ .bicubicResize(xx_ss1,yy_ss1,-1.0,1.0)
\ .yv12LUT(Yexpr="x 128 - abs "+string(dering_floor)+" - "+string(dering_bias)+" *")
\ .deflate(Y=3,U=1,V=1).blur(1.58)
\ : last
# .Ylevels(0,3.0,255,0,255)
#---------------------------------------------------------------------------------------------------------------------
# 1st supersampling stage to perform sharpening at
#

(ss1_x > 1.0 || ss1_y > 1.0) ? dusted.Lanczosresize(xx_ss1,yy_ss1)
\ : dusted

#---------------------------------------------------------------------------------------------------------------------
# Build DeRing'ing Mask & perform dering'ing: +++ NEW ROUTINE (Pre-processor) +++
#
tmpp = string(dering_floor)
edge1b = dering < 0
\ ? yv12subtract( last, last.xsharpen(255,255),tol=1,wideRange=true )
\ .yv12lut(yexpr="x 128 - abs "+tmpp+" *")
\ .expand().inflate().expand().inflate().FineEdge(dering_bias).blur(1.58)
\ .greyscale.Ylevels(19,1.6,208,0,255)
\ : edge1b
dering < 0 ? maskedmerge( last, soft, edge1b, Y=3,U=1,V=1, useMMX=true ) : NOP

#-------- iterative sharpening, currently only 3-fold: its slow enough ... --------

temp = last
shrpcnt = 0
mskcnt = 0
shrpcnt = (PixSharp != 0) ? shrpcnt + 1 : shrpcnt
shrpcnt = (detailcontr2 != 0) ? shrpcnt + 1 : shrpcnt
shrpcnt = (detailcontr1 != 0) ? shrpcnt + 1 : shrpcnt
mskcnt = (EQ>shrpcnt) ? shrpcnt : EQ

# Stage 1 : UnsharpMasking, wide radius -----------------------
detailcontr1 != 0
\ ? unsharpmask(detailcontr1,contr_radius,0)
\ : NOP
detailcontr1 != 0 && (shrpcnt==1 || mskcnt>1 && shrpcnt>=mskcnt) && (EQ>0)
\ ? MaskedMerge(last,temp,edge0.expand.inflate.inflate, Y=3,U=1,V=1,useMMX=true)
\ : NOP
mskcnt = (detailcontr1 != 0 && (shrpcnt==1 || mskcnt>1 && shrpcnt>=mskcnt))
\ ? mskcnt - 1
\ : mskcnt
shrpcnt = detailcontr1 != 0 ? shrpcnt - 1 : shrpcnt

# Stage 2 : UnsharpMasking, small radius ----------------------
detailcontr2 != 0
\ ? unsharpmask(detailcontr2, 1,0)
\ : NOP
detailcontr2 != 0 && (shrpcnt==1 || mskcnt>1&&shrpcnt>=mskcnt) && (EQ>0)
\ ? MaskedMerge(last,temp,edge0.inflate.inflate,Y=3,U=1,V=1,useMMX=true)
\ : NOP
mskcnt = (detailcontr2 != 0 && (shrpcnt==1 || mskcnt>1&&shrpcnt>=mskcnt))
\ ? mskcnt - 1
\ : mskcnt
shrpcnt = detailcontr2 != 0 ? shrpcnt - 1 : shrpcnt

# Stage 3 : per-pixel sharpening ------------------------------
PixSharp != 0.0
\ ? sharpen( PixSharp )
\ : NOP
PixSharp != 0.0 && shrpcnt > 0 && EQ>0
\ ? MaskedMerge(last,temp,edge0, Y=3,U=1,V=1,useMMX=true)
\ : NOP
undot()

#---------------------------------------------------------------------------------------------------------------------
# DeRing'ing of sharpen'ed clip: +++ OLD ROUTINE (Post-processor) +++
#
dering > 0 ? MaskedMerge(last,last.unfilter(-dering,-dering),edge1b.bicubicresize(xx_ss1,yy_ss1),Y=3,U=1,V=1,useMMX=true)
\ : NOP

# Now I have the other idea - but it's too slow, yet
antiflicker2 == true ? temporalsoften(1,2,3,23,2) : NOP

#---------------------------------------------------------------------------------------------------------------------
# 2nd supersampling stage to perform SubPel operation & XSharpening at
#
# Notes: Luma Warping - may help for sources that are hard to get a "clean" picure from.
# - Should help making the picture a little more "gracile" when doing DVD -> HDTV upsizing

xx_ss2 != ox || yy_ss2 != oy ? LanczosResize(xx_ss2,yy_ss2) : NOP

subpelstren != 0.0 ? blur(subpelstren) : NOP

warp_Y ? awarpsharp(depth=(ss2_x+ss2_y)/2*3,thresh=0.5,blurlevel=2,cm=0) : NOP

Xstren != 0 && Xlimit !=0 ? xsharpen(Xstren,Xlimit) : NOP

LanczosResize(dest_x,dest_y).undot()

#---------------------------------------------------------------------------------------------------------------------
# Build new EdgeMask of the enhanced clip
#
edge2 = bicubicresize(int(dest_x/1.75/16+.5)*16,int(dest_y/1.75/16+.5)*16,1.0,.0)
\ .DEdgeMask(0,255,0,255,"-5 -7 -5 -7 48 -7 -5 -7 -5",Y=3,U=1,V=1,useMMX=true,setdivisor=true,divisor=1)
bordermask = blankclip(edge2,width=dest_x-16,height=dest_y-16,color=$FFFFFF)
\ .addborders(2,2,2,2,color=$8F8F8F).addborders(2,2,2,2,color=$6F6F6F)
\ .addborders(2,2,2,2,color=$202020).addborders(2,2,2,2,color=$000000)
edge2 = edge2
\ .levels( (detail_floor+int(detailcontr1/15+detailcontr2/30+PixSharp*15)), 4.0,128,flatweight,255,false)
\ .bicubicResize(dest_x,dest_y,1.0,0)
edge2 = exborder ? edge2.logic(bordermask,"min") : edge2
edge2 = edge2
\ .inflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1)
\ .blur(1.58).greyscale()
\ .inflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1)
\ .temporalsoften(1,63,63,255,2)

#---------------------------------------------------------------------------------------------------------------------
# Put original de-noised & not-sharpened clip into areas still appearing flat, after all that sharpening
#
MaskedMerge(dusted.lanczosresize(dest_x,dest_y),last,edge2,Y=3,U=1,V=1,useMMX=true)

#---------------------------------------------------------------------------------------------------------------------
# Chroma Warping - often useful for sources where colors are "bleeding". Superfluid for clean sources.
#
warp_UV ? MergeChroma( aWarpSharp(depth = 8.5 * (dest_x/ox + dest_y/oy), thresh=0.5, cm=1, blurlevel=2) ) : NOP

#---------------------------------------------------------------------------------------------------------------------
# Visualizations
#
debug == "dering" ? overlay(last,blankclip(last,color=$00A000),mask=edge1b.bicubicresize(dest_x,dest_y),mode="blend",opacity=dering_weight)
\ : NOP
debug == "protect" ? overlay(last,blankclip(last,color=$00A000),mask=edge0.bicubicresize(dest_x,dest_y),mode="blend",opacity=0.75)
\ : NOP
debug == "detail" ? overlay(last,blankclip(last,color=$00A000),mask=edge2.bicubicresize(dest_x,dest_y),mode="blend",opacity=0.75)
\ : NOP
debug == "compareH" ? stackhorizontal(clp.lanczosresize(dest_x,dest_y).crop(cropx,0,-cropx,-0).addborders(0,0,4,0,color=$800000).subtitle("Original"),
\ last.crop(cropx,0,-cropx,-0).subtitle("iiP") )
\ : NOP
debug == "compareV" ? stackvertical(clp.lanczosresize(dest_x,dest_y).crop(0,cropy,-0,-cropy).addborders(0,0,0,4,color=$800000).subtitle("Original"),
\ last .crop(0,cropy,-0,-cropy).subtitle("iiP") )
\ : NOP
debug == "showall" ? stackvertical( stackhorizontal( edge0 .greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,4,4,color=$800000).subtitle("Protection of sharp edges"),
\ edge1b.greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,0,4,color=$800000).subtitle("DeRing'ing") ),
\ stackhorizontal( edge2 .greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,4,0,color=$800000).subtitle("Detail areas"),
\ last .crop(cropx,cropy,-cropx,-cropy).subtitle("iiP") ) )
\ : NOP

return(last)
}

#

Didée
28th June 2004, 16:18
Parameter description (only parameters new in iiP v.0.5)

EQ

Edge "quality" parameter.
Specifies how many of the sharpening steps will be protected by the protection mask.

0 = deaktivated. Don't ever choose that for encoding!! - but it's nice for visualizing why edge protection is needed at all ;)
1 = protect only the last sharpening step. "Standard", as in older versions.
2 = protect the first & the last sharpening step. Recommended.
3 = protect all three sharpening steps. Minimalizes any risk of producing oversharpening, but lessens the overall contrast gain.


warp_Y, warp_UV , [bool]

These will activate additional luma warping, resp. chroma warping. (Uses MarcFD's aWarpSharp plugin.)

Luma warping - should help in making the picture a little more 'gracile' when upsizing to bigger resolution, e.g. 1:1 PAR -> anamorphic PAR, DVD -> 720p, or such. For keeping same resolution or downsizing, perhaps it may help on sources with distorted detail by "straightening" it. Or it may not help - YMMV.
Luma warping is performed in 2nd supersampling stage, prior to XSharpening.

Chroma warping - should help a lot on sources with bleeding colors. I put this in, since I had big problems on my Enterprise DVB captures: on the starfleet uniforms, the red stripes are badly bleeding into the blue cloth. This looks *very* ugly, like an aquarell that's gotten wet. It looks much better with chroma warping.
On clean sources, chroma warping mostly is a waste of CPU cycles.

Note: aWarpSharp's parameters are hard-coded. Depth is automatically scaled by the supersampling factors (Y) resp. by the [original:destination] size ratio (UV).
If someone thinks more configuration is needed, tell me. For me it works fine the way it is.


[b]New deringing routine

Now you can choose between to routines for deringing:

The "old" routine can be used as formerly. Parameters have not changed. Note that this routine is a post-processor, after the sharpening, but prior to XSharpening.

The new routine uses another way to create the deringing mask (utilizes XSharpen to find areas-of-interest). The current processing method for the found areas is very sophisticated: "Downsize(softbicubic).Upsize(verysoftbicubic)".

It acts as a pre-processor, prior to the main sharpening steps, but already in the first supersampling stage.

To use the new deringing routine, assigning a negative value to the dering parameter.

The parameters dering_floor and dering_bias behave differently with this routine. It's a bit difficult to describe ...
dering_floor is sort of a sensitivity against edges: the bigger this parameter, the more areas around weaker edges will be considered.
dering_bias can be seen as some sort of multiplier, or normalizer ... how to tell? (Internally, it's the "divisor" parameter for MaskTool's "DEdgeMask" function.) The smaller dering_bias, the brighter the mask will get, and the more areas found by dering_floor will be kept. The bigger dering_bias, the more weaker areas will get cancelled from the mask again, and the darker the dering-mask will become.

To get a feeling for this, please play a little with these two parameters & the new routine, while having set debug="showall". A good starting point is floor=8, bias=12. It seems to me that bias should mostly be in the range bias = [floor, floor*2] - but who knows what different sources may require. This one is new to me, too ;)

dering = -200 ~ -1 tells how strongly the affected areas will be blurred through the bicubic resizers. Recommended range is from "-160" for strong processing to "-20" for weak processing.
Attention: If you use a too big number here, you'll get artefacts near edges! Try "dering = -350" to see what I mean. You should not exceed -160, perhaps evev -200. Look out when artefacting starts to appear. "dering = -120" gives already pretty strong processing.

The dering_weight parameter is not used with the new deringing routine.


exborder

This is a switch to exclude the outmost border from sharpening.

It is not uncommon, even for otherwise HiQ DVD sources, to have artefacts in the border areas. You now these bright and/or dark lines that often appear near the top/bottom letterboxing, and on the frame's sides as well.
But, not everyone is willing to crop these additional 2 ~ 8 pixels from the sides, to get rid of that crap. Now, if you're cropping so tight that source's border artefacts are kept, then at least they shouldn't be sharpened ;)
Set [i]exborder=true to do so. The used masking draws a "sinus sweep" (sort of) from 100% exclusion to ~15% exclusion, over the outmost 8 pixels on all sides of the frame.
There is nothing to configure. Tell me if you want something.


[b]detail_floor [int]

This is part of the controlling how weak a detail is still considered to be "detail", in order to be copied to the output frame from the sharpened clip. Remember: areas considered to be "no-detail" are copied from the PixieDust'ed, not-sharpened clip.
Look at the "Detail Mask" in debug mode to get a feeling for it. Former versions had this parameter hardcoded to "23". New default is "20". Negative values are possible, in case you consider them needed.

Didée
28th June 2004, 16:19
Explanations, thoughts, tips and (speed) considerations

- or -

Didée's usual, dreadfully boring blabla ;)



Regarding the EQ parameter:

iiP performs up to three chained sharpening steps: UnsharpMasking-wide + UnsharpMasking-narrow + PixelSharpen.
Generally, any unprotected sharpening endangers oversharpening of high-contrast edges. With chained sharpening, it gets even worse: the first sharpening greates artefacts, the second one sharpens also those artefacts, the third one ... you get the idea. Without any protection, you'll get those ugly halos, and you get them even with additional borders, themselves emphasized:
first sharpener gives halos, second sharpener gives those halos a hard border, the third makes everything even more annoying.

Former iiP versions internally created exactly such an over-oversharpened image, and used only one MaskedMerge() operation after all sharpening, to exclude hard edges from getting copied from the sharpened clip into the working clip.
Although multi-protection was on my mind from the very start, I wanted to avoid the additionally needed processing time. And I thought the one-step protection would be sufficient to exclude all oversharpening artefacts. Well, it is mostly, but not always. Previous iiP versions let some artefacts sneak through, especially when strong sharpening values were used.

With v.0.5, multiple protection may be specified through the EQ parameter.

EQ=1 is exactly the same as formerly. Everything is sharpened-up without protection, and then copied to the working clip according to the protection mask.

The most "exact" way to do the image sharpening is to protect *every* step by the protection mask. This is done by specifying EQ=3. The result should be close to totally free of oversharpening artefacts produced by iiP itself. Oversharpening already present in the source is anther story -> DeRinging.
With EQ=3, the working chain is " 1.sharpening -> MaskedMerge -> 2.sharpening -> MaskedMerge -> 3.sharpening -> MaskedMerge ".

However, EQ=3 lessens the possible gain of detail contrast quite a bit. From my experience so far, EQ=2 is a very good compromise.
EQ=2 will protect the first and the last sharpening step - whichever those might be, in case you are using only two of the three possible sharpening steps. (Sounds simple, and basically it IS simple. However, to make this work correctly for all possibilities of choosing only two of the three sharpeners, required some more lines of code than I expected...)
EQ=2 should give the best trade-off between speed and edge quality. There should hardly be any artefacts coming through, and the contrast gain is definetly better than with EQ=3. Hence I recommend to use EQ=2 - unless you figure out that your particular source needs EQ=3, or can get away with EQ=1.

EQ=0 is a major bad idea for encoding, of course. However, by setting EQ to zero, it gets blataneously obvious why all this protection stuff is needed at all. Isn't it?

Needless to say: the higher EQ you use, the slower the script will run. Each EQ increment requires another instance of MaskedMerge()'ing the luma plane over - and this is on the 1st supersampling stage, so this operation is not for free.

OTOH: the higher EQ you use, the better compressability you'll get for the output.



(New) Deringing Routine

The biggest problem with self-made deringing is: to create a mask that "fits" really good onto the problematic areas.

Firstly, we want to catch as much of the problematic areas as possible, preferebly all of them, only them, and nothing else.

Secondly, while catching all of them, it must be avoided to mask *across* any edges in the image. We want the mask to be present in the "ultimate neighborhood" of hard edges, to catch halos and mosquito noise. In areas where the mask *covers* the edge, we would force the edge itself to get blurring (depending on the used processing mthod, that is). This is probably not what we want to do.

Thirdly, there is the question of which kind of processing should be actually performed on the masked areas.

(1) Is still unsolved. There's no distinction between "ah, here are edge artefacts, we must apply deringing here" and "yup, this area is clean, no deringing is needed". At least for edge halos, there are ideas of how to do indeed *that*. But it's not possible to do that in a script - if you can code plugins, and have a little spare time, just ask me. Ideas is what I have PLENTY.

(1)+(2) - The new deringing routine utilizes XSharpen to find areas-of-interest, basically by taking the clip, and subtracting an XSharpen'ed version from itself. On this difference image, a quasi-Sobel edge detector is performed. Finally, everything gets extended and feathered a little - there is the new deringing mask.
It has a definetly better respose to edge areas than the old method, which was based on an UnsharpMask - difference image. Still the new method's response to hard edges is greater than to weaker edges. The danger of masking-across-edges is magnitudes lower than with the old method. However, the "tightness" at which the new mask is "fitting" to either side of the edges is not perfectly distributed - but I consider it quite usable as it is. Further improvement might be possible.

(3) The currently used processor for deringing is the most lame one can think of:
"BicubicResize(small,soft).BicubicResize(orig,verysoft)" is what actually is done to the dering'ed areas - and this works surprisingly effective, handling both halos and mosquitos pretty well, without getting all too obvious. There is danger, of course, of loosing small detail that is present in the direct neighborhood of strong edges. (How do you want to distinguish small detail from mosquito noise - to a machine it looks the very same).
The strength of dering-processing defines at what scale the image will be downsized, before upsizing again. "dering=-150" will scale down by a factor of ca. 2.8, "-100" by ca. 2.2, "-50" by ca. 1.6. Values numerically greater than 160 might cause artefacts. Try "-350" to force those artefacts. Then, knowing how they look like, you know what to look for if you're forced to use very high settings.
Values up to "-150" should be safe, and strong enough for almost all cases. "-40" to "-80" should be a good range for rather clean sources - but let your own eyes decide.


As already stated, the old routine can be used just as formerly. The new routine is invoked by specifying negative values to the dering parameter.

It should be mentioned that the old routine acted (and still acts) as a *post* processor. That is, after the main sharpening, but before the XSharpening. Together with the fact that it partly masks *across* edges, it was used to fight against source-artefacts as well as artefacts created by iiP itself (through too little edge protection). The blurring of some edges then was (partly) restored by the following XSharpening.

The new routine now acts as *pre* processor, i.e. before any sharpening is applied (but after the base denoising). That's the preferred way to do it, now that EQ is available.


EQ and New Deringing

The new deringing is *noticeably* slower than the old one. That's just how it is, and there's little that can be done.
You should carefully check your source, if it needs deringing at all. Since selfmade artefacts now can be avoided through higher EQ values, perhaps you simply don't need any deringing!
In particular, I would not recommend to use the new deringing with strong values, together with EQ=3. This will result in very slow processing, and will give an output that is ... smooooth. Of course there might be sources out there that require exactly this. But generally, you should not go higher than EQ=2 when using somewhat strong deringing. With low or medium deringing, I'd say EQ=2 is the one to use. With strong deringing, and/or when using some lower sharpening values or less sharpening steps, you might be well off with EQ=1 as well.

All I can advise you to do is this:
Watch out for different problematic scenes, and then figure out which combination of features copes the best with all of them, on average.


Luma Warping

Well, not much to say here - exept that it uses MarcFD's "aWarpSharp" plugin, which you should have available. Try it, and see for yourself if you like it or not. Or if you can see any difference at all.
The effect should be minor, and that's how it is supposed to be. Assumingly, some people would like to hit me for the mere fact that I'm using WarpSharping on natural video soures. However, it is performed in the "big" 2nd supersampling stage, with a relative small depth value.
The intended effect is to get some minor thinning/straightening of image features, and it is mostly meant to be used when you actually *upscale* your clip through iiP. When you're doing the old "anamorphic 720*yy --> 1:1 640*yy" game, then there is probably not much to gain with lume warping. But try and see yourself.

Thanks to the fact that MarcFD managed to get his aWarpSharp pretty fast, the impact on speed is not so bad.


Chroma Warping

This one is not intended for general usage. But you might come across sources where it can do small wonders!
I implemented it for sources with bleeding colors, and there it generally achieves very noticeable improvements. One example: For the ones that know the (new) Enterprise series (Cpt. Archer, T'Pol, Dr. Phlox ...), you might have noticed that the blue uniforms with red stripes are particular difficult - the stripes are "bleeding" into the blue cloth like ink flows into ink paper :( For me, chroma warping does a brilliant job there.

UV warping is performed on the final output clip, on destination resolution. It use chroma mode 1 - "warp chroma with luma bump map".

This one also is not too expensive, performance-wise.

I think it doesn't make much sense on souces with clean colors (but mf might disagree...)

***

Ah, I'm out of time now.

If you have any questions, go ahead. I'm all ears.


- Didée

Chainmax
28th June 2004, 17:04
Wouldn't it be better to just link to a premade avs instead of posting the whole script?

malkion
28th June 2004, 17:38
Chainmax, I dont think Didee wants to setup linkage space.. I find it insignificant either way.

Didee, is there any possible hints you could provide to help us narrow the parameters for the various floors and bias settings with the debug view? Also if it helps to set the various other parameters, like the newer dering parm, I mean, what do you personally use the debug view for? I noticed prior to this version you had coded some yuv analyzing which you could call on to check out the video (or was it on limitedsharpen). Also, what are the usage for the current script's optional coding? such as the following:

1) the #ylevels call on the old dering routine.

2) edge00 = edge00.yv12lut(yexpr="x 128 - 2 *").expand(Y=3,U=1,V=1).blur(1.58)

this line is found in the build edgemask for protect floor routine. edge00 is no longer called in the debugview section.

these 2 are from the new 0.5a version. I guess I saw some more from a old version no longer worth mentioning. :D

there are some similar #calls in the limitedsharpen script, but thats for a different thread. I'll be doing further tests of course. These questions arent that important since it has nothing to do with the actual video encoding.

Soulhunter
28th June 2004, 18:09
Originally posted by Didée
masktools-v1.4.16.zip (http://www.geocities.com/manao47/Filters/)
Sorry, it was late n' there are way too much MaskTools versions on my HD !!!


By a first small preview, I was able to spot out some ugly blocks... :(

Think they are related to PixieDust !!!


Btw, the next eye riddle... (http://forum.doom9.org/showthread.php?s=&threadid=78856)


Bye

malkion
28th June 2004, 20:36
You can try adding .BlindPP(quant=8,cpu2="xxxxoo",moderate_h=40,moderate_v=60)

after dusted. may not help during preview, but according to some people
it can catch most blocks during encoding.

Soulhunter
28th June 2004, 21:47
Yes, but this introduces too much quality degradation IMO... :(

Think Deen would be a good replacement for PixieDust !!!


Bye

Didée
29th June 2004, 08:32
Originally posted by Soulhunter
[B]Sorry, it was late n' there are way too much MaskTools versions on my HD !!!
Heheh, yes, same on my side. That's why on my HD, *all* versions of MaskTools are named with version number: "MaskTools_v1.4.16.dll" ;)

By a first small preview, I was able to spot out some ugly blocks... :(
Think they are related to PixieDust !!!
Yes and yes. Old "problem" of PixieDust - I don't want to discuss this all over again. I'd say, it's a trade-off you have to pay for the (currently) unreached, unbeaten, unbelievable best overall denoiser+smoother we have available for usage. /*bites lips to not start lenghty elaborating*/

You should actually try something like malkion suggested:
by malkion
You can try adding .BlindPP(quant=8,cpu2="xxxxoo",moderate_h=40,moderate_v=60)
Previously, I even had a similar line in the script, it was only outcommented.
Should really go in as a configurable option, so you can either use it or not, without having to mess with the script.

IMHO, s-th like BlindPP(Quant=12,cpu2="xx??oo",moderate_h=45|50|55, moderate_v=55|60|65" doesn't hurt the output noticeably (iiP still is to come after this line ;) ), but helps a lot against the blocking. It won't vanish, but it gets much better.

by Soulhunter
Think Deen would be a good replacement for PixieDust !!!
If you think so - go ahead and just try it! Very easy to do:

Just set "duststr=0", then PixieDust is completely disabled. As replacement, call your denoiser-of-choice immediately before iiP():

...
Deen(whatever)
iiP( 8064, 6048, duststr=0, ...)

I am curious what results you'll get, regarding quality, and not less regarding compressability :D
To have said that: I have close to zero experience with Deen. Why? Because its basic working principle is the same as Convolution3D. And the latter is one of the filters that disappeard (almost) completely out of my scripts, over time.

As said, right now I'm not in the mood to discuss PixieDust again ...
But I do have my certain reasons to use PixieDust exclusively, this you can believe.
Every heard something about "noise cutoff"? Tip: Think about the general principle of limiting thresholds ...


Preparing some more tips now.


- Didée

malkion
29th June 2004, 11:43
On my PC, I've noticed as well, that if you're encoding to anything greater than original DVD resolution (havent found the threshold yet) with pixiedust, the result clip is borked. I tried PixieDust on a HDTV source, and it didn't go too well. On normal DVD resolution source, it's fine. PixieDust doesn't like a source at 1280,720.

Didée
29th June 2004, 12:23
Chainmax:

Better it would be, yes.

In front of my mind's eye, I see a little website, holding all my scripts, nice colorful manuals for them, and preferably several dozens of MB's for offering demo clips to download.

You organize the webspace, and I'll upload. :D


malkion:

Indeed. All Dust flavours by Steady are limited by framesize. But remember, Steady appeared out of nowhere with his Dust package by a time when Conv3D was "the magic filter" - early 2003, that was. Times have changed a lot since then. By then, we thought not very much about processing HDTV sources. For sure we didn't think about *motion compensated* processing of such big framesizes ... not to speak about encoding ;)
A big pity is that you can't call Dust more than once on the same clip ranges, because of some internal variable's stuff, as it seems. Otherwise you could crop with a little overlap, blow the dust over it, and re-stack it together.
If you definetly want to do it, you have to create four avisynth scripts, each calling the same source, each cropping one quadrant+overlap, dust it, crop overlap, return it. Then you create a script that calls these four scripts by *AviSource*, and stack them together.
With a little luck, it might work.

Hmmh ... time to check out Manao's mvtools - although I've the feeling they still have some way to go to reach Dust's level, as far as denoising is concerned. Actually I can't tell.

[edit]

still to malkion:

Excuse me, but ...
I noticed prior to this version you had coded some yuv analyzing which
you could call on to check out the video (or was it on limitedsharpen)
I did ... WHAT ? :eek:

I have no idea what that should have been. Please explain closer. Do you by any chance mean an optional "colorYUV(analyze=true)" call to show the used level ranges?

Oh, and "edge00" is only a relict from developping, it is not used at all. Moreover, the usage of edge00 in the debug section was ... a li'l mistake ;)


- Didée

Sirber
29th June 2004, 12:25
Could you do a ZIP with all needed stuff? Thanks :D

scharfis_brain
29th June 2004, 12:42
didée:

jep, multiple calls of ...dust doens'Ät work, but what about this? :


a= crop(upperleft)
b= crop(lowerleft)
c= crop(upperright)
d= crop(lowerright)

a+b+c+d

pixiedust(..)

a= trim(upperleftframerange)
b= trim(lowerleftframerange)
c= trim(upperrightframerange)
d= trim(lowerrightframerange)

stackhorizontal(stackvertical(a,b),stackvertical(c,d))

Didée
29th June 2004, 12:44
Originally posted by Sirber
Could you do a ZIP with all needed stuff? Thanks
So that you can feed iiP's output into any sort of RealMedia encoder?

Do you think I'm CRAZY?

:D

Sure, Sirber. ;)


Scharfi:

Ah, interesting idea. Worth trying out. (But I put no money on it.)

Scharfi: The (failing) sample, please ...

- Didée

Sirber
29th June 2004, 12:59
RealVideo, RealVideo, RealVideo!!!!!!! :devil:

Want me to host you?

Soulhunter
29th June 2004, 19:24
Originally posted by Didée

Deen(whatever)
iiP( 8064, 6048, duststr=0, ...)

Hehe, this is what I did before... :D

But I wasn't sure if your script doest need PixieDust's processing to do some other funky stuff !!!

Originally posted by Didée
I am curious what results you'll get, regarding quality, and not less regarding compressabilityWhen I find the time, I will post some samples... ;)


Btw, progress with the new eye riddle ???


Bye

Didée
30th June 2004, 08:44
One correction of my own false comment, before you start out:

To disable Pixie, use dustweight = 0.0 ! When setting "duststr=0.0", it is also (effectively) disabled ... but PixieDust would first do its full work, changing nothing, and then get copied over ... a pretty slow No-Op. By zeroing dustweight, Pixie will actually be bypassed - that's what you want to do.

But remember:

The more *you* like the preview you're getting -

- the more your *encoder* will HATE it ;)


Me has taken some screenshots, wait a little.


- Didée

Didée
30th June 2004, 10:35
A case example.

Yesterday I did my first full encoding with iiP v.0.5a. You see, I myself am still learning to use it ;)

Target was Enterprise episode 1x09 - "Die Saat". (am too lazy now to browse for the original title. perhaps "The Seed" - but probably not)

Here are some screenshots comparing the naked RAW DVB stream to iiP's output. Note that this is an upscale from 4:3 letterboxed to 16:9 anamorphic:


source-1:
http://img111.imageshack.us/img111/3425/1x091asourcevh0.png

iiP-1:
http://img50.imageshack.us/img50/998/1x091biipbr2.png


source-2:
http://img486.imageshack.us/img486/7166/1x092asourcerq9.th.png (http://img486.imageshack.us/my.php?image=1x092asourcerq9.png)

iiP-2:
http://img486.imageshack.us/img486/4876/1x092biiplg6.th.png (http://img486.imageshack.us/my.php?image=1x092biiplg6.png)


source-3:
http://img50.imageshack.us/img50/1931/1x093asourceou8.th.png (http://img50.imageshack.us/my.php?image=1x093asourceou8.png)

iiP-3:
http://img50.imageshack.us/img50/4828/1x093biiplm2.th.png (http://img50.imageshack.us/my.php?image=1x093biiplm2.png)


source-4:
http://img41.exs.cx/img41/9159/1x09_4a_source.png

iiP-4:
http://img41.exs.cx/img41/7486/1x09_4a_iiP.png


source-8:
http://img45.imageshack.us/img45/9435/1x098asourceut5.th.png (http://img45.imageshack.us/my.php?image=1x098asourceut5.png)

iiP-8:
http://img275.imageshack.us/img275/3058/1x098biipzq3.th.png (http://img275.imageshack.us/my.php?image=1x098biipzq3.png)

source-9:
http://img107.imageshack.us/img107/4268/1x099asourcete6.th.png (http://img107.imageshack.us/my.php?image=1x099asourcete6.png)

iiP-9:
http://img490.imageshack.us/img490/6310/1x099biipua8.th.png (http://img490.imageshack.us/my.php?image=1x099biipua8.png)


The used script looked like this:
v1=mpeg2source("ENTERPRISE_0327_1.d2v", idct=7, cpu=4,moderate_h=45,moderate_v=60,showQ=false)

v1.trim(12,60029)
crop(8,72,-8,-72)

MyDelogo()

## version05a
iip( dest_x = 708, dest_y = 532,
\ duststr = 2, dustweight = 1.0,
\ ss1_x = 1.414, ss1_y = 1.414,
\ detailcontr1= 127, detailcontr2=255+40, contr_radius=2, PixSharp=0.38,
\ ss2_x=3.25, ss2_y=3.25,
\ Xstren=255, Xlimit=255,
\ subpelstren = 1.0, antiflicker1=false, antiflicker2=true,
\ flatweight = 0,
\ protect_floor = 0, protect_bias = 12,
\ dering = -80, dering_weight = 1.0,
\ dering_floor = 10, dering_bias = 12,
\ EQ = 2, detail_floor = 15,
\ warp_Y = true, warp_UV=true, exborder = true,
\ debug="-showall", cropx=36, cropy=56
\ )

crop(2,2,-2,-2)

colorYUV(cont_u=18,cont_v=12)

limiter()

return last

Notes:

Be sure to view those screenshots at an sufficient brightness/gamma level, in particular the dark ones. You know, all those parts that are invisible, "lost in the dark", in normal desktop viewing, spring to the eye very obviously when played through overlay in a dark room ...

As you can see from the output, I was careful with the sharpening & enhancing. One can very easily overdo things with iiP - but of course I don't want to do over-processing. My goal with this source is to bring it back to what it should have been in first place (and what it *was*, originally. But we dumb TV consumers are getting fed with such big crap sometimes, it's just ridiculous).
Moreover, my aim is to put each season onto 2 DVDs - that makes 13 episodes, each about ~42 min, per DVD. Given the resolution, you can do the math yourself ;) -- Below the summing line, I end up with an average bitrate of 1050 kbps, taken the overall for all episodes. This really isn't that impressing high for a framesize of 704*528 ;)
I'm ending up with an average P-quantizer of 4.0~4.2 using SixOfNine-HVS in XviD. "Translated" to the standard matrix, that would be a quant of ~2.6.

The source is somewhat noisy - not too bad, but definetly too much to simply pipe the source unfiltered into XviD. This results in annoying "floating wall" artefacts.

For my taste, the source is also too blurry. You see I've used relatively high sharpening values - "detailcontr2" is already in overdrive range. For cleaner sources, one could simply go higher with "detailcontr1", but on these particular sources, bitrate climbs way too much. 127 is my limit in this specific case.

protect_floor is down to zero - always a good choice to not enhance any remaining noise more than necessary.
protect_bias at 12 was figured by try'n'error. 16 gave not enough sharpening, at 10 some edge artefacting started to appear.

DeRinging was almost standard:floor-bias at 10-12 gave a good compromise at catching source artefacts even at weaker levels, while still masking everything strong enough.
I was teared between 8-10 and 12-12 for different scenes, so I just took the golden middle ;)
Now that I review it, I could have put it a little higher values for dering, perhaps -100 would have been better.
Moreover, now I have the impression I should feather-out the whole deringing mask a little bit more.

The ss2_x|y values were set a little lower. The source's details are not as dense as in a good DVD movie, so I could afford this.

detail_floor was lowered to 15 after inspection of several scenes with weak detail. However, this is more important for compression than for the visuals.

All warp options were used, for the formerly mentioned reasons. Same goes for border exclusion.

EQ mode was "2". The source comes along with an (un)fair amount of small, but quite annoying artefacts (best seen in motion, there's no so much to tell from the screenshots), which here makes EQ=1 to look not very nice. And EQ=3 would be far too strong for a source with such insufficient sharpness.

Lastly, I applied a weak color correction. Somehow the series seems to suffer from NTSC-television-color-flatness, or whatever damage they might have done. It just looks too "empty", occasionally.

Very lastly: No, the the removal of that wonderful logo was NOT done by iiP :D


Okay, that was the little walk-through, or better said, run-through.

Also, now you have an idea what crap I am producing all day long ;)


- Didée

Inc
30th June 2004, 11:36
Very lastly: No, the the removal of that wonderful logo was NOT done by iiP

What procedure did u use for removing the logo in such a nice quality? Yo want to keep it secret? ;)

Greets
Inc.

Didée
30th June 2004, 13:35
Secret? What secret? :confused:

1. The name is "Didée".

2. The filter is "DeLogo".

3. The search button is at the top of the page. :)

4. The remainder is hard work.


- Didée

Soulhunter
30th June 2004, 17:17
Originally posted by Didée
One correction of my own false comment, before you start out:

To disable Pixie, use dustweight = 0.0 ! When setting "duststr=0.0", it is also (effectively) disabled ... but PixieDust would first do its full work, changing nothing, and then get copied over ... a pretty slow No-Op. By zeroing dustweight, Pixie will actually be bypassed - that's what you want to do.
Ok, I set them both to zero... :)


THX n' Bye

Soulhunter
12th July 2004, 19:35
Ok, here is my "replace dust with deen" example...

iip( dest_x= 1024, dest_y= 576,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.25,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = false, warp_UV = false,
\ debug= "showall | compareH/V | protect | dering",
\ cropx=32, cropy=16
\ )

http://img21.exs.cx/img21/1483/IIP_2077.jpg


edeen(3,3,3,1,1,true)

iip( dest_x= 1024, dest_y= 576,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 0, dustweight = 0, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.25,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = false, warp_UV = false,
\ debug= "showall | compareH/V | protect | dering",
\ cropx=32, cropy=16
\ )

http://img37.exs.cx/img37/8587/eDeen_2077.jpg

malkion
12th July 2004, 23:05
Originally posted by Soulhunter
Ok, here is my "replace dust with deen" example...

It seems like pixiedust looks a tad sharper on still samples.

How does it look when in motion?

DarkNite
13th July 2004, 07:40
@Didée

When I first looked at that source (thinking DVB content would actually be much sharper) I thought it might've been one of those hazed over love scenes.

Those results looks amazingly better than that soft source.

@Soulhunter

Any particular reason for using eDeen the spatial monster, instead of the kinder, faster, more tweakable, and much less prone to access violations, Deen?

Looking at the upper left corner wall section, and the lateral obliques of Mr. "Russel Crowe beats my a%$!" there's some strange oil painting effect going on. Looks like more experimenting may be called for.

Soulhunter
13th July 2004, 18:12
Originally posted by DarkNite
Any particular reason for using eDeen the spatial monster, instead of the kinder, faster, more tweakable, and much less prone to access violations, Deen?
Not really, was only a quick "try n' see" attempt... :o

Originally posted by DarkNite
Looking at the upper left corner wall section, and the lateral obliques of Mr. "Russel Crowe beats my a%$!" there's some strange oil painting effect going on. Looks like more experimenting may be called for. Yeah, I will do further experiments !!!


Bye

Soulhunter
13th July 2004, 20:34
Now a "replace Dust with MipSmooth" example...

IIP as before:

http://img21.exs.cx/img21/1483/IIP_2077.jpg


MipSmooth MovieHQ:

http://img33.exs.cx/img33/4228/MipSmoothed.jpg


Bye

tedkunich
3rd September 2004, 07:16
@Didée

I've been trying out your iip processor for my LD caps and have run into a bit of a snag that I'm hoping you might be able to suggest some guidance with:

with the following parameters:
iip( dest_x= 720, dest_y= 360,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1, antiflicker1= false, antiflicker2= false,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 2, PixSharp=0.4,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 0,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = false, warp_UV = false,
\ debug= "",
\ cropx=32, cropy=16
\ )


I get some really ugly artifacts/grain/noise in the returned clip. I have experimented with the detailcontr1 settings without much success in returning a clean clip. Setting detailcontr2 along with all of the other requisite settings to zero, reduces the introduced noise somewhat. Setting the Dust strength higher (8) does nothing but lose detail - noise/artifacts in the returned clip are unaffected. Setting ss1_x and ss1_y to something like 5 will eliminate the artifacts, but then your script does not really sharpen up any edges. Any thoughts as to what to try next?

T


PS I'll try to get a sample of what I am talking about and get it hosted somewhere.....

Didée
3rd September 2004, 08:46
tedkunich:

Yes, please make a short sample available. Without, everything is guesswork.

However, you definetly should raise detail_floor from 1 to something >>8. Realize that default is 20...
Check with "showall" that the "detail" debug frame appears with not too much noise in it (a _moderate_ noise level in this frame is okay). Raise detail_floor until it starts to appear cleaner.

Also, those two antiflicker switches could help to improve.

Lastly, are you sure about your dering settings? Default is -80/8/16. Your settings of -60/16/8 will push "deringing" on big amounts of frame area - and therefore also in areas of weak detail (real or artificial), that might tend to be spatially instable from the very start. That could lead to additional "artefacts", namely those transitions between "deringed" and not "deringed" parts, in areas where it was not intended to be used. (The actual [new] deringer is mostly designed to clean around hard edges.)

Perhaps your input is simply not clean enough and would require additional pre-processing. As mentioned time ago, iiP is not so much a "repairer". Its focus lies on enhancing. If source's artefact aren't fully catched by Dust & deringing, then something else must be done beforehand.

A sample would help.

tedkunich
3rd September 2004, 17:00
@Didée

Here are two small samples... In clip 1, my settings distort the face, giving it almost a cartoonish look. Clip2, there is lots of artifacts in the sky background....

http://www.geocities.com/tedk_1/clips.htm

My POS ISP has no hosting, so I had to go thorugh a free Geocities account... right now, I get a message saying to check back later.... dunno what that is all about.... give it an hour or so and the clips should be available.


I did ramp up the detail_foor setting to 60 and was able to get much better results, although I get a lot of noise around the sharp transitions in detail...

Would it be to difficult to put together a usage guide of your script for us noobs? kind of a first things first approach with maybe a bit of a narrative as to settign up the parameters. You have descriptions of the parameters scattered about in this thread as the script has evolved, but I for one, still have not been able to determine what are the effects of each of the paramters. As an example, I was able to figure out the "DERING" debug view, but is there an prefered order in adjusting the parameter so that they are not skewed way off? I had no clue as to what the "DETAIL" view was telling me, prior to your reply - from what I gather now, the white mask areas are where there are details that will not be processed????


Thanks for all your efforts!!!


T

Didée
3rd September 2004, 22:35
I love GeoCities :devil:

Now it tells me the site has exceeded its limit. Some minutes before, the links appeared, but could not be accessed ("... is temporarily unavailable").

>> Would it be to difficult to put together a usage guide

Yes. I'm currently a little out of shape, and have neither the energy nor the mood for such an effort.

Everything lies somewhere in the thread ... be adventureous, and read carefully ;)

JanBing
4th September 2004, 01:58
Wow, I am a bittle overwhelmed by this thread... any chances for some collected info? Simply as: Which plugins do I need, and what's the script *g*

There are so many version (and so many info in general) floating around in this thread, that I - as a newbie to AviSynth - am definintely knocked out.

So... to cut a long story short... (and this is where you finish this sentence :D )

Didée
5th September 2004, 00:39
tedkunich:

Finally geoCities delivered.

Well ... difficult source to get HD quality from (joke). The Han Solo sequence can't get good-looking at all: too much noise, too much detail exceeded by noise floor. And faces start looking ugly much earlier than anything else...

Perhaps more motion compensated pre-processing via MVTools + (e.g.) DeGrainMedian could prepare the source better.

For iiP alone, perhaps try the following:

- manually replace PixieDust with GoldDust
- settings suggestion:crop(0,0,-0,-4)
converttoyv12()
iip( dest_x= 720, dest_y= 288,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 3, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1= 127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.3,
\ ss2_x = 3.5, ss2_y = 4.0,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 0,
\ protect_floor = 0, protect_bias = 8,
\ dering = -60, dering_weight= 1.0, dering_floor = 8, dering_bias=12,
\ detail_floor = 25, EQ = 2,
\ warp_Y = true, warp_UV = false, exborder = false,
\ debug= "-compareV",
\ cropx=40, cropy=16
\ )

I didn't play too much with it, but (together with GoldDust) the 2nd scene looks rather OK, and Harry looks not too bad when in motion. Not sure if warpY should be used or not, though.

BTW, Harry looked pretty awful when I fed the source without any filtering to XviD ;)

tedkunich
5th September 2004, 04:20
@Didée

Thanks, FYI I spent a bit of time trying to find some of the worst scenes in the capture for those clips... :D the rest is not that bad... especially considering that it is a LD capture with a $50 card...


I'm processing the clip now with some other settings I came up with.... It has about 4 more hours to go, so I'll let it finish, then I'll try your recomendations.

Any tips on the MVTools? I have never used it before. How would that work with DegrainMedian?


Thanks


Ted

audioslave
9th September 2004, 21:20
@Didée
Great work! :D
This just gets better and better. Any chance of getting a zip file with all filters + the script? Or, maybe there already is one that I missed... :(
Thanks again! ;)

Jo_Gors
11th September 2004, 03:37
May be I'm posting a boring question, but I tried iip several times with no success.
Whatever warsharp version I use, seems doesn't works.

With the version dideè linked in his post, I allways get a "hieroglyplical like" error message (japanese?) and with the other one I've found in the web, I get "..there's no function named unsharpmask".


The loadpluginex is present both in the script and the plugins' folder.
I'm running the latest 2.55 avisynth version (august,31)

Tried on 2 different PC with the same results.

Any suggestions?



greetings

Jo

Didée
11th September 2004, 14:20
msvcr70.dll/msvcr71.dll
msvcp70.dll/msvcp71.dll
--> %windir%/system32

Plus for safety, put WarpSharp.dll *NOT* in the pluginfolder, but load it manually. Autoloading may cause problems, too.

Jo_Gors
11th September 2004, 17:40
Thanks a lot Didèe, now it works.

One more thing, what's about that "MyDelogo()" in your script?
(I know,... your name is.... and the search button is.... :D )


greetings

Jo

AllTimeSToneD
11th November 2004, 00:22
Any chance we could get IIP to accept 1920x1080P sources? It works nice with 1280x720 but once feed with 1920x1080P i get "unrecognized expection" error. And "No" lol im not gone upsample it but i think iip does a damn nice work also on downsampling :D

I could probably set a resizer to1280x720 before iip but i would lose alot of image information this way that iip could use :D :D

Didée
11th November 2004, 01:55
/*holds hands against head, eyes go :eek:, thinking:*/

That guy wants to FEED 1920*1080 into iiP! He must be AllTimeSToneD ...

:)

No currently you can't. Dust is the limiting factor, since it supports 1440*1440 at max. And I didn't do any safety checkings wether the input is too big ...
So, as an compromise, you could resize your awfully shitty looking HDTV source to 1440^2 first, and then apply iiP to deliver 1280*720.

However, using Dust on such resolutions is no fun: Around christmas time, please remember to inform us how the encoding job is going and all.

Try and see if "duststrength=0, dustweight=0.0" will pass through, or if the process chain insists on actually building Dust's fork. If so, manually delete it from the script, or replace it with an easier & faster filter, like ... MipSmooth @ 2.0 (where is the "evil grin" smiley??)

Moreover, using supersamplings > 1.0 in iiP perhaps would be not so clever in this case.

Think I'll do some more changes at weekend - iiP is going to marry so, anyways.

AllTimeSToneD
11th November 2004, 02:40
hat guy wants to FEED 1920*1080 into iiP! He must be AllTimeSToneD ...
Yes I'm :D
Imagine actually there is a channel for insane ppl like myself and mf :D :D :D
No currently you can't. Dust is the limiting factor, since it supports 1440*1440 at max.
Yeah i realized that too.
Try and see if "duststrength=0, dustweight=0.0" will pass through...manually delete it from the script...

Tryed first and second option but it didn't work :rolleyes: I'm currently messing around with the replacing and somehow i can't get it to work :p Might be cuz its 2:30am :D
Think I'll do some more changes at weekend - iiP is going to marry so, anyways.
A nice! Tell me if you need a true 1920x1080 source(native) as sample to play around.

... i wonder how and upsampled 4000x2250 (IMAX) from a 1920x1080 movie would look like :D :D :D
Around christmas time, please remember to inform us how the encoding job is going and all.
Ah dont worry about that :D i have three comps standing around and idling. I could probably use them or even TCP Deliver IPP :D

Didée
11th November 2004, 10:38
Yes, setting duststr & dusweight to zero can't escape the framesize problem - the way the code is writtern, the dust chain internally will always be established, even if it is not used later on.

But modding is rather easy. Find the following part at the beginning:
|
#---------------------------------|
# Base denoising by PixieDust |
# |
dusted = clp.addborders(0,0,xcorr,|...
dusted = (dustweight==0.0) ? clp |
\ : ( dus|...
\ |
|
soft=dusted.bicubicresize(xx_small|...
|
#---------------------------------|
# Build EdgeMask to protect alread|...
|

And adjust it like that:
|
#---------------------------------|
# Base denoising by PixieDust |
# |
dusted = duststr>0 ? clp.addborder|...
\ : clp |
dusted = (dustweight==0.0) ? clp |
\ : ( dus|...
\ |
|
soft=dusted.bicubicresize(xx_small|...
|
#---------------------------------|
# Build EdgeMask to protect alread|...
|
Now the Dust chain should not be built up when you specify "duststr=0, dustweight=0.0). Use another denoiser of your choice then, before calling iiP (IF denoising is needed at all).

Or alternatively, you could hardcode another denoiser yourself, like
#---------------------------------
# Base denoising by PixieDust

dusted = clp

# WannaDenoise?
dusted = dusted.YourVeryDenoiser()

#---------------------------------
# Build EdgeMask to protect alread...

Avisynth is easy, isn't it?

AllTimeSToneD
11th November 2004, 16:46
>Avisynth is easy, isn't it?

Ic now its crystal clear :D though its 4:45pm ;)

Thx

oo_void
11th November 2004, 19:03
In related resizing issues ... I tried a couple of passes of sending the results of tritical's FastEDIUpsizer (http://forum.doom9.org/showthread.php?s=&postid=459732#post459732) into your new version of IIP, IIP_v6.0a I think it is (yeah, the new super-alpha, untested one). Insteading of an extremely nice, resized image though, I seem to be getting some strange results.

With the EDI upsize, the dimensions of the video going into IIP are 1408 x 544 (2x source size) and I'm trying to get 720 x 360 out of IIP (dest_x = 720, dest_y = 360). Instead of getting the nice, prestine image I've come to expect out of IIP ;), the image appears to have become currupted in the lower right hand portion ... A wierd interlace like corruption flipped on the x axis. I'd written the issue off as having something to do with Dust, but in hearing that Dust should be able to accept files up to 1440 x 1440, it seems a little strange.

I tried playing around with MemoryMax a bit to, but no avail. Things work fine if I run a Lanczos4 before the IIP call and knock it down to 720 x 544, but that's the extent of the testing I've been able to do to date.

If you're interested, I post a sample image sometime tonight (the power's out at home so I can RDP in to the video machine until everything is reset). Anyways ...

------
oo_void

Socio
11th November 2004, 20:14
This whole thread is very interesting, I am a real Avisynth supernoob in fact the only thing I have used Avisynth is re-sizing in ffdshow for DVD playback.

After seeing some of the results I am now wondering if it possible to use Didee's script at least in part for on the fly DVD viewing via ffdshow and Zoomplayer? If so, and before I go finding all the plugins I will need what would need to be omitted from this script, I assume the mpeg2source line would be because Avisynth can automatically use ffdshow as source.
SetMemoryMax(256)

Import("C:\Program files\AviSynth 2.5\plugins\IIP.avs")

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LoadPluginEx.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\undot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\WarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dustv5.dll")

#mpeg2source

iip( dest_x= 1280, dest_y= 720,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.25,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = false, warp_UV = false,
\ debug= "showall | compareH/V | protect | dering",
\ cropx=32, cropy=16
\ )




Thanks for any info

BTW: Just in case it might work I found all but one plugin, I can;t find the LoadPluginEx.dll (did find LoadPluginEx2.dll will this work?). Could someone point me in the right ditection?


Thanks

oo_void
11th November 2004, 21:21
If you don't mind watching stuff at 2fps ... sure you can use it for on the fly conversion ;).

Seriously, IIP is definately not for real-time processing ... Even Dust alone will knock you down to 50% real time. Once you add all the masks and sharpening, your down to about a day and a half of processing (Athlon 2800 speeds) for about 2 hours of video footage. Anyways ...

------
oo_void

Socio
11th November 2004, 21:45
Well I tried it and the movie starts for a sec and then Zoomplpayer crashes. To bad because if it were to work in real time it would have been awesome looking at pics of others results.

Didée
12th November 2004, 09:16
Socio: Hihi :D - nah, that won't work. Think you can jump the atlantic if only your start-up is long enough?

oo_void:
Suppose it's Dust, yes. I was puzzled myself when I lately toyed to find the max. framesize and did find 1440^2 ... I remember we've already had a talk about the size issue time ago. I couldn't remember the result (that's why I did a quickl test again), but I'm almost sure we found a much lower barrier, something like > 1024 or so ... maybe it's ~somehow~ related to CPU architecture?

Could you please post or PM the script with that EDI preprocessing & iiP function call, then I'll have a look at it.

kingmob
13th November 2004, 03:02
Looks like iip isn't compatible with the latest masktools (v-1.5.5). Using that version instead of version 1.4.16 gives me the following error:
"maskedmerge doesn't have a named argument: "useMMX""

Using the old version doesn't give any error

malkion
13th November 2004, 03:25
kingmob, use notepad or something and find ",usemmx=true" and delete all instances of it to use it with masktools-v1.5.5.dll (it's hardcoded now)

BTW, Didee, I wanted to mention something, and see if it's just me. I've noticed that using the old dering method does not leave "a sharpened horizontal edge line" found at the top border and bottom border of the picture. That, in my opinion necessitates the use of bordermask to minimize this effect.

I definitely prefer the old dering method over the new dering method. Do you think it has to do with using xsharpen?

Can any one else confirm this finding?

Finally Didee, I can confirm oo_void's discovery. I toyed with HDTV sources before using iiP, you need to get rid of DUST. Even if dust can reportedly handle 1440^2, it will not do it right... I scrapped dust totally and had to settle for another smoother.

[edit: added final thought]

kingmob
13th November 2004, 13:37
Thx, i figured i could do that but i didn't want to lose mmx :).

Btw, I used iip to resize a capture at 720,576 to 640,480 with RemoveDirt instead of pixiedust. It took some time but the results were very satisfying, especially as i had to smooth the source a lot and in the end it looked more pleasing than on my TV :D. All on default settings, tweaking only made it worse :rolleyes:

Socio
21st November 2004, 16:56
I wanted to test out IIP and I have never tried enhancing and backing up a DVD before but found a great guide for DVD rebuilder so I used that. My test was Starwars Episode 1 widescreen since it has a lot of noise I figured I would be the perfect DVD to try. I also have been using LimitedSharpen for on the fly DVD watching and was so impressed and got so many ooohs and aaahs over it I decided to try the IIP/Limitedsharpen combo script.

LimitedSharpen I am familiar with however IIP I am still a super noob. All I wanted to do was clean up and sharpen the image to the highest quality I can. What I got was not what I expected, if you look at the pic below, the three things that stick out, first are the edges of the images, they are messed up and I don't know what is causing it. The second thing is the image is no longer 16X9, it seem to be stretched top and bottom and squished on the sides a bit. The third is, it is to dark, and I am not sure why it did not retain its original tone.

Below are settings I used and a pic of the result:

SetMemoryMax(96)

Import("C:\Program Files\AviSynth 2.5\plugins\IIP.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\LimitedSharpen.avs")

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\undot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools-p4-5.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\WarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LoadPluginEx.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dustv5.dll")

iip (duststr=2, dustweight=1.0,
\ ss1_x=1.5, ss1_y=1.5,
\ detailcontr1=104, detailcontr2=208,
\ contr_radius=2, PixSharp=0.0,
\ ss2_x=1.5, ss2_y=1.5,
\ XSmode=3, Xstren=40, Xradius=2, XLmode=2,
\ Xovershoot=1, Xwide=false, Xsoft=false,
\ subpelstren=0.0, flatweight=0,
\ antiflicker1=true, antiflicker2=true,
\ protect_floor=0, protect_bias=12,
\ dering=-80, dering_weight=1.0,
\ dering_floor=8, dering_bias=16,
\ detail_floor=16,
\ EQ=2, exborder=false,
\ warp_Y=false, warp_UV=false,
\ debug="dering | protect | detail | compareH | compareV | compareT | showall",
\ cropx=8, cropy=8
\ )

The result:

http://img112.exs.cx/img112/3127/jacked.jpg

Like I said all I want to do it is enhance my DVD leaving the aspect ratio in tact with the correct coloring. Is there any thing in the above setting I can change to help me achieve it?

Thanks for any help!

Karyudo
21st November 2004, 19:23
I can help with one thing: the aspect ratio is OK. Or close enough. What makes you think it's wrong?

Soulhunter
21st November 2004, 19:30
Originally posted by Socio

Like I said all I want to do it is enhance my DVD leaving the aspect ratio in tact with the correct coloring. Is there any thing in the above setting I can change to help me achieve it?

Thanks for any help!

For this edges halos...

- Crop away the black boarders completely

- Use the exborder function (exborder=true)

- Re-add the boarders if you really need them


To get a 16:9 AR...

- Use the "dest_x, dest_y" parameters to set a 16:9 resolution

- Or stay with the original resolution and use AR signaling instead


Bye

Socio
21st November 2004, 20:35
Originally posted by Soulhunter
For this edges halos...

- Crop away the black boarders completely

- Use the exborder function (exborder=true)

- Re-add the boarders if you really need them
Bye

I want to make sure I follow, if I set the exborder=true then do I just remove the cropx=, cropy= function?

As far as AR goes it apears fine in the pic it way the player I was the software player I was viewing it on that really screwed it up.
I will have to re-encode and burn it to disk and check it on my big screen to see for sure.

Thanks for yor replies!

Soulhunter
21st November 2004, 22:07
Originally posted by Socio

I want to make sure I follow, if I set the exborder=true then do I just remove the cropx=, cropy= function?

Yes, coz you crop the all boarders before using iip... ;)


Originally posted by Socio

As far as AR goes it apears fine in the pic it way the player I was the software player I was viewing it on that really screwed it up.
I will have to re-encode and burn it to disk and check it on my big screen to see for sure.

Ah, I re-read you post...

You wanna produce a video DVD, no ???

Then forget my first advice about this... :rolleyes:


Bye

Socio
21st November 2004, 22:40
Originally posted by Soulhunter
Yes, coz you crop the all boarders before using iip... ;)

Ah, I re-read you post...

You wanna produce a video DVD, no ???

Then forget my first advice about this... :rolleyes:


Bye

Let me clairify;

What I want to do is take my Starwars Episode 1 DVD for example run it through IIP/limitedSharpen to clean it up and sharpen it then burn it. I figured since I got such a nice enhancement with LimitedSharpen on the fly why not go a step further and just burn a backup al ready processed with even better results.

Oh and the exborder=true did not do anything to weird lines around the edges of the image. I even tried the setting you used for your widescreen pics on this thread and still the same. I have also tried both Cinema Craft SP trial and Rejig and both give me the same anomaly.

Didée
21st November 2004, 22:54
Guys, the cropx|cropy parameters are only affecting the debug views (when debug is used) ... they'll never do anything to the 'real' output! I'm pretty sure that's explained somewhere in the documentation scattered over the thread ;)

Socio, the plenty of parameters are there for a reason. Probably the defaults don't fit all too well to your source.

Try the following:

- higher protect_bias to 16~20~24~...

- as Soulhunter said, crop away the mattes with crop(0,??,-0,-??) before iiP, in iiP use exborder=true, re-add the mattes with addborders(0,??,0,??) after iiP

- compare XLmode=1 with XLmode=2. Here, XLmode=2 should be better when higher values (>20) for protect_bias are used. When protect_bias is rather small (<16), then XLmode=1 should mostly work better.

- dering settings should always be adjusted, but ... that one is very hard to judge from the distance. Generally, lower the dering_floor setting if you start to loose small detail noticeably. Lower settings for dering_bias will work better against halos, together with playing with dering between 40~120. Wrong settings will make the picture really ugly ;)
Higher dering_bias and higher dering_floor will work somewhat more similar to an overall gaussian haze (dering mask will be very dimished, but with much detail). The opposite (dering mask with only few, but very bright lines) will concentrate to areas around hard edges only.
It is really advised to use debug="showall", to see where which effect with which strength will be applied.
A screenshot from the output of debug="showall" would tell more (gives a BIG picture ... cropx/cropy cut some borders away for this debug view only, and in case of posting, that picture may be a [reasonably] compressed JPEG).

Soulhunter
21st November 2004, 23:51
Originally posted by Didée

Guys, the cropx|cropy parameters are only affecting the debug views (when debug is used) ... they'll never do anything to the 'real' output! I'm pretty sure that's explained somewhere in the documentation scattered over the thread ;)

Thought its a inbuild crop function, though I never used it... :D


Bye

Socio
22nd November 2004, 01:11
I think I figured out what the problem is and do not believe it is the settings. Starwars Episode 1 in a DVD 9 and I am using DVD builder which is for DVD 5's so when I tried to encode and use Avisynth IIP to enhance it was actually compressing the 7.8 gig DVD 9 in to a 4.3gigs of DVD5 or there about thus the bad image quality.

I have since broken the SW DVD 9 in to three parts so I can get no or low compression and higher bit rates. Now it must be doing something right because it took 45 minutes to process a 934kb .vaf file where it would have only taken 60 seconds or less before. needless to say it will be a while before I can see any actual PQ results, if it takes 45 minutes for a 934kb file it will take days for a 1 gig vob!:D

Thanks for your help thus far and I bet I am not done with you guys yet.;)

Socio
22nd November 2004, 16:37
I tried out the Cinema Craft encoder trial and the IIP/Limitedsharpen combo is turning out pretty damn good.

See what you think:


Before

http://img95.exs.cx/img95/8484/noencode2.jpg

Re-encoded via DVD Rb and Cinema Craft encoder trial + IIP/Limitedsharpen combo

http://img95.exs.cx/img95/8885/reencode.jpg

Didée
22nd November 2004, 16:56
>> See what you think:

I think:

"If I knew how it looked before/without iiP, I could tell something. Without knowing that, I can tell nothing."

;)

Socio
22nd November 2004, 17:06
I uped a before pic!

Ok Didée before you start yelling, I know it is not the same frame but it as close as I can get using the capture in my DVD software.

jptheripper
3rd December 2004, 17:05
i am having all kinds of trouble setting up iip for use with rebuilder

i got all the .dlls

could someone post the current iip.avs, and the current default settings for a 720x480 dvd?

thanx

-jp

Socio
5th December 2004, 18:24
jptheripper,

I don't know if this will help but:

I am using the IIP/LimitedSharpen combo found in this thread:

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

And I am using these settings you might need additional dll files that I am using:

SetMemoryMax(96)


Import("C:\Program Files\AviSynth 2.5\plugins\IIP.avs")


LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\undot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools-p4-5.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\WarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\colormatrix.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LoadPluginEx.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dustv5.dll")


iip (duststr=2, dustweight=1.0,
\ ss1_x=1.5, ss1_y=1.5,
\ detailcontr1=104, detailcontr2=208,
\ contr_radius=2, PixSharp=0.0,
\ ss2_x=1.5, ss2_y=1.5,
\ XSmode=3, Xstren=40, Xradius=2, XLmode=2,
\ Xovershoot=1, Xwide=false, Xsoft=false,
\ subpelstren=0.0, flatweight=0,
\ antiflicker1=true, antiflicker2=true,
\ protect_floor=0, protect_bias=20,
\ dering=-80, dering_weight=1.0,
\ dering_floor=8, dering_bias=16,
\ detail_floor=16,
\ EQ=2, exborder=false,
\ warp_Y=false, warp_UV=false,
\ debug="dering | protect | detail | compareH | compareV | compareT | showall",
\ cropx=8, cropy=8
\ )

ColorMatrix()

Chainmax
12th December 2004, 19:52
I am currently trying to make an SVCD out of a mediocre capture. Since some denoising had to be made in order to clean it up, I chose to do some sharpening. Two almost identical scripts were created, one with LimitedSharpen and one with IIP. Since my eyes aren't really trained and my monitor is about to go kaput (it's too dark even with 100% brightness and contrast), I'd like to ask you guys to evaluate the following pictures and tell me which script you think produces a better output, and maybe suggest me ways to improve on it:

Source Frame:
http://members.arstechnica.com/x/master_burrfoot/DK_CJ%20-%20Source.png

IIP v0.5a:
http://members.arstechnica.com/x/master_burrfoot/DK_CJ%20-%20IIP.png

LimitedSharpen:
http://members.arstechnica.com/x/master_burrfoot/DK_CJ%20-%20LS.png


And here are the scripts:

Script with IIP v0.5a:
AVISource("X:\wherever\Danny_Kaye_CourtJester.avi",audio=false)
AssumeFPS(29.97)
ConvertToYV12()
Crop(6,0,710,400,align=true)
hqdn3d(0,0,3,3)
Deen("a2d",1,3,5)
IIP( dest_x = 480, dest_y = 272,
\ duststr = 2, dustweight = 1.0,
\ ss1_x = 1.5, ss1_y = 1.5,
\ detailcontr1= 127, detailcontr2=255+40, contr_radius=2, PixSharp=0.38,
\ ss2_x= 4, ss2_y= 4,
\ Xstren=255, Xlimit=255,
\ subpelstren = 1.0, antiflicker1=false, antiflicker2=true,
\ flatweight = 0,
\ protect_floor = 0, protect_bias = 12,
\ dering = -80, dering_weight = 1.0,
\ dering_floor = 10, dering_bias = 12,
\ EQ = 2, detail_floor = 15,
\ warp_Y = true, warp_UV=true, exborder = true,
\ debug="-showall", cropx=0, cropy=0
\ )
AddGrain(3,0,0)
AddBorders(0,104,0,104)
TextSub("X:\wherever\Danny_Kaye_CourtJester.srt")

Script with LimitedSharpen:
AVISource("X:\wherever\Danny_Kaye_CourtJester.avi",audio=false)
AssumeFPS(29.97)
ConvertToYV12()
Crop(6,0,710,400,align=true)
hqdn3d(0,0,3,3)
RemoveGrain(mode=2)
Deen("a2d",1,3,5)
Lanczos4Resize(480,272)
RemoveGrain(mode=2)
LimitedSharpen()
AddGrain(3,0,0)
AddBorders(0,104,0,104)
TextSub("X:\wherever\Danny_Kaye_CourtJester.srt")

I can also host a small clip if you guys feel like giving this a go.

Soulhunter
12th December 2004, 20:33
Originally posted by Chainmax

I can also host a small clip if you guys feel like giving this a go.

Sure... ;)


Bye

Socio
12th December 2004, 22:42
Originally posted by Soulhunter
Sure... ;)


Bye


You elaborate way to much in your posts!:D

Chainmax,

If I were you I would try the IIP/Limitedsharpen combo script that can be found in the LimitedSharpen thread. This way you can have the best of both.

Chainmax
12th December 2004, 22:49
The sample clip can be downloaded from [Link Removed]. The upload will be complete in ~45 minutes.

[edit: just read Socio's reply]
Socio, that would be a good idea, but I'm using supersampling.

Soulhunter
12th December 2004, 22:51
Originally posted by Socio

You elaborate way to much in your posts!:D


Seems Chainmax understood my "one word" post... ;)


Bye

Didée
13th December 2004, 01:00
I checked the inofficial iiP version, and can't find any bug. Just try it, and you'll immediately see if it works for you, or if it doesn't.

Looking at that screenshot, it's quite obvious that the script with LimitedSharpen is less detailed (stoned floor, and many of the golden spots on that sleeve are much weaker, giving an "uneven" distribution of them, compared to the source). No surprise, comparing both denoising methods. Also, the iiP script cleanes most halos, where they just stay in the 2nd script. Again no surprise, iiP has that feature, LS has not ... yet.

Judging only that screenshot, the iiP processing looks better to me. But another question is bitrate ... the 2nd script will most probably force less bitrate, so it also depends on how things turn out after compression.

Chainmax
13th December 2004, 02:14
I'd rather use an official tested version as I'm not able to detect fine details that other people (like you guys) will find instantly.

I didn't notice the haloing (at least I did notice the weaker golden spots so I'm not THAT blind :)), but since you say that IIP almost removes it, would you say it's a good idea to do a BlindDeHalo2(2.0,2.0,100) right after the cropping? Also, what do you mean by "No surprise, comparing both denoising methods"? The IIP script has actually more denoising: it doesn't have the two RemoveGrain calls but it has the deringing and Pixiedust.
About compressibility, this is a 101 minutes movie that will be split to 2CDs and use 224kbps audio, so that would result in an average video bitrate of about 1935 kbps which is pretty good for an SVCD, right?
In any case, aside from extra halo removal, how would you improve on the IIP version?

MvB
2nd January 2005, 18:33
Hi didée,

Your IIP is absolutley great. I'm trying to play around with it but it's quite difficult to have all the information i need in one place. Everything is scattered around the hole thread. So my question is:
would it be possible to put the important information of this thread in on place to look at?
(For example the meanings of all the parameters and how they affect the picture quality)

Thanks
MvB

dvwannab
19th January 2005, 00:59
help a noob, please.

getting an error "there is no function named "unsharpmask" iiP line 179:

SetMemoryMax(192)

Import("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\iiP.avs")
Import("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\limitedsharpen2.avs")

LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\dgdecode.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\LoadPluginEx.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\undot.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\MaskTools-v1.5.5.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\warpsharp.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\dustV5.dll")

mpeg2source("D:\ReplayTV\Local_Guide\FraCro.d2v")

crop(16,4,-32,-4)

iip( dest_x= 672, dest_y= 400,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1= 104, detailcontr2 = 208, contr_radius = 2, PixSharp=0.38,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.58, flatweight = 0,
\ protect_floor = 0, protect_bias = 16,
\ dering = -80, dering_weight= 1.0, dering_floor = 8, dering_bias=12,
\ detail_floor = 10, EQ = 2,
\ warp_Y = false, warp_UV = false, exborder = true,
\ debug= "protect | dering | compareH|V | showall",
\ cropx=0, cropy=0
\ )

Limitedsharpen2(ss_x=1,ss_y=1,Smode=4,aSharpS=0.4,aWThresh=0.99)

AddBorders(24,20,24,20)


_____________________________________________________________________
Code:
____________________________________________________________________
# iip : Integrated Image Processor, v.0.5a
#
#
# ---------------
# | It is slow. |
# ---------------
#
# New in v.0.5 :
#
# EQ [int] : Edge quality. 0=deaktivated (don't do that!!!), 1=standard (as formerly), 2=better'n'slower, 3=evenbetter'n'evenslower
# Note: when using EQ = 2|3, then it's a good idea to *DEACTIVATE* deringing in iiP (don't hit the dog twice).
#
# warp_Y, warp_UV [bool] additional Luma & Chroma Warping.
#
# Luma warping should make the picture more 'gracile' when upsizing to bigger resolution, e.g. DVD -> HDTV.
# For same resolution or downsizing, it may (?) help for sources with distorted detail. Or it may not - YMMV.
#
# Chroma warping helps on sources with bleeding colors (e.g. Enterprise: on the uniforms, the red stripes are bleeding into
# the blue cloth, which looks *very* ugly [like an aquarell that's gotten wet]. It looks much better with chroma warping.)
# On clean sources, chroma warping is a waste of CPU cycles.
#
# exborder [bool] : exclude outmost 8-pixel-border from sharpening (gradient masked)
#
# dering: old method: called with positive values for "dering"
# new method: called with negative values for "dering" (better, but slower)
#
# detail_floor [int] : was formerly hardcoded, now user-definable. default 20.
#

function Ylevels(clip clp, int a, float gamma, int b, int c, int d)
{ wicked="x "+string(a)+" - "+string(b)+" "+string(a)+" - / 1 "+string(gamma)+" / ^ "+string(d)+" "+string(c)+" - * "+string(c)+" +"
# Reminder: Yexpr = "x a - b a - / 1 gamma / ^ d c - * c +"
# return( clp.subtitle(wicked) )
return( clp.YV12LUT(Yexpr = wicked) )
}

function FineEdge( clip clp, int "div" )
{
logic( clp.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5", setdivisor=true, divisor=div)
\ ,clp.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5", setdivisor=true, divisor=div), "max", Y=3,U=1,V=1 )
}

function iip( clip clp,
\ int "dest_x", int "dest_y",
\ int "duststr", float "dustweight",
\ float "ss1_x", float "ss1_y",
\ int "detailcontr1", int "detailcontr2",
\ int "contr_radius", float "PixSharp",
\ float "ss2_x", float "ss2_y",
\ int "Xstren", int "Xlimit",
\ float "subpelstren", int "flatweight",
\ bool "antiflicker1", bool "antiflicker2",
\ int "protect_floor",int "protect_bias",
\ int "dering", float "dering_weight",
\ int "dering_floor", float "dering_bias",
\ int "detail_floor",
\ int "EQ", bool "exborder",
\ bool "warp_Y", bool "warp_UV",
\ string "debug",
\ int "cropx", int "cropy"
\ )
{
ox = clp.width
oy = clp.height
xcorr=(int(ox/16.0+.9999)*16)-ox
ycorr=(int(oy/ 8.0+.9999)* 8)-oy
dest_x = default(dest_x, clp.width)
dest_y = default(dest_y, clp.height)
ss1_x = default(ss1_x, 1.414)
ss1_y = default(ss1_y, 1.414)
ss2_x = default(ss2_x, 3.5)
ss2_y = default(ss2_y, 3.5)
duststr = default(duststr, 2)
dustweight = default(dustweight, 1.0)
antiflicker1= default(antiflicker1, true)
antiflicker2= default(antiflicker2, true)
Xlimit = default(Xlimit, 255) # SS<3 ? 23 : 255
Xstren = default(Xstren, 255) # SS<3 ? 216 : 255
detailcontr1= default(detailcontr1, 104)
detailcontr2= default(detailcontr2, 208)
contr_radius= default(contr_radius, 2)
PixSharp = default(PixSharp, 0.4)
subpelstren = default(subpelstren, 1.58)
flatweight = default(flatweight, 0)
protect_floor=default(protect_floor, 0)
protect_bias= default(protect_bias, 16)
dering = default(dering, -80)
dering_floor= default(dering_floor, 8)
dering_floor= dering<0 ? dering_floor*2 : dering_floor
dering_bias = default(dering_bias, 16)
dering_weight=default(dering_weight, 1.0)
detail_floor= default(detail_floor, 20)
EQ = default(EQ, 2)
EQ = (EQ>3) ? 3 : EQ
exborder = default(exborder, false)
warp_Y = default(warp_Y, false)
warp_UV = default(warp_UV, false)
debug = default(debug, "Mickey Mouse")
cropx = default(cropx, 40)
cropy = default(cropy, 20)

cropx=int(cropx/4)*4
cropy=int(cropy/4)*4
xx_ss1 = int(ox*ss1_x/16+.5)*16
yy_ss1 = int(oy*ss1_y/16+.5)*16
xx_ss2 = int(ox*ss2_x/16+.5)*16
yy_ss2 = int(oy*ss2_y/16+.5)*16
xx_small = int(ox/(abs(dering)/80+1.0)/16+.5)*16 + 32
yy_small = int(oy/(abs(dering)/80+1.0)/16+.5)*16 + 16

# Now I have the other idea - but it's too slow, yet
clp = antiflicker1 == true ? clp.temporalsoften(2,2,3,23,2) : clp

#---------------------------------------------------------------------------------------------------------------------
# Base denoising by PixieDust
#
dusted = clp.addborders(0,0,xcorr,ycorr).converttoyuy2().PixieDust(limit=duststr).converttoyv12().crop(0,0,-xcorr,-ycorr)
dusted = (dustweight==0.0) ? clp
\ : ( dustweight<1.00 ? Overlay(clp, dusted, opacity=dustweight)
\ : dusted )

soft=dusted.bicubicresize(xx_small,yy_small,.2,.4).bicubicresize(xx_ss1,yy_ss1,1.0,.0)

#---------------------------------------------------------------------------------------------------------------------
# Build EdgeMask to protect already sharp detail from oversharpening
#
YV12subtract( dusted.sharpen(0.6).sharpen(0.6), dusted.blur(1.0).blur(1.0) )

edge00 = bicubicResize(xx_ss1,yy_ss1,-1.0,1.0)
edge0=edge00
\ .YV12LUT(Yexpr="x 128 - abs "+string(protect_floor)+" - "+string(protect_bias)+" *")
\ .deflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1).blur(1.58)
edge00 = edge00.yv12lut(yexpr="x 128 - 2 *").expand(Y=3,U=1,V=1).blur(1.58)

#---------------------------------------------------------------------------------------------------------------------
# Build DeRing'ing Mask: +++ OLD ROUTINE +++
#
dering > 0 ? expand(Y=3,U=1,V=1) : NOP
edge1b = dering > 0
\ ? yv12subtract( expand(Y=3,U=1,V=1).blur(1.58),
\ inpand(Y=3,U=1,V=1),tol=1,wideRange=true )
\ .bicubicResize(xx_ss1,yy_ss1,-1.0,1.0)
\ .yv12LUT(Yexpr="x 128 - abs "+string(dering_floor)+" - "+string(dering_bias)+" *")
\ .deflate(Y=3,U=1,V=1).blur(1.58)
\ : last
# .Ylevels(0,3.0,255,0,255)
#---------------------------------------------------------------------------------------------------------------------
# 1st supersampling stage to perform sharpening at
#

(ss1_x > 1.0 || ss1_y > 1.0) ? dusted.Lanczosresize(xx_ss1,yy_ss1)
\ : dusted

#---------------------------------------------------------------------------------------------------------------------
# Build DeRing'ing Mask & perform dering'ing: +++ NEW ROUTINE (Pre-processor) +++
#
tmpp = string(dering_floor)
edge1b = dering < 0
\ ? yv12subtract( last, last.xsharpen(255,255),tol=1,wideRange=true )
\ .yv12lut(yexpr="x 128 - abs "+tmpp+" *")
\ .expand().inflate().expand().inflate().FineEdge(dering_bias).blur(1.58)
\ .greyscale.Ylevels(19,1.6,208,0,255)
\ : edge1b
dering < 0 ? maskedmerge( last, soft, edge1b, Y=3,U=1,V=1 ) : NOP

#-------- iterative sharpening, currently only 3-fold: its slow enough ... --------

temp = last
shrpcnt = 0
mskcnt = 0
shrpcnt = (PixSharp != 0) ? shrpcnt + 1 : shrpcnt
shrpcnt = (detailcontr2 != 0) ? shrpcnt + 1 : shrpcnt
shrpcnt = (detailcontr1 != 0) ? shrpcnt + 1 : shrpcnt
mskcnt = (EQ>shrpcnt) ? shrpcnt : EQ

# Stage 1 : UnsharpMasking, wide radius -----------------------
detailcontr1 != 0
\ ? unsharpmask(detailcontr1,contr_radius,0)
\ : NOP
detailcontr1 != 0 && (shrpcnt==1 || mskcnt>1 && shrpcnt>=mskcnt) && (EQ>0)
\ ? MaskedMerge(last,temp,edge0.expand.inflate.inflate, Y=3,U=1,V=1)
\ : NOP
mskcnt = (detailcontr1 != 0 && (shrpcnt==1 || mskcnt>1 && shrpcnt>=mskcnt))
\ ? mskcnt - 1
\ : mskcnt
shrpcnt = detailcontr1 != 0 ? shrpcnt - 1 : shrpcnt

# Stage 2 : UnsharpMasking, small radius ----------------------
detailcontr2 != 0
\ ? unsharpmask(detailcontr2, 1,0)
\ : NOP
detailcontr2 != 0 && (shrpcnt==1 || mskcnt>1&&shrpcnt>=mskcnt) && (EQ>0)
\ ? MaskedMerge(last,temp,edge0.inflate.inflate,Y=3,U=1,V=1)
\ : NOP
mskcnt = (detailcontr2 != 0 && (shrpcnt==1 || mskcnt>1&&shrpcnt>=mskcnt))
\ ? mskcnt - 1
\ : mskcnt
shrpcnt = detailcontr2 != 0 ? shrpcnt - 1 : shrpcnt

# Stage 3 : per-pixel sharpening ------------------------------
PixSharp != 0.0
\ ? sharpen( PixSharp )
\ : NOP
PixSharp != 0.0 && shrpcnt > 0 && EQ>0
\ ? MaskedMerge(last,temp,edge0, Y=3,U=1,V=1)
\ : NOP
undot()

#---------------------------------------------------------------------------------------------------------------------
# DeRing'ing of sharpen'ed clip: +++ OLD ROUTINE (Post-processor) +++
#
dering > 0 ? MaskedMerge(last,last.unfilter(-dering,-dering),edge1b.bicubicresize(xx_ss1,yy_ss1),Y=3,U=1,V=1)
\ : NOP

# Now I have the other idea - but it's too slow, yet
antiflicker2 == true ? temporalsoften(1,2,3,23,2) : NOP

#---------------------------------------------------------------------------------------------------------------------
# 2nd supersampling stage to perform SubPel operation & XSharpening at
#
# Notes: Luma Warping - may help for sources that are hard to get a "clean" picure from.
# - Should help making the picture a little more "gracile" when doing DVD -> HDTV upsizing

xx_ss2 != ox || yy_ss2 != oy ? LanczosResize(xx_ss2,yy_ss2) : NOP

subpelstren != 0.0 ? blur(subpelstren) : NOP

warp_Y ? awarpsharp(depth=(ss2_x+ss2_y)/2*3,thresh=0.5,blurlevel=2,cm=0) : NOP

Xstren != 0 && Xlimit !=0 ? xsharpen(Xstren,Xlimit) : NOP

LanczosResize(dest_x,dest_y).undot()

#---------------------------------------------------------------------------------------------------------------------
# Build new EdgeMask of the enhanced clip
#
edge2 = bicubicresize(int(dest_x/1.75/16+.5)*16,int(dest_y/1.75/16+.5)*16,1.0,.0)
\ .DEdgeMask(0,255,0,255,"-5 -7 -5 -7 48 -7 -5 -7 -5",Y=3,U=1,V=1,setdivisor=true,divisor=1)
bordermask = blankclip(edge2,width=dest_x-16,height=dest_y-16,color=$FFFFFF)
\ .addborders(2,2,2,2,color=$8F8F8F).addborders(2,2,2,2,color=$6F6F6F)
\ .addborders(2,2,2,2,color=$202020).addborders(2,2,2,2,color=$000000)
edge2 = edge2
\ .levels( (detail_floor+int(detailcontr1/15+detailcontr2/30+PixSharp*15)), 4.0,128,flatweight,255,false)
\ .bicubicResize(dest_x,dest_y,1.0,0)
edge2 = exborder ? edge2.logic(bordermask,"min") : edge2
edge2 = edge2
\ .inflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1)
\ .blur(1.58).greyscale()
\ .inflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1)
\ .temporalsoften(1,63,63,255,2)

#---------------------------------------------------------------------------------------------------------------------
# Put original de-noised & not-sharpened clip into areas still appearing flat, after all that sharpening
#
MaskedMerge(dusted.lanczosresize(dest_x,dest_y),last,edge2,Y=3,U=1,V=1)

#---------------------------------------------------------------------------------------------------------------------
# Chroma Warping - often useful for sources where colors are "bleeding". Superfluid for clean sources.
#
warp_UV ? MergeChroma( aWarpSharp(depth = 8.5 * (dest_x/ox + dest_y/oy), thresh=0.5, cm=1, blurlevel=2) ) : NOP

#---------------------------------------------------------------------------------------------------------------------
# Visualizations
#
debug == "dering" ? overlay(last,blankclip(last,color=$00A000),mask=edge1b.bicubicresize(dest_x,dest_y),mode="blend",opacity=dering_weight)
\ : NOP
debug == "protect" ? overlay(last,blankclip(last,color=$00A000),mask=edge0.bicubicresize(dest_x,dest_y),mode="blend",opacity=0.75)
\ : NOP
debug == "detail" ? overlay(last,blankclip(last,color=$00A000),mask=edge2.bicubicresize(dest_x,dest_y),mode="blend",opacity=0.75)
\ : NOP
debug == "compareH" ? stackhorizontal(clp.lanczosresize(dest_x,dest_y).crop(cropx,0,-cropx,-0).addborders(0,0,4,0,color=$800000).subtitle("Original"),
\ last.crop(cropx,0,-cropx,-0).subtitle("iiP") )
\ : NOP
debug == "compareV" ? stackvertical(clp.lanczosresize(dest_x,dest_y).crop(0,cropy,-0,-cropy).addborders(0,0,0,4,color=$800000).subtitle("Original"),
\ last .crop(0,cropy,-0,-cropy).subtitle("iiP") )
\ : NOP
debug == "showall" ? stackvertical( stackhorizontal( edge0 .greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,4,4,color=$800000).subtitle("Protection of sharp edges"),
\ edge1b.greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,0,4,color=$800000).subtitle("DeRing'ing") ),
\ stackhorizontal( edge2 .greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,4,0,color=$800000).subtitle("Detail areas"),
\ last .crop(cropx,cropy,-cropx,-cropy).subtitle("iiP") ) )
\ : NOP

return(last)
}

#

Didée
19th January 2005, 09:41
Firstly, to be safe, move the line that loads "LoadPluginEx". Different versions of it have different behaviour, and I can never remember which-work-how ... :
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\dgdecode.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\LoadPluginEx.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\undot.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\MaskTools-v1.5.5.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\warpsharp.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\LoadPluginEx.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\dustV5.dll")
Then it could be that you're using a "wrong" version of WarpSharp. There are different versions out there, all are doing warpsharping ... but only one does also UnsharpMasking.

The "right" one is exactly this one (http://www.avisynth.org/warpenterprises/files/warpsharppackage_25_dll_20031103.zip).

Also, these two DLLs must be present in your Windows/system32 folder, it won't work without them:

- msvcr71.dll
- msvcp71.dll

And: In case your setup is configured so that plugins get auto-loaded from the GKnot folder, then move all plugins that are used by iiP to a different directory, and load them manualy from there.
WarpSharp and PixieDust definetly *cannot* be autoloaded. Not fully sure about LoadPluginEx and MaskTools, but they could make problems, too.
Plugin autoloading seems a nice feature, but is often causing nothing but problems, problems, problems ...
I always load ALL plugins manually. I never used any autoloading at all (except for DSsource in recent versions). And I never had any of those problems. (Except for C-Plugins, sometimes ... but that's another story :rolleyes: )

***

And my left eyebrow raises like the one of Mr. Spock, when I see that LS2() line at the very end :| You don't need that as an iiP post-processor, really not. You should *configure* iiP instead ;)

Suggestions:

- Raise detailcontr1 & 2 to 127 & 255.
- Lower protect_bias to 12 or 8.
- Raise dering_bias to 16, 20 or 24.

Or: don't use iiP at all, but only that LS2-thingie with strrrrrong settings. I'm *not* responsible for that one, despite the function's name. :D

dvwannab
20th January 2005, 04:45
Thanks Didee. That did it. Moved position of LoadPluginEx, got that version of warpsharp and it worked like a charm. Thanks buddy.

dvwannab
9th February 2005, 17:45
Hey all,

Just want to report back on my first full encode using iiP. I dont have screen shots. First because screens shots do not always tell the full story (accurate) and second I dont have any web space to host and get them up. Another thing about static shots, is that you are easily fooled on what you think looks better than another.

I encoded a soccer game using iiP, after doing short 5 minute test encode clips of game action as well as studio hosts with close-ups. I compared test clips of:

iiP vs LimitedSharpen (LS) vs LimitedSharpen2 (LS2) vs iiP/LS2 combo (LS disabled).

The test file was originally captured at high quality (6 Mbps VBR) ReplayTV unit (mpeg2), from sat TV with S-video connection.

In the static screen capture test the iiP/LS2 combo was just wickedly sweet. But when I burned all the encodes onto DVD-RW and watched on 32" TV, it was plain to see that iiP was the close, but clear winner.

iiP - did the best job creating a clearer, but sharper image without highlighting any potential artifacts that was present in the other encodes. The close-ups were handled extremely well.

LS, iiP/LS2 then LS2 finished in that order. The only tweaking in the script was to change dust weight from 1 to 2 in iiP and iiP/LS2. I will try my next test on a movie to see if the results are mirrored. My gut says that it may not be the case, as sports are harder for processing, because everything that is involved with that. Lots of movement, camera pans, quick scene changes, camera distance, etc etc.

Valky
22nd February 2005, 17:42
Well, I still got error on line 206, 'couldn't find function awarpsharp' and I am using exactly the same version of warpsharp that Didee suggested and I am loading my plugins manually? Using latest masktools.


edit: I got this finally work, when I found awardsharp.dll file and loaded it in script. I just didn't saw it anywhere on those example scripts and I thought it was part of that warpsharp-plugin.

Gn0m0rz
24th February 2005, 16:43
Lo @ all, please to meet you.
I´m from Spain and is my first post in this forum.
Sorry for my poor english, i will try to write the best that i know.
With this function of Avisynth (IIP), the image is very imppresive but i have a problem. I use this in realtime over FFdshow but my fps are very low (14 FPS) :(
I have read all pages of this post and i haven´t found solution for this problem.
Do u use this filter in realtime ?, would be possible?.
This is my image without and with IIP.

http://img235.exs.cx/img235/931/defaultthehunted5gm.png

http://img235.exs.cx/img235/3887/iipthehunted5oq.png

The results are incredible but i can´t see a film with this lag.
I post u my config HTPC and the code IIP, can u say me if all is correct? :

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

Shuttle XPC SB81P - PciE
Intel P4 550 3.4GHz @ 3,95 Ghz
Corsair XMS Pro 1GB DDR PC-3200 / 2-2-2-5
Raid 0 - Seagate 3160827AS - 320 Gb SATA
Pioneer DVDRW A05
HIS X850XT PE - Dual DVI VIVO - 256MB PCIe

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

Import("D:\Programas\Imagen\AviSynth 2.5\plugins\IIP.avs")

LoadPlugin("D:\Programas\Imagen\AviSynth 2.5\plugins\UnDot.dll")
LoadPlugin("D:\Programas\Imagen\AviSynth 2.5\plugins\MaskTools.dll")
LoadPlugin("D:\Programas\Imagen\AviSynth 2.5\plugins\warpsharp.dll")
LoadPlugin("D:\Programas\Imagen\AviSynth 2.5\plugins\asharp.dll")
LoadPlugin("D:\Programas\Imagen\AviSynth 2.5\plugins\aWarpSharp.dll")
LoadPlugin("D:\Programas\Imagen\AviSynth 2.5\plugins\LoadPluginEx.dll")
LoadPlugin("D:\Programas\Imagen\AviSynth 2.5\plugins\DustV5.dll")


iip( dest_x= 1024, dest_y= 576,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 0, dustweight = 0, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.25,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = false, warp_UV = false,
\ debug= "showall | compareH/V | protect | dering",
\ cropx=32, cropy=16
\ )

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

Waiting for reply. Thanks :P
Regards.
-QuinT-

Didée
24th February 2005, 17:12
No, no way. Sorry.

iiP was never meant for realtime usage, but only for pre-processing before encoding. And in that case, time doesn't matter (basically).

But then - are you really getting 14fps with above posted script? (I'm deeply impressed!). If so, ~perhaps~ you can reach realtime by additionally setting "Xstren=0" and "Xlimit=0".
Also, using positive values for "dering", instead of negative values, runs a little faster.
Finally you could use "EQ=1" instead of "2" - that's faster too, *but* then there is much more danger of getting oversharpening on edges. If so, reduce some sharpening values.

With above suggestions, perhaps you're able to reach realtime indeed. However: any speed gain only comes from deactivating more and more features, what will of course worsen the output more and more.

It's a little like using a bulldozer to drive to the baker and buy a bread. One *can* do that, but for sure that is not "intended usage" ;)

Soulhunter
24th February 2005, 17:30
Originally posted by Gn0m0rz

With this function of Avisynth (IIP), the image is very imppresive but i have a problem. I use this in realtime over FFdshow but my fps are very low (14 FPS) :(


ROFLMAO !!!

Sorry, I know thats ya first post here, but...

Some ppl would "kill" to run such a function @ 14 fps !!!


Bye

Taurus
24th February 2005, 22:17
I'm getting 2 fps :D

patxitron
24th February 2005, 23:37
I don't tested this script yet, but it seems to me that you can use it to encode a 720p upsized xvid version of your dvd and burn it as a HDTV movie.

Using it this way, does not matter if it is realtime or not, and you can use a less powerfull (and more quiet) HTPC to play the movie.

Best regards

jptheripper
25th February 2005, 00:08
everytime i try to install the filters for iip im getting a "couldnt open c:\program files\avisynth\plugins\avsfilter.vdf.avs" error

someone please help. I have a nasty source that really needs iip

once i get this error, it occurs on every avs script, even test ones. I imagine its from autoloading plugins

jptheripper
25th February 2005, 00:15
okay fixed that by moving all teh filters into a seperate folder.. now it laods all the way thru the load mpegsource command and when i test with windows media player the window just goes away.

im on a p3 1ghz with 1.5gb ram
i have tried memory max at 64-128-256

jptheripper
25th February 2005, 00:53
Baffled. now i get an evaluatin error:
"Evaluate: Unrecognized exception!
iip.avs line 122
text.avs line 28 #end of script below

SetMemoryMax(128)

Import("C:\Program Files\AviSynth 2.5\plugins\new\IIP.avs")

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\undot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\new\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\new\WarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\new\LoadPluginEx.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\new\dustv5.dll")


mpeg2source("H:\temp\new.d2v")

iip( dest_x= 720, dest_y= 480,
\ ss1_x = 1, ss1_y = 1,
\ duststr = 0, dustweight = 0, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.25,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = false, warp_UV = false,
\ debug= "showall | compareH/V | protect | dering",
\ cropx=32, cropy=16
\ )

DarkNite
25th February 2005, 06:27
Please forgive me, but I'm still drooling over that 14 fps. I think I just found a reason to upgrade again. :D

P.S. - I'd also like to take this oppurtunity to thank Didée again for the excellent script that has helped greatly on a few sources.

Gn0m0rz
25th February 2005, 09:48
"couldnt open c:\program files\avisynth\plugins\avsfilter.vdf.avs"

Delete the file with this name avsfilter.xxx

jptheripper
25th February 2005, 19:44
it actually worked once i moved the plugins to a sperate folder , it think there was an autoloading issue

now i have to figure out why it simply crashes.

Is there other tools to preview avs's ?

dvwannab
25th February 2005, 19:59
@ jptheripper,

see Didee response to my problems below (located on page 9)

Originally posted by Didée
Firstly, to be safe, move the line that loads "LoadPluginEx". Different versions of it have different behaviour, and I can never remember which-work-how ... :
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\dgdecode.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\LoadPluginEx.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\undot.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\MaskTools-v1.5.5.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\warpsharp.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\LoadPluginEx.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\dustV5.dll")
Then it could be that you're using a "wrong" version of WarpSharp. There are different versions out there, all are doing warpsharping ... but only one does also UnsharpMasking.

The "right" one is exactly this one (http://www.avisynth.org/warpenterprises/files/warpsharppackage_25_dll_20031103.zip).

Also, these two DLLs must be present in your Windows/system32 folder, it won't work without them:

- msvcr71.dll
- msvcp71.dll

And: In case your setup is configured so that plugins get auto-loaded from the GKnot folder, then move all plugins that are used by iiP to a different directory, and load them manualy from there.
WarpSharp and PixieDust definetly *cannot* be autoloaded. Not fully sure about LoadPluginEx and MaskTools, but they could make problems, too.
Plugin autoloading seems a nice feature, but is often causing nothing but problems, problems, problems ...
I always load ALL plugins manually. I never used any autoloading at all (except for DSsource in recent versions). And I never had any of those problems. (Except for C-Plugins, sometimes ... but that's another story :rolleyes: )

***

And my left eyebrow raises like the one of Mr. Spock, when I see that LS2() line at the very end :| You don't need that as an iiP post-processor, really not. You should *configure* iiP instead ;)

Suggestions:

- Raise detailcontr1 & 2 to 127 & 255.
- Lower protect_bias to 12 or 8.
- Raise dering_bias to 16, 20 or 24.

Or: don't use iiP at all, but only that LS2-thingie with strrrrrong settings. I'm *not* responsible for that one, despite the function's name. :D

jptheripper
26th February 2005, 00:34
mine keeps crashing on the line

soft=dusted.bicubicresize(xx_small,yy_small,.2,.4).bicubicresize(xx_ss1,yy_ss1,1.0,.0)


getting the evaluate! unrecognizedd exception error

this is my iip script

iip( dest_x= 720, dest_y= 480,
\ ss1_x = 1, ss1_y = 1,
\ duststr = 0, dustweight = 0, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.25,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = false, warp_UV = false,
\ cropx=32, cropy=16
\ )

can someone tell me what the nulls are for each so i can turn them all off and then turn on 1 by 1 so ican isolate the issue?

Didée
27th February 2005, 12:27
Hmh, it should work. Try to put decimal numbers for ss1_x|y, instead of integer. If that doesn't help, search the block where xx_small & y_small are calculated (rather at the beginning of the script, after the big default(...) block) and exchange it with this:
xx_small = int(ox/(abs(dering)/80.0+1.0)/16.0+.5)*16 + 32
yy_small = int(oy/(abs(dering)/80.0+1.0)/16.0+.5)*16 + 16
There was an error in this two lines, reagarding the (dreadful) float//integer handling.

Will be corrected in the next version, which I'm currently at. Expect more Speed :)

jptheripper
1st March 2005, 02:36
hmm, those were already there.

trying again

Didée
1st March 2005, 09:04
Yes those lines were already there. But read closely: there's a tiny change that was made.

BTW, if it still fails: what version of avisynth are you using? There's a buch of builds out there that are in use, all of them with their own small bugs ...

DeepDVD
2nd March 2005, 03:13
As everybody can recognize all inventions, projects or at least new functions in the "Usage Forum" are stucking. Everytime I visit it I seek important news and improvements. The last few months there was (except BlindDehalo) no big hit in here :(.

Dideé, any progress?

BTW did you know nik Sharpener use sort of techniques like LS and iiP making Photoshop things more sharpen? I recognized it by testing a picture of yoda which was posted before. The LimitedSharpen/iiP sharpening is indeed almost or exactly the same as in nik Sharpener.

Examples: http://download.nikmultimedia.com/downloads/pdf/de_samples/SampleBook.pdf

Didée
2nd March 2005, 09:20
I wouldn't say there are no inventions. Just for example, scharfis_brain's efforts in better handling of interlaced video, and especially the motion compensated framerate conversion is a great thing.
But if you need more inventions, of course you are warmly invited to make some! ;)

Regarding iiP, there is no new functionality to expect. However I'm currently looking into optionally offering slightly simplified routines for denoising, deringing and fine-sharpening. The whole thing will still be slow, but compared to the last version a speedup in the range of 50% ~ 75% seems feasable.

And in case I get good grip of the remaining problems in LS-EX, then you can expect another one of those threads with a *big* initial post ;)

About that nik PS thingy - well, I was always wondering for what too simple stuff (partially at least) one can make money, if only the name of Adobe or Photoshop is involved. Look e.g. at that "graduated fog" filter. What a genious idea, cough.

Looking at it from such an angle, I could be a rich man as well. Pity that I'm not.

DarkNite
3rd March 2005, 04:44
How "simplified" are we talking here? Well, if we're talking about 50-75%, options are always good. :)

What routines would you say are eating the most cycles as the script stands now? I can garner a rather decent boost by changing the denoiser I use, but only in the range of 15-20%.

I guess I'm just curious as to where exactly the other 30-55% is coming from, and how it will effect the overall output.

Didée
3rd March 2005, 09:14
>> How "simplified" are we talking here?

Oh, I was thinking about temporalsoften(5,255,255...) for denoising, 3 or 4 times blur(1.58) for deringing, and unfilter(150,150) for fine sharpening :D

Seriously. SSXsharpen is ultra-slow cause of the big supersampling, and will be replaced by LimiteSharpen as default (like in the alpha), and optionally by the even faster ModerateSharpen. This also helps the warp_Y option, in case it gets used.
PixieDust most probably will get LRemoveDust as faster option.
For deringing I've also another way of creating the mask, which is both a little faster and better fitting.

DarkNite
5th March 2005, 09:40
Sounds like a solid plan. These are the kind of script changes that can make comparison testing fun again.

As an added bonus, another 100 or so variables means more fun when randomly generating "the perfect settings" when someone asks for help with a source. :devil:

Seriously, that was just a joke. Do not do this to your freinds on irc, unless you're at least an op, or your nick contains the word Evil.

guada 2
14th March 2005, 00:06
Hello everyone,

To this address: http://forum.doom9.org/showthread.php?threadid=70916&perpage=20&pagenumber=10).
I tried this script for the encoding of the movie matrix3 in 1024*576 with the RV10 format, and hfe 2.1 activated.
The result is without call. I also used the Xvid codec but the result was not the same.
But, when I wanted to test NIC'S Wmv9 program: WMNicEnc v.0.99 bêta, the script doesn't function.

Would someone be able to explain me why?.

dark.soft
19th March 2005, 07:36
Hi Didée, I tried your script and I must say that is outstanding! But I have two questions for you:
1\On things that aren't on focus (e.g. walls), the script applies the sharpening and they appear ugly, like if they are pencil coloured! What are the parameters wich I should change to correct this?
2\I tried a certain piece of Resident Evil, the elevator scene, where there is a lot of blue. Well, with your script I noticed a thing that happens only when converting to yv12: the borders of the blue are blocky, and if I set a resolution like 640x480 they become really noticeable. So, can you tell me a solution?
Thank you very much for writing such an amazing script!

guada 2
19th March 2005, 10:53
Sorry, Didée. It works very well with WMNicEnc v.0.99. i just missing an dll in Windows.
Your script is fantastic. ;)

PlazzTT
19th March 2005, 19:30
There's not much mention of using VHS sources in this thread, although on other threads it has been mentioned that iip is great for processing VHS.

Which settings should be adjusted from default, taking into account that a noisy VHS source is being processed, and not a relatively cleaner DVD, TV or HDTV source?

dark.soft
19th March 2005, 22:11
I've made other tests, and I've noticed that all the things that are blurry (not on focus) are sharpened bad, so that they seem in focus, but that's wrong. I don't think there is a solution for this, am I right Didée?

Didée
20th March 2005, 00:20
guada 2: Fine if it works and pleases. :)

dark.soft: If blurry background objects are enhanced too strongly, then

- set protect_floor to zero if it isn't already
- raise protect_bias
- raise detail_floor
- drop the "EQ" parameter by 1, and reduce the sharpening settings
- (less probably) certain fiddling with deringing can help, too

Use the debug="showall" feature for tweaking the parameters:

- The "protection" mask shows you which parts of the frame are protected from getting sharpened, and how strongly.

- The "detail" mask shows you in which places the sharpened result is applied. If there are too much visible "structures" in those areas that are getting too much sharpening, raise "detail_floor" until these disappear. [edit]


PlazzTT: I've very little personal experience with processing VHS captures. First it must be assured that the souce is sufficiently "calmed down" by the internal denoiser. Raising "duststr" to 5 or 8 at max. might be necessary, together with both deflicker options @ "true". If this doesn't suffice, you need to use another denoiser beforehand.
Then VHS may need more deringing - or it may not. Depends on your signal.
For sharpening, you probably should raise radius to 3 or even 4, especially when [stronger) deringing is used. But when using radii > 2, detail_contr1 should be lowered somewhat, mostly.
Perhaps raising raising detail_contr2 and/or pixsharp is beneficial, if the source is clean & stable enough for that.
Warp_UV could be a good idea for VHS, too.

Much of poking around. I don't do any VHS, and input quality might be just anything, so it's hard to judge.

guada 2
22nd March 2005, 00:45
Hello Didée, :)

I tried your script on an extract of matrix 2 with a bitrate of 450 Kbps in 720p.
I have been very surprised of the quality of the picture.

My file of 23.5mo has been divided by 10 either 2.35 mo.
Even in pause on fast stages, the script preserves its chromatic wealth.

I wonder what your script would give on a cd of 700mo in HD.
To be honest, it is one of my main objectives.

Didée
22nd March 2005, 01:34
Oh, indeed. HD @ 450 kbps.

\:eek:/

dark.soft
22nd March 2005, 09:22
720p at 450 kbps? Guada 2, you're a genius! :D

Soulhunter
22nd March 2005, 10:26
Ouch, now I understand why he gets better results with RV10... :D


Bye

guada 2
22nd March 2005, 20:58
Hello Gentlemen, :)

One would say that you didn't appreciate my bitrate.
I think that I had forget to specify something,it is HD streaming in the WMV9 format and no of the RV10 (Mr SOUL my Friend).

I saw it was possible to put on a SD card of 512 mo 2 Xvid Movies.
So I do some test in Streaming HD 720p on 800mo.

Think yourselves that I am mad or brilliant :p

JasonFly
24th March 2005, 20:00
I'm wondering what is the "weakest link" of the processing chain with such low speed scripts?
Is it CPU, RAM, HHD speed?

BTW, what if this script would become a plugin? I don't know if it would be possible but could there be a speed increase by making that?

DarkNite
27th March 2005, 21:30
In my experience this particular script will bring your cpu to it's knees. iip could replace prime95 as your burn in test. ;)

Memory usage can be "controlled" (ie "MemoryMax(192)") within the avisynth script, assuming there's no leaks in the functions/plugins you're using, or apps you're serving to, or anything else involved in the chain. So using 192MB-256MB of memory isn't bad at all considering what you get out of it.

I can't speak for Didée, but making this a plugin would limit some of the flexibility this script offers to people who choose to alter the script to meet their needs, or the needs of their source.

Who knows, you might see somebody do a plugin of the "simplified", less slow version that's been mentioned. Stranger things have happened here.

Lastly, HDD speed is always a problem in computing. Lobby for faster development of nonvolatile dynamic random access memories (like FDRAM).

DeepDVD
29th March 2005, 23:35
As a silent protest I used my freetime to make some banners for some demos to get the new iip. See my signature :D :D :D

http://mitglied.lycos.de/tdeepblue/freeiip.jpg

Didée
30th March 2005, 01:44
Nice try, DeepDVD :)

But you have to know I only fall for 3D renders. If possible, with radiated illumination.

This was done 5 years ago, when I wondered about possibilities for a PC desk in that darn corner in the living room with rustical furniture:

http://img221.exs.cx/img221/1108/livingroomdraft989ie.th.jpg (http://img221.exs.cx/my.php?loc=img221&image=livingroomdraft989ie.jpg)

(POV-Ray/MegaPOV, 100% scripted. No pre-made libraries or textures were used, except painting & screenshot.)


To ease the task for you: radiation isn't mandatory. But 3D is. ;)

guada 2
30th March 2005, 17:45
Hello Didée,

In pre-visualization before the validation of your script, Nero recode read perfectly my file, but after to have validated the file, I note that it is reversed in mode reading.
Normal or not normal ?

akupenguin
30th March 2005, 21:27
Originally posted by JasonFly
I'm wondering what is the "weakest link" of the processing chain with such low speed scripts?
Is it CPU, RAM, HHD speed?
I'm guessing RAM. It uses lots of simple filters, which do only a little processing each but still require generation of a new frame. And many of them apply to a high-res image that won't even fit in L3 cache. I'm sure it could be made several times faster by processing in slices.
However, I agree that packaging it in a plugin would greatly reduce the easy of tweaking it.

HDD speed only matters for very fast filterchains, and only if one or both ends are huffy.

JnZ
1st April 2005, 22:34
Hi,

I'm just testing IIP, and my results are fantastic. Didée, you are genius.

Script is very slow, about 1-2fps on my Athlon in 720p res., but with incredible result!

So, if we really want convert DVD -> 720p, it's better:
1)make one pass to HuffYUV, and from this source make 2-pass XviD encoding (finaly 3-pass).
2)or make directly 2-pass XviD encoding, but both pass with very slow speed (1-2fps).
This is the really question!

I think, that first possibility is better, because hardest work (IIP resize) can be shared to two or more computers. Video can be divided to many parts and result in HuffYUV can be joined. Anyway in 1), IIP script can be anytime stopped, and next time we make encoding on next frame, and finally join this avis. Etc.

Thx. Didée, now, I'm thinking, that hollywood makes HI-DEF from normal DVDs, but uses your IIP! :D :D :D

guada 2
4th April 2005, 22:07
Hello Didée, :)

I made the comparison of the codec Xvid 1.1 of Koepi and Wmv9bêta of NIC with your script at low bitrate.


- an avi file Starwars 2: 19.6 Mo

SETTINGS:
- Xvid 1.1 with VD 1.5.10 (Filter:LanczosResize: 240*176) Bitrate: 151kbps

Unrectricted
H263
B-VOPs: 2/100/100
Packed Bitsream
Closed GOV
UH 6
VHQ Mode 4
CM
0/250
Quantizer: 2/4/2/13/2/14
Treillis quantization

Second pass:
Intra frame tuning:0/1/20
Loose curve scaling
Respect VBV Buffer
Overflow S/I/D: 2/2/2
H/l bitrate: 0/0


- Nic' S Wmenc 0.99 beta

Windows video media 9
Progressive mode
Bitrate: 144000
Quality: 100
FPS: 25
Secs/KF : 5
Resolution: 240*176
VBR Quality 100
MultiPass Encoding

The final file: 1.97 Mo without sound



My report:

- the codec WmEnc of NIC does not appreciate your script with low bitate.
- the image is filtered too much (fuzzy significant). However the characters are reproduced better.
- the codec of Koepi digests better your script, the image is less fuzzy and better defined on the characters (less artifact than Wmv).

A question indiscrete your script it would not be dedicated to the codec Xvid? :)

Note: sorry for my english

troy
6th April 2005, 04:37
I just started encoding a 68 minute dv video using IIP. It will take about 110 hours on my P3 800/512 mb of ram. I did some test clips and then look good. I wish that I could adjust some of the parameters but I have read this thread a bunch of times and I can not understand what is going on. The only parameter I understand is duststrength. For example what is a binary mask. I just dont understand what is going on here. I am a newbee and I guess I will try to read and learn more but I wish that the parameters meant something to me. I think that if I could understand masks I would know a lot more but I have read the masktools thread and it is just not clicking. Well I guess I will go and read some more and quit whining.

JnZ
6th April 2005, 08:43
I'm just encoding DVD IceAge using IIP (because it's short, about 116880 frames only). Sample clips, I've made,looks very good. I go upsize to 1280x672. I encode to lossless codec first, using FFV1 from ffdshow. Total filesize will be about 37Gbytes. Then I encode this large avi using 2-pass XviD.

Encoding is so slow. At now, I have 37000 frames encoded (31%), after 15hours. Completly it takes about 2 days + additional XviD encoding. Fortunately, encoding to FFV1 (slowest part), can be anytime interrupted.

I left my proc at default freq,beccause I don't want to risk any unstability :D

dvwannab
6th April 2005, 17:33
Originally posted by guada 2
My report:

- the codec WmEnc of NIC does not appreciate your script with low bitate.
- the image is filtered too much (fuzzy significant). However the characters are reproduced better.
- the codec of Koepi digests better your script, the image is less fuzzy and better defined on the characters (less artifact than Wmv).

A question indiscrete your script it would not be dedicated to the codec Xvid? :)


I dont think so. I believe that it is a generally accepted and provened that XviD compresses better tha WMV at low bitrates (low meaning below 1500 mbps). WMV only really shines with high bitrates where you are unable to tell the difference between WMV or any other codec. For my money XviD is the king of low bitrate encodes. Others that are better than WMV in this category is RealVideo and Quicktime.

guada 2
7th April 2005, 00:45
As regards the RV10E hfe2.1, I suppose that it is not necessary to make the attempt for this bitrate because it is sovereign.

Nevertheless, I wanted to underline that the script of Didée was better convenient for Xvid than for WMV in this bitrate.
With high bitrates, the WMV is more interesting and more homogeneous.

dvwannab, make a little test for this bitrate, and you will say to me then of what you think.
Naturally, you will choose at the same moment one quiet and fast scenes.

To soon

Didée
7th April 2005, 01:40
guada,

one cannot say that I had made iiP especially targetting at XviD encoding. In a sense, intention was to enhance detail /plus/ reduce noise, in order to deliver as much of *relevant* picture information to any encoder, so that it won't spoil its bits on not relevant data, speak noise.
If XviD makes the best job on this intention, well ... perhaps that's the reason why I'm using XviD, too ;)

However, I think your test does not say much about the correlation iiP <-> Codec. You are aware you're encoding a *stamp sized* clip (240*172, oh dear), are you? And moreover, 150 kbps is a rather low bitrate, even for such a resolution. I don't think iiP's filtering has much to do with your findings. You could have used _any_ filtering, and the result would have been the same. With the setup you've been using, you were testing the plain codec performance, and nothing else.



@ troy

Well, I can understand your problems in understanding the principles of what is done in the script. But to ease your mind: you're not alone with that ;) , I know many people are confused by the many parameters and all the masking. But then, I can't explaing everything from scratch now...
Basically, there is a) noise removal, b) cleaning of areas around prominent image features (removal of "halos" and "mosquito noise"), c) sharpening (in several stages), and d) mixing everything together.

If you set >>debug="showall"<<, you get displayed all important masks that are used. The "protection mask" shows which areas will get less sharpening, to avoid over-sharpening artefacts. White areas will get not sharpened (except for the last step of sharpening).
The "dering mask" shows which areas will get cleaned - again, white is the processed area.
The "detail mask" shows what in the end is considered as "important area". For the parts shown as white in this mask, the denoised+cleaned+sharpened clip will be used. For the parts shown in dark, only the denoised clip will be used, without any sharpening (in order to keep detail-less areas calm, i.e. to not enhance any remaining noise).

The usual procedure is to look closely, decide if you need more or less of any of the used processing techniques - more sharpening, less deringing, or whatever - and to adjust the according parameter. Then hit F5 in Virtualdub, and see if you get closer to what you want.

For understanding which parameter does what, please read the explanations given earlier. :)



JnZ & all:

I know I had promised a faster version of iiP for quite a while. But apart from the usual "too little time", I'm not only plagued ;) with lots and lots of new ideas (and it's impossible for me to leave my fingers off them when I have ideas!), but also with mountains of video stuff I've to process myself. I don't even use iiP very much myself lately, because I just do not have the time for using it.

Sorry for that. But be assured, there are some nice things in store, if I manage to come around, somewhen, somehow. However I won't release any premature, half-finished stuff. Either correctly, or not at all: that's how things are done.

guada 2
8th April 2005, 18:28
Hello Didée, :)

This test shows just that for these low bitrate your script is favorable to Xvid.
Besides, as soon as bitrate grows Xvid loses of the ground on Wmv9.

Indeed, I have to test others script of this nature (and others):

*Import ("C:\PROGRA~1\GORDIA~1\IIP.avs")
*
LoadPlugin ("C:\Program Files\GordianKnot\DGMPGDec\DGDecode.dll")
*LoadPlugin ("C:\PROGRA~1\GORDIA~1\fftw3.dll")
*LoadPlugin ("C:\PROGRA~1\GORDIA~1\MipSmooth.dll")
*LoadPlugin ("C:\PROGRA~1\GORDIA~1\undot.dll")
*LoadPlugin ("C:\PROGRA~1\GORDIA~1\MaskTools.dll")
*LoadPlugin ("C:\PROGRA~1\GORDIA~1\WarpSharp.dll")
*LoadPlugin ("C:\PROGRA~1\GORDIA~1\UnFilter.dll")
*LoadPlugin ("C:\PROGRA~1\GORDIA~1\LoadPluginEx.dll")
*LoadPlugin ("C:\PROGRA~1\GORDIA~1\dustv5.dll")
*
Avisource (" C:\Documents and Settings\Administrateur\Mes documents\Nouveau dossier\fragmentvideoHD\extrait 2 Starwars720p.avi ")
*fftw3 (sigma=2.0, plane=0, bt =-1, bh=48, bw=48, measure=false, sharpen=0.4)
*iip (duststr = 2, dustweight = 1.0,
*ss1_x = 1.33, ss1_y = 1.66,
*detailcontr1 = 127, detailcontr2 = 208,
*contr_radius = 3, PixSharp = 0.3,
*ss2_x = 2.5, ss2_y = 3.5,
*Xstren = 208, Xlimit = 255,
*subpelstren = 0.0, flatweight = 0,
*antiflicker1 = true, antiflicker2 = true,
*protect_floor = 0, protect_bias = 12,
*dering =-100, dering_weight = 1.0,
*dering_floor = 8, dering_bias = 12,
*detail_floor = 24,
*EQ = 2, to exborder = false,
*warp_Y = true, warp_UV = true,
*debug = " dering ¦ Protect ¦ Detail ¦ CompareH ¦ CompareV ¦ CompareT ¦ Showall ",
*cropx = 40, cropy = 20
)

The quality is naturally present.
But it misses stability in the synchronization of the slow scenes and the fast scenes contrary to the treatment of your script.

I understand that this bitrate make you sad, but all the tests are allowed.
Be without fear, for the filing of video high quality, I use your script with some modifications of the software CCE 2.70 Pro.
It is really magnificent.

JnZ
24th April 2005, 18:34
Hm,

I just upgraded my system to Athlon 64 3000+ s939.

I noticed faster run IIP script (about 2 times faster on Athlon 64 3000+ vs Barton 2500+),but both runs on 1800MhZ. This is interesting.

But! Xvid encoding runs at same speed (maybe slower) an Athlon 64. This is really strange. Maybe bad optimization for Athlon 64?

P.S.: I finished Ice Age in 1280x672 and result are outstanding. It looks like original HI-DEF material.
I also encode Lord Of the Rings: Fellowship of the Ring Extended Edition using IIP to whole DVD (about 2400kbps in XviD, res. 1024x416). I divide this job on 14 machines, and the next day, I have abot 60G whole movie in FFV1, and encode it to XviD on my machine (it takes one more day). Result: very good.

3ngel
16th May 2005, 09:16
@Didee
Hi, i wanted to test your iip script, but i'm a little confused by the huge amount of parameters to set in order to work with it. Can you suggest me a good command line for you, so i can start with it and study slowly all parameters? My source is 1024 * 416 already clean material, and it needs only a little sharpening for the small details (but obviuosly if it can clean temporal noise i don't see is good :)).
Thank you so much ;)

JnZ
16th May 2005, 10:07
Originally posted by 3ngel
@Didee
Can you suggest me a good command line for you, so i can start with it and study slowly all parameters?
Try default settings. Results are good. If You have clean source, set dust params. at 0. Bye.

3ngel
16th May 2005, 10:21
@JnZ
For default settings you mean iip() with no parameters?

Didée
16th May 2005, 16:17
3ngel:

Default settings as used with iiP() are the same as these (http://forum.doom9.org/showthread.php?s=&postid=517100#post517100). Except for the resolution parameters in the first line, obviously.

3ngel
18th May 2005, 12:51
@Didee
Ok, thank you 'ill try it. But what about to include in the script a little explanation of any single parameter with the default value associated? I say this because this thread has become a little difficult to read :)
Moreover, i don't understand, what is the means of the dest_x and dest_y?

Didée
18th May 2005, 13:28
Yes indeed, this thread has become hard to read. However, by now it's far too late to rescue it ... perhaps I'll make up a "#2" or "revisited" thread for the next version of iiP. If I ever manage to build one. Currently I'm in a too bad shape to make any sort of big effort.

Well ... gathered together from all over this thread:

Parameter description for iiP v.0.5a


dest_x, dest_y ,
Obviously, these are specifying the final output resolution.

duststr, dustweight, antiflicker1, antiflicker2 [int],[float 0.0~1.0],,[bool]
duststr is the denoising level of PixieDust. default is 2, try 1~8 depending on how noisy the source is.
dustweight: instead of using the "dusted" clip, you can mix it back with the raw input image by a percentage of dustweight.
antiflicker: I had other plans for it. For now, it simply calms the picture further down by a weak temporalsoften(). See if you like it better on or off.

[b]ss1_x, ss1_y [float],[float]
These are the supersampling factors for the following sharpening stage. Default is 1.4, try 1.0~2.0. With 1.0 the supersampling is discarded.

detailcontr1, detailcontr2, contrast_radius, PixSharp [int],int],[int],[float]
These are the values for detail enhancement.
detailcontr is the strength of unsharp masking. Default is 112, try 40~80~160~255~512, this depends on the source quality and your taste.
contrast_radius is the radius for unsharp masking. Default is 2, try 3 and 4 also. This correlated with the supersampling factors above.
PreSharp is simply the value for a sharpen()-command after unsharp masking. Default is 0.8, try 0.0~1.0.
NOTE: to completely disable detail enhancement, set detailcontr=0 and PreSharp=0.0

ss2_x, ss2_y [float],[float]
These are the supersampling factors for the following Xsharpening stage. Default is 3.5 . For downsizing, go not under 4.0. For upsizing, 3.0 might be sufficient.

Xstren, Xlimit [int],[int]
These are the strength and limit factors for Xsharpen(). Default is (255,255). If you don't have the patience for big enough supersampling, e.g. for 2* supersampling only, try something like (128,23).

subpelstren
This envokes a sharpen(1.0) on the flat areas, and a blur(1.0) on the edges of the supersampled image, prior to XSharpen().

[b]flatweight [int]
At the very end, the denoised-but-not-sharpened original clip is copied back into the flat areas of the full-processed clip. Through flatweight you can control the strength of this copying process. "0" will return the calmest picture with best compressability. Try values 0~32~64~128.

dering_floor [int]
As before, this is a value controlling at which "strength-of-detail" the deringing part will start to kick in. Default is "8", useful range is from 0 to about 32.

dering_bias [int]
This still controls how quickly the strength of the de-ringing process will raise as the strength-of-detail raises. Higher values will apply more deringing.
Default is "16", useful range is from about 4 up to infinite (almost).
The effect gets saturated with higher values. You will see big changes in the mask when changing this in the range of 0 ~ 16; beyond of 64, the mask will stay almost the same.

protect_floor [int]
This controls at wich level of detail-strength in the source the applied sharpening will start to get attenuated. Default is "8", useful range is from 0 to [something]. From my experiences so far, keep it in the range of 0 ~ 16.

protect_bias [int]
Again, this controls how quickly the attenuation of the applied sharpening will raise with the strength of detail. Higher values will protect more detail from oversharpening (but reduce the effective overall amount of sharpening).
Default is "16", useful range is IMO 4 ~ 64. With high values, this will saturate similar to "dering_bias".


EQ [int]

Edge "quality" parameter.
Specifies how many of the sharpening steps will be protected by the protection mask.

0 = deaktivated. Don't ever choose that for encoding!! - but it's nice for visualizing why edge protection is needed at all ;)
1 = protect only the last sharpening step. "Standard", as in older versions.
2 = protect the first & the last sharpening step. Recommended.
3 = protect all three sharpening steps. Minimalizes any risk of producing oversharpening, but lessens the overall contrast gain.


warp_Y, warp_UV , [bool]

These will activate additional luma warping, resp. chroma warping. (Uses MarcFD's aWarpSharp plugin.)

Luma warping - should help in making the picture a little more 'gracile' when upsizing to bigger resolution, e.g. 1:1 PAR -> anamorphic PAR, DVD -> 720p, or such. For keeping same resolution or downsizing, perhaps it may help on sources with distorted detail by "straightening" it. Or it may not help - YMMV.
Luma warping is performed in 2nd supersampling stage, prior to XSharpening.

Chroma warping - should help a lot on sources with bleeding colors. I put this in, since I had big problems on my Enterprise DVB captures: on the starfleet uniforms, the red stripes are badly bleeding into the blue cloth. This looks *very* ugly, like an aquarell that's gotten wet. It looks much better with chroma warping.
On clean sources, chroma warping mostly is a waste of CPU cycles.

Note: aWarpSharp's parameters are hard-coded. Depth is automatically scaled by the supersampling factors (Y) resp. by the [original:destination] size ratio (UV).
If someone thinks more configuration is needed, tell me. For me it works fine the way it is.


[b]New deringing routine

Now you can choose between two routines for deringing:

The "old" routine can be used as formerly. Parameters have not changed. Note that this routine is a post-processor, after the sharpening, but prior to XSharpening.

The new routine uses another way to create the deringing mask (utilizes XSharpen to find areas-of-interest). The current processing method for the found areas is very sophisticated: "Downsize(softbicubic).Upsize(verysoftbicubic)".

It acts as a pre-processor, prior to the main sharpening steps, but already in the first supersampling stage.

To use the new deringing routine, assigning a negative value to the [i]dering parameter.

The parameters dering_floor and dering_bias behave differently with this routine. It's a bit difficult to describe ...
dering_floor is sort of a sensitivity against edges: the bigger this parameter, the more areas around weaker edges will be considered.
dering_bias can be seen as some sort of multiplier, or normalizer ... how to tell? (Internally, it's the "divisor" parameter for MaskTool's "DEdgeMask" function.) The smaller dering_bias, the brighter the mask will get, and the more areas found by dering_floor will be kept. The bigger dering_bias, the more weaker areas will get cancelled from the mask again, and the darker the dering-mask will become.

To get a feeling for this, please play a little with these two parameters & the new routine, while having set debug="showall". A good starting point is floor=8, bias=12. It seems to me that bias should mostly be in the range bias = [floor, floor*2] - but who knows what different sources may require. This one is new to me, too ;)

dering = -200 ~ -1 tells how strongly the affected areas will be blurred through the bicubic resizers. Recommended range is from "-160" for strong processing to "-20" for weak processing.
Attention: If you use a too big number here, you'll get artefacts near edges! Try "dering = -350" to see what I mean. You should not exceed -160, perhaps evev -200. Look out when artefacting starts to appear. "dering = -120" gives already pretty strong processing.

The dering_weight parameter is not used with the new deringing routine.


exborder

This is a switch to exclude the outmost border from sharpening.

It is not uncommon, even for otherwise HiQ DVD sources, to have artefacts in the border areas. You now these bright and/or dark lines that often appear near the top/bottom letterboxing, and on the frame's sides as well.
But, not everyone is willing to crop these additional 2 ~ 8 pixels from the sides, to get rid of that crap. Now, if you're cropping so tight that source's border artefacts are kept, then at least they shouldn't be sharpened ;)
Set [i]exborder=true to do so. The used masking draws a "sinus sweep" (sort of) from 100% exclusion to ~15% exclusion, over the outmost 8 pixels on all sides of the frame.
There is nothing to configure. Tell me if you want something.


[b]detail_floor [int]

This is part of the controlling how weak a detail is still considered to be "detail", in order to be copied to the output frame from the sharpened clip. Remember: areas considered to be "no-detail" are copied from the PixieDust'ed, not-sharpened clip.
Look at the "Detail Mask" in debug mode to get a feeling for it. Former versions had this parameter hardcoded to "23". New default is "20". Negative values are possible, in case you consider them needed.

ccfilms
19th May 2005, 04:41
OK. I need to read through this three 100% entirely tommorrow. I just saw the screens on page 10 and I was like WOW. I wondering how this'll work with my DV footage. :D (is insanely curious and probably won't be able sleep all night thinking of the possibilities).

3ngel
19th May 2005, 06:45
@Didee
Ok, now it's a bit better :)
But i don't understand, what is the use of dest_x, dest_y? The resolution isn't alway the same of source? That is, having a 720*576 video, what is the diff between iip() and for example iip(dest_x=640, dest_y=480) ?

Soulhunter
19th May 2005, 07:38
Originally posted by 3ngel

Ok, now it's a bit better :)
But i don't understand, what is the use of dest_x, dest_y? The resolution isn't alway the same of source? That is, having a 720*576 video, what is the diff between iip() and for example iip(dest_x=640, dest_y=480) ?

- iip() outputs the video in the same resolution you feed it

- iip(dest_x=640, dest_y=480) resizes the video to 640x480


Bye

3ngel
19th May 2005, 08:10
Oh, on right. I didn't think iip was a "resizer" too. Ok :)

Soulhunter
19th May 2005, 08:39
Originally posted by 3ngel

Oh, on right. I didn't think iip was a "resizer" too. Ok :)

As IIP resizes the source anyway for the internal super-sampling (upsizing -> sharpening -> downsizing), the "dest" params save you a additional (unnecessary) processing step if you wanna resize the video... :)


Bye

ccfilms
19th May 2005, 15:54
Now, I'm quite a n00b to avisynth (though, im learning it quite fast and loving it).

iip just keep crashing on me. I load it up and all the plugins and it just goes boop and shuts down WMP-Classic.

Here's my script

is there a way that i can use like a de-bug thing or whatever to find what line in the code is making it crash?

I'm too lazy to figure out some iip settings myself (yet, but i will! Cuz I'm obsessed with tweaking!) so i just copied a script i found on here in this thread:

Import("C:\Program Files\GordianKnot\AviSynthPlugins\iip.avs")
LoadPlugin("C:\Program Files\DGIndex\DGDecode.dll")
LoadPlugin("C:\Program Files\GordianKnot\AviSynthPlugins\UnDot.dll")
LoadPlugin("C:\Program Files\GordianKnot\AviSynthPlugins\MaskTools.dll")
LoadPlugin("C:\Program Files\GordianKnot\AviSynthPlugins\LoadPluginEx.dll")
LoadPlugin("C:\Program Files\GordianKnot\AviSynthPlugins\warpsharp.dll")
LoadPlugin("C:\Program Files\GordianKnot\AviSynthPlugins\asharp.dll")
LoadPlugin("C:\Program Files\GordianKnot\AviSynthPlugins\DustV5.dll")

Directshowsource("C:\Documents and Settings\Jeremy\My Documents\My Videos\Sinking Ships\Originals\Scene 1 - Running Mono\Walking Forward 2.avi")


iip( dest_x= 672, dest_y= 400,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1= 104, detailcontr2 = 208, contr_radius = 2, PixSharp=0.38,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.58, flatweight = 0,
\ protect_floor = 0, protect_bias = 16,
\ dering = -80, dering_weight= 1.0, dering_floor = 8, dering_bias=12,
\ detail_floor = 10, EQ = 2,
\ warp_Y = false, warp_UV = false, exborder = true,
\ debug= "protect | dering | compareH|V | showall",
\ cropx=0, cropy=0
\ )

What tis it doing wrong?

JnZ
19th May 2005, 21:30
Originally posted by ccfilms
iip just keep crashing on me. I load it up and all the plugins and it just goes boop and shuts down WMP-Classic.
What tis it doing wrong?
Do you have Msvcp71.dll and msvcr71.dll in your system32 folder? This can crash.

3ngel
19th May 2005, 21:43
In this sense, what are the .dll needed to run the script? They got lost in the thread :)

ccfilms
19th May 2005, 21:46
Yes and yes. I have those both in there.




Here's settings i tried.

It just shuts off. like it wont even open in vdub, media player, nothin:

SetMemoryMax(192)

Import("C:\Program Files\iiP\iip.avs")
LoadPlugin("C:\Program Files\DGIndex\DGDecode.dll")
LoadPlugin("C:\Program Files\iiP\UnDot.dll")
LoadPlugin("C:\Program Files\iiP\MaskTools.dll")
LoadPlugin("C:\Program Files\iiP\warpsharp.dll")
LoadPlugin("C:\Program Files\iiP\asharp.dll")
LoadPlugin("C:\Program Files\iiP\aWarpSharp.dll")
LoadPlugin("C:\Program Files\iiP\LoadPluginEx.dll")
LoadPlugin("C:\Program Files\iiP\DustV5.dll")


mpeg2source("C:\armedconflict.d2v")

iip( dest_x= 1024, dest_y= 576,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 0, dustweight = 0, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.25,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = false, warp_UV = false,
\ debug= "showall | compareH/V | protect | dering",
\ cropx=32, cropy=16
\ )

Didée
20th May 2005, 12:12
ccfilms -

The script also uses Unfilter.dll (although not when using the default deringing mode). Better import it, too.
BTW, aSharp.dll is not used by iiP.

What version of MaskTools you're using? v1.4.6 and v1.4.9 should work out-of-the-box together with iiP. When using more recent versions of MaskTools, all instances of ",useMMX=true" must be deleted manually from the script.


Oh well. I'm getting closer to the statement

:rolleyes: "no more support when you are using an AviSynth version that vanishes instead of showing error messages" :rolleyes:

Read: Use the official 2.55 of AviSynth, or 2.56 alpha from 19dec2004 or 06jan2005 -- life gets much easier then, in regard to bug hunting.

What AviSynth version *are* you using?

ccfilms
20th May 2005, 15:36
Sorry, yeah, I was using the latest beta. I shall install the version you suggest. :D And do the things you suggest. Thanks.




Yup. your totally right. Thanks man. :) I got it working.



Directshowsource("C:\Documents and Settings\Jeremy\My Documents\My Videos\Sinking

Ships\Originals\Scene 4 - Kitchen\Jim - Walking up to counter 3.avi")
ConvertToYUY2(interlaced=true)
BlindPP(cpu2="ooxxox")
LeakKernelBob(0,10,false,true)
#dgbob(0,8,)
TomsMoComp(0,-1,0)
convert60ito24p(1,0)
ConvertToYV12(interlaced=false)

iip( dest_x= 848, dest_y= 480,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 0, dustweight = 0, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.25,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = false, warp_UV = false,
\ debug= "showall | compareH/V | protect | dering",
\ cropx=32, cropy=16
\ )

That's my script...converting 60i to 24p and then running the iiP. It's about 0.25fps though. :( I'm upgradeing from my P$ 1.8Ghz, 512MB PC133 up to an AMD Athlon 64 3200+ Venice (overclockable to huge amounts) and 1GB PC3200 RAM! :D woohoo!!!!




~~~~~~~~~~~~~~~~~~~~~~~~~~~


Now, I ran this one script last night, it seemed to produce some nicer results than the iiP actually and it was about 0.5fps on my system...

it converts to 24p, then it runs pixiedust. Then i pump it up to twice the res i want my final to be, I sharpen twice over with limited sharpen, then I lower teh res back to my final and I run limited sharpen one more time and this is what I got:

http://www.ccfilms.com/sharp.jpg


Just something to consider. :P



I'd like though to take some time and tweak the iiP....cuz it's got alot it can do. :)

Tuesday
10th June 2005, 14:58
hey, i'm having trouble with iip:

I keep getting this error message when opening the avs with vdub:


"Avisynth open failure:
Script error: there is no function named "c"
(...\iip.avs, 117 line)
(...\movie.avs, line 13)"

I'm using:

Vdub v1.5.10
masktools 1.4.9
avisynth 2.55

any help? i can find the variable "c" in the line it's reffering to but i don't understand how its used in the script so i can't do much about this error :(

malkion
10th June 2005, 22:38
the error is caused by the original copy and paste of the script.

find the first line that says

dusted = clp.addborders(0,0,xcorr,ycorr).converttoyuy2()
.PixieDust(limit=duststr). converttoyv12().c rop(0,0,-xcorr,-ycorr)

you notice the c rop, make it look like crop and you'll be ok.

also for the latest masktools. you'll have to remove ,usemmx=true, since masktools does not use the optimization in the call anymore.

Didée
11th June 2005, 01:50
Oh my Lord, heaven help!

We now do have the new vBulletin software version!

I mean ... that one that destroys all posted scripts by injecting spaces everywhere, if the written code contains character sequences long enough without spaces.

I consider this a serious malfunction in the handling of <code> content.

edit: fixed. Swede removed the forced <space> insertion within <code> tags. Thanks a lot!

Pookie
12th June 2005, 03:28
Didee! Just another "Thank You" for IIP and LimitedSharpen . I use LimitedSharpen all the time, and IIP when I can spare the time.

Didée
12th June 2005, 15:28
Fine :)

(I hope you don't do such kind of image _destruction_ like ccfilms has shown above) ;)

Teegedeck
9th July 2005, 19:59
How nice, I feel like a newbie again! Up till this moment I have spent about 12 hours trying to get the script to work and now feel very inclined to beg you to make a plugin from it. :)

When I try to load the script, the application crashes silently.

I have put the plugins into my plugins-directory:
DustV5.dll
LoadPluginEx.dll
MaskTools.dll [I've tried 1.4.16 as well as older versions]
UnDot.dll
warpsharp.dll [tried the one from the warpsharp package as well as the yv12 version]

This is my script, just kept the defaults for first experimenting:
LoadPlugin("D:\DGMPGDec\DGDecode.dll")
import("D:\AviSynth 2.5\plugins\deaktiviert\iip.avs")
mpeg2source("D:\DVD\IFO\B_II\VIDEO_TS\b.d2v")
MemoryMax(192)
iip( dest_x= 720, dest_y= 576,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1= 104, detailcontr2 = 208, contr_radius = 2, PixSharp=0.38,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.58, flatweight = 0,
\ protect_floor = 0, protect_bias = 16,
\ dering = -80, dering_weight= 1.0, dering_floor = 8, dering_bias=12,
\ detail_floor = 10, EQ = 2,
\ warp_Y = false, warp_UV = false, exborder = false,
\ debug= "protect | dering | compareH|V | showall",
\ cropx=64, cropy=32
\ )
Anything obvious that I've overlooked? This kind of thing really is beyond my grasp.

Soulhunter
9th July 2005, 20:26
@ Teegedeck

Hmm, here it works... :\

But I placed some plugins in separate folders n' load them manually !!!


# ZIP with plugins -> http://rapidshare.de/files/2928289/Plugins.zip.html

LoadPlugin("C:\Programme\DGDecode\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\Dust\LoadPluginEx2.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\Masktools.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\Undot.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\WarpSharp\WarpSharp.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\Dust\DustV5.dll")

mpeg2source("C:\Tests\Gladiator\Ch13.d2v")

iip( dest_x= 720, dest_y= 576,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1= 104, detailcontr2 = 208, contr_radius = 2, PixSharp=0.38,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.58, flatweight = 0,
\ protect_floor = 0, protect_bias = 16,
\ dering = -80, dering_weight= 1.0, dering_floor = 8, dering_bias=12,
\ detail_floor = 10, EQ = 2,
\ warp_Y = false, warp_UV = false, exborder = false,
\ debug= "protect | dering | compareH|V | showall",
\ cropx=64, cropy=32
\ )
Bye

Didée
9th July 2005, 23:24
OMG, a n00b! :D

12 hours of trying is brave work, Teegedeck, very brave. The first test encodings could already have finished ...

The problem surely is plugin autoloading. See this post (http://forum.doom9.org/showthread.php?p=597874#post597874) about the problems, and solutions.

Then, this comprehensive parameter overview (http://forum.doom9.org/showpost.php?p=656699&postcount=234) makes a good print-out before going to tweak parameters. ;)

BTW, the defaults very likely are too strong for your taste ...

Teegedeck
10th July 2005, 09:10
Thanks for the replies! Aha! Now we're getting somewhere... After downgrading AviSynth, media player classic doesn't exit silently anymore but AviSynth throws errors: First I got an error that maskedmerge doesn't have a 'use mmx' argument'. After deleting that from the iiP.avs, it came out that I needed trbarry's 'unfilter'-plugin. Now, that got completely past me. Only now I found that it has been mentioned in this thread.

So, problem solved, but I never would have gathered that I needed unfilter from just looking at the script - perhaps you could add it to the 'loadplugin...' list.

Thanks, Didée! I'm looking forward to playing with the parameters now.

molecool
11th July 2005, 02:02
Thanks for the replies! Aha! Now we're getting somewhere... After downgrading AviSynth, media player classic doesn't exit silently anymore but AviSynth throws errors: First I got an error that maskedmerge doesn't have a 'use mmx' argument'. After deleting that from the iiP.avs, it came out that I needed trbarry's 'unfilter'-plugin. Now, that got completely past me. Only now I found that it has been mentioned in this thread.

I was pointed to iip and limitedsharpen by the 3dtv alias and last weekend I finally tried it. Fortunately I read the entire thread and was able to resolve one problem after the other. Updating AviSynth, finding all those plugins, putting them into my plugins directory, putting them out again and loading them manually, removing those mmx arguments (it's the default setting in MaskTools now) - you guys know the drill. It takes some determination to make those scripts work and they are not for the faint of heart ;-)

BUT, the results are absolutely mind boggling and worth every hour of pain - I do a lot of anaglyphic encoding and having super sharp and crisp clips really increases the impact somehow. LimitedSharpen has now completely replaced all my sharpen calls in my AviSynth scripts - resulting in sharp but non-grainy clips - I simply couldn't believe my eyes.... Didée is a freakin' genius. I do have a programming background, but looking at both of his scripts I must say: RESPECT!!

Thanks for doing this, Didée - looking at the dates of the postings these scripts have gone through months of revisions. The potential to take regular DV content and size it up to HD dimensions witout major penalties is a huge step forward. Digital projection is rapidly gaining a foothold and 2k projectors are getting more and more affordable. Small indie filmmakers like me need every possible advantage to produce great looking work and this is more than I had hoped for. I even dare to say that, given enough processing power, IIP could compete head-to-head with IMAX' Digital Remastering - I might actually consult you (Didée) in the future about doing something like that.

Thanks a million for all the hard work, Didée :thanks:

NoodleMaps
21st August 2005, 19:46
First off, I am loving the results of the images I am getting from this script. But as a newbie should, I am having some problems. Why? Becuase I don't know what I'm doing. I have captured VHS into Premiere Pro via a Canopus ADVC300. I basicaaly turned off all of it's noise reducion, because it made the images look to muddy, that's when I found this thread and began to fiddle with the script and tried to learn what I could, since Friday. My original files are in the MicrosoftDV codec and my knowledge on avisynth are extremly limited. But I'm learning that the search option is my friend. Anyway, here is the script that I am using. On my 14inch stuido monitor I have setup here, the video looks great when it is played out. But when I play the same DVD that I made, on my 32in TV The image once again looks muddy. The 32 is a Sony Trinitron and I am playing the DVD through an Xbox hooked up via the Component connections.


SetMemoryMax(512)


LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mpeg2dec3.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Unfilter\UnFilter_Avisynth_2.5_Alpha\unfilter.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Undot\undot.dll")
LoadPlugin("C:\otheravisysth Plugins\Masktools\masktools.dll")
LoadPlugin("C:\otheravisysth Plugins\warpsharp\warpsharp.dll")
LoadPlugin("C:\otheravisysth Plugins\LoadPluginEx.dll")
LoadPlugin("C:\otheravisysth Plugins\aWarpSharp.dll")
LoadPlugin("C:\otheravisysth Plugins\dust\dustv5.dll")

Import("I:\iip script\iip.avs")
#-----------------------------------------------------------------
avisource("I:\Justanother Test\Just Another.avi")
ConvertToYUY2(interlaced=true)

iip( dest_x = 720, dest_y = 480,
\ duststr = 4, dustweight = 1.0,
\ ss1_x = 1.33, ss1_y = 1.66,
\ detailcontr1 = 127, detailcontr2 = 208,
\ contr_radius = 3, PixSharp = 0.3,
\ ss2_x = 2.5, ss2_y = 3.5,
\ Xstren = 208, Xlimit = 255,
\ subpelstren = 0.0, flatweight = 0,
\ antiflicker1 = true, antiflicker2 = true,
\ protect_floor= 0, protect_bias = 12,
\ dering = -100, dering_weight= 1.0,
\ dering_floor = 8, dering_bias = 12,
\ detail_floor = 24,
\ EQ = 2, exborder = false,
\ warp_Y = true, warp_UV = true,
\ debug="dering | protect | detail | compareH | compareV | compareT | showall",
\ cropx = 40, cropy = 20
\ )


return( last )

here are 2 stills to show a before and after

http://home.comcast.net/~jmohney4/images/oingoiip.jpg

Suggestions welcomed

Thanks

jptheripper
22nd August 2005, 01:09
i have been trying to get iip to work for a long time now. right now i get s syntax error on the import iip.avs command, line 1 column 1 it says (which is a # !!!!!!)

any ideas?

Didée
22nd August 2005, 08:12
@ jptherripper
Probably a problem with unicode charset when copy/pasting the script from your browser window. Mentioned e.g. here (http://forum.doom9.org/showthread.php?p=651138#post651138). Re-save the script once more, with the text editor using plain Windows (ANSI) charset.


@ NoodleMaps
I'm not used to work with VHS captures (did that only 2 times at all, iirc), so I've very little experience with that. Generally, the results from VHS sources will be less impressing, since VHS simply does not deliver *that* much of detail, but need more filtering (smoothing) for stabilization.

But one important thing: If your source actually is interlaced (it probably is), then you must, at least, put the iiP call inbetween separatefields() ... weave(). Even better, but also much slower would be to first do a smartbob, then iiP, then re-weave again to an interlaced stream. (For the latter, the forum search is your friend ... if interlacing is concerned, I'm more than likely to produce nonsense when pulling something quickly out of the sleeve ;) )

dvwannab
31st August 2005, 18:15
But one important thing: If your source actually is interlaced (it probably is), then you must, at least, put the iiP call inbetween separatefields() ... weave(). Even better, but also much slower would be to first do a smartbob, then iiP, then re-weave again to an interlaced stream. (For the latter, the forum search is your friend ... if interlacing is concerned, I'm more than likely to produce nonsense when pulling something quickly out of the sleeve ;) )

Didee,

For interlaced clip, would the script look like this:

mpeg2source("F:\TVcap.d2v")

AssumeTFF()

TMCBob()

# function TMCbob(clip c)
{ ord = getparity(c) ? 1 : 0
c = c.SeparateFields.TomsMoComp(1,-1,0)
c = stackvertical(c.crop(0,0,0,1-c.height),c,c.crop(0,c.height-1,0,0))
evn = c.SelectEven
odd = c.SelectOdd
evn = (ord == 0) ? evn : evn.crop(0,1,0,0).addborders(0,0,0,1)
odd = (ord == 1) ? odd : odd.crop(0,1,0,0).addborders(0,0,0,1)
interleave(evn,odd).crop(0,0,0,-2).assumeframebased()
}

iip( dest_x= 704, dest_y= 480,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1= 127, detailcontr2 = 208, contr_radius = 2, PixSharp=0.3,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 0.58, flatweight = 0,
\ protect_floor = 0, protect_bias = 12,
\ dering = -100, dering_weight= 1.0, dering_floor = 8, dering_bias=12,
\ detail_floor = 10, EQ = 2,
\ warp_Y = false, warp_UV = false, exborder = true,
\ debug= "protect | dering | compareH|V | showall",
\ cropx=0, cropy=0
\ )
AssumeTFF()
SeparateFields()
SelectEvery(4,0,3)
Weave()

With IIP should the dest_y be doubled to 960 vice 480? A bit confused here. Thanks for help.

Red Raven
9th September 2005, 23:02
Can someone give me a link to IIP download? :)

Cheers

Taurus
10th September 2005, 09:44
Can someone give me a link to IIP download? :)

Cheers

I don't know, maybe you're blind?
On the very first page of this thread there is a link to page six IIP (http://forum.doom9.org/showthread.php?s=&postid=517100#post517100)
Just copy and paste all the stuff into a *.txt file and rename it's extension to IIP.avs.

Cheers

Taurus

dvwannab
14th September 2005, 19:34
double post

hannah
3rd October 2005, 00:07
When I change either warp_Y=true or warp_UV= true, I get an "no function named awarpsharp" error in the code (pic attached).

Am I missing any plugin here? Please see attached my list of plugins.

Many thanks in advance
______________________________

My .avs script:

SetMemoryMax(256)


Loadplugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\LeakKernelDeint.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools-p4-5.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins1\warpsharp.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\LoadPluginEx.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\UnDot.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\dustv5.dll")

Import("C:\Program Files\AviSynth 2.5\plugins\iip.avs")

MPEG2Source("C:\Documents and Settings\kmajumde\Desktop\Black\Black.d2v")
LeakKernelDeint(Order=1,threshold=5)
CROP(8,52,-8,-52,true)
ColorMatrix()
iip( dest_x= 1024, dest_y= 576,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.4,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = false, warp_UV = false,
\ debug= "showall | compareH/V | protect | dering",
\ cropx=32, cropy=16
\ )
_________________________________________________


IIP.avs which is in my plugins dir:
# iip : Integrated Image Processor, v.0.5a
#
#
# ---------------
# | It is slow. |
# ---------------
#
# New in v.0.5 :
#
# EQ [int] : Edge quality. 0=deaktivated (don't do that!!!), 1=standard (as formerly), 2=better'n'slower, 3=evenbetter'n'evenslower
# Note: when using EQ = 2|3, then it's a good idea to *DEACTIVATE* deringing in iiP (don't hit the dog twice).
#
# warp_Y, warp_UV [bool] additional Luma & Chroma Warping.
#
# Luma warping should make the picture more 'gracile' when upsizing to bigger resolution, e.g. DVD -> HDTV.
# For same resolution or downsizing, it may (?) help for sources with distorted detail. Or it may not - YMMV.
#
# Chroma warping helps on sources with bleeding colors (e.g. Enterprise: on the uniforms, the red stripes are bleeding into
# the blue cloth, which looks *very* ugly [like an aquarell that's gotten wet]. It looks much better with chroma warping.)
# On clean sources, chroma warping is a waste of CPU cycles.
#
# exborder [bool] : exclude outmost 8-pixel-border from sharpening (gradient masked)
#
# dering: old method: called with positive values for "dering"
# new method: called with negative values for "dering" (better, but slower)
#
# detail_floor [int] : was formerly hardcoded, now user-definable. default 20.
#

function Ylevels(clip clp, int a, float gamma, int b, int c, int d)
{ wicked="x "+string(a)+" - "+string(b)+" "+string(a)+" - / 1 "+string(gamma)+" / ^ "+string(d)+" "+string(c)+" - * "+string(c)+" +"
# Reminder: Yexpr = "x a - b a - / 1 gamma / ^ d c - * c +"
# return( clp.subtitle(wicked) )
return( clp.YV12LUT(Yexpr = wicked) )
}

function FineEdge( clip clp, int "div" )
{
logic( clp.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5", setdivisor=true, divisor=div)
\ ,clp.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5", setdivisor=true, divisor=div), "max", Y=3,U=1,V=1 )
}

function iip( clip clp,
\ int "dest_x", int "dest_y",
\ int "duststr", float "dustweight",
\ float "ss1_x", float "ss1_y",
\ int "detailcontr1", int "detailcontr2",
\ int "contr_radius", float "PixSharp",
\ float "ss2_x", float "ss2_y",
\ int "Xstren", int "Xlimit",
\ float "subpelstren", int "flatweight",
\ bool "antiflicker1", bool "antiflicker2",
\ int "protect_floor",int "protect_bias",
\ int "dering", float "dering_weight",
\ int "dering_floor", float "dering_bias",
\ int "detail_floor",
\ int "EQ", bool "exborder",
\ bool "warp_Y", bool "warp_UV",
\ string "debug",
\ int "cropx", int "cropy"
\ )
{
ox = clp.width
oy = clp.height
xcorr=(int(ox/16.0+.9999)*16)-ox
ycorr=(int(oy/ 8.0+.9999)* 8)-oy
dest_x = default(dest_x, clp.width)
dest_y = default(dest_y, clp.height)
ss1_x = default(ss1_x, 1.414)
ss1_y = default(ss1_y, 1.414)
ss2_x = default(ss2_x, 3.5)
ss2_y = default(ss2_y, 3.5)
duststr = default(duststr, 2)
dustweight = default(dustweight, 1.0)
antiflicker1= default(antiflicker1, true)
antiflicker2= default(antiflicker2, true)
Xlimit = default(Xlimit, 255) # SS<3 ? 23 : 255
Xstren = default(Xstren, 255) # SS<3 ? 216 : 255
detailcontr1= default(detailcontr1, 104)
detailcontr2= default(detailcontr2, 208)
contr_radius= default(contr_radius, 2)
PixSharp = default(PixSharp, 0.4)
subpelstren = default(subpelstren, 1.58)
flatweight = default(flatweight, 0)
protect_floor=default(protect_floor, 0)
protect_bias= default(protect_bias, 16)
dering = default(dering, -80)
dering_floor= default(dering_floor, 8)
dering_floor= dering<0 ? dering_floor*2 : dering_floor
dering_bias = default(dering_bias, 16)
dering_weight=default(dering_weight, 1.0)
detail_floor= default(detail_floor, 20)
EQ = default(EQ, 2)
EQ = (EQ>3) ? 3 : EQ
exborder = default(exborder, false)
warp_Y = default(warp_Y, false)
warp_UV = default(warp_UV, false)
debug = default(debug, "Mickey Mouse")
cropx = default(cropx, 40)
cropy = default(cropy, 20)

cropx=int(cropx/4)*4
cropy=int(cropy/4)*4
xx_ss1 = int(ox*ss1_x/16+.5)*16
yy_ss1 = int(oy*ss1_y/16+.5)*16
xx_ss2 = int(ox*ss2_x/16+.5)*16
yy_ss2 = int(oy*ss2_y/16+.5)*16
xx_small = int(ox/(abs(dering)/80+1.0)/16+.5)*16 + 32
yy_small = int(oy/(abs(dering)/80+1.0)/16+.5)*16 + 16

# Now I have the other idea - but it's too slow, yet
clp = antiflicker1 == true ? clp.temporalsoften(2,2,3,23,2) : clp

#---------------------------------------------------------------------------------------------------------------------
# Base denoising by PixieDust
#
dusted = clp.addborders(0,0,xcorr,ycorr).converttoyuy2().PixieDust(limit=duststr).converttoyv12().crop(0,0,-xcorr,-ycorr)
dusted = (dustweight==0.0) ? clp
\ : ( dustweight<1.00 ? Overlay(clp, dusted, opacity=dustweight)
\ : dusted )

soft=dusted.bicubicresize(xx_small,yy_small,.2,.4).bicubicresize(xx_ss1,yy_ss1,1.0,.0)

#---------------------------------------------------------------------------------------------------------------------
# Build EdgeMask to protect already sharp detail from oversharpening
#
YV12subtract( dusted.sharpen(0.6).sharpen(0.6), dusted.blur(1.0).blur(1.0) )

edge00 = bicubicResize(xx_ss1,yy_ss1,-1.0,1.0)
edge0=edge00
\ .YV12LUT(Yexpr="x 128 - abs "+string(protect_floor)+" - "+string(protect_bias)+" *")
\ .deflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1).blur(1.58)
edge00 = edge00.yv12lut(yexpr="x 128 - 2 *").expand(Y=3,U=1,V=1).blur(1.58)

#---------------------------------------------------------------------------------------------------------------------
# Build DeRing'ing Mask: +++ OLD ROUTINE +++
#
dering > 0 ? expand(Y=3,U=1,V=1) : NOP
edge1b = dering > 0
\ ? yv12subtract( expand(Y=3,U=1,V=1).blur(1.58),
\ inpand(Y=3,U=1,V=1),tol=1,wideRange=true )
\ .bicubicResize(xx_ss1,yy_ss1,-1.0,1.0)
\ .yv12LUT(Yexpr="x 128 - abs "+string(dering_floor)+" - "+string(dering_bias)+" *")
\ .deflate(Y=3,U=1,V=1).blur(1.58)
\ : last
# .Ylevels(0,3.0,255,0,255)
#---------------------------------------------------------------------------------------------------------------------
# 1st supersampling stage to perform sharpening at
#

(ss1_x > 1.0 || ss1_y > 1.0) ? dusted.Lanczosresize(xx_ss1,yy_ss1)
\ : dusted

#---------------------------------------------------------------------------------------------------------------------
# Build DeRing'ing Mask & perform dering'ing: +++ NEW ROUTINE (Pre-processor) +++
#
tmpp = string(dering_floor)
edge1b = dering < 0
\ ? yv12subtract( last, last.xsharpen(255,255),tol=1,wideRange=true )
\ .yv12lut(yexpr="x 128 - abs "+tmpp+" *")
\ .expand().inflate().expand().inflate().FineEdge(dering_bias).blur(1.58)
\ .greyscale.Ylevels(19,1.6,208,0,255)
\ : edge1b
dering < 0 ? maskedmerge( last, soft, edge1b, Y=3,U=1,V=1 ) : NOP

#-------- iterative sharpening, currently only 3-fold: its slow enough ... --------

temp = last
shrpcnt = 0
mskcnt = 0
shrpcnt = (PixSharp != 0) ? shrpcnt + 1 : shrpcnt
shrpcnt = (detailcontr2 != 0) ? shrpcnt + 1 : shrpcnt
shrpcnt = (detailcontr1 != 0) ? shrpcnt + 1 : shrpcnt
mskcnt = (EQ>shrpcnt) ? shrpcnt : EQ

# Stage 1 : UnsharpMasking, wide radius -----------------------
detailcontr1 != 0
\ ? unsharpmask(detailcontr1,contr_radius,0)
\ : NOP
detailcontr1 != 0 && (shrpcnt==1 || mskcnt>1 && shrpcnt>=mskcnt) && (EQ>0)
\ ? MaskedMerge(last,temp,edge0.expand.inflate.inflate, Y=3,U=1,V=1)
\ : NOP
mskcnt = (detailcontr1 != 0 && (shrpcnt==1 || mskcnt>1 && shrpcnt>=mskcnt))
\ ? mskcnt - 1
\ : mskcnt
shrpcnt = detailcontr1 != 0 ? shrpcnt - 1 : shrpcnt

# Stage 2 : UnsharpMasking, small radius ----------------------
detailcontr2 != 0
\ ? unsharpmask(detailcontr2, 1,0)
\ : NOP
detailcontr2 != 0 && (shrpcnt==1 || mskcnt>1&&shrpcnt>=mskcnt) && (EQ>0)
\ ? MaskedMerge(last,temp,edge0.inflate.inflate,Y=3,U=1,V=1)
\ : NOP
mskcnt = (detailcontr2 != 0 && (shrpcnt==1 || mskcnt>1&&shrpcnt>=mskcnt))
\ ? mskcnt - 1
\ : mskcnt
shrpcnt = detailcontr2 != 0 ? shrpcnt - 1 : shrpcnt

# Stage 3 : per-pixel sharpening ------------------------------
PixSharp != 0.0
\ ? sharpen( PixSharp )
\ : NOP
PixSharp != 0.0 && shrpcnt > 0 && EQ>0
\ ? MaskedMerge(last,temp,edge0, Y=3,U=1,V=1)
\ : NOP
undot()

#---------------------------------------------------------------------------------------------------------------------
# DeRing'ing of sharpen'ed clip: +++ OLD ROUTINE (Post-processor) +++
#
dering > 0 ? MaskedMerge(last,last.unfilter(-dering,-dering),edge1b.bicubicresize(xx_ss1,yy_ss1),Y=3,U=1,V=1)
\ : NOP

# Now I have the other idea - but it's too slow, yet
antiflicker2 == true ? temporalsoften(1,2,3,23,2) : NOP

#---------------------------------------------------------------------------------------------------------------------
# 2nd supersampling stage to perform SubPel operation & XSharpening at
#
# Notes: Luma Warping - may help for sources that are hard to get a "clean" picure from.
# - Should help making the picture a little more "gracile" when doing DVD -> HDTV upsizing

xx_ss2 != ox || yy_ss2 != oy ? LanczosResize(xx_ss2,yy_ss2) : NOP

subpelstren != 0.0 ? blur(subpelstren) : NOP

warp_Y ? awarpsharp(depth=(ss2_x+ss2_y)/2*3,thresh=0.5,blurlevel=2,cm=0) : NOP

Xstren != 0 && Xlimit !=0 ? xsharpen(Xstren,Xlimit) : NOP

LanczosResize(dest_x,dest_y).undot()

#---------------------------------------------------------------------------------------------------------------------
# Build new EdgeMask of the enhanced clip
#
edge2 = bicubicresize(int(dest_x/1.75/16+.5)*16,int(dest_y/1.75/16+.5)*16,1.0,.0)
\ .DEdgeMask(0,255,0,255,"-5 -7 -5 -7 48 -7 -5 -7 -5",Y=3,U=1,V=1,setdivisor=true,divisor=1)
bordermask = blankclip(edge2,width=dest_x-16,height=dest_y-16,color=$FFFFFF)
\ .addborders(2,2,2,2,color=$8F8F8F).addborders(2,2,2,2,color=$6F6F6F)
\ .addborders(2,2,2,2,color=$202020).addborders(2,2,2,2,color=$000000)
edge2 = edge2
\ .levels( (detail_floor+int(detailcontr1/15+detailcontr2/30+PixSharp*15)), 4.0,128,flatweight,255,false)
\ .bicubicResize(dest_x,dest_y,1.0,0)
edge2 = exborder ? edge2.logic(bordermask,"min") : edge2
edge2 = edge2
\ .inflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1)
\ .blur(1.58).greyscale()
\ .inflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1)
\ .temporalsoften(1,63,63,255,2)

#---------------------------------------------------------------------------------------------------------------------
# Put original de-noised & not-sharpened clip into areas still appearing flat, after all that sharpening
#
MaskedMerge(dusted.lanczosresize(dest_x,dest_y),last,edge2,Y=3,U=1,V=1)

#---------------------------------------------------------------------------------------------------------------------
# Chroma Warping - often useful for sources where colors are "bleeding". Superfluid for clean sources.
#
warp_UV ? MergeChroma( aWarpSharp(depth = 8.5 * (dest_x/ox + dest_y/oy), thresh=0.5, cm=1, blurlevel=2) ) : NOP

#---------------------------------------------------------------------------------------------------------------------
# Visualizations
#
debug == "dering" ? overlay(last,blankclip(last,color=$00A000),mask=edge1b.bicubicresize(dest_x,dest_y),mode="blend",opacity=dering_weight)
\ : NOP
debug == "protect" ? overlay(last,blankclip(last,color=$00A000),mask=edge0.bicubicresize(dest_x,dest_y),mode="blend",opacity=0.75)
\ : NOP
debug == "detail" ? overlay(last,blankclip(last,color=$00A000),mask=edge2.bicubicresize(dest_x,dest_y),mode="blend",opacity=0.75)
\ : NOP
debug == "compareH" ? stackhorizontal(clp.lanczosresize(dest_x,dest_y).crop(cropx,0,-cropx,-0).addborders(0,0,4,0,color=$800000).subtitle("Original"),
\ last.crop(cropx,0,-cropx,-0).subtitle("iiP") )
\ : NOP
debug == "compareV" ? stackvertical(clp.lanczosresize(dest_x,dest_y).crop(0,cropy,-0,-cropy).addborders(0,0,0,4,color=$800000).subtitle("Original"),
\ last .crop(0,cropy,-0,-cropy).subtitle("iiP") )
\ : NOP
debug == "showall" ? stackvertical( stackhorizontal( edge0 .greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,4,4,color=$800000).subtitle("Protection of sharp edges"),
\ edge1b.greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,0,4,color=$800000).subtitle("DeRing'ing") ),
\ stackhorizontal( edge2 .greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,4,0,color=$800000).subtitle("Detail areas"),
\ last .crop(cropx,cropy,-cropx,-cropy).subtitle("iiP") ) )
\ : NOP

return(last)
}

#
__________________________

Didée
3rd October 2005, 01:11
*cough* (http://www.avisynth.org/warpenterprises/#aWarpSharp)

mg262
3rd October 2005, 01:20
Also...in a standard set up plug-ins in your C:\Program Files\AviSynth 2.5\plugins\ directory will be loaded automatically, so you don't need to use this kind of thing:

Loadplugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")

... although it won't do any harm. The exception is this line:

Loadplugin("C:\Program Files\AviSynth 2.5\plugins\dustv5.dll")

Autoloading dust seems a little risky... I would personally move it into a different directory (for example C:\Program Files\AviSynth 2.5\plugins\old ) and update the above line (the one in italics) accordingly.

hannah
3rd October 2005, 03:40
thanks guys..loaded aWarpSharp.dll and that solved the problem. Hey Didée any possibility of making your IIP as .dll. Also is Integrated Image Processor, v.0.5a the final version?

Didée
3rd October 2005, 15:11
any possibility of making your IIP as .dll.
Nobody holds you back from doing it :)

Also is Integrated Image Processor, v.0.5a the final version?
Good question. There are several possibilities for speeding it up. But in the meantime, I'm following completely other approaches to achieve what iiP is aiming for.
If one time I get bored, iiP might get overhauled. But the chances for me getting bored are pretty low.

Backwoods
3rd October 2005, 21:30
I wonder why people want DLLs so bad.

mg262
3rd October 2005, 21:49
I would be very interested in the answer to that question. Cf this thread, especially the post linked to on autoloading scripts:
http://forum.doom9.org/showthread.php?p=697833#post697833

jptheripper
3rd October 2005, 22:20
as for the dlls, i for one have never got iip to work. I am a (i thought) competent computer user, have even programmed in c++, but no matter what i do i get avs errors.

dll's are basically idiot proof, or at least a download package with all the right versions of everything in one folder. b/c for the life of me.. and i have tried on at least 10 occassions

Pookie
4th October 2005, 04:20
iiP is tricky to set up. Here's the "secret":

LoadPluginEx.dll and Dustv5.dll MUST reside in a folder OTHER than your normal 2.5 AviSynth plugins location.

#-----------------------#
import("d:\plugins2.5\iip.avs")
LoadPlugin("d:\plugins2.5\masktools.dll")
LoadPlugin("d:\plugins2.5\warpsharp.dll")

#Now, load the 2.0 plugins from a different directory

LoadPlugin("g:\plugins2.0\LoadPluginEx.dll")
LoadPlugin("g:\plugins2.0\DustV5.dll")


# Notice the 2.0 plugins are the LAST to be loaded in the script #

#-----------------------#

hannah
4th October 2005, 11:43
iiP is tricky to set up. Here's the "secret":

LoadPluginEx.dll and Dustv5.dll MUST reside in a folder OTHER than your normal 2.5 AviSynth plugins location.

I suppose there is a truth behind the above statement however I can verify that my IIP.avs works fine with all plugins being in the same directory. Please check the screenshot of my plugins directory.

As far as workable IIP.avs and IIP call script goes..look at my first post. That's working for me.

jptheripper if you need a zip file of my .dlls in my plugins I am more than happy to send it to you so that you can get your IIP.avs working.

And Didee when I asked about a .dll version of IIP, basically I was hoping that this way it will be idiot proof. I am sure we all will agree that there is certain degree of tweaking required to get IIP.avs working.

aberforthsgoat
7th October 2005, 18:14
OK guys,

I've spent several hours reading up on this stuff, and I'm ready to take the plunge. I live in Switzerland, am a big fan of American football, have DVDs sent on a regular basis - and the DVD quality is generall *awful.* To keep size down, they use a screwy encoding (I think it's called CVD, rather than normal DVD), everything blurs when the players go faster than a trot, artifacts galore, mucho bad interlacing. I'm thinking that this iip stuff may help me get a little more out of the material.

My goal: rebuild the DVDs offline, getting as much clean up done as possible, deinterlacing and resizing to 1280X1024 (for my monitor) or at least XGA (for my projector).

Problem: I'm a complete newbie to this stuff. I can run ZP with FFDShow, but I don't have a clue about this AVISynth stuff. Zero. Nada. Nichts.

I spent a while reading up, I downloaded a bunch of stuff, installed AVISynth, put a bunch of plugins into the directory, copied in the combined iip-limited sharpen avs combo, I copied the standard script from this thread into DVD rebuilder and set her off. No go.

I'm getting an AVISynth error message: "Script error: there is no function named "iip." Then something about line 21.

This is hardly going to be my last hang-up, but perhaps someone can hold my hand a little here.

BTW, I also read something over on AVS about EDIUpsizer - it'd be fun to pole that in somewhere. But I've absolutely no idea how, of course.

Thanks for any help!

Mike

Pookie
7th October 2005, 20:11
Mike - I think you're using the wrong tool to fix your problem. IIP is like the icing on the cake. ;) If the cake tastes bad, the icing isn't going to help.
IIP is great when you have your favorite movie ripped to disk, and about 40 hours of re-encoding time on your hands.

Post a 10-20 second clip of your footage somewhere so people can make suggestions, or try FFT3DFilter to clean up your source.

aberforthsgoat
7th October 2005, 23:17
Mike - I think you're using the wrong tool to fix your problem. IIP is like the icing on the cake. ;) If the cake tastes bad, the icing isn't going to help.
IIP is great when you have your favorite movie ripped to disk, and about 40 hours of re-encoding time on your hands.

Post a 10-20 second clip of your footage somewhere so people can make suggestions, or try FFT3DFilter to clean up your source.

Hmm. The 40 hours part wouldn't be such a big problem - I wasn't expecting this to be easy. And the wait would be more than worth it if I could extract a good picture out of the material.

But of course, the question is (1) whether I can get anything good out of what I have and (2) what it will take to do that.

If I could just deinterlace properly and convert it to standard DVD encoding, I could at least run the stuff under ZP with Dscaler and FFDShow (with Lanczos and some other filters). Since Dscaler seems to be allergic to the VCD encoding, I can't even do that right now.

Anyway, I'll see about getting a clip put together tomorrow.

Thaks again for the hints!

Mike

DarkNite
8th October 2005, 19:56
@aberforthsgoat

We can't help you much without a script to look at, and other materials that may help us to help you properly. So keep that in mind when asking for help later.

If you get an error like "no function named" then you haven't properly imported the script, or plugin associated with that call.

One thing I've seen cause that is when someone has "hide known file extensions" enabled in their folder view settings which (besides being a generally evil default setting, almost as evil as the shell media handler) makes it hard to change a .txt file to .avs and the call fails when they link it to "script.avs" because it's actually "script.avs.txt".

That was a shot in the dark, but that's what we're left doing if we don't have anything to refer to.

aberforthsgoat
9th October 2005, 08:39
One thing I've seen cause that is when someone has "hide known file extensions" enabled in their folder view settings which (besides being a generally evil default setting, almost as evil as the shell media handler) makes it hard to change a .txt file to .avs and the call fails when they link it to "script.avs" because it's actually "script.avs.txt".

That was a shot in the dark, but that's what we're left doing if we don't have anything to refer to.

Thanks - and that was a smart guess - but doesn't seem to be it. However, I agree - I seem to be getting stuck on some very minor error. I can now run simple plugins with AVSSynth - even tried out the EDIUpsizer - and these work fine (though I can't figure out how to tell EDI what output size I want ... ) - but when I try to import the iip avs file, I always get an error. Here's the script I'm tying to use at the moment:

Import("C:\PROGRA~1\GORDIA~1\iip.avs")

LoadPlugin("C:\PROGRA~1\GORDIA~1\undot.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\MaskTools.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\WarpSharp.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\DGDecode.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\LoadPluginEx.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\dustv5.dll")

mpeg2source("D:\Football4\Chargers-Pats.d2v")

iip( dest_x= 1024, dest_y= 768,

ss1_x = 1.414, ss1_y = 1.414,

duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,

detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.4,

ss2_x = 3.5, ss2_y = 3.5,

Xstren = 255, Xlimit = 255,

subpelstren= 1.0, flatweight = 64,

protect_floor= 4, protect_bias = 16,

dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,

detail_floor= 1, EQ = 2,

warp_Y = true, warp_UV = false,

debug= "showall | compareH/V | protect | dering",

cropx=32, cropy=16

)



I've been trying it in DVD Rebuilder, in Gordian Knot, in Zoom Player, and now in AVSEdit - and it always says there's a syntax error in line 12 column 0. I take this to mean that it's not importing the iip script - but I can't imagine why not.

BTW, and yes - I've carefully copied all the material to the Gordian knot folder.

Thanks for any more tips!

Mike

Didée
9th October 2005, 14:29
Did you really not put any "\" line breakers, or were they somehow lost when posting?

iip( dest_x= 1024, dest_y= 768,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.4,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = true, warp_UV = false,
\ debug= "showall | compareH/V | protect | dering",
\ cropx=32, cropy=16
\ )

I admit that the descriptions about the necessarities for iiP are a little scattered, and for starters surely it's not the most easy function to get run.
But then, I won't make a general crash curse "how do use this Avisynth thingy at all?". Avisynth comes shipping with a manual, where Avisynth usage is thoroughly explained. However, it does not explain how to install an operating system or hardware drivers.

aberforthsgoat
9th October 2005, 15:54
Did you really not put any "\" line breakers, or were they somehow lost when posting?


Guilty as charged, your honor.

I admit that the descriptions about the necessarities for iiP are a little scattered, and for starters surely it's not the most easy function to get run.
But then, I won't make a general crash curse "how do use this Avisynth thingy at all?". Avisynth comes shipping with a manual, where Avisynth usage is thoroughly explained. However, it does not explain how to install an operating system or hardware drivers.

My apologies. I *had* made an attempt to RTFM, but perhaps not as, umm, serious an attempt as it should have been. Anyway, the problem is solved. And my knowledge of AVISynth grows apace.

Mike (who has now discovered that he has a mismatch between his version of DGDecode and the DGIndexing being done in his version of Gordian Knot, but is bound and determined to solve the problem by himself!)

aberforthsgoat
9th October 2005, 17:01
(who has now discovered that he has a mismatch between his version of DGDecode and the DGIndexing being done in his version of Gordian Knot, but is bound and determined to solve the problem by himself!)

And I did. I picked up a newer version of Gordian Knot, ironed out some more kinks - and IT WORKED!!!!

Mike (who should probably feeling much less elated and much more ashamed of himself.)

jbc23
14th October 2005, 12:16
iip is a GREAT script, kiss Didée to death if Didée were a girl, but iip is..........too...........slow.....

My computer is Pentium 4 cpu 3.3GB, 2GB RAM, I used iip script to encode a 130 mins DVD into 1.4GB XviD, 2 pass encoding, and it took 61 hours to finish ( first pass: 30 hours, 15 minutes; second pass: 30 hours, 45 minutes ), which means I had to turn on the computer for 2 and a half consecutive days, and meanwhile, I had no computer to use 'cause it's doing encoding job, although the result is wonderful, the encoding time is a bit too long, if the time needed for 2 pass encoding with iip could be shortened to within 10 hours, this script is simply extraordinary.

One bug to report is iip is compatible with DGindex 1.2.1, but not compatible with DGindex 1.4.3 (the latest version), I found this when I updated GordianKnot to the latest version (http://www.free-codecs.com/download/Gordian_Knot_Rip_Pack.htm), after I used DGindex to save a DVD project, if I opened the movie .d2v through iip script, GordianKnot said it could not found the movie .d2v, but I could open the movie .d2v directly (not through iip script), then I restored the DGindex to older version 1.2.1 to save a DVD project, then all worked fine, I could open the movie .d2v through iip script.

Didée
14th October 2005, 13:14
[while drying the kisses off my face] ;)


Welcome to the forum, jbc23.


iip is..........too...........slow..... It's not the fastest script around, agreed. It takes a while and some computing to make things look like iiP makes them look.
(Scribbling a draft is a matter of minutes, where a beautiful painting may take weeks or months.)


I used iip script to encode a 130 mins DVD into 1.4GB XviD, 2 pass encoding, and it took 61 hours to finish ( first pass: 30 hours, 15 minutes; second pass: 30 hours, 45 minutes )
...
if the time needed for 2 pass encoding with iip could be shortened to within 10 hours Well, you took the long road. Taking the short road won't cut the encoding time down to 10 hours ... but it will almost halven the time needed:

1st, load your script /w iiP and save that to an intermediate file /w lossless compression (e.g. ffdshow's YV12-Huffyuv)

Then, do a normal 2-pass XviD encoding with that lossless file as input. Doing so, you would have saved approx. 27 hours ...


One bug to report is iip is compatible with DGindex 1.2.1, but not compatible with DGindex 1.4.3 (the latest version) False. It is compatible. There is not any relation between iiP's functionality and the "how" of how you load the video source into the script. Suspect is either that after upgrading DGIndex you called the wrong d2v file, or that there is a general issue between GordianGnot and recent versions of DGIndex (can't tell .. it's been years since I used GordianGnot for encoding). But surely it has nothing to do with iiP.

Boulder
14th October 2005, 14:42
I've noticed that tsp's MT plugin loves the combination Didée's script+P4 HT CPU ;)

(Hint: multithreading == faster processing :cool: )

jbc23
14th October 2005, 14:55
Welcome to the forum, jbc23.

Thanks, you're a really nice person.


1st, load your script /w iiP and save that to an intermediate file /w lossless compression (e.g. ffdshow's YV12-Huffyuv)

Then, do a normal 2-pass XviD encoding with that lossless file as input. Doing so, you would have saved approx. 27 hours ...

How much harddisk space will it take to save a normal D5 DVD ( 4.3 GB ) to an intermediate file /w loseless compression.


There is not any relation between iiP's functionality and the "how" of how you load the video source into the script. Suspect is either that after upgrading DGIndex you called the wrong d2v file, or that there is a general issue between GordianGnot and recent versions of DGIndex (can't tell .. it's been years since I used GordianGnot for encoding). But surely it has nothing to do with iiP.
If I used DGindex 1.4.3 (the latest version) to save a DVD project, I could open the movie .d2v directly (not through iip script), but could not if I opened it through iip script ( I checked many times, there is no mistake with the movie .d2v file). Then if I restored the DGindex to older version 1.2.1 to save a DVD project, then all worked fine, I could open the movie .d2v through iip script.

Boulder
14th October 2005, 15:14
Post the script that gave you problems, otherwise the problem cannot be fixed.

Didée
14th October 2005, 15:24
How much harddisk space will it take to save a normal D5 DVD ( 4.3 GB ) to an intermediate file /w loseless compression. It depends, but it's not little. In the range of 5GB to 50 GB.

If I used DGindex 1.4.3 (the latest version) to save a DVD project, I could open the movie .d2v directly (not through iip script), but could not if I opened it through iip script ( I checked many times, there is no mistake with the movie .d2v file). Please double-check that the not-working script is loading the correct version of "DGDecode.dll". One should (often: must) always import exactly that version of dgdecode.dll that that comes shipping with the DGIndex.exe that was used to create a d2v project file.

Indicators:

a) GordianKnot said it could not found the movie .d2v This sounds exactly like the error message that mpeg2dec.dll (or versions of dgdecode.dll <= v1.2.x) will spit out when trying to load a d2v made by a newer DGindex with these old DLLs.

b) I actually checked a few minutes ago. It *does* work. :)

708145
14th October 2005, 15:41
iip is a GREAT script, kiss Didée to death if Didée were a girl, but iip is..........too...........slow.....

My computer is Pentium 4 cpu 3.3GB, 2GB RAM, I used iip script to encode a 130 mins DVD into 1.4GB XviD, 2 pass encoding, and it took 61 hours to finish ( first pass: 30 hours, 15 minutes; second pass: 30 hours, 45 minutes ), which means I had to turn on the computer for 2 and a half consecutive days, and meanwhile, I had no computer to use 'cause it's doing encoding job, although the result is wonderful, the encoding time is a bit too long, if the time needed for 2 pass encoding with iip could be shortened to within 10 hours, this script is simply extraordinary.


hi jbc23!

Plans are to add a feature to ELDER that allows to interrupt your encode and later (after reboot or so) continue without too much duplicated effort.

If enough ppl would like such a feature I'll add it to the official TODO list.

bis besser,
Tobias

jbc23
14th October 2005, 16:50
It depends, but it's not little. In the range of 5GB to 50 GB.
much less space than I thought, I assumed maybe it would take up to 80GB space to save a normal 4.3GB DVD w/ lossless compression.

Please double-check that the not-working script is loading the correct version of "DGDecode.dll". One should (often: must) always import exactly that version of dgdecode.dll that that comes shipping with the DGIndex.exe that was used to create a d2v project file.

Yeah, you're right, I just tried putting the DGDecode.dll 1.4.3 into iip foloder, then all worked like a charm.

btw, would you mind checking my iip script to see if there is wrong setting?
in my setting, the loadplugin list includes "DGDecode.dll, LeakKernelDeint.dll, mt_masktools.dll, warpsharp.dll, LoadPulginEx.dll, UnDot.dll, dustv5.dll", are these .dll all needed for iip to work, any of them is optional?

Is "import LimitedSharpen.avs" necessary, is "LimitedSharpen" an optional choice?


SetMemoryMax(256)


Loadplugin("E:\Program Files\iip\DGDecode.dll")
Loadplugin("E:\Program Files\iip\LeakKernelDeint.dll")
Loadplugin("E:\Program Files\iip\mt_masktools.dll")
Loadplugin("E:\Program Files\iip\warpsharp.dll")
Loadplugin("E:\Program Files\iip\LoadPluginEx.dll")
Loadplugin("E:\Program Files\iip\UnDot.dll")
Loadplugin("E:\Program Files\iip\dustv5.dll")

Import("E:\Program Files\iip\LimitedSharpen.avs")
Import("E:\Program Files\iip\iip.avs")

MPEG2Source("E:\test\test.d2v")
LeakKernelDeint(Order=1,threshold=5)
CROP(8,52,-8,-52,true)
ColorMatrix()
iip( dest_x= 800, dest_y= 444,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.4,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = true, warp_UV = false,
\ debug= "showall | compareH/V | protect | dering",
\ cropx=32, cropy=16
\ )

hi jbc23!

Plans are to add a feature to ELDER that allows to interrupt your encode and later (after reboot or so) continue without too much duplicated effort.

If enough ppl would like such a feature I'll add it to the official TODO list.

bis besser,
Tobias
I, for one, would think this feature is marvellous, considering the fact a lot of ppl in the world still use not so fast computers, say Pentium 3 cpu 1GB, 512MB RAM, and the long encoding time and uninterruptable encoding process are a pain in the ass for them, if the encoding process could be interruptted at any time and resume later, it would be quite convenient for those computer users with slow CPUs.

However, I always dream of a script that can produce extraordinary encoding result with very little encoding time. :D

jptheripper
14th October 2005, 19:01
i finally got iip to run, works when double clicking the avs in media player (although screen stays blank

script is
SetMemoryMax(1024)

Loadplugin("C:\Program Files\AviSynth 2.5\iip_plugins\DGDecode.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\iip_plugins\MaskTools-v1.5.8\MaskTools.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\iip_plugins\warpsharp.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\iip_plugins\LoadPluginEx.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\iip_plugins\UnDot.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\iip_plugins\dustv5.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\iip_plugins\aWarpSharp.dll")

Import("C:\Program Files\AviSynth 2.5\iip\iip.avs")

MPEG2Source("C:\28temp\D2VAVS\V08.d2v")
iip( dest_x= 720, dest_y= 480,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.4,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = false, warp_UV = false,
\ debug= "showall | compareH/V | protect | dering",
\ cropx=32, cropy=16
\ )
AudioDub(BlankClip())

i gave 4gb of memory

when i drag the avs into cce2.5sp to encode i get

"couldn't find appropriate video codec for 'yv12'"

any ideas?

Pookie
14th October 2005, 19:36
Loadplugin("C:\Program Files\AviSynth 2.5\iip_plugins\LoadPluginEx.dll")

and

Loadplugin("C:\Program Files\AviSynth 2.5\iip_plugins\dustv5.dll"

should be the last two lines in your "loadplugin section" .

Two things to try

1) add a Converttoyv12() line at the end of your script
2) http://forum.doom9.org/showthread.php?s=&threadid=56972

Boulder
14th October 2005, 20:23
Put ConverttoYUY2() at the end of the script.

DarkNite
15th October 2005, 00:57
@708145: Yes, please. I always find the various "pause" features useful. You never know when you might need those clock cycles back, or may have to restart your winbox for whatever reason. Could a pause/resume feature be implemented in ELDERChap as well?

@jpripper: If you use multipass VBR you'd be better off feeding CCE an intermediate file so that you could do multiple passes to your heart's content without wasting a week or two in the process. Personally, I don't feed an iip based script to anything except avs2avi or VirtualDub. After I have an intermediate anything goes.

708145
15th October 2005, 01:27
@708145: Yes, please. I always find the various "pause" features useful. You never know when you might need those clock cycles back, or may have to restart your winbox for whatever reason. Could a pause/resume feature be implemented in ELDERChap as well?


Another thing to add during beta then :)

About ELDERchap: I know no one besides me who actually used it so I consider it out-dated since ELDER will be available for Linux as well when Avisynth 3.0 gets released.

bis besser,
Tobias

Pookie
16th October 2005, 04:32
One way to speed up iiP might be to replace PixieDust (great, but SLOWWWWWW) with kassandro's RemoveGrain v1.0, especially with the SSE optimized plugins. Even Undot could be replaced with RemoveGrain(mode=1), (although Undot is quite peppy anyway).

Update: Well, I tried the above replacement filters and modified the iiP script, plus I replaced all instances of BicubicResize with FastBicubicResize. Yes, it is faster (2 fps instead of 1!). But I think the results aren't as sharp anymore.

jptheripper
16th October 2005, 14:35
Put ConverttoYUY2() at the end of the script.

sorry, but at the end of which script? iip.avs or my video avs

Boulder
16th October 2005, 16:40
And the end of your video avs.

Didée
16th October 2005, 18:12
One way to speed up iiP might be to ...
[grinding the hurdy-gurdy]
iiP is slow because it does things the way it does them. If it is doing certain things in a slow way, then most probably there were certain reasons to not do them the fast way.
[/grinding the hurdy-gurdy]


But okay ... for the speed freaks, here's the fastest possible solution:

function iiP_ultra_fast( clip clp )
{
return( clp .sharpen(1) )
}
:p :p


Seriously again - remember this (http://forum.doom9.org/showthread.php?p=565874#565874)? Could be there is a bug in it, but I forgot what it was.

Pookie
16th October 2005, 20:45
Didée:

The point of my "let's change the recipie" post was to demonstrate that speed can be had at the cost of quality. But that defeats the purpose of iiP. :D

Thanks for that iiP_ultra_fast function. I'm going to try it out on "Apocalypse Now Redux" and upscale it to 1920x1080. :p

jeffhuge
21st October 2005, 02:21
Didée:

First of all, I must appreciate you for the great, magnificent, amazing, unbelievable...... job!!! :)

And this is my questions as below:
In your answer to jbc23
1st, load your script /w iiP and save that to an intermediate file /w lossless compression (e.g. ffdshow's YV12-Huffyuv)

Then, do a normal 2-pass XviD encoding with that lossless file as input. Doing so, you would have saved approx. 27 hours ...

I met the same problem and my computer is p4 2.26G *_* 512MB sdram which needed almost 100 hours when encoding a 140min film!!!!! I use that iipv0.6 hack version.

I cant bear that much time but I dont quite understand what to do to output a an intermediate file /w lossless compression .Would you please to explain it with more details?


And I'm still waiting for your LS-EX because I am deeply impressed by LS (that LS2 is almost as good as LS).Is there any news about it? ^^

DarkNite
21st October 2005, 04:56
"an intermediate file /w lossless compression" is just a file (in your case probably an avi) that was encoded using a lossless codec to gain speed in a later multi pass operation without sacrificing quality. There are an abundance of lossless codecs to choose from, each having it's own strengths and weaknesses, or "focus" if you will.

You could just choose direct stream copy in virtualdub to output your avs to a lossless avi, but you wouldn't get any compression as it simply outputs raw yv12, or whatever your input was. Using a huffman based codec like ffdshow's implementation of huffyuv for yv12 you could achieve the same goal using 1/2 - 1/3 of the raw filesize (depending on settings).

Have a look around and see which lossless codec fits your needs. There are plenty of discussions on the subject in this forum, and others as well.

:search:

jeffhuge
21st October 2005, 11:56
great thx to DarkNite!!

Mr.Bitey
25th November 2005, 04:30
Im an AVISynth total noob so please dont be too rough! ;-), however I finally got IIP working (after many hours reading this thread, the limitedsharpen thread and several over on avsforums)! and after some 6 hours have my first 2 minute clip from LOTR - looks very promising!

Im feeding the IIP output into CCE which is limited to max 720x576 sized frames (PAL here). Is there another comparable encoder that will accept a frame size of 1776x1000 (or 1920x1080) ?

I'm really interested to see what IIP processed (and resized) video looks like when played with a DxVA mpeg2 decoder (taking ffdshow out the loop, which is what does my current re-sizing). I find the DxVA decoders to be a lot more fluid compared to the software decoders such as dscaler5006 (which is what I currently use with ffdshow)..

Cheers,
Bitey

DarkNite
25th November 2005, 08:09
Have you ever tried QuEnc (http://nic.dnsalias.com/QuEnc.html)?

Mr.Bitey
28th November 2005, 00:46
Thanks DarkNite,

Sorry for some more basic questions here, if the process didnt take so long (not a criticism!) I would just try it out and see :-)

Would I be better of (PQ wise) outputing IIP video to cce and encoding vbr multipass at 720x576 then using a simple resize script to resize using lanczos 4 to 1776x1000 passing the output to QuEnc for the final encoding?

or

using IIP to do the resizing and use QuEnc to do the encoding all in one step?

I am not concerned with how long the process will take or necessarily how big the files are, I am only concerned about getting the best PQ.

Cheers,
Bitey

Didée
28th November 2005, 01:10
The first method makes absolutely no sense. The second is the way to do.

However, to finish the job within this decade, you should:

1.) open the script in e.g. Virtualdub, and save to a lossless codec like huffyuv (for Quenc: huffyuv compression within ffdshow encoder, set to yv12).

2.) after the (enormously big!) huffyuv file was created, feed it into Quenc, and perform suited multipass encoding.

This way, all the expensive computations of iiP have to be done only one time, not over and over again for every pass of encoding.
You'll need a spare, free hardrive for the intermediate file ... and not only a 40GB one ;)

Mr.Bitey
28th November 2005, 01:39
Hi Didée,

Thanks for the info, I see the error of my ways (and why my 2 minute clip took a silly amount of time for IIP/cce to complete the work :o ).

Looks like I'll have to run a ethernet cable through the roof this weekend (to get access to some more drive space on another machine) so I can leave it inplace for the week it'll take :D without my wife complaining about cables through the house again!

Cheers,
Bitey

jeffhuge
28th November 2005, 04:08
Hi Didée,
I have encoded several films through IIP.I find there is no difference between a 2GHz p4 CPU and a 3GHz CPU when encoding.Both is 1 fps. I dont have that much hardisk space so I cant bear the time even if it processes amazing images.
Is it the CPU that decides the encoding speed?What about the ram?(thinking about setmax() )
would you give me a advise that what kind of CPU should I use?

Mr.Bitey
2nd December 2005, 04:22
2.) after the (enormously big!) huffyuv file was created, feed it into Quenc, and perform suited multipass encoding.


Input test file ~2mb
Output file 381mb (1776x1000 res)

A 4.3gb dvd would end up needing around 630GB :(
[EDIT] Ended up being more like 97Gig :)

Looks like im going to do it in sections :-)

Cheers
Bitey

3ngel
4th December 2005, 14:58
Hi,
trying using again Iip but on the line regarding the plugin-load of warpsharp.dll
i get this error:

http://img471.imageshack.us/img471/6743/immagine0zs.png

What does this means?? :confused:

EDIT : Ok i managed. There where necessary two files :

msvcp71.dll
msvcr71.dll

They have to be put in /System32 dir.

Mr.Bitey
4th December 2005, 23:07
2.) after the (enormously big!) huffyuv file was created, feed it into Quenc, and perform suited multipass encoding.


Hi Didée,

Im almost there, however when I transferred my IIP 'setup' to another pc (with a lot more disk and CPU) virtualdubmod was complaining it couldnt find a yv12 decompressor, I reluctantly installed Divx5 (seemed to be a 'fix' according to google) and that seemed to get me passed the error however in the preview the image looked very very wrong: bad colour, appeared to be patches missing of the image and some type of field problem where parts of one frame appeared over the top of another (sorry, I dont know the correct terms) :(

Cheers,
Bitey

Audionut
4th December 2005, 23:51
Mr.Bitey, Install xvid decoder or helix yuv codecs.

Use search.

spolja
19th December 2005, 21:53
Hi,

After several days of reading this thread and several others and figuring out how everything works (noob), I finally managed to set it up and running. After few encodes I must say I'm amazed how good picture looks with iip. I've tested script mainly for upsized video (I want to make DVD backups in 720p resolution) so I'm wondering if anyone has suggestions for script settings for upsizing video. I appretiate any info you can give. Thanks.

spolja

P.S. Thanks Didée for this wonderful script.

aberforthsgoat
19th December 2005, 23:27
... virtualdubmod was complaining it couldnt find a yv12 decompressor ...

I'm not Didee - not by a long shot! - but I seem to recall having been stuck with that at some point - and having solved it with the live ConvertToYV12().

Then again, I have a memory fit for a politician, so I may way off base.

One way or another, good luck!

Mike

DarkNite
20th December 2005, 07:16
@spolja

What do you use now (a nice full script example is always good), and what types of sources do you most often work with?

The horrible truth is that it's very dependent upon the condition of the source (some may say the eyes of the encoder as well), and no single answer can be given to that question that would be satisfactory.

There are a few things you can say that are good general practice when using iiP:

1) resize within iiP

2) dust is not always the answer (you may have to do a few things before iiP)

3) the defaults are not made for every source

4) be prepared to do "a little bit" of comparing screenshots, or test clips
(it's easy enough to copy source frame to clipboard with virtualdub and
paste it into paint or paint.net, make some changes to your script,
reload video, repeat...)

Does any of that help?

spolja
21st December 2005, 22:20
@DarkNite

As I said I'm would use script for DVD backups (mainly ones that have good (clean) picture). I've noticed that quality depends a lot on the input source and values within iip. I'm testing now (finally managed to get decent CPU (Opteron 146) but with every day it gets better. Btw, thanks for info.


P.S. Sorry for my bad english

Teegedeck
1st January 2006, 12:11
Hi Didée, just wanted to say thanks. I was very pleasantly surprised to find that iiP does wonders on the dreaded 'Fawlty Towers' DVDs even at default settings (errr; though I use your 'LRemoveDust'-script - 'LRemoveDust(18)' - instead of PixieDust in order to speed things up a little)! A shame I haven't got time (and the CPU) to experiment; but, as said, I'm very content with what I get. :thanks:

Valky
1st January 2006, 16:53
Hi Didée, just wanted to say thanks. I was very pleasantly surprised to find that iiP does wonders on the dreaded 'Fawlty Towers' DVDs even at default settings (errr; though I use your 'LRemoveDust'-script - 'LRemoveDust(18)' - instead of PixieDust in order to speed things up a little)! A shame I haven't got time (and the CPU) to experiment; but, as said, I'm very content with what I get. :thanks:

Did the script something for those rainbow-effects too?

Shadowfax3000
3rd January 2006, 12:02
I need some help upconverting to 1080p. Solutions for upconversion are spread around quite a bit in this thread and it's hard to know what exactly I need. Could someone post a call I should use for upconverting a NTSC DVD to 1080p? I would like to use LimitedSharpen (or LimitedSharpen2, whichever is better) if it indeed yields better quality. Thank you all sooo much! You're all doing an awesome job.

Teegedeck
3rd January 2006, 21:00
Did the script something for those rainbow-effects too?
I don't think so; there's no de-halo function in this script. But I'm gonna have a look. I was just amazed how much detail iiP salvaged from Fawlty Towers (compared to, for example, Didée's LRemoveDust script on its own). Though, let's face it, FT is the worst-quality video (European origin) I've ever seen - and one cannot turn ***t into gold.

Pookie
4th January 2006, 00:01
Have you had a look at Didée's "SeeSaw" function, posted in a recent thread ? Still in the early stages, but very nice at cleaning and restoring details. Can also run at 20fps, depending upon the noise reduction util you use with it.

jfma
23rd January 2006, 12:16
Didée,

First of all THANKS for all your great work!!

Do you think it would be reasonable to integrate SeeSaw within iiP? Maybe it would add a final sharpness touch that is difficult to obtain from some poor sources.

Didée
23rd January 2006, 13:02
No, an integration of SeeSaw into iiP (or vice versa) surely will not happen. If you like so, of course you can play with feeding iiP's output into SeeSaw, probably with iiP's settings being more on the careful side.

Truth is I've no further plans for iiP, except perhaps for making a final version with internally uses LimitedSharpen instead of the sloohoow SSXSharpen. (...there's a test version floating around somewhere.)

What I do have on the workbench is a big fusion of LimitedSharpen, SeeSaw, Dehalo_alpha, plus some more bells'n whistles. If I'll ever manage to put all modules together in a senseful way, it'll probably the successor of iiP.

Revgen
24th January 2006, 07:59
What I do have on the workbench is a big fusion of LimitedSharpen, SeeSaw, Dehalo_alpha, plus some more bells'n whistles. If I'll ever manage to put all modules together in a senseful way, it'll probably the successor of iiP.

Good Luck! :D

Chainmax
24th January 2006, 17:08
What I do have on the workbench is a big fusion of LimitedSharpen, SeeSaw, Dehalo_alpha, plus some more bells'n whistles. If I'll ever manage to put all modules together in a senseful way, it'll probably the successor of iiP.

Didn't you tell me a while a go that such a thing (I was asking for a LS+D_A combo IIRC) wasn't really worth it?

By the way, I intend to make a 1280x544 backup of Hackers to a DVD-R soon. What would you recommend me to use: LimitedSharpen, SeeSaw, a combination of both or IIP? Also, seeing that I'll be disposing of a ~5400kbps bitrate (0.32-0.33b/pp), what Xvid custom matrix would you recommend me?

Pookie
24th January 2006, 22:12
Hey Chainmax, how about trying out all of them on a small clip and letting everyone know ? :) You know how subjective all of this stuff is.

Chainmax
25th January 2006, 14:00
There are two reasons why I can't/won't do that: first, I haven't gotten the DVD yet and second, i'd really prefer to hear the opinion of more experienced people so as to have a good starting point.


I think I'll skip IIP because of what Didée said 4 posts above. Now, here's my reasoning:

1) using LimitedSharpen first would enhance details a little bit and also whatever little noise the movie might have. Seesaw would further enhance details and its denoising stage would eliminate the noise.

2) using Seesaw first would enhance details more in the first step and denoise the movie, so LimitedSharpen would only further enhance the details brought out by Seesaw.


So, it seems to me that SeeSaw + Resize + LimitedSharpen would be the more sensible choice. Do you agree?

lexor
25th January 2006, 14:14
So, it seems to me that SeeSaw + Resize + LimitedSharpen would be the more sensible choice. Do you agree?
well it depends how well resize is going to work, sometimes it puts more noise (with my tv caps it always puts more) so I first resize, then do all cleaning, so it all depends on whether or not LimitedSharpen is enough after resize. DVD source is different though (cleaner to begin with).

mg262
25th January 2006, 14:20
I think there is a limit to how much detail you can pull out (with the existing technology)... I would be sceptical about using LimitedSharpen after seesaw. One or the other, I would say... but of course you could always try it and report back.

LimitedSharpen has a resizer built into it, so I don't think there's ever any reason for using resize + LimitedSharpen. I can't remember whether seesaw has a resizer built into it...

lexor, unlike you I normally resize last so that the earlier filters have as unadulterated a signal is possible to work with... but I haven't observed this increase in noise on resizing -- what resizer are you using?

Chainmax
25th January 2006, 14:26
LimitedSharpen does use Avisynth resizing and one can edit the script to use the one you want (I have the original one edited for Lanczos4). Why do you feel that it's one or the other? Remember I'll be making a 1280x544 backup of it.

mg262
25th January 2006, 14:29
I think we're talking at cross purposes. When you wrote
SeeSaw + Resize + LimitedSharpen
I assumed you were thinking of using a stand-alone resizer before LimitedSharpen.

Chainmax
25th January 2006, 14:36
Well, the complete script would be IVTC+cropping+seesaw+lanczos4resize+limitedsharpen if that's what you mean.

GeneralMartok
3rd April 2006, 18:54
I've been using iiP for quite some time to enhance cinemascope films for my home theater. It's a constant height setup using an anamorphic lens to stretch the image to over 3 meters in width.
I've been running some experiments to speed things up a litle. Instead of hacking into iiP I simply tried out some filter chains (I am not that good). Among them was SeeSaw for detail enhancement. However I couldn't get rid of the halos and the mosquito noise. So I tried to imitate iiP's sharpening stages using LimitedSharpen:
Detail enhacement with unsharp masking, the miracle of Smode 4, and sharpening the edges. This is what I came up with:

MPEG2Source("F:\NEU\VTS_01_1.d2v")
Crop(0,72,-0,-72)
PixieDustPP(2)
HQDering()
LimitedSharpenFaster(Smode=1,radius=2,edgemode=2,strength=60)
LimitedSharpenFaster(Smode=4,edgemode=2,strength=120)
LimitedSharpenFaster(ss_x=2,ss_y=2,edgemode=1,strength=250,dest_x=1024,dest_y=576)
BlindDeHalo3(lodamp=3,hidamp=3,PPmode=3)


The result is looking almost identical to this:


MPEG2Source("F:\NEU\VTS_01_1.d2v")
Crop(0,72,-0,-72)
iip( dest_x = 1024, dest_y = 576,
\ duststr = 2, dustweight = 1.0,
\ detailcontr1 = 127, detailcontr2 = 255+40,
\ contr_radius = 2, PixSharp = 0.38,
\ ss2_x = 3, ss2_y = 3,
\ Xstren = 255, Xlimit = 255,
\ subpelstren = 1.0, flatweight = 0,
\ antiflicker1 = false, antiflicker2 = true,
\ protect_floor= 0, protect_bias = 12,
\ dering = -60, dering_weight= 1.0,
\ dering_floor = 8, dering_bias = 12,
\ detail_floor = 15,
\ EQ = 2, exborder = true,
\ warp_Y = true, warp_UV = false,
\ debug="detail | compareH | compareV | compareT | showall",
\ cropx = 40, cropy = 20
\ )
BlindDeHalo3(lodamp=3,hidamp=3,PPmode=3)


The contrast with iiP is a little higher though, but the speed is much higher.

About BlindDeHalo: I came to the conclusion that virtually all DVD sources need additional halo removal - at least when projected on a screen that big. I tried DeHalo_alpha(), however the results are looking unnatural somehow. Also - in contradiction what I've read in the forum - dehaloing after sharpening preserves more detail than before sharpening.

Of course, I am simply a user - not capable of writing such sophisticated functions like Didée - however I hope I'm on the right way.

Mr.Bitey
20th April 2006, 02:45
GeneralMartok,

I dont follow why your calling LSF three times?? :)

Cheers,
Bitey

GeneralMartok
20th April 2006, 17:18
That's because iip uses also 3 sharpening steps.
However, I've been testing a little and came to the conclusion that this way doesn't work.
It seems there is currently no alternative for iip.

Mr.Bitey
21st April 2006, 06:13
Hi All,

Its a slow day at work, so ive installed iip5 on my work machine..(for inspiration again :)

My goal is to process my favourite dvd's (not on my work machine, which is a slow old dog of a thing getting 1.0fps at the moment LOL) with iip5 and store on my HTPC for playback only on the HTPC in a 1776x1000 resolution without the need to resize.

My HTPC/Display run a resolution of 1776x1000.

My HTPC is a P4 3.4ghz and im using a radeon9800pro video card.

I intend to output from virtualdubmod to huffyuv then encode to something - and this is my delemma now - what to encode it to :-) given its only ever going to be played on my HTPC.. whatever it is needs to be able to play on my HTPC without any hint of stutter or chop (which is why I want it in 1776x1000 to start with)..

I am open to any recommendations please!

Cheers,
Bitey

DarkNite
22nd April 2006, 04:54
You might be best served by XviD if you're going to be pushing that many pixels around (I can only guess what astronomical bitrates you'll be using). While I would love to say do everything using x264 I also realize it isn't practical for those without the hardiest setups, and hardware acceleration or select decoders to do so beyond 720p.

Have you considered doing them in 720p (1280x720)? I don't see how letting the hardware scale it to your display is going to cause stuttering more so than encoding at a much higher resolution.

Mr.Bitey
23rd April 2006, 07:54
Thanks for the advice DarkNite,

I think ive found the solution to my stuttering issues, so I may not need to use such a high resolution. Ive moved from VMR9 renderless, back to overlay and reduced as many of the hardware anti-aliasing etc on my video card - seems to have fixed my limitedsharpenfaster stutters/chop..

I'll have a look into xvid and x264 and try some test clips..

Cheers,
Bitey

Cheers,
Bitey

tomos
24th May 2006, 20:49
looks like i'm joining the party when everyone else is leaving. :p

i just found out about IIP today when trying to upscale some video i have (to show on my projector). found some sample images of how good IIP can be and want to use it.

I've tried but cant even get the script to load properly.

I've got the files in this (http://forum.doom9.org/showthread.php?p=616533#post616533) post as well as the script and function call Didee posted here (http://forum.doom9.org/showthread.php?p=517100#post517100).

Presumably that script is whats called in 'IIP.avs'.

my AVS script basically goes like this:

Loadplugin("C:\Program Files\AviSynth 2.5\plugins\IIP.avs")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\Decomb521.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\UnDot.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\warpsharp.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\asharp.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\aWarpSharp.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\LoadPluginEx.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\DustV5.dll")

mpeg2source("clip.d2v")

iip( dest_x= 1280, dest_y= 720,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1= 104, detailcontr2 = 208, contr_radius = 2, PixSharp=0.38,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.58, flatweight = 0,
\ protect_floor = 0, protect_bias = 16,
\ dering = -80, dering_weight= 1.0, dering_floor = 8, dering_bias=12,
\ detail_floor = 10, EQ = 2,
\ warp_Y = false, warp_UV = false, exborder = false,
\ debug= "protect | dering | compareH|V | showall",
\ cropx=64, cropy=32
\ )

but i always get this error when opening:

Avisynth open failure:
LoadPlugin: ƒvƒ‰ƒOƒCƒ““Ç�žƒGƒ‰�[
(F:\AVS\test.avs, line 1)

which points to the IIP avs file but i have no idea what to change in there.

anyone know what i'm doing wrong?

Boulder
24th May 2006, 20:58
Don't try to load iip.avs with LoadPlugin. Use Import().

tomos
24th May 2006, 21:16
Don't try to load iip.avs with LoadPlugin. Use Import().

thank you :D

the error is gone. have a new one though :(

Avisynth open failure:
Script error: there is no function named "YV12subtract"
(C:\Program Files\AviSynth 2.5\plugins\IIP.avs, line 127)
(F:\AVS\test.avs, line 27)

there's no 27th line tho, its basically just - \ )

foxyshadis
24th May 2006, 21:40
27 is the end of the call to IIP, so it gets reported in the stack, but the important one is the first line, 127 in IIP.avs. It's an easy fix though, just put the script import after the loadplugins and make sure you have the latest 1.x of masktools.

tomos
24th May 2006, 22:35
ok, i moved the import line to after the load plugins, and grabbed the latest masktools from avisynth.org and that cleared the error. problem is it just went on to a new error. :(

Avisynth open failure:
Script error: maskedmerge does not have a named argument "useMMX"
(C:\Program Files\AviSynth 2.5\plugins\IIP.avs, line 164)
(F:\AVS\test.avs, line 27)

removed every instance of usemmx=true from IIP.avs and it loads. It loads, It loads!! :D

just have to get rid of these borders now which have popped up around my video for some reason.

thanks guys :) was pulling my hair out there

EDIT
-----

scratch the borders issue. that was just me being a eejit. alls working now althout i cant believe how slow this runs. getting less than 1fps at the mo encoding to divx. then again, its stuck on 50% on my dual core. seems it cant use both cores.

Mr.Bitey
25th May 2006, 01:18
YV12ubtract was dropped from v2 of masktools - you need to make sure you have the old one loaded too (1.5.8 i think the last one was)..

[EDIT] - oops - didnt see the other reply on the last page :)

Cheers,
Bitey

himmania
11th November 2006, 03:42
i still can't run it ;(

after when i got a error about "useMMX" now i'm getting error " Script Error there is no function named "unsharpmask"
what should i do?

Didée
11th November 2006, 03:50
import warpsharp.dll (from the warpsharp "package" (http://www.avisynth.org/warpenterprises/#WarpSharp), not "warpsharpYV12") ...

himmania
11th November 2006, 16:16
yeah! thank you.

turstar
26th November 2006, 12:30
IIP.avs + download link ???

foxyshadis
26th November 2006, 13:22
The link to the script is right in the first post, where it's always been. (Hint: It points to page 6.)

turstar
26th November 2006, 14:22
Hay,

I'm orginal script


# Created with Gordian Knot
#
# http://gknot.doom9.org

# PLUGINS
LoadPlugin("C:\PROGRA~1\GORDIA~1\DGMPGDec\DGDecode.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\decomb.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\KernelDeInt.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\UnDot.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\dgbob.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\Convolution3d.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\FluxSmooth.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\TomsMoComp.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\VSFilter.dll")
#LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\SimpleResize.dll")

# SOURCE
mpeg2source("D:\azuredengelen\Gordionscript\VTS_01_1.d2v")

# TRIM
#trim(startframe,endframe)

# IVTC
#Telecide(order=1,guide=1).Decimate()
# or use
#IVTC(44,11,95)
#GreedyHMA(1,0,4,0,0,0,0,0)

# DEINTERLACING (1)
#FieldDeinterlace()
#FieldDeinterlace(blend=false)
#TomsMoComp(1,5,1)

# DEINTERLACING (2)
#KernelDeInt(order=1,sharp=true)
# or maybe
#DGBob(order=1,mode=0)

# DEINTERLACING (3) - special requests
#GreedyHMA(1,0,0,0,0,0,0,0)
#Telecide()
#SeparateFields()

# CROPPING
crop(2,2,716,476)

# SUBTITLES
#VobSub("FileName")

# RESIZING
LanczosResize(576,320)

# DENOISING: choose one combination (or none)
Undot()

# 1) little noise
#Temporalsoften(2,3,3,mode=2,scenechange=6)
#mergechroma(blur(1.3))
#FluxSmoothST(5,7)

# 2) medium noise
#Temporalsoften(3,5,5,mode=2,scenechange=10)
#Convolution3d("moviehq")
#FluxSmoothST(7,7)

# 3) heavy noise
#Temporalsoften(4,8,8,mode=2,scenechange=10)
#Convolution3d("movielq")
#FluxSmoothST(10,15)

# BORDERS
#AddBorders(left,top,right,bottom)

# COMPRESSIBILITY CHECK
# !!!!Snip Size now has to be 14 for use in GKnot!
#SelectRangeEvery(280,14)

# FOOL CCEnc
#empty = BlankClip()
#AudioDub(last,empty)


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

IIP what to put in order?



Import("C:\Program Files\GordianKnot\AviSynthPlugins\IIP.avs")
LoadPlugin("C:\Program Files\GordianKnot\AviSynthPlugins\UnDot.dll")
LoadPlugin("C:\Program Files\GordianKnot\AviSynthPlugins\MaskTools.dll")
LoadPlugin("C:\Program Files\GordianKnot\AviSynthPlugins\warpsharppackage\warpsharp.dll")
LoadPlugin("C:\Program Files\GordianKnot\AviSynthPlugins\asharp.dll")
LoadPlugin("C:\Program Files\GordianKnot\AviSynthPlugins\aWarpSharp.dll")
LoadPlugin("C:\Program Files\GordianKnot\AviSynthPlugins\warpsharppackage\LoadPluginEx.dll")
LoadPlugin("C:\Program Files\GordianKnot\AviSynthPlugins\DustV5.dll")


iip( dest_x= 576, dest_y= 320,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 0, dustweight = 0, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.25,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = false, warp_UV = false,
\ debug= "showall | compareH/V | protect | dering",
\ cropx=32, cropy=16
\ )



ERROR???

http://img135.imageshack.us/img135/1441/neemmeevn8.jpg

Audionut
27th November 2006, 00:48
That error message is telling you what's wrong, and even hints at how to fix the problem.

G_M_C
2nd December 2006, 12:57
Well, i want to try this function too, and i've allmost got everything i need. Bu i cannot find DustV5.dll anywhere. I understand i might be found trough the avisynth.org website, but thats been offline for a few months now.

Can someone please help me out with a link to DustV5.dll ?

Thx in advance :)

Taurus
2nd December 2006, 14:16
Well, i want to try this function too, and i've allmost got everything i need. Bu i cannot find DustV5.dll anywhere. I understand i might be found trough the avisynth.org website, but thats been offline for a few months now.

Can someone please help me out with a link to DustV5.dll ?

Thx in advance :)
If still in need for the DustV5.dll just P.M. me with your E-Mail Adress and I will send you a copy (Date 2003).

Cheers
Taurus

Didée
2nd December 2006, 14:37
If still in need for the DustV5.dll just P.M. me with your E-Mail Adress ..
... and become member of a druid's circle, or what? :)

No need to hide out ... since quite some time, the DustV5 package can be downloaded e.g. >here (http://home.arcor.de/dhanselmann/_stuff/dust_v5.zip)<, too ... :)

G_M_C
2nd December 2006, 16:00
Thx to you both :)

I've got it the dll, and i'm gonna expiriment with iip now.

PS: I also got the "useMMX" error. Resolved it by removing every instance of it, but it makes iip go very slow. Think i'll have to read up on some of the used plugins to see if there was a change in commands (when useMMX was removed for a different CPU-optimization command or something).

mahsah
7th December 2006, 21:29
Well, I am reletively new to avisynth, so this is confusing to me, especially when this is exactly what I would like too accomplish for my old dvds. Could someone post an (example) script for an mpeg2source at NTSC resolution of 720 x 480 to HD?

mahsah
8th December 2006, 22:23
Ah, nevermind, I got it all figured out. Although it was a pain to find dustv5.dll :D

turstar
19th May 2007, 00:02
# iip : Integrated Image Processor, v.0.5a
#
#
# ---------------
# | It is slow. |
# ---------------
#
# New in v.0.5 :
#
# EQ [int] : Edge quality. 0=deaktivated (don't do that!!!), 1=standard (as formerly), 2=better'n'slower, 3=evenbetter'n'evenslower
# Note: when using EQ = 2|3, then it's a good idea to *DEACTIVATE* deringing in iiP (don't hit the dog twice).
#
# warp_Y, warp_UV [bool] additional Luma & Chroma Warping.
#
# Luma warping should make the picture more 'gracile' when upsizing to bigger resolution, e.g. DVD -> HDTV.
# For same resolution or downsizing, it may (?) help for sources with distorted detail. Or it may not - YMMV.
#
# Chroma warping helps on sources with bleeding colors (e.g. Enterprise: on the uniforms, the red stripes are bleeding into
# the blue cloth, which looks *very* ugly [like an aquarell that's gotten wet]. It looks much better with chroma warping.)
# On clean sources, chroma warping is a waste of CPU cycles.
#
# exborder [bool] : exclude outmost 8-pixel-border from sharpening (gradient masked)
#
# dering: old method: called with positive values for "dering"
# new method: called with negative values for "dering" (better, but slower)
#
# detail_floor [int] : was formerly hardcoded, now user-definable. default 20.
#

function Ylevels(clip clp, int a, float gamma, int b, int c, int d)
{ wicked="x "+string(a)+" - "+string(b)+" "+string(a)+" - / 1 "+string(gamma)+" / ^ "+string(d)+" "+string(c)+" - * "+string(c)+" +"
# Reminder: Yexpr = "x a - b a - / 1 gamma / ^ d c - * c +"
# return( clp.subtitle(wicked) )
return( clp.YV12LUT(Yexpr = wicked) )
}

function FineEdge( clip clp, int "div" )
{
logic( clp.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5", setdivisor=true, divisor=div)
\ ,clp.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5", setdivisor=true, divisor=div), "max", Y=3,U=1,V=1 )
}

function iip( clip clp,
\ int "dest_x", int "dest_y",
\ int "duststr", float "dustweight",
\ float "ss1_x", float "ss1_y",
\ int "detailcontr1", int "detailcontr2",
\ int "contr_radius", float "PixSharp",
\ float "ss2_x", float "ss2_y",
\ int "Xstren", int "Xlimit",
\ float "subpelstren", int "flatweight",
\ bool "antiflicker1", bool "antiflicker2",
\ int "protect_floor",int "protect_bias",
\ int "dering", float "dering_weight",
\ int "dering_floor", float "dering_bias",
\ int "detail_floor",
\ int "EQ", bool "exborder",
\ bool "warp_Y", bool "warp_UV",
\ string "debug",
\ int "cropx", int "cropy"
\ )
{
ox = clp.width
oy = clp.height
xcorr=(int(ox/16.0+.9999)*16)-ox
ycorr=(int(oy/ 8.0+.9999)* 8)-oy
dest_x = default(dest_x, clp.width)
dest_y = default(dest_y, clp.height)
ss1_x = default(ss1_x, 1.414)
ss1_y = default(ss1_y, 1.414)
ss2_x = default(ss2_x, 3.5)
ss2_y = default(ss2_y, 3.5)
duststr = default(duststr, 2)
dustweight = default(dustweight, 1.0)
antiflicker1= default(antiflicker1, true)
antiflicker2= default(antiflicker2, true)
Xlimit = default(Xlimit, 255) # SS<3 ? 23 : 255
Xstren = default(Xstren, 255) # SS<3 ? 216 : 255
detailcontr1= default(detailcontr1, 104)
detailcontr2= default(detailcontr2, 208)
contr_radius= default(contr_radius, 2)
PixSharp = default(PixSharp, 0.4)
subpelstren = default(subpelstren, 1.58)
flatweight = default(flatweight, 0)
protect_floor=default(protect_floor, 0)
protect_bias= default(protect_bias, 16)
dering = default(dering, -80)
dering_floor= default(dering_floor, 8)
dering_floor= dering<0 ? dering_floor*2 : dering_floor
dering_bias = default(dering_bias, 16)
dering_weight=default(dering_weight, 1.0)
detail_floor= default(detail_floor, 20)
EQ = default(EQ, 2)
EQ = (EQ>3) ? 3 : EQ
exborder = default(exborder, false)
warp_Y = default(warp_Y, false)
warp_UV = default(warp_UV, false)
debug = default(debug, "Mickey Mouse")
cropx = default(cropx, 40)
cropy = default(cropy, 20)

cropx=int(cropx/4)*4
cropy=int(cropy/4)*4
xx_ss1 = int(ox*ss1_x/16+.5)*16
yy_ss1 = int(oy*ss1_y/16+.5)*16
xx_ss2 = int(ox*ss2_x/16+.5)*16
yy_ss2 = int(oy*ss2_y/16+.5)*16
xx_small = int(ox/(abs(dering)/80+1.0)/16+.5)*16 + 32
yy_small = int(oy/(abs(dering)/80+1.0)/16+.5)*16 + 16

# Now I have the other idea - but it's too slow, yet
clp = antiflicker1 == true ? clp.temporalsoften(2,2,3,23,2) : clp

#---------------------------------------------------------------------------------------------------------------------
# Base denoising by PixieDust
#
dusted = clp.addborders(0,0,xcorr,ycorr).converttoyuy2().PixieDust(limit=duststr).converttoyv12().crop(0,0,-xcorr,-ycorr)
dusted = (dustweight==0.0) ? clp
\ : ( dustweight<1.00 ? Overlay(clp, dusted, opacity=dustweight)
\ : dusted )

soft=dusted.bicubicresize(xx_small,yy_small,.2,.4).bicubicresize(xx_ss1,yy_ss1,1.0,.0)

#---------------------------------------------------------------------------------------------------------------------
# Build EdgeMask to protect already sharp detail from oversharpening
#
YV12subtract( dusted.sharpen(0.6).sharpen(0.6), dusted.blur(1.0).blur(1.0) )

edge00 = bicubicResize(xx_ss1,yy_ss1,-1.0,1.0)
edge0=edge00
\ .YV12LUT(Yexpr="x 128 - abs "+string(protect_floor)+" - "+string(protect_bias)+" *")
\ .deflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1).blur(1.58)
edge00 = edge00.yv12lut(yexpr="x 128 - 2 *").expand(Y=3,U=1,V=1).blur(1.58)

#---------------------------------------------------------------------------------------------------------------------
# Build DeRing'ing Mask: +++ OLD ROUTINE +++
#
dering > 0 ? expand(Y=3,U=1,V=1) : NOP
edge1b = dering > 0
\ ? yv12subtract( expand(Y=3,U=1,V=1).blur(1.58),
\ inpand(Y=3,U=1,V=1),tol=1,wideRange=true )
\ .bicubicResize(xx_ss1,yy_ss1,-1.0,1.0)
\ .yv12LUT(Yexpr="x 128 - abs "+string(dering_floor)+" - "+string(dering_bias)+" *")
\ .deflate(Y=3,U=1,V=1).blur(1.58)
\ : last
# .Ylevels(0,3.0,255,0,255)
#---------------------------------------------------------------------------------------------------------------------
# 1st supersampling stage to perform sharpening at
#

(ss1_x > 1.0 || ss1_y > 1.0) ? dusted.Lanczosresize(xx_ss1,yy_ss1)
\ : dusted

#---------------------------------------------------------------------------------------------------------------------
# Build DeRing'ing Mask & perform dering'ing: +++ NEW ROUTINE (Pre-processor) +++
#
tmpp = string(dering_floor)
edge1b = dering < 0
\ ? yv12subtract( last, last.xsharpen(255,255),tol=1,wideRange=true )
\ .yv12lut(yexpr="x 128 - abs "+tmpp+" *")
\ .expand().inflate().expand().inflate().FineEdge(dering_bias).blur(1.58)
\ .greyscale.Ylevels(19,1.6,208,0,255)
\ : edge1b
dering < 0 ? maskedmerge( last, soft, edge1b, Y=3,U=1,V=1, useMMX=true ) : NOP

#-------- iterative sharpening, currently only 3-fold: its slow enough ... --------

temp = last
shrpcnt = 0
mskcnt = 0
shrpcnt = (PixSharp != 0) ? shrpcnt + 1 : shrpcnt
shrpcnt = (detailcontr2 != 0) ? shrpcnt + 1 : shrpcnt
shrpcnt = (detailcontr1 != 0) ? shrpcnt + 1 : shrpcnt
mskcnt = (EQ>shrpcnt) ? shrpcnt : EQ

# Stage 1 : UnsharpMasking, wide radius -----------------------
detailcontr1 != 0
\ ? unsharpmask(detailcontr1,contr_radius,0)
\ : NOP
detailcontr1 != 0 && (shrpcnt==1 || mskcnt>1 && shrpcnt>=mskcnt) && (EQ>0)
\ ? MaskedMerge(last,temp,edge0.expand.inflate.inflate, Y=3,U=1,V=1,useMMX=true)
\ : NOP
mskcnt = (detailcontr1 != 0 && (shrpcnt==1 || mskcnt>1 && shrpcnt>=mskcnt))
\ ? mskcnt - 1
\ : mskcnt
shrpcnt = detailcontr1 != 0 ? shrpcnt - 1 : shrpcnt

# Stage 2 : UnsharpMasking, small radius ----------------------
detailcontr2 != 0
\ ? unsharpmask(detailcontr2, 1,0)
\ : NOP
detailcontr2 != 0 && (shrpcnt==1 || mskcnt>1&&shrpcnt>=mskcnt) && (EQ>0)
\ ? MaskedMerge(last,temp,edge0.inflate.inflate,Y=3,U=1,V=1,useMMX=true)
\ : NOP
mskcnt = (detailcontr2 != 0 && (shrpcnt==1 || mskcnt>1&&shrpcnt>=mskcnt))
\ ? mskcnt - 1
\ : mskcnt
shrpcnt = detailcontr2 != 0 ? shrpcnt - 1 : shrpcnt

# Stage 3 : per-pixel sharpening ------------------------------
PixSharp != 0.0
\ ? sharpen( PixSharp )
\ : NOP
PixSharp != 0.0 && shrpcnt > 0 && EQ>0
\ ? MaskedMerge(last,temp,edge0, Y=3,U=1,V=1,useMMX=true)
\ : NOP
undot()

#---------------------------------------------------------------------------------------------------------------------
# DeRing'ing of sharpen'ed clip: +++ OLD ROUTINE (Post-processor) +++
#
dering > 0 ? MaskedMerge(last,last.unfilter(-dering,-dering),edge1b.bicubicresize(xx_ss1,yy_ss1),Y=3,U=1,V=1,useMMX=true)
\ : NOP

# Now I have the other idea - but it's too slow, yet
antiflicker2 == true ? temporalsoften(1,2,3,23,2) : NOP

#---------------------------------------------------------------------------------------------------------------------
# 2nd supersampling stage to perform SubPel operation & XSharpening at
#
# Notes: Luma Warping - may help for sources that are hard to get a "clean" picure from.
# - Should help making the picture a little more "gracile" when doing DVD -> HDTV upsizing

xx_ss2 != ox || yy_ss2 != oy ? LanczosResize(xx_ss2,yy_ss2) : NOP

subpelstren != 0.0 ? blur(subpelstren) : NOP

warp_Y ? awarpsharp(depth=(ss2_x+ss2_y)/2*3,thresh=0.5,blurlevel=2,cm=0) : NOP

Xstren != 0 && Xlimit !=0 ? xsharpen(Xstren,Xlimit) : NOP

LanczosResize(dest_x,dest_y).undot()

#---------------------------------------------------------------------------------------------------------------------
# Build new EdgeMask of the enhanced clip
#
edge2 = bicubicresize(int(dest_x/1.75/16+.5)*16,int(dest_y/1.75/16+.5)*16,1.0,.0)
\ .DEdgeMask(0,255,0,255,"-5 -7 -5 -7 48 -7 -5 -7 -5",Y=3,U=1,V=1,useMMX=true,setdivisor=true,divisor=1)
bordermask = blankclip(edge2,width=dest_x-16,height=dest_y-16,color=$FFFFFF)
\ .addborders(2,2,2,2,color=$8F8F8F).addborders(2,2,2,2,color=$6F6F6F)
\ .addborders(2,2,2,2,color=$202020).addborders(2,2,2,2,color=$000000)
edge2 = edge2
\ .levels( (detail_floor+int(detailcontr1/15+detailcontr2/30+PixSharp*15)), 4.0,128,flatweight,255,false)
\ .bicubicResize(dest_x,dest_y,1.0,0)
edge2 = exborder ? edge2.logic(bordermask,"min") : edge2
edge2 = edge2
\ .inflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1)
\ .blur(1.58).greyscale()
\ .inflate(Y=3,U=1,V=1).inflate(Y=3,U=1,V=1)
\ .temporalsoften(1,63,63,255,2)

#---------------------------------------------------------------------------------------------------------------------
# Put original de-noised & not-sharpened clip into areas still appearing flat, after all that sharpening
#
MaskedMerge(dusted.lanczosresize(dest_x,dest_y),last,edge2,Y=3,U=1,V=1,useMMX=true)

#---------------------------------------------------------------------------------------------------------------------
# Chroma Warping - often useful for sources where colors are "bleeding". Superfluid for clean sources.
#
warp_UV ? MergeChroma( aWarpSharp(depth = 8.5 * (dest_x/ox + dest_y/oy), thresh=0.5, cm=1, blurlevel=2) ) : NOP

#---------------------------------------------------------------------------------------------------------------------
# Visualizations
#
debug == "dering" ? overlay(last,blankclip(last,color=$00A000),mask=edge1b.bicubicresize(dest_x,dest_y),mode="blend",opacity=dering_weight)
\ : NOP
debug == "protect" ? overlay(last,blankclip(last,color=$00A000),mask=edge0.bicubicresize(dest_x,dest_y),mode="blend",opacity=0.75)
\ : NOP
debug == "detail" ? overlay(last,blankclip(last,color=$00A000),mask=edge2.bicubicresize(dest_x,dest_y),mode="blend",opacity=0.75)
\ : NOP
debug == "compareH" ? stackhorizontal(clp.lanczosresize(dest_x,dest_y).crop(cropx,0,-cropx,-0).addborders(0,0,4,0,color=$800000).subtitle("Original"),
\ last.crop(cropx,0,-cropx,-0).subtitle("iiP") )
\ : NOP
debug == "compareV" ? stackvertical(clp.lanczosresize(dest_x,dest_y).crop(0,cropy,-0,-cropy).addborders(0,0,0,4,color=$800000).subtitle("Original"),
\ last .crop(0,cropy,-0,-cropy).subtitle("iiP") )
\ : NOP
debug == "showall" ? stackvertical( stackhorizontal( edge0 .greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,4,4,color=$800000).subtitle("Protection of sharp edges"),
\ edge1b.greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,0,4,color=$800000).subtitle("DeRing'ing") ),
\ stackhorizontal( edge2 .greyscale().lanczosresize(dest_x,dest_y).crop(cropx,cropy,-cropx,-cropy)
\ .addborders(0,0,4,0,color=$800000).subtitle("Detail areas"),
\ last .crop(cropx,cropy,-cropx,-cropy).subtitle("iiP") ) )
\ : NOP

return(last)
}

#




SCRIPT

Import("D:\megui\AviSynthPlugins\IIP.avs")

LoadPlugin("D:\megui\AviSynthPlugins\Undot.dll")
LoadPlugin("D:\megui\AviSynthPlugins\masktools-v1.4.16\MaskTools.dll")
LoadPlugin("D:\megui\AviSynthPlugins\WarpSharp.dll")
LoadPlugin("D:\megui\AviSynthPlugins\LoadPluginEx.dll")
LoadPlugin("D:\megui\AviSynthPlugins\dust_20_dll_20030123\dustv5.dll")

mpeg2source("D:\DVD\matrix\MARY_REILLY\VIDEO_TS\matrix.d2v")

iip( dest_x= 720, dest_y= 360,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1, antiflicker1= false, antiflicker2= false,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 2, PixSharp=0.4,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 0,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = false, warp_UV = false,
\ debug= "",
\ cropx=32, cropy=16
\ )




ERROR
http://img295.imageshack.us/img295/7114/11111111jf1.jpg

please!

foxyshadis
19th May 2007, 01:08
That's part of warpsharp.dll. You might verify that you have the right version of it, you should be able to get it off of warpenterprises.

Pookie
19th May 2007, 01:47
I'm pretty sure this is the correct one...

http://www.geocities.co.jp/SiliconValley-PaloAlto/2382/warpsharp_2003_1103.cab


OT -

Looks like somebody created an MMX optimized version of the plugin - dunno if it is the same warpsharp, however.

http://seraphy.fam.cx/~seraphy/program/WarpSharp/index.html

turstar
19th May 2007, 10:58
Thanks for reply My problem is solved but now i have this problem
http://img292.imageshack.us/img292/2519/55555555xq6.jpg

Didée
19th May 2007, 11:15
now i have this problem
http://img292.imageshack.us/img292/2519/55555555xq6.jpg
Older versions of iiP had only one single "antiflicker=true/false" switch.

Later versions don't have "antiflicker" anymore. Instead, they have
- "antiflicker1=true/false" (pre-calming) , and
- "antiflicker2=true/false" (post-calming).

Jeremy Duncan
23rd May 2007, 17:32
Maybe foxyshadis or Didée can upgrade this iip so it can be played in realtime using ffdshow.
I can play this using about 60% cpu, so it's not the cpu speed.


LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\undot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\WarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LoadPluginEx.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dustv5.dll")
iip( dest_x= 1680, dest_y= 1050,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 4, dustweight = 0.1, antiflicker1= true, antiflicker2= true,
\ detailcontr1= 134, detailcontr2 = 308, contr_radius = 1, PixSharp=0.18,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.58, flatweight = 0,
\ protect_floor = 0, protect_bias = 16,
\ dering = -80, dering_weight= 1.0, dering_floor = 8, dering_bias=12,
\ detail_floor = 10, EQ = 2,
\ warp_Y = false, warp_UV = false, exborder = false,
\ debug= "protect | dering | compareH|V | showall",
\ cropx=64, cropy=32
\ )


Here's a link to the necessary plugins
Link (http://rapidshare.com/files/32952761/Plugins.zip.html)

I'm hoping foxyshadis can make a mt_masktools version. :)

Jeremy Duncan
23rd May 2007, 17:45
Actually, you know.
Didée made this in the beginning of 2004. Close to 3 1/2 years ago, and he's using plugins from 2003.

Maybe make a iip using more modern plugins ?
Hopefully making it faster ?

Terranigma
23rd May 2007, 17:52
Or you can wait it out and let Didée focus his attention on the MV-version of seesaw. ;)

canuckerfan
9th March 2008, 10:05
anyone have a link to dust.dll?

Taurus
9th March 2008, 10:59
anyone have a link to dust.dll?
Three posts above @ Jeremy's provided link.

canuckerfan
9th March 2008, 19:00
Thanks. don't know how I missed that. but I can't seem to load dustv5.dll - it doesn't seem to load automatically and when I try to do it manually it gives this weird error:

LoadPlugin: "some weird characters"
(blach blach, line 13) <-- obviously the load line

what's up?

Taurus
9th March 2008, 19:57
Thanks. don't know how I missed that. but I can't seem to load dustv5.dll - it doesn't seem to load automatically and when I try to do it manually it gives this weird error:

LoadPlugin: "some weird characters"
(blach blach, line 13) <-- obviously the load line

what's up?
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\LoadPluginEx.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\dustv5.dll")
LoadPluginEx.dll is needed because dust is a pre AviSynth 2.5 plugin.

canuckerfan
9th March 2008, 21:57
oh ok. but turns out I've been loading it all along...

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TMM.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TDeint.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TIVTC.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\nnedi.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\despot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mvtools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\vinverse.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LoadPluginEx.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\asharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\awarpsharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\undot.dll")
LoadPlugin("E:\Program Files\AviSynth 2.5\plugins\DustV5.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\IIP.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\Ylevels_MT.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\dehalo_alpha_mt.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\SootheMT.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\LimitedSharpenFaster.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\LimitedSharpen2.avs")

SetMemoryMax(768)

avisource("G:\Hindi Movies\DCH\temp_1.avi")

iip (duststr=2, dustweight=1.0,
\ ss1_x=1.5, ss1_y=1.5,
\ detailcontr1=104, detailcontr2=208,
\ contr_radius=2, PixSharp=0.0,
\ ss2_x=1.5, ss2_y=1.5,
\ XSmode=3, Xstren=40, Xradius=2, XLmode=2,
\ Xovershoot=1, Xwide=false, Xsoft=false,
\ subpelstren=0.0, flatweight=0,
\ antiflicker1=true, antiflicker2=true,
\ protect_floor=0, protect_bias=20,
\ dering=-80, dering_weight=1.0,
\ dering_floor=8, dering_bias=16,
\ detail_floor=16,
\ EQ=2, exborder=false,
\ warp_Y=false, warp_UV=false,
\ debug="dering | protect | detail | compareH | compareV | compareT | showall",
\ cropx=8, cropy=8
\ )

#converttoyuy2()

canuckerfan
12th March 2008, 04:07
any ideas, guys?

Didée
12th March 2008, 08:28
See: http://forum.doom9.org/showthread.php?p=543622#post543622

Socio
12th March 2008, 19:55
any ideas, guys?

Try setting your imports and loads portion of your script like this and see if it helps:

SetMemoryMax(768)
Import("C:\Program Files\AviSynth 2.5\plugins\IIP.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\Ylevels_MT.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\dehalo_alpha_mt.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\SootheMT.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\LimitedSharpenFaster.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\LimitedSharpen2.avs")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TMM.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TDeint.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TIVTC.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\nnedi.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\despot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mvtools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\vinverse.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\asharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\awarpsharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\undot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LoadPluginEx.dll")
LoadPlugin("E:\Program Files\AviSynth 2.5\plugins\DustV5.dll")

I always import then load dll's saving the Loadplugin and Dust for last when I use IIP and it works for me.

canuckerfan
12th March 2008, 22:47
thanks for the suggestions, guys.

See: http://forum.doom9.org/showthread.php?p=543622#post543622
this did the trick:)

badshah
17th March 2008, 18:54
~edit~

error solved ... sorry for the trouble. :(

San07
7th July 2008, 08:51
Iam getting these Errors.:confused:


If i use mt_masktool the error i get is "There is no function named YV12Subtract".

If i use Masktool V1.5.8 the error i get "maskedmerge doesnot have a named arguement USEMMX"

If i use Masktool V1.4.16 the error i get "Cannot open video input".



LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LeakKernelDeint.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools-v1.5.8\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\warpsharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\UnDot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LoadPluginEx.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dust_20_dll_20030123\DustV5.dll")

DGDecode_mpeg2source("E:\Rough\Bheema\VIDEO_TS\VTS_02_1.d2v")
crop( 4, 66, -6, -64)

import("C:\Program Files\AviSynth 2.5\Scripts\IIP.avs")

iip( dest_x= 1240, dest_y= 576,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1= 104, detailcontr2 = 208, contr_radius = 2, PixSharp=0.38,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.58, flatweight = 0,
\ protect_floor = 0, protect_bias = 16,
\ dering = -80, dering_weight= 1.0, dering_floor = 8, dering_bias=12,
\ detail_floor = 10, EQ = 2,
\ warp_Y = false, warp_UV = false, exborder = false,
\ debug= "protect | dering | compareH|V | showall",
\ cropx=64, cropy=32
\ )


Guys what am i doing wrong ?

Didée
7th July 2008, 09:40
MaskTools have undergone many small changes that time back. iiP was created for/under MaskTools v1.5.6, but wasn't adapted for each and every of those small changes.

For using MaskTools v1.5.8, go ahead and simply delete all "useMMX=true" parameters from the script.

Else: use MaskTools v1.5.6 (http://manao4.free.fr/MaskTools-v1.5.6.zip).


BTW, iiP is a real Dinosaur, I consider it pretty much outdated.

San07
7th July 2008, 12:16
MaskTools have undergone many small changes that time back. iiP was created for/under MaskTools v1.5.6, but wasn't adapted for each and every of those small changes.

For using MaskTools v1.5.8, go ahead and simply delete all "useMMX=true" parameters from the script.

Else: use MaskTools v1.5.6 (http://manao4.free.fr/MaskTools-v1.5.6.zip).


BTW, iiP is a real Dinosaur, I consider it pretty much outdated.

Version 1.5.6 also didn't work, after deleting "useMMX=true" parameters from the script it worked.


Thank's a lot for this awesome IIP Didee, a small request y can't build a new version of IIP with fast process.:)

San07
7th July 2008, 13:07
Oops before i saw only the preview of script in megui & i said it works.

now a problem when i load avs file in megui it showed.

http://i187.photobucket.com/albums/x20/srini07/Error2.jpg

i gave yes


after that the job shows error.:confused:

http://i187.photobucket.com/albums/x20/srini07/Error-1.jpg

SetMemoryMax(96)

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LeakKernelDeint.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\UnDot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools-v1.5.6\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\warpsharppackage_25_dll_20031103\warpsharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LoadPluginEx.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dust_20_dll_20030123\DustV5.dll")
DGDecode_mpeg2source("E:\Rough\Bheema\Sample.d2v")

import("C:\Program Files\AviSynth 2.5\Scripts\IIP.avs")

iip( dest_x= 1060, dest_y= 540,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 2, dustweight = 1.0, antiflicker1= true, antiflicker2= true,
\ detailcontr1= 104, detailcontr2 = 208, contr_radius = 2, PixSharp=0.38,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.58, flatweight = 0,
\ protect_floor = 0, protect_bias = 16,
\ dering = -80, dering_weight= 1.0, dering_floor = 8, dering_bias=12,
\ detail_floor = 10, EQ = 2,
\ warp_Y = false, warp_UV = false, exborder = false,
\ debug= "protect | dering | compareH|V | showall",
\ cropx=64, cropy=32
\ )

crop( 10, 76, -12, -72)

return last


any sugessions what to do now.:confused:

LaTo
7th July 2008, 17:57
Oops before i saw only the preview of script in megui & i said it works.

now a problem when i load avs file in megui it showed.

http://i187.photobucket.com/albums/x20/srini07/Error2.jpg

i gave yes


after that the job shows error.:confused:
[/CODE]

any sugessions what to do now.:confused:

MOD16:
-------
width / 16 = int
height / 16 = int

YOUR SOURCE:
--------------
1002 / 16 = float
392 /16 = float

FIX:
----
Replace crop( 10, 76, -12, -72) by crop(16, 78, -16, -78)
OR
Add this line after crop: Lanczosresize(992,384)

San07
8th July 2008, 21:47
Thank's After changing Crop it gave same message after giving yes it Worked.

Brother Darrell
5th October 2008, 17:28
BTW, iiP is a real Dinosaur, I consider it pretty much outdated.

What is being suggested as a replacement?

Sagekilla
6th October 2008, 00:45
Try any one of the very similar MVTools based cleanup functions -- TemporalDegrain, mcspuds, MCTemporalDenoise. Most of them are all very similar to each other in their core components: MVDegrain being used as a major component for the denoising, in varying stages

espy2
26th May 2009, 11:35
Got it working basically OK meaning I get a result with no error messages but the image quality is odd - looks like an impressionist painting (blotchy detail). Source video was noisy DV footage (PAL 16-9 720x576) rendered via AviSynth's TDeint(mode=0) to 25p stored as HuffYuv (result looked good). Maybe "iip" is being upset by the noise?

Please, for uprezzing noisy DV footage, what is my best overall strategy or what iip settings are recommended? Without understanding the iip code in detail I see it uses some motion estimation etc. so I wonder if it could be persuaded to do deinterlacing and temporal denoising at the same time as uprezzing (I don't ask much!) or if instead I need to do these things as pre-iip processing stages (like my current TDeint stage).

Any help appreciated.

th3obr0
9th June 2009, 23:37
I get a really sharp image at first, and then on moving the slider in AvsP, it crashes.

I am unable to use iip. I guess it's pretty heavy for my laptop :confused:.

uzair_rock
4th September 2009, 16:12
Guys im having a problem while using the iip function.
Im using it in Avisynth for ripping dvd and also upscaling it to 720p, Avisynth is giving me the following error:
"AviSynth Script Error:
The Script's return was not a video clip"

The script im using in AviSynth is as follow:

Import("C:\Program Files\AviSynth 2.5\plugins\iip.avs")

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\UnDot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\WarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LoadPluginEx.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DustV5.dll")

DGDecode_mpeg2source("C:\Documents and Settings\Uzair\My Documents\Video enhancement tools\PROJECT\New Folder (2)\sample2.d2v", info=3)
ColorMatrix(hints=true, interlaced=true, threads=0)
tfm(order=1).tdecimate()
crop( 2, 10, -6, -8)

Spline64Resize(720,480) # Spline64 (Sharp)

iip( dest_x= 720, dest_y= 480,
\ ss1_x = 1.414, ss1_y = 1.414,
\ duststr = 0, dustweight = 0, antiflicker1= true, antiflicker2= true,
\ detailcontr1=127, detailcontr2 = 255, contr_radius = 3, PixSharp=0.25,
\ ss2_x = 3.5, ss2_y = 3.5,
\ Xstren = 255, Xlimit = 255,
\ subpelstren= 1.0, flatweight = 64,
\ protect_floor= 4, protect_bias = 16,
\ dering = -60, dering_weight= 1.0, dering_floor = 16, dering_bias=8,
\ detail_floor= 1, EQ = 2,
\ warp_Y = false, warp_UV = false,
\ debug= "showall | compareH/V | protect | dering",
\ cropx=32, cropy=16
\ )

Can anyone please tell what am i missing and why this error is occuring?

Adub
4th September 2009, 18:14
Are you sure that your stored iip.avs script is complete, and has no missing return calls at the end?

uzair_rock
4th September 2009, 18:31
Yes i am, here's my iip.avs :

function iip( clip clp,
\ int "dest_x", int "dest_y",
\ int "duststr", float "dustweight",
\ float "ss1_x", float "ss1_y",
\ int "detailcontr1", int "detailcontr2",
\ int "contr_radius", float "PixSharp",
\ float "ss2_x", float "ss2_y",
\ int "Xstren", int "Xlimit",
\ float "subpelstren", int "flatweight",
\ bool "antiflicker1", bool "antiflicker2",
\ int "protect_floor",int "protect_bias",
\ int "dering", float "dering_weight",
\ int "dering_floor", float "dering_bias",
\ int "detail_floor",
\ int "EQ", bool "exborder",
\ bool "warp_Y", bool "warp_UV",
\ string "debug",
\ int "cropx", int "cropy"
\ )
{
ox = clp.width
oy = clp.height
xcorr=(int(ox/16.0+.9999)*16)-ox
ycorr=(int(oy/ 8.0+.9999)* 8)-oy
dest_x = default(dest_x, clp.width)
dest_y = default(dest_y, clp.height)
ss1_x = default(ss1_x, 1.414)
ss1_y = default(ss1_y, 1.414)
ss2_x = default(ss2_x, 3.5)
ss2_y = default(ss2_y, 3.5)
duststr = default(duststr, 2)
dustweight = default(dustweight, 1.0)
antiflicker1= default(antiflicker1, true)
antiflicker2= default(antiflicker2, true)
Xlimit = default(Xlimit, 255) # SS<3 ? 23 : 255
Xstren = default(Xstren, 255) # SS<3 ? 216 : 255
detailcontr1= default(detailcontr1, 104)
detailcontr2= default(detailcontr2, 208)
contr_radius= default(contr_radius, 2)
PixSharp = default(PixSharp, 0.4)
subpelstren = default(subpelstren, 1.58)
flatweight = default(flatweight, 0)
protect_floor=default(protect_floor, 0)
protect_bias= default(protect_bias, 16)
dering = default(dering, -80)
dering_floor= default(dering_floor, 8)
dering_floor= dering<0 ? dering_floor*2 : dering_floor
dering_bias = default(dering_bias, 16)
dering_weight=default(dering_weight, 1.0)
detail_floor= default(detail_floor, 20)
EQ = default(EQ, 2)
EQ = (EQ>3) ? 3 : EQ
exborder = default(exborder, false)
warp_Y = default(warp_Y, false)
warp_UV = default(warp_UV, false)
debug = default(debug, "Mickey Mouse")
cropx = default(cropx, 40)
cropy = default(cropy, 20)

cropx=int(cropx/4)*4
cropy=int(cropy/4)*4
xx_ss1 = int(ox*ss1_x/16+.5)*16
yy_ss1 = int(oy*ss1_y/16+.5)*16
xx_ss2 = int(ox*ss2_x/16+.5)*16
yy_ss2 = int(oy*ss2_y/16+.5)*16
xx_small = int(ox/(abs(dering)/80+1.0)/16+.5)*16 + 32
yy_small = int(oy/(abs(dering)/80+1.0)/16+.5)*16 + 16
}

uzair_rock
4th September 2009, 19:25
Here is the iip.avs :

function iip( clip clp,
\ int "dest_x", int "dest_y",
\ int "duststr", float "dustweight",
\ float "ss1_x", float "ss1_y",
\ int "detailcontr1", int "detailcontr2",
\ int "contr_radius", float "PixSharp",
\ float "ss2_x", float "ss2_y",
\ int "Xstren", int "Xlimit",
\ float "subpelstren", int "flatweight",
\ bool "antiflicker1", bool "antiflicker2",
\ int "protect_floor",int "protect_bias",
\ int "dering", float "dering_weight",
\ int "dering_floor", float "dering_bias",
\ int "detail_floor",
\ int "EQ", bool "exborder",
\ bool "warp_Y", bool "warp_UV",
\ string "debug",
\ int "cropx", int "cropy"
\ )
{
ox = clp.width
oy = clp.height
xcorr=(int(ox/16.0+.9999)*16)-ox
ycorr=(int(oy/ 8.0+.9999)* 8)-oy
dest_x = default(dest_x, clp.width)
dest_y = default(dest_y, clp.height)
ss1_x = default(ss1_x, 1.414)
ss1_y = default(ss1_y, 1.414)
ss2_x = default(ss2_x, 3.5)
ss2_y = default(ss2_y, 3.5)
duststr = default(duststr, 2)
dustweight = default(dustweight, 1.0)
antiflicker1= default(antiflicker1, true)
antiflicker2= default(antiflicker2, true)
Xlimit = default(Xlimit, 255) # SS<3 ? 23 : 255
Xstren = default(Xstren, 255) # SS<3 ? 216 : 255
detailcontr1= default(detailcontr1, 104)
detailcontr2= default(detailcontr2, 208)
contr_radius= default(contr_radius, 2)
PixSharp = default(PixSharp, 0.4)
subpelstren = default(subpelstren, 1.58)
flatweight = default(flatweight, 0)
protect_floor=default(protect_floor, 0)
protect_bias= default(protect_bias, 16)
dering = default(dering, -80)
dering_floor= default(dering_floor, 8)
dering_floor= dering<0 ? dering_floor*2 : dering_floor
dering_bias = default(dering_bias, 16)
dering_weight=default(dering_weight, 1.0)
detail_floor= default(detail_floor, 20)
EQ = default(EQ, 2)
EQ = (EQ>3) ? 3 : EQ
exborder = default(exborder, false)
warp_Y = default(warp_Y, false)
warp_UV = default(warp_UV, false)
debug = default(debug, "Mickey Mouse")
cropx = default(cropx, 40)
cropy = default(cropy, 20)

cropx=int(cropx/4)*4
cropy=int(cropy/4)*4
xx_ss1 = int(ox*ss1_x/16+.5)*16
yy_ss1 = int(oy*ss1_y/16+.5)*16
xx_ss2 = int(ox*ss2_x/16+.5)*16
yy_ss2 = int(oy*ss2_y/16+.5)*16
xx_small = int(ox/(abs(dering)/80+1.0)/16+.5)*16 + 32
yy_small = int(oy/(abs(dering)/80+1.0)/16+.5)*16 + 16
}

Sagekilla
4th September 2009, 19:35
That looks highly incomplete. You have a bunch of stuff going on but no filtering whatsoever.

Gavino
4th September 2009, 19:48
Yes, it's clearly incomplete.

Compare with the version in post#105 (http://forum.doom9.org/showthread.php?p=517100#post517100) of this thread.

uzair_rock
4th September 2009, 20:28
im sorry guys i got the full script from the above mention post, but now im having a script error:

Avisynth script error:
maskedmerge does not have a named argument "useMMX"
(C:\Program Files\AviSynth 2.5\plugins\iip.avs, line 164)

The error is now from the iip.avs, what can it be?

uzair_rock
4th September 2009, 21:40
well i resolved the above problem.
can we use seesaw and limtedsharpenfaster at the same time? and which is better to use under what conditions??

matfra
23rd July 2012, 17:30
Hi guys,
Im trying to test ipp.avs
But it keep telling me errors. I copied the script from page 6, but still issue.
Can someone upload a working avs so we can download it easy. I never understood why people just past script. This script is massive. It should be downloadble and well document. I have to look on many pages to find part of script.

Boulotaur2024
23rd July 2012, 18:04
iip is really old and dated as mentionned in this very page, you will never get support for that.
You might want to use a combination of :

- Resizers Functions Pack (http://www.mediafire.com/?rz047g74fis5el9)
- SMDegrain for denoising + Sharpening (its 'Contrasharp" parameter set to > 50)
- SmoothAdjust for the levels correction