get nxn size blocks from 2d array?
Hi all I am so confuse about getting nxn blocks from 2d array, for an instance:
an 2d array of size is 512*512, and has numbers filled already and its like:
array1[512][512] is
Code:
0, 1, 2, .........511
512, 513' 514.......1023
1024, 1025' 1026......1335
:
and I'd like to copy 4x4 size block from array to
array2[16384][4][4]
(512*512/16=16384 is number of blocks)
so 1st block of array2 will be
Code:
0, 1, 2, 3
512, 513' 514, 515
1024, 1025' 1026, 1027
1336, 1337, 1338, 1339
my code:
Code:
int k=0;
for(i=0; i<512; i++)
for(j=0; j<512; j++)
for(m=0; m<4; m++)
for(n=0; n<4; n++){
array2[k][m][n]=array1[i%4][j%4];
k++;
}
but i got bus error and so confuse
can anyone help me out please?