On 08/05/2005, at 03:49:22, Pierre-Olivier Latour wrote:
I took my video layering thing from before and added masked each
frame with a CI Kernel taking in some random mask (currently a
circle) and outputting that, I also had to change the depth
buffering to not have the rectangle clip.
First of all, is the CI Kernel the fastest way to do this? or
should I be using Blend With Mask?
General rule is that, if there's already a Core Image filter that
does what you need, you should use it as it has been written by us
and will be optimal - that does not say you cannot write efficient
kernels, but it's less work :)
Secondly, I noticed it was getting a bit slow with many layers, so
I tried to pull the masking out of the loop, and only do it once
per frame. I saw no way to do this in the current composition so I
made a new one that takes an image as input, masks it with the CI
kernel, and outputs an image. I instantiated a QCRenderer with
this composition, then in the renderAtTime: method when I get a
frame from the quicktime player, I apply the mask using the new
composition, and then add that image into the array and then feed
it into the old composition. I've found the performance from this
to be terrible, even compared to the CI kernel working on each
frame every time the main composition is rendered, which seems silly.
That's because -valueForOutputKey will always output a NSImage for
Image ports and that kills performance when chaining compositions
this way.
This probably sounds overcomplicated, but basically I think it
comes down to the fact that extracting an Image from a QCRenderer
hinders performance if you want to use that image in another
QCRenderer because it can only be an NSImage, and I want to get
around this. If you want a copy of the project I'll put it up
somewhere.
Your analysis is correct, and unfortunately given the current API
lacks a way to specify how you would like to retrieve the images
produced by a composition, there's no way to do that.
Ok, I've filed it as a bug (4111911) since I think it's a really
serious issue.