|
26 | 26 | */ |
27 | 27 | #include "motiondetect_opt.h" |
28 | 28 |
|
29 | | -#ifdef USE_ORC |
30 | | -#include "orc/motiondetectorc.h" |
31 | | -#endif |
32 | | - |
33 | 29 | #ifdef USE_SSE2 |
34 | 30 | #include <emmintrin.h> |
35 | 31 |
|
@@ -100,35 +96,7 @@ double contrastSubImg1_SSE(unsigned char* const I, const Field* field, |
100 | 96 | } |
101 | 97 | #endif |
102 | 98 |
|
103 | | -#ifdef USE_ORC |
104 | | -/** |
105 | | - calculates the contrast in the given small part of the given image |
106 | | - using the absolute difference from mean luminance (like Root-Mean-Square, |
107 | | - but with abs() (Manhattan-Norm)) |
108 | | - For multichannel images use contrastSubImg_Michelson() |
109 | | -
|
110 | | - \param I pointer to framebuffer |
111 | | - \param field Field specifies position(center) and size of subimage |
112 | | - \param width width of frame |
113 | | - \param height height of frame |
114 | | -*/ |
115 | | -double contrastSubImg_variance_orc(unsigned char* const I, const Field* field, |
116 | | - int width, int height) { |
117 | | - unsigned char* p = NULL; |
118 | | - int s2 = field->size / 2; |
119 | | - int numpixel = field->size*field->size; |
120 | | - |
121 | | - p = I + ((field->x - s2) + (field->y - s2) * width); |
122 | | - |
123 | | - unsigned int sum=0; |
124 | | - image_sum_optimized((signed int*)&sum, p, width, field->size, field->size); |
125 | | - unsigned char mean = sum / numpixel; |
126 | | - int var=0; |
127 | | - image_variance_optimized(&var, p, width, mean, field->size, field->size); |
128 | | - return (double)var/numpixel/255.0; |
129 | | -} |
130 | | - |
131 | | -/// plain C implementation of variance based contrastSubImg (without ORC) |
| 99 | +/// plain C implementation of variance based contrastSubImg |
132 | 100 | double contrastSubImg_variance_C(unsigned char* const I, |
133 | 101 | const Field* field, int width, int height) { |
134 | 102 | int k, j; |
@@ -158,69 +126,6 @@ double contrastSubImg_variance_C(unsigned char* const I, |
158 | 126 | } |
159 | 127 | return (double)var/numpixel/255.0; |
160 | 128 | } |
161 | | -#endif |
162 | | - |
163 | | - |
164 | | - |
165 | | - |
166 | | - |
167 | | - |
168 | | -#ifdef USE_ORC |
169 | | -/** |
170 | | - compares a small part of two given images |
171 | | - and returns the average absolute difference. |
172 | | - Field center, size and shift have to be choosen, |
173 | | - so that no clipping is required. |
174 | | - Uses optimized inner loops by ORC. |
175 | | -
|
176 | | - \param field Field specifies position(center) and size of subimage |
177 | | - \param d_x shift in x direction |
178 | | - \param d_y shift in y direction |
179 | | -*/ |
180 | | -unsigned int compareSubImg_thr_orc(unsigned char* const I1, unsigned char* const I2, |
181 | | - const Field* field, int width1, int width2, int height, |
182 | | - int bytesPerPixel, int d_x, int d_y, |
183 | | - unsigned int threshold) { |
184 | | - unsigned char* p1 = NULL; |
185 | | - unsigned char* p2 = NULL; |
186 | | - int s2 = field->size / 2; |
187 | | - int j; |
188 | | - unsigned int sum = 0; |
189 | | - p1 = I1 + ((field->x - s2) + (field->y - s2) * width1) * bytesPerPixel; |
190 | | - p2 = I2 + ((field->x - s2 + d_x) + (field->y - s2 + d_y) * width2) * bytesPerPixel; |
191 | | - |
192 | | - for (j = 0; j < field->size; j++) { |
193 | | - unsigned int s = 0; |
194 | | - image_line_difference_optimized(&s, p1, p2, field->size* bytesPerPixel); |
195 | | - sum += s; |
196 | | - if( sum > threshold) // no need to calculate any longer: worse than the best match |
197 | | - break; |
198 | | - p1 += width1 * bytesPerPixel; |
199 | | - p2 += width2 * bytesPerPixel; |
200 | | - } |
201 | | - |
202 | | - |
203 | | - return sum; |
204 | | -} |
205 | | - |
206 | | -// implementation with 1 orc function, but no threshold |
207 | | -unsigned int compareSubImg_orc(unsigned char* const I1, unsigned char* const I2, |
208 | | - const Field* field, int width1, int width2, int height, |
209 | | - int bytesPerPixel, int d_x, int d_y, |
210 | | - unsigned int threshold) { |
211 | | - unsigned char* p1 = NULL; |
212 | | - unsigned char* p2 = NULL; |
213 | | - int s2 = field->size / 2; |
214 | | - unsigned int sum=0; |
215 | | - p1 = I1 + ((field->x - s2) + (field->y - s2) * width1) * bytesPerPixel; |
216 | | - p2 = I2 + ((field->x - s2 + d_x) + (field->y - s2 + d_y) * width2) |
217 | | - * bytesPerPixel; |
218 | | - |
219 | | - image_difference_optimized(&sum, p1, width1 * bytesPerPixel, p2, width2 * bytesPerPixel, |
220 | | - field->size* bytesPerPixel , field->size); |
221 | | - return sum; |
222 | | -} |
223 | | -#endif |
224 | 129 |
|
225 | 130 | #ifdef USE_SSE2 |
226 | 131 | unsigned int compareSubImg_thr_sse2(unsigned char* const I1, unsigned char* const I2, |
|
0 commit comments