- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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; } } }Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you try without using the# define Point(...) macro's, and use the formulas directly. Maybe the C2H compiler is not intelligent enough??
Does the code works in software mode??- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Try to remove any ALTERA NIOS specific HAL use and also ignore# define statement.
Because C2H only accelerate the function which is purely C/C++ and used only their library. They will never work with NIOS HAL function and etc.. Best Regards, slsnios
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page