-
Notifications
You must be signed in to change notification settings - Fork 84
Description
Where possible it is better for data locality in CPU caches to process data in the smallest possible chunks in each filter in a filterchain. Currently for multi-planes formats we have natural plane-granularity and if filters do not use inter-plane dependency the filter manager may try to process data between filters as a chain of plane processing instead of a frame (set of planes).
This may need AVS filters API update:
- Checking method like bool IsPlaneBasedProcessingSupported(void) to ask filter if it can process single plane of multi-planes formats at the filter graph creation.
- Maybe a new GetPlane() method to request plane only processing. Maybe some hack is possible to feed a set of single-plane formats to filter and use standard GetFrame() method. But it may need to create several instances of a filter for each plane and it may cause other performance issues. But this enables us to use any old filters without changes. This may be sort of script-based method:
p1,p2,pn=SeparatePlanes()
p1=Filter1(p1)
p1=Filter2(p1)
p2=Filter1(p2)
p2=Filter2(p2)
pn=Filter1(p1)
pn=Filter2(pn)
CombinePlanes(p1,p2,pn) where Filter2 interconnects with Filter1 with GetFrame() methods as today but process only 1 plane each time.
Example of filter-chain with plane-based processing between 2 filters (example for 1D resize filters) - https://github.com/DTL2020/AviSynthPlus/blob/034a47e2c91ad9d84ad24492d37a18f99b58d996/avs_core/filters/resample.cpp#L2372
This can be expanded to a chain of other filters in total filtergraph until we reach non-supported filter or special end of chain filter-aggregator of planes at the output of AVS to consumer process. Or simply use the end of the chain filter always in frame-based processing mode. So its GetFrame() method will output fully processed all planes.