Can you spot why is this code several times slower in v3.5.5 (and 3.5.4) than v3.36? Is there some version specific optimizations I should implement?
I measured speed difference 3...5 times on different size images (My system is XP SP3, Core2Duo, 3.5 GB).
Below effect is actually stripped down to just call AddNoiseEffect and render the result.
In v3.36 it renders fast.
In v.3.5.5 (and 3.5.4) it is slow.
Codelab designed effect:
#region UICode
int Amount1 = 50; // [0,100] Amount
#endregion
unsafe void Render(Surface dst, Surface src, Rectangle rect)
{
// Setup for calling the Noise function
AddNoiseEffect noiseEffect = new AddNoiseEffect();
PropertyCollection nProps = noiseEffect.CreatePropertyCollection();
PropertyBasedEffectConfigToken nParameters = new PropertyBasedEffectConfigToken(nProps);
nParameters.SetPropertyValue(AddNoiseEffect.PropertyNames.Intensity, 40);
nParameters.SetPropertyValue(AddNoiseEffect.PropertyNames.Saturation, 0);
nParameters.SetPropertyValue(AddNoiseEffect.PropertyNames.Coverage, 100.0);
noiseEffect.SetRenderInfo(nParameters, new RenderArgs(dst), new RenderArgs(src));
// Call the Noise function
noiseEffect.Render(new Rectangle[1] {rect},0,1);
// Now in the main render loop, the dst canvas has a noisy version of the src canvas
for (int y = rect.Top; y < rect.Bottom; y++)
{
ColorBgra* srcPtr = src.GetPointAddressUnchecked(rect.Left, y);
ColorBgra* dstPtr = dst.GetPointAddressUnchecked(rect.Left, y);
for (int x = rect.Left; x < rect.Right; x++)
{
ColorBgra DstPixel = *dstPtr;
ColorBgra SourcePixel = *srcPtr;
// will render some more stuff here
*dstPtr = DstPixel;
srcPtr++;
dstPtr++;
}
}
}