Closed myrsloik closed 9 years ago
I got it.
Btw, you should pass the source frame instead of NULL to newVideoFrame(2) too or the frame properties won't be propagated properly. Did I annoy you yet?
Oh and I think https://github.com/Khanattila/KNLMeansCL/blob/master/KNLMeansCL/KNLMeansCL.cpp#L712 is a double free of the src frame since you free it again later
The basic structure I had copied from another plugin. I must have seen NULL and then left. Btw do a thing like this:
src = vsapi->getFrameFilter(n, d->node, frameCtx);
src = vsapi->getFrameFilter(n-1, d->node, frameCtx);
vsapi->freeFrame(src);
src = vsapi->getFrameFilter(n, d->node, frameCtx);
vsapi->freeFrame(src);
It does not create memory leaks?
Every getFrameFilter() must have a matching freeFrame() call. I looked at your code again and I guess I got confused by the variable reuse. I think it doesn't leak frames.
https://github.com/Khanattila/KNLMeansCL/blob/master/KNLMeansCL/KNLMeansCL.cpp#L691
You don't have to use vs_bitblt to copy planes, you can use newVideoFrame2 and you simply reference the old planes.
See this line for an example: https://github.com/vapoursynth/vapoursynth/blob/master/src/core/lutfilters.cpp#L310