pix_compare will do something similar by comparing the luma of each pixel in two streams, and either copies the right pixel if it's lighter ('direction 1') or darker ('direction 0'). You could possibly modify that code to your needs as well.
i'll have a look at it ...
also, is there a way to analyze frames (to get the average brightness or something similar)?
I wrote some basic analysis objects like that a few years ago, but they didn't seem all that useful. They were part of the yuv_ objects, which are no longer part of GEM, but they are still in CVS under some old branches.
Is there any general interest in having some specialized objects like this in GEM? They are simple to write and quite easy to code up in SIMD for speed.
i'm interested in some functions to analyze video frames ... i'm working on an audiovisual installation that is supposed to control video by sound and vice versa ... in which branches will i can find the yuv_ objects? also, i don't know, if it's good to remove objects from the sources ... maybe it's better to have a second library of Gem objects e.g. like pidip for pdp ...
cheers ... tim