PDA

View Full Version : Is there a SetBuffer command for AviSynth?


wdq4587
17th May 2002, 13:18
A long time ago, I have read the AviSynth source. It's beautiful and it's works not like most other program. It's a recursive program like LISP and prolog language. One question is it not have a internal picture buffer, every frame is get when only request. It's efficiency but not good for IVTC purpose. A IVTC program need read ahead several frames to determine 3:2 pulldown sequence, and then generate output by detect. So a frame at least need read twice. Some source cannot read twice or rewind, like FlaskMPEG. And for other source like DVD2AVI read twice(with rewind) is also time consume (for I,B,P frame). So I think it's better add a SetBuffer(number,source) internal command for AviSynth to cache the frames recently readed. Buffer is store and access by frame number. Of course it's not very useful when randomize access. But when compress it's must be useful. Of course, not only for IVTC, frame cache buffer is also useful for other filters who need read more frames before output.

I don't know whether Decomb or GreedyHMA has it' internal frame buffer.(I notice Decomb output 3 frame fast and 1 frame slowly). But I guess DoubleWeave() must have a internal buffer(1 frame size) for it need combine fields from two frames to generate one frame.

BTW. I also want to know whether DoubleWeave() (combine with other command)can process TopField first and BottomField first both now? Since I have leave doom9 forum for about 1 year. In my last test it seems complementparity() not works for this purpose.

trbarry
17th May 2002, 15:04
The way I understand it, Avisynth already buffers a number of frames internally that can be accessed by frame number. And Decomb and GreedyHMA already take advantage of this.

So GreedyHMA, for instance, looks at 6 frames at a time to determine which of 5 is the most likely duplicate to be dropped. But if the records are being processed mostly in order then they are actually being accessed from Avisynth's record cache anyway. And at least for GreedyHMA it only does this process once every 5 records as long as you don't use Trim() or other random requests.

If you compile and run Avisynth in debug mode you can watch the record access pattern and it doesn't seem to have to do extra reads in most cases.

And yes, I totally agree that Avisynth is a very nifty architecture! Ben RG has quite a right to be proud of creating that.

- Tom

dividee
17th May 2002, 20:44
That's right, avisynth caches the output of each filter in the filter graph. It uses up to 1/4 of the physical memory only for frame buffers.

About DoubleWeave and TFF/BFF, I don't know exactly what you want to do, but basically you can reorder fields or frames any way you want with avisynth, so I'm sure what you want to do is possible (even if I don't know what it is :) )

And I agree too, avisynth architecure is a real masterpiece.

wdq4587
20th May 2002, 02:48
Thanks for reply!
Of course there is one question: Why not AviSynth give a ability to let user define the buffer size (for every stream), so it will use memory more efficiently.

My another queston about DoubleWeave() is: It seems there are two type of interlaced video source, odd field first and even field first(I don't know which is most often used), but DoubleWeave() seems can only process one type. I mean add complementparity() first do not has effect for another type weave.