Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 16 F2D** diffss(F2D** ss, int num, int intervals)
- 17 {
- 18 F2D** dss;
- 19 int o, sizeM, sizeN, s, i, j;
- 20 F2D *current, *in1, *in2;
- 21
- 22 dss = malloc(num*intervals*sizeof(F2D*));
- 23
- 24 int size, togo;
- 25 for(o=0; o<num; o++)
- 26 {
- 27 for(s=0; s<(intervals-1); s++)
- 28 {
- 29 sizeM = ss[o*intervals+s]->height;
- 30 sizeN = ss[o*intervals+s]->width;
- 31
- 32 //Amin: This loop is run as many times as imsmooth functions (36 for fullhd and 25 for vga) with the same M and N sizes
- 33
- 34 dss[o*intervals+s] = fMallocHandle(sizeM, sizeN);
- 35
- 36 current = dss[o*intervals+s];
- 37 in1 = ss[o*intervals+s+1];
- 38 in2 = ss[o*intervals+s];
- 39
- 40 /* Amin: Original implementation
- 41 for(i=0; i<sizeM; i++)
- 42 {
- 43 for(j=0; j<sizeN; j++)
- 44 {
- 45 subsref(current,i,j) = subsref(in1,i,j) - subsref(in2,i,j);
- 46 }
- 47 }
- 48 */
- 49 /* Amin: Simpler implementation with one loop
- 50 for(i=0; i<sizeM*sizeN; i++) {
- 51 asubsref(current,i) = asubsref(in1,i) - asubsref(in2,i);
- 52 }
- 53 */
- 54 /* Amin: simpler implementation with 8 loop unrolling
- 55 */
- 56 for(i=0; i<sizeM*sizeN; i=i+8) {
- 57 togo = sizeM*sizeN - i;
- 58 size = (togo > 8) ? 8 : togo;
- 59
- 60 for (j=0; j<size; j++)
- 61 asubsref(current,i+j) = asubsref(in1,i+j) - asubsref(in2,i+j);
- 62 }
- 63 }
- 64 }
- 65
- 66 return dss;
- 67 }
- 68
- 69
- 70
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement