PandA-2024.02
main.c
Go to the documentation of this file.
1 #include <stdlib.h>
2 
3 #define abs(x) ((x)>0?(x):-(x))
4 
5 #pragma map call_hw VIRTEX5 0
6 void
7 __attribute__ ((noinline))
8 satd( unsigned char pix[32], int* i_satd_result)
9 {
10 
11  int16_t tmp[4][4];
12  int16_t diff[4][4];
13  int d;
14 
15  diff[0][0] = pix[0] - pix[16];
16  diff[0][1] = pix[1] - pix[17];
17  diff[0][2]= pix[2] - pix[18];
18  diff[0][3] = pix[3] - pix[19];
19 
20  diff[1][0] = pix[4] - pix[20];
21  diff[1][1] = pix[5] - pix[21];
22  diff[1][2] = pix[6] - pix[22];
23  diff[1][3] = pix[7] - pix[23];
24 
25  diff[2][0] = pix[8] - pix[24];
26  diff[2][1] = pix[9] - pix[25];
27  diff[2][2] = pix[10] - pix[26];
28  diff[2][3] = pix[11] - pix[27];
29 
30  diff[3][0] = pix[12] - pix[28];
31  diff[3][1] = pix[13] - pix[29];
32  diff[3][2] = pix[14] - pix[30];
33  diff[3][3] = pix[15] - pix[31];
34 
35  for( d = 0; d < 4; d++ )
36  {
37  int s01, s23;
38  int d01, d23;
39 
40  s01 = diff[d][0] + diff[d][1]; s23 = diff[d][2] + diff[d][3];
41  d01 = diff[d][0] - diff[d][1]; d23 = diff[d][2] - diff[d][3];
42 
43  tmp[d][0] = s01 + s23;
44  tmp[d][1] = s01 - s23;
45  tmp[d][2] = d01 - d23;
46  tmp[d][3] = d01 + d23;
47  }
48 
49  for( d = 0; d < 4; d++ )
50  {
51  int s01, s23;
52  int d01, d23;
53 
54  s01 = tmp[0][d] + tmp[1][d]; s23 = tmp[2][d] + tmp[3][d];
55  d01 = tmp[0][d] - tmp[1][d]; d23 = tmp[2][d] - tmp[3][d];
56 
57  *i_satd_result += abs( s01 + s23 ) + abs( s01 - s23 ) + abs( d01 - d23 ) + abs( d01 + d23 );
58  }
59 }
60 
61 int main() {
62  char *a;
63  int *b;
64  int i;
65 
66  a=malloc(32*sizeof(char));
67  b=malloc(sizeof(int));
68 
69  for(i=0;i<32;i++) {
70  a[i] = i%3;
71  }
72  *b=0;
73 
74  satd(a,b);
75 
76  return 0;
77 }
void __attribute__((noinline))
Definition: main.c:7
#define abs(x)
Definition: main.c:3
void main()
Definition: main.c:670

Generated on Mon Feb 12 2024 13:02:48 for PandA-2024.02 by doxygen 1.8.13