augment gen loopcount limit for image analysis

Diemo Schwarz's icon

I'm doing some image analysis in (message-based) gen, on an unrolled matrix copied into a jit.buffer~. (This is the only practical way I found to implement a weighted histogram.) However, already with small test images of 640 x 480, this makes for > 300000 iterations, which is larger than the security limit GENLIB_LOOPCOUNT_BAIL = 100000, and gen stops working with warning:

gen: audio processing exception: Too many iterations (runaway loop?)

How can I augment or remove this unpractical and rather artificial limit?

Matteo Marson's icon

Hi Diemo,

I don't know if this limit can be removed or edited, but a possible workaround could be to split the iteration over multiple calls. I mean something like this:

Max Patch
Copy patch and select New From Clipboard in Max.

You would have, of course, to keep track of the variables and plug them back into gen, but if you can do something similar, it should work.

EDIT:
this is a version of the patch above with a selectable number of iterations.

Max Patch
Copy patch and select New From Clipboard in Max.