Log in

View Full Version : rendering clip in another avs is faster than in the same avs?


HolyWu
23rd January 2012, 18:48
Hi there. Sorry if this question has already been answered somewhere. If so, please kindly drop me a link. :thanks:

Firstly, here is A.avs script:

FFVideoSource("foo.mkv")
denoised = NLMeansCL(h=0.9)
ContraSharpening(denoised, last)
Trim(43157, 43876)
f3kdb(ditherC=0, keep_tv_range=true)


Output is a 30 seconds 720p24 video. Encode A.avs with the following x264 command-line and get encoding speed of 2.66 fps:

x264 --preset veryslow --tune film --crf 18 --keyint 240 --min-keyint 24 --bframes 3 --ref 8 --no-fast-pskip --colormatrix bt709 --sar 1:1


Then, here is B.avs script:

FFVideoSource("foo.mkv")
denoised = AVISource("denoise.avs")
ContraSharpening(denoised, last)
Trim(43157, 43876)
f3kdb(ditherC=0, keep_tv_range=true)

and denoise.avs script:

FFVideoSource("foo.mkv")
NLMeansCL(h=0.9)


Source is the same video. Encode B.avs with the same x264 command-line as above and get encoding speed of 6.01 fps. :eek:

I have also tried denoising with MDegrain2(no prefiltering) and got the same effect: 3.18 fps v.s. 6.63 fps.

So why is there a big speed difference between these two manner :confused:

AviSynth version is official 2.6.0 ST.

pbristow
23rd January 2012, 20:07
At a guess, I'd say it is that in the second case you're splitting the workload between two threads/processes, which can run on separate cores of your processor. In the first case, one core has to do all the work, so it takes twice as long. I'm not *sure* that's what happens when one instance of Avisynth calls another, but it seems likely.

Try using Windows Task Manager's "Performance" tab to monitor how busy your processor cores are while running each version. You'll need "View" -> "CPU History" set to to "One Graph per CPU".

pbristow
23rd January 2012, 22:31
I think you missing interesting part that his denoising filter runs on GPU...


True, but FFVideoSource doesn't. Maybe it's all that Matroska decoding that benefits from the 2nd thread/process? ;)

I'd be interested to know what Task Manager reveals, anyway.

HolyWu
24th January 2012, 04:55
Yes, the CPU usage is higher in the second case. This time I use "avs2avi -c null -o n" to test the speed, in order to exclude x264 from CPU usage. Then the speed difference is more significant, 3.88 fps v.s. 17.14 fps.

A.avs http://i41.tinypic.com/25yucn4.png
B.avs http://i44.tinypic.com/dvq9fk.png

However, this trick seems not work on LSFmod. I tried the script:

FFVideoSource("foo.mkv")
denoised = NLMeansCL(h=0.9)
LSFmod(denoised, source=last)
Trim(43157, 43876)
f3kdb(ditherC=0, keep_tv_range=true)

compared to:

FFVideoSource("foo.mkv")
denoised = AVISource("denoise.avs")
LSFmod(denoised, source=last)
Trim(43157, 43876)
f3kdb(ditherC=0, keep_tv_range=true)


The two scripts' fps is almost the same, 11.2x fps. Can't figure out why.

Bloax
24th January 2012, 07:05
Are you sure the MT versions won't benefit you?
Because you've got plenty of cores there.

Gavino
24th January 2012, 10:49
I'd be interested to know what speed you get if you replace AviSource() in B.avs with Import().
Does this make a difference?

Or even simply the equivalent script:
FFVideoSource("foo.mkv")
denoised = FFVideoSource("foo.mkv").NLMeansCL(h=0.9)
ContraSharpening(denoised, last)
Trim(43157, 43876)
f3kdb(ditherC=0, keep_tv_range=true)

HolyWu
24th January 2012, 18:34
Both Import() and FFVideoSource().NLMeansCL()'s speed are the same as A.avs :p