I have two vectors of a large, but arbitrary (v1.length need not equal v2.length), number of points, and I want to pairwise multiply them. Because this is the main bottleneck in a large loop of AS3 code, I thought I would try to pull out the code and run it async via Pixel Bender. Now, to represent the data I would have two image2 variables as input.
How can I get a pixel from one image and do the calculations with each pixel of the other image? I am just learning Pixel Bender, so I may have overlooked some work around for looping.
EDIT: Perhaps I need to clarify. Let's say I have something like this
var v1:Vector.<Point> = ...;
var v2:Vector.<Point> = ...;
var result:Vector.<Point> = ...;
for (var i:int = 0; i < v1.length; ++i)
for (var j:int = 0; j < v2.length; ++j)
result[i] += v1[i] * v2[j];
This is a nested loop--how can I emulate it in Pixel Bender?
Loops and nested loops (other than those built-in) are prohibited in pixel bender for flash.
http://forums.adobe.com/thread/840318
http://blog.leeburrows.com/2011/02/pixelbender-filters-3/
I guess the exception is pixelbender 3D, which is in beta and designed to be used with the molehill API's.
EDIT
Here are links that are official Adobe docs that explicitly confirm the above:
From page 17:
Pixel Bender in Flash Player does not support: -> loops or control structures other than if and else.
This was a real bummer for me when I found out myself and I think this is a major failure on Adobe's part.