Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th August 2008, 12:13   #41  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
Quote:
Originally Posted by neuron2 View Post
I haven't seen tsp in a while, so I made the patch. Try this and let me know how it works.

http://neuron2.net/misc/VariableBlur.dll
Thanks for giving it a try! Alas, it seems the memory leak is not fixed.

Playing this script in Vdub & eyeballing memory usage in TaskManager:
Code:
SetMemoryMax(64)

# LoadPlugin(" ... \VariableBlur_v04.dll")
  LoadPlugin(" ... \VariableBlur_memfix1.dll")

ColorBars(pixel_type="YV12")

b1 = BinomialBlur(vary=2.5,varc=2.5,Y=3,U=3,V=3)
b2 = BinomialBlur(vary=3.5,varc=3.5,Y=3,U=3,V=3)
b3 = BinomialBlur(vary=5.5,varc=5.5,Y=3,U=3,V=3)
b4 = BinomialBlur(vary=8.0,varc=8.0,Y=3,U=3,V=3)

merge( merge(b1,b2), merge(b3,b4) )

return( last )
After loading the script, VD occupies ~40.000 K virtual memory.

After ~2000 frames, it's ~200.000 K. After ~8000 frames, it's ~500.000 K, and keeps growing.


All I can guesstimate is that it's related to the "repeated" appliance of the 5x5 kernel filter: when using only small variances (all vary,varc = 1.0, which can be computed with one single instance of a 5x5 kernel), then memory usage consolidates at ~112.000 K after ~700 frames, and doesn't grow any more.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 20th August 2008, 12:53   #42  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
OK, I'm away on business. I'll fix it up when I return. I didn't test it, just found a new without a delete. I'll do some testing this time.
Guest is offline   Reply With Quote
Old 23rd August 2008, 06:54   #43  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
OK, please try again with the same link as above. It climbs at first and then stabilizes.
Guest is offline   Reply With Quote
Old 30th August 2008, 12:45   #44  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
Oops, time goes by so fast.

It seems your changes fixed the problem, memory usage is stable now. Thank you very much!

If you could up the changed sources, we could update the common places (Warpenterprises and tsp's page, if we get them).
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 30th August 2008, 13:19   #45  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Quote:
Originally Posted by Didée View Post
If you could up the changed sources, we could update the common places (Warpenterprises and tsp's page, if we get them).
See here:

http://neuron2.net/misc/VariableBlur.zip

Thank you for your test results.
Guest is offline   Reply With Quote
Old 16th October 2008, 07:50   #46  |  Link
45tripp
Dolphin Blue
 
45tripp's Avatar
 
Join Date: Mar 2007
Posts: 336
with variableblur, (both neuron2's last build and tritical's)
calling gaussianblur() and unsharp()
results in the error:
evaluate: system exception - access violation

anyone else get that?

edit:
avisource("blah")
gaussianblur()
__________________
injected with feelings; with no final fading

Last edited by 45tripp; 16th October 2008 at 08:50. Reason: script post
45tripp is offline   Reply With Quote
Old 16th October 2008, 08:29   #47  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 16th October 2008, 09:33   #48  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
Works fine here. Do you get that error immediately upon loading the script, or at some point during processing?

Poke in the blue - perhaps it's related to fftw3.dll in /system32, resp. to the version of that dll? I vaguely remember that there had been updates of that dll, but then there had been discussions about some problems...
I've an (supposely) older version of it -- file date 2004-01-30, size 1589 kB (Dll does not show a version number in its properties).
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 16th October 2008, 22:14   #49  |  Link
45tripp
Dolphin Blue
 
45tripp's Avatar
 
Join Date: Mar 2007
Posts: 336
Quote:
Originally Posted by Didée View Post
Works fine here. Do you get that error immediately upon loading the script, or at some point during processing?
immediate

Quote:
Originally Posted by Didée View Post
Poke in the blue - perhaps it's related to fftw3.dll in /system32, resp. to the version of that dll?
good guess.
don't remember where i got the one i'd been working with.
it's got a 2008 date.
but the one hosted at warpenterprises works.


ty
tripp
__________________
injected with feelings; with no final fading
45tripp is offline   Reply With Quote
Old 29th November 2008, 22:11   #50  |  Link
PeaceAnt
also known as GrassHoppeR
 
Join Date: Mar 2006
Location: Poland
Posts: 30
Quote:
Originally Posted by bartrobinson View Post
You know what would be really cool? If you could adjust the radius based on the luminance of a secondary clip input.
does anybody work upon this filter?

pozdrawiam
PeaceAnt is offline   Reply With Quote
Old 30th November 2008, 17:45   #51  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
You could futz something in like this, (in pseudo code):

luma = getLuminance(clip2)
strength = (luma < thr1) ? value1 : (luma < thr2) ? value2: (luma < thr3) ? value3: value4
Gaussianblur(strength)

replace thr1-4, value1-4 with appropriate thresholds/strengths, and then find some function that would get the luminance level of second clip and return a number.

All very easy.


Edit: If I could figure out why the hell my avisynth throws an error every time I try to call AverageLuma(), I could make a better script but here's an example for you:
Code:
Avisource("..")
clip1 = last
clip2 = clip1.SomeFilter() # or another source clip.
luma = AverageLuma(clip2)

thresh1 = 30
thresh2 = 60
thresh3 = 120
thresh4 = 200
str1 = 5
str2 = 4
str3 = 3
str4 = 4
str5 = 6

strength = (luma <= 30) ? str1 : (luma <= 60) ? str2 : (luma <= 120) ? str3 : (luma <= 200) ? str4 : str5
GaussianBlur(strength)
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame.

Last edited by Sagekilla; 30th November 2008 at 18:03.
Sagekilla is offline   Reply With Quote
Old 30th November 2008, 19:36   #52  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by Sagekilla View Post
If I could figure out why the hell my avisynth throws an error every time I try to call AverageLuma(), I could make a better script but here's an example for you
AverageLuma can only be called inside run-time filters like ScriptClip.
Gavino is offline   Reply With Quote
Old 30th November 2008, 19:50   #53  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Quote:
Originally Posted by Sagekilla View Post
Edit: If I could figure out why the hell my avisynth throws an error every time I try to call AverageLuma(), I could make a better script but here's an example for you:
Look at http://avisynth.org/mediawiki/Runtime_environment
LaTo is offline   Reply With Quote
Old 30th November 2008, 23:52   #54  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
Ah that explains things a lot. Thanks.

The idea more or less remains the same. Use a function to get the luminance level, then use the strength you want for whatever threshold it is.
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame.
Sagekilla is offline   Reply With Quote
Old 1st December 2008, 01:26   #55  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
Think a little further out of the box. Varying the radius on a per-frame basis is not very interesting.

The interesting idea is to vary the radius on a per-pixel level, i.e. the control clip tells which radius to use for processing each pixel of the source clip.
Which is impossible to construct through a script, it requires plugin support.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 1st December 2008, 02:50   #56  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,348
You can fake it with makstools, but it will be between 2 and 256 times slower, depending upon how much precision you fake it with.
*.mp4 guy is offline   Reply With Quote
Old 1st December 2008, 08:48   #57  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
hmm... interesting. you feed it an alpha channel and it blurs according to it's brightness.

i see possibilities with fake depth of field using mvtools to construct a depth map...
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 1st December 2008, 09:06   #58  |  Link
PeaceAnt
also known as GrassHoppeR
 
Join Date: Mar 2006
Location: Poland
Posts: 30
i did it with pure avisynth: http://forum.doom9.org/showthread.php?t=143186
but it's still a fake. i'm dreamin' about real compound blur plugin. xmas coming soon...

pozdrawiam
PeaceAnt is offline   Reply With Quote
Old 4th December 2008, 10:48   #59  |  Link
PeaceAnt
also known as GrassHoppeR
 
Join Date: Mar 2006
Location: Poland
Posts: 30
Quote:
Originally Posted by Didée
The interesting idea is to vary the radius on a per-pixel level, i.e. the control clip tells which radius to use for processing each pixel of the source clip.
Which is impossible to construct through a script, it requires plugin support.
Quote:
Originally Posted by Mug Funky
hmm... interesting. you feed it an alpha channel and it blurs according to it's brightness.
here's my plugin that averages number of pixels according to value of alpha channel with 1/16 pixel precision.
http://members.lycos.co.uk/grasshopper/dof/ <-example and files
http://members.lycos.co.uk/grasshopper/dof/ghrchb.dll <-GHRCompoundHBlur plugin
http://members.lycos.co.uk/grasshopp...poundHBlur.cpp <-source code

it works only in x-axis and needs some optimalization (or maybe ass and mmx code? ) but it WORKS!

what you think?

below is the main loop code. maybe someone has an issue how to improve its speed, blurring near the edge and so, that you can find it useful too. but first of all it must not crash! i'm not experienced cpp writer so please check my source code.

Code:
		for (i=0; i < (src_height-32); i++) {
			for (w=64; w<(src_width-64); w+=4) {

			v = *(srcp + w + 3);
			a = (v & 15);
			b = (v & 240)>>2;

			ub = a*(*(srcp + w - b - 4)+*(srcp + w + b + 4));
			ug = a*(*(srcp + w - b - 3)+*(srcp + w + b + 5));
			ur = a*(*(srcp + w - b - 2)+*(srcp + w + b + 6));

lb=lg=lr = 0;
for (j=-b; j<=b; j+=4){
lb+=*(srcp + w+j);
lg+=*(srcp + w+j+1);
lr+=*(srcp + w+j+2);
}
n = 16+v+v;
*(dstp + w) = (lb*16+ub)/n;
*(dstp + w+1) = (lg*16+ug)/n;
*(dstp + w+2) = (lr*16+ur)/n;
*(dstp + w+3) = v;
		}
srcp+=src_pitch;
dstp += dst_pitch;
	}
pozdrawiam
PeaceAnt is offline   Reply With Quote
Old 4th December 2008, 18:12   #60  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
try replace slow dividing by approximation: multiplication with shift.

like this:

n=...
d=(1<<16)/n;

*(dstp+w)= ((lb*16+ub)*d)>>16
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:02.


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