eac3to_mod
9th February 2024, 03:15
I want to have a source filter DGSource() invoke another filter as if it was invoked after DGSource() in the script. I put this at the end of Create_DecodeSource():
DGSource* dec = new DGSource(
(char*)args[0].AsString(""),
[etc.]
args[25].AsString("pq"),
args[26].AsInt(0),
(float)args[27].AsFloat(0.15f),
(float)args[28].AsFloat(0.0f),
args[29].AsString("high"),
NULL, NULL, env);
#if 1
PClip clip = env->Invoke("Filter", dec).AsClip();
return clip;
#else
return dec;
#endif
If the #if is 0 it runs as usual. If the #if is 1 it runs slow and jerkily. I determined that DGSource() is not receiving frame requests in order.
For #if 0 I get the expected sequence of requests to DGSource(): 0,1,2,3,4,5,...
For #if 1 I get the expected sequence of requests to Filter(): 0,1,2,3,4,5,...
but DGSource() is receiving from Filter(): 0,1,0,2,2,1,3,3,2,4,4,3,...
This obviously messes up DGSource(), causing her to repeat frames and go into random access to go backwards.
Filter() is a temporal filter requesting the previous, current, and next frames from Avisynth. I'm sure that is the reason for the behavior. Just wondering if there is any way to mitigate this so DGSource() is happy. If I put Filter() as a standalone filter in the script, rather than invoking it, things are fine. That makes me believe there should be a solution.
Is there a cache between DGSource() and Filter()? Seems to me that if there was this would not happen. I know about SetCacheHints() but don't know whether to put it in DGSource() or Filter(), in both, and how to do it. The documentation I have seen is confusing and I don't even know how valid it all is for the latest Avisynth+.
Hehe, I'm good with filters and not so good with Avisynth internals, so any help to resolve this would be awesomely appreciated. Thank you.
DGSource* dec = new DGSource(
(char*)args[0].AsString(""),
[etc.]
args[25].AsString("pq"),
args[26].AsInt(0),
(float)args[27].AsFloat(0.15f),
(float)args[28].AsFloat(0.0f),
args[29].AsString("high"),
NULL, NULL, env);
#if 1
PClip clip = env->Invoke("Filter", dec).AsClip();
return clip;
#else
return dec;
#endif
If the #if is 0 it runs as usual. If the #if is 1 it runs slow and jerkily. I determined that DGSource() is not receiving frame requests in order.
For #if 0 I get the expected sequence of requests to DGSource(): 0,1,2,3,4,5,...
For #if 1 I get the expected sequence of requests to Filter(): 0,1,2,3,4,5,...
but DGSource() is receiving from Filter(): 0,1,0,2,2,1,3,3,2,4,4,3,...
This obviously messes up DGSource(), causing her to repeat frames and go into random access to go backwards.
Filter() is a temporal filter requesting the previous, current, and next frames from Avisynth. I'm sure that is the reason for the behavior. Just wondering if there is any way to mitigate this so DGSource() is happy. If I put Filter() as a standalone filter in the script, rather than invoking it, things are fine. That makes me believe there should be a solution.
Is there a cache between DGSource() and Filter()? Seems to me that if there was this would not happen. I know about SetCacheHints() but don't know whether to put it in DGSource() or Filter(), in both, and how to do it. The documentation I have seen is confusing and I don't even know how valid it all is for the latest Avisynth+.
Hehe, I'm good with filters and not so good with Avisynth internals, so any help to resolve this would be awesomely appreciated. Thank you.