Recomputing EdgeCue in grabcuNPP?

I am tracing grabCutNPP in CUDA SDK

I found that in the function “computeSegmentationFromTrimap”, it will compute the EdgeCue in every iteration.
But the input of EdgeCue (edge_strength and d_image) should not be change in this iterative process.
So its output (d_top, d_bottom, d_left_transposed, d_right_transposed, …) should be static, right?

I try to extract the EdgeCue outside the while loop and let it just execute once in whole process, but the result will be strange.
Recomputing EdgeCue

, without recomputing EdgeCue

The reason I can only wonder is that the nppiGraphcut function change the outputs of EdgeCue, but I am not sure.

Can someone tell me where is the problem?

My enviroment:
Win7 SP1
CUDA 4.1
Visual Studio 2010
GT 430

The attachment is the code I’ve modified from original SDK file.
GrabCut.cpp (13.8 KB)