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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th April 2024, 23:06   #2821  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,574
Do we still need to declare SetMemoryMax?

I mean, almost 70% of the computers are now 64-bit with gazillions of GBs of RAM.

Is it of any use? Can't we simply let modern Windows to manage memory?
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 16th April 2024, 23:20   #2822  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,781
You can probably omit it quite safely. Avisynth uses a convenient default.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old Yesterday, 04:47   #2823  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,731
The default is quite conservative and is sometimes not enough if you work on 4K sources with heavy filtering and use multithreading. There's no real harm setting the max higher if you have the memory available, Avisynth will use what it needs and not all of it automatically.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old Yesterday, 12:16   #2824  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,574
Perhaps I didn't explain well.

I know I can set it as I want but, seen VaporSynth memory use, why can't AVS+ go that way too and send Setmemorymax to ancient memories?
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old Yesterday, 12:17   #2825  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,574
Quote:
Originally Posted by Boulder View Post
The default is quite conservative and is sometimes not enough if you work on 4K sources with heavy filtering and use multithreading.
I can't find my post but, some years ago, I did some tests where I saw performance decrease with Setmemorymax increase.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old Today, 00:09   #2826  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,903
Quote:
Originally Posted by tormento View Post

I know I can set it as I want but, seen VaporSynth memory use, why can't AVS+ go that way too and send Setmemorymax to ancient memories?
It's already ancient memory.
There's no need to set it, Avisynth will manage that automatically.
By default, in modern x64 systems, it will use 4GB of RAM which is plenty.
Remember that this is the memory of the cache, in other words the memory used to store frames without having to fetch them again, NOT the RAM used by filters in general. This means that even if you were to set SetMemoryMax(512) but you were heavily filtering a UHD content, Avisynth would still use way more than 512MB of RAM. Remember that the cache is there only so that if you have temporal filters and encoders that need to access frames in a non linear fashion, Avisynth won't have to compute them every single time it moves forward and backward and forward and backward etc. The bigger the cache the more frames are gonna be stored, but storing too many frames can be detrimental as it's gonna use RAM that could otherwise be used by - let's say - the encoder, which is why the cache size is calculated on the fly on the basis of the available RAM and it never exceeds 4GB.

Assuming RGB48 (which is overkill anyway), we have:

3840×2160×48 = 398131200 bits = 0.0498 gigabyte

That's just for one frame, so at the current default Avisynth can cache more than 80 frames. Obviously working with RGB48 UHD is a bit unrealistic, but if we work in YUV that number increases and it even goes much further if we work in 8bit and at lower resolutions.
My point is that it's already implemented correctly and I don't see a reason to change that. If anything, having the SetMemoryMax() is useful if you wanna reduce the cache.
FranceBB is offline   Reply With Quote
Old Today, 04:20   #2827  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,062
It looks you not understand how frame-based AVS+ MT is working.

To make things as fast as possible (to minimize CPU stall on threads sync) it looks AVS+ simply put several frames cache around _each_ filter in the filtergraph and in _each_ logical thread. So any time system have some free logical CPU cores it can load it with some useful computing.

But it cause awful RAM consuming in any 'complex' scripts of a several filters in a chain.

Total RAM in a cache is about NumFrames_in_Prefetch_x_NumFilters_x_NumThreads_x_FrameSize.
DTL is offline   Reply With Quote
Old Today, 04:59   #2828  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,731
Regarding the 4GB, which is unfortunately not enough in many cases: https://forum.doom9.org/showthread.p...75#post1913375
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder 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:16.


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