Leading analyst firm, KuppingerCole reviews AlgoSec's Security Policy Management Solution, and the security challenges faced by companies today in their Executive View report.
void naive_rotate(int dim, pixel *src, pixel *dst)
{
int i, j;
for (i = 0; i < dim; i++)
for (j = 0; j < dim; j++)
dst[RIDX(dim-1-j, i, dim)] = src[RIDX(i, j, dim)];
}
src[i][j]
int i, j, dst_idx;
for (i=0; i<dim; i++) {
dst_idx = (dim-1)*dim + i;
for (j=0; j<dim; j++) {
dst[dst_idx] = *src++;
dst_idx -= dim;
}
}
int i, j;
for (i = 0; i < dim; i++)
for (j = 0; j < dim; j+=32){
dst[RIDX(dim-1-j, i, dim)] = src[RIDX(i, j, dim)];
dst[RIDX(dim-1-(j+1), i, dim)] = src[RIDX(i, (j+1), dim)];
dst[RIDX(dim-1-(j+2), i, dim)] = src[RIDX(i, (j+2), dim)];
dst[RIDX(dim-1-(j+3), i, dim)] = src[RIDX(i, (j+3), dim)];
dst[RIDX(dim-1-(j+4), i, dim)] = src[RIDX(i, (j+4), dim)];
dst[RIDX(dim-1-(j+5), i, dim)] = src[RIDX(i, (j+5), dim)];
dst[RIDX(dim-1-(j+6), i, dim)] = src[RIDX(i, (j+6), dim)];
dst[RIDX(dim-1-(j+7), i, dim)] = src[RIDX(i, (j+7), dim)];
dst[RIDX(dim-1-(j+8), i, dim)] = src[RIDX(i, (j+8), dim)];
dst[RIDX(dim-1-(j+9), i, dim)] = src[RIDX(i, (j+9), dim)];
dst[RIDX(dim-1-(j+10), i, dim)] = src[RIDX(i, (j+10), dim)];
dst[RIDX(dim-1-(j+11), i, dim)] = src[RIDX(i, (j+11), dim)];
dst[RIDX(dim-1-(j+12), i, dim)] = src[RIDX(i, (j+12), dim)];
dst[RIDX(dim-1-(j+13), i, dim)] = src[RIDX(i, (j+13), dim)];
dst[RIDX(dim-1-(j+14), i, dim)] = src[RIDX(i, (j+14), dim)];
dst[RIDX(dim-1-(j+15), i, dim)] = src[RIDX(i, (j+15), dim)];
dst[RIDX(dim-1-(j+16), i, dim)] = src[RIDX(i, (j+16), dim)];
dst[RIDX(dim-1-(j+17), i, dim)] = src[RIDX(i, (j+17), dim)];
dst[RIDX(dim-1-(j+18), i, dim)] = src[RIDX(i, (j+18), dim)];
dst[RIDX(dim-1-(j+19), i, dim)] = src[RIDX(i, (j+19), dim)];
dst[RIDX(dim-1-(j+20), i, dim)] = src[RIDX(i, (j+20), dim)];
dst[RIDX(dim-1-(j+21), i, dim)] = src[RIDX(i, (j+21), dim)];
dst[RIDX(dim-1-(j+22), i, dim)] = src[RIDX(i, (j+22), dim)];
dst[RIDX(dim-1-(j+23), i, dim)] = src[RIDX(i, (j+23), dim)];
dst[RIDX(dim-1-(j+24), i, dim)] = src[RIDX(i, (j+24), dim)];
dst[RIDX(dim-1-(j+25), i, dim)] = src[RIDX(i, (j+25), dim)];
dst[RIDX(dim-1-(j+26), i, dim)] = src[RIDX(i, (j+26), dim)];
dst[RIDX(dim-1-(j+27), i, dim)] = src[RIDX(i, (j+27), dim)];
dst[RIDX(dim-1-(j+28), i, dim)] = src[RIDX(i, (j+28), dim)];
dst[RIDX(dim-1-(j+29), i, dim)] = src[RIDX(i, (j+29), dim)];
dst[RIDX(dim-1-(j+30), i, dim)] = src[RIDX(i, (j+30), dim)];
dst[RIDX(dim-1-(j+31), i, dim)] = src[RIDX(i, (j+31), dim)];
}
int i, j;
for (i = 0; i < dim; i++){
if((dim%64) == 0)
for (j = 0; j < dim; j+=64){
dst[RIDX(dim-1-(j), i, dim)] = src[RIDX(i, (j), dim)];
dst[RIDX(dim-1-(j+1), i, dim)] = src[RIDX(i, (j+1), dim)];
dst[RIDX(dim-1-(j+2), i, dim)] = src[RIDX(i, (j+2), dim)];
dst[RIDX(dim-1-(j+3), i, dim)] = src[RIDX(i, (j+3), dim)];
dst[RIDX(dim-1-(j+4), i, dim)] = src[RIDX(i, (j+4), dim)];
dst[RIDX(dim-1-(j+5), i, dim)] = src[RIDX(i, (j+5), dim)];
dst[RIDX(dim-1-(j+6), i, dim)] = src[RIDX(i, (j+6), dim)];
dst[RIDX(dim-1-(j+7), i, dim)] = src[RIDX(i, (j+7), dim)];
dst[RIDX(dim-1-(j+8), i, dim)] = src[RIDX(i, (j+8), dim)];
dst[RIDX(dim-1-(j+9), i, dim)] = src[RIDX(i, (j+9), dim)];
dst[RIDX(dim-1-(j+10), i, dim)] = src[RIDX(i, (j+10), dim)];
dst[RIDX(dim-1-(j+11), i, dim)] = src[RIDX(i, (j+11), dim)];
dst[RIDX(dim-1-(j+12), i, dim)] = src[RIDX(i, (j+12), dim)];
dst[RIDX(dim-1-(j+13), i, dim)] = src[RIDX(i, (j+13), dim)];
dst[RIDX(dim-1-(j+14), i, dim)] = src[RIDX(i, (j+14), dim)];
dst[RIDX(dim-1-(j+15), i, dim)] = src[RIDX(i, (j+15), dim)];
dst[RIDX(dim-1-(j+16), i, dim)] = src[RIDX(i, (j+16), dim)];
dst[RIDX(dim-1-(j+17), i, dim)] = src[RIDX(i, (j+17), dim)];
dst[RIDX(dim-1-(j+18), i, dim)] = src[RIDX(i, (j+18), dim)];
dst[RIDX(dim-1-(j+19), i, dim)] = src[RIDX(i, (j+19), dim)];
dst[RIDX(dim-1-(j+20), i, dim)] = src[RIDX(i, (j+20), dim)];
dst[RIDX(dim-1-(j+21), i, dim)] = src[RIDX(i, (j+21), dim)];
dst[RIDX(dim-1-(j+22), i, dim)] = src[RIDX(i, (j+22), dim)];
dst[RIDX(dim-1-(j+23), i, dim)] = src[RIDX(i, (j+23), dim)];
dst[RIDX(dim-1-(j+24), i, dim)] = src[RIDX(i, (j+24), dim)];
dst[RIDX(dim-1-(j+25), i, dim)] = src[RIDX(i, (j+25), dim)];
dst[RIDX(dim-1-(j+26), i, dim)] = src[RIDX(i, (j+26), dim)];
dst[RIDX(dim-1-(j+27), i, dim)] = src[RIDX(i, (j+27), dim)];
dst[RIDX(dim-1-(j+28), i, dim)] = src[RIDX(i, (j+28), dim)];
dst[RIDX(dim-1-(j+29), i, dim)] = src[RIDX(i, (j+29), dim)];
dst[RIDX(dim-1-(j+30), i, dim)] = src[RIDX(i, (j+30), dim)];
dst[RIDX(dim-1-(j+31), i, dim)] = src[RIDX(i, (j+31), dim)];
dst[RIDX(dim-1-(j+32), i, dim)] = src[RIDX(i, (j+32), dim)];
dst[RIDX(dim-1-(j+33), i, dim)] = src[RIDX(i, (j+33), dim)];
dst[RIDX(dim-1-(j+34), i, dim)] = src[RIDX(i, (j+34), dim)];
dst[RIDX(dim-1-(j+35), i, dim)] = src[RIDX(i, (j+35), dim)];
dst[RIDX(dim-1-(j+36), i, dim)] = src[RIDX(i, (j+36), dim)];
dst[RIDX(dim-1-(j+37), i, dim)] = src[RIDX(i, (j+37), dim)];
dst[RIDX(dim-1-(j+38), i, dim)] = src[RIDX(i, (j+38), dim)];
dst[RIDX(dim-1-(j+39), i, dim)] = src[RIDX(i, (j+39), dim)];
dst[RIDX(dim-1-(j+40), i, dim)] = src[RIDX(i, (j+40), dim)];
dst[RIDX(dim-1-(j+41), i, dim)] = src[RIDX(i, (j+41), dim)];
dst[RIDX(dim-1-(j+42), i, dim)] = src[RIDX(i, (j+42), dim)];
dst[RIDX(dim-1-(j+43), i, dim)] = src[RIDX(i, (j+43), dim)];
dst[RIDX(dim-1-(j+44), i, dim)] = src[RIDX(i, (j+44), dim)];
dst[RIDX(dim-1-(j+45), i, dim)] = src[RIDX(i, (j+45), dim)];
dst[RIDX(dim-1-(j+46), i, dim)] = src[RIDX(i, (j+46), dim)];
dst[RIDX(dim-1-(j+47), i, dim)] = src[RIDX(i, (j+47), dim)];
dst[RIDX(dim-1-(j+48), i, dim)] = src[RIDX(i, (j+48), dim)];
dst[RIDX(dim-1-(j+49), i, dim)] = src[RIDX(i, (j+49), dim)];
dst[RIDX(dim-1-(j+50), i, dim)] = src[RIDX(i, (j+50), dim)];
dst[RIDX(dim-1-(j+51), i, dim)] = src[RIDX(i, (j+51), dim)];
dst[RIDX(dim-1-(j+52), i, dim)] = src[RIDX(i, (j+52), dim)];
dst[RIDX(dim-1-(j+53), i, dim)] = src[RIDX(i, (j+53), dim)];
dst[RIDX(dim-1-(j+54), i, dim)] = src[RIDX(i, (j+54), dim)];
dst[RIDX(dim-1-(j+55), i, dim)] = src[RIDX(i, (j+55), dim)];
dst[RIDX(dim-1-(j+56), i, dim)] = src[RIDX(i, (j+56), dim)];
dst[RIDX(dim-1-(j+57), i, dim)] = src[RIDX(i, (j+57), dim)];
dst[RIDX(dim-1-(j+58), i, dim)] = src[RIDX(i, (j+58), dim)];
dst[RIDX(dim-1-(j+59), i, dim)] = src[RIDX(i, (j+59), dim)];
dst[RIDX(dim-1-(j+60), i, dim)] = src[RIDX(i, (j+60), dim)];
dst[RIDX(dim-1-(j+61), i, dim)] = src[RIDX(i, (j+61), dim)];
dst[RIDX(dim-1-(j+62), i, dim)] = src[RIDX(i, (j+62), dim)];
dst[RIDX(dim-1-(j+63), i, dim)] = src[RIDX(i, (j+63), dim)];
}
else if((dim%32) == 0)
for (j = 0; j < dim; j+=32){
dst[RIDX(dim-1-(j), i, dim)] = src[RIDX(i, (j), dim)];
dst[RIDX(dim-1-(j+1), i, dim)] = src[RIDX(i, (j+1), dim)];
dst[RIDX(dim-1-(j+2), i, dim)] = src[RIDX(i, (j+2), dim)];
dst[RIDX(dim-1-(j+3), i, dim)] = src[RIDX(i, (j+3), dim)];
dst[RIDX(dim-1-(j+4), i, dim)] = src[RIDX(i, (j+4), dim)];
dst[RIDX(dim-1-(j+5), i, dim)] = src[RIDX(i, (j+5), dim)];
dst[RIDX(dim-1-(j+6), i, dim)] = src[RIDX(i, (j+6), dim)];
dst[RIDX(dim-1-(j+7), i, dim)] = src[RIDX(i, (j+7), dim)];
dst[RIDX(dim-1-(j+8), i, dim)] = src[RIDX(i, (j+8), dim)];
dst[RIDX(dim-1-(j+9), i, dim)] = src[RIDX(i, (j+9), dim)];
dst[RIDX(dim-1-(j+10), i, dim)] = src[RIDX(i, (j+10), dim)];
dst[RIDX(dim-1-(j+11), i, dim)] = src[RIDX(i, (j+11), dim)];
dst[RIDX(dim-1-(j+12), i, dim)] = src[RIDX(i, (j+12), dim)];
dst[RIDX(dim-1-(j+13), i, dim)] = src[RIDX(i, (j+13), dim)];
dst[RIDX(dim-1-(j+14), i, dim)] = src[RIDX(i, (j+14), dim)];
dst[RIDX(dim-1-(j+15), i, dim)] = src[RIDX(i, (j+15), dim)];
dst[RIDX(dim-1-(j+16), i, dim)] = src[RIDX(i, (j+16), dim)];
dst[RIDX(dim-1-(j+17), i, dim)] = src[RIDX(i, (j+17), dim)];
dst[RIDX(dim-1-(j+18), i, dim)] = src[RIDX(i, (j+18), dim)];
dst[RIDX(dim-1-(j+19), i, dim)] = src[RIDX(i, (j+19), dim)];
dst[RIDX(dim-1-(j+20), i, dim)] = src[RIDX(i, (j+20), dim)];
dst[RIDX(dim-1-(j+21), i, dim)] = src[RIDX(i, (j+21), dim)];
dst[RIDX(dim-1-(j+22), i, dim)] = src[RIDX(i, (j+22), dim)];
dst[RIDX(dim-1-(j+23), i, dim)] = src[RIDX(i, (j+23), dim)];
dst[RIDX(dim-1-(j+24), i, dim)] = src[RIDX(i, (j+24), dim)];
dst[RIDX(dim-1-(j+25), i, dim)] = src[RIDX(i, (j+25), dim)];
dst[RIDX(dim-1-(j+26), i, dim)] = src[RIDX(i, (j+26), dim)];
dst[RIDX(dim-1-(j+27), i, dim)] = src[RIDX(i, (j+27), dim)];
dst[RIDX(dim-1-(j+28), i, dim)] = src[RIDX(i, (j+28), dim)];
dst[RIDX(dim-1-(j+29), i, dim)] = src[RIDX(i, (j+29), dim)];
dst[RIDX(dim-1-(j+30), i, dim)] = src[RIDX(i, (j+30), dim)];
dst[RIDX(dim-1-(j+31), i, dim)] = src[RIDX(i, (j+31), dim)];
}
}
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
k=0;
for (i = 0; i < dim; i++){
l = RIDX(dim-1-dim, i, dim);
for (j = RIDX(dim-1-j, i, dim);; j>l < dim; j-=dim){
dst[j] = src[k];
k++;
}
}