Altera_Forum
Honored Contributor
19 years agoSome questions about C2H
When I used C2H to accelerate my code,I met some problems.
I chose a fuction to accelerate,but the report told me that:"The code does not contain any loop...".But it has 6 loops. I don't know what's wrong.Please help me.Thank you! -------------------------------------My code below------------------------------------------- void HistogramEql(alt_16 nWidth, alt_16 nHeight, alt_u8 *lpInput, alt_u8 *lpOutput) { alt_16 x, y; # define Point1(x, y) lpInput[(x) + (y) * nWidth] # define Point(x, y) lpOutput[(x) + (y) * nWidth] alt_16 r[256], s[256]; alt_16 i; i=0; do{ r=s=0; i++; }while(i<256); for (y = 0; y < nHeight; y++) { for (x = 0; x < nWidth; x++) { r[Point1(x, y)]++; } } s[0] = r[0]; for (y = 1; y < 256; y++) { s[y] = s[y - 1]; s[y] += r[y]; } for (y = 0; y < nHeight; y++) { for (x = 0; x < nWidth; x++) { Point(x, y) = s[Point1(x, y)] * 255 / nWidth / nHeight; } } }