-
-
Save uploadcare-user/84374075d857a72ae4e65ec11fe2f3d4 to your computer and use it in GitHub Desktop.
Unfolding loops and branching, optimization 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (xx = 0; xx < imOut->xsize; xx++) { | |
if (imIn->bands == 4) { | |
// Body, 4-band images | |
} else if (imIn->bands == 3) { | |
ss0 = 0.0; | |
ss1 = 0.0; | |
ss2 = 0.0; | |
for (x = (int) xmin; x < (int) xmax; x++) { | |
ss0 = ss0 + (UINT8) imIn->image[yy][x*4+0] * k[x - (int) xmin]; | |
ss1 = ss1 + (UINT8) imIn->image[yy][x*4+1] * k[x - (int) xmin]; | |
ss2 = ss2 + (UINT8) imIn->image[yy][x*4+2] * k[x - (int) xmin]; | |
} | |
ss0 = ss0 * ww + 0.5; | |
ss1 = ss1 * ww + 0.5; | |
ss2 = ss2 * ww + 0.5; | |
imOut->image[yy][xx*4+0] = clip8(ss0); | |
imOut->image[yy][xx*4+1] = clip8(ss1); | |
imOut->image[yy][xx*4+2] = clip8(ss2); | |
} else { | |
// Body, 1- and 2-band images | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment