39 |
|
|
40 |
|
|
41 |
#include "../portab.h" |
#include "../portab.h" |
42 |
|
#include "../global.h" |
43 |
#include "sad.h" |
#include "sad.h" |
44 |
|
|
45 |
sad16FuncPtr sad16; |
sad16FuncPtr sad16; |
51 |
|
|
52 |
sadInitFuncPtr sadInit; |
sadInitFuncPtr sadInit; |
53 |
|
|
|
#define ABS(X) (((X)>0)?(X):-(X)) |
|
54 |
|
|
55 |
uint32_t |
uint32_t |
56 |
sad16_c(const uint8_t * const cur, |
sad16_c(const uint8_t * const cur, |
111 |
|
|
112 |
for (i = 0; i < 16; i++) { |
for (i = 0; i < 16; i++) { |
113 |
int pixel = (ptr_ref1[i] + ptr_ref2[i] + 1) / 2; |
int pixel = (ptr_ref1[i] + ptr_ref2[i] + 1) / 2; |
|
|
|
|
if (pixel < 0) { |
|
|
pixel = 0; |
|
|
} else if (pixel > 255) { |
|
|
pixel = 255; |
|
|
} |
|
|
|
|
114 |
sad += ABS(ptr_cur[i] - pixel); |
sad += ABS(ptr_cur[i] - pixel); |
115 |
} |
} |
116 |
|
|
141 |
|
|
142 |
for (i = 0; i < 8; i++) { |
for (i = 0; i < 8; i++) { |
143 |
int pixel = (ptr_ref1[i] + ptr_ref2[i] + 1) / 2; |
int pixel = (ptr_ref1[i] + ptr_ref2[i] + 1) / 2; |
|
|
|
|
if (pixel < 0) { |
|
|
pixel = 0; |
|
|
} else if (pixel > 255) { |
|
|
pixel = 255; |
|
|
} |
|
|
|
|
144 |
sad += ABS(ptr_cur[i] - pixel); |
sad += ABS(ptr_cur[i] - pixel); |
145 |
} |
} |
146 |
|
|