00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <stdio.h>
00022 #include <stdlib.h>
00023 #include <string.h>
00024 #include <flgrCoreDataIO.h>
00025 #include <flgrCoreDispatch.h>
00026 #include <flgrCoreVector.h>
00027 #include <flgrCoreArithVector.h>
00028 #include "flgrMeasureBase.h"
00029 #include "flgrMeasureBaseSSE.h"
00030 #include "flgrMeasureBaseSSE2.h"
00031
00032
00033
00046
00047
00048
00049
00050 #define FLGR_MACRO_MEASURE1D_MIN_MAX(dtype) \
00051 int i,k; \
00052 int spp=dat->spp; \
00053 int length=dat->length*spp; \
00054 dtype *pdat = (dtype*) dat->array; \
00055 dtype *pmini = (dtype*) mini->array; \
00056 dtype *pmaxi = (dtype*) maxi->array; \
00057 dtype val; \
00058 \
00059 \
00060 \
00061 for(k=0 ; k<spp ; k++) { \
00062 pmini[k] = flgr_get_array_##dtype(pdat,k); \
00063 pmaxi[k] = pmini[k]; \
00064 \
00065 for(i=spp+k ; i<length ; i+=spp) { \
00066 val = flgr_get_array_##dtype(pdat,i); \
00067 pmini[k] = FLGR_MIN(pmini[k],val); \
00068 pmaxi[k] = FLGR_MAX(pmaxi[k],val); \
00069 } \
00070 } \
00071 return
00072
00073
00074 void flgr1d_measure_min_max_fgBIT(FLGR_Data1D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
00075 FLGR_MACRO_MEASURE1D_MIN_MAX(fgBIT);
00076 }
00077
00078 void flgr1d_measure_min_max_fgUINT8(FLGR_Data1D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
00079 #ifdef __SSE2__
00080 if(dat->spp==1) {
00081 flgr1d_measure_min_max_spp1_SSE2_fgUINT8(dat, mini, maxi);
00082 }else {
00083 FLGR_MACRO_MEASURE1D_MIN_MAX(fgUINT8);
00084 }
00085 #else
00086 #ifdef __SSE__
00087 if(dat->spp==1) {
00088 flgr1d_measure_min_max_spp1_SSE_fgUINT8(dat, mini, maxi);
00089 }else {
00090 FLGR_MACRO_MEASURE1D_MIN_MAX(fgUINT8);
00091 }
00092 #else
00093 FLGR_MACRO_MEASURE1D_MIN_MAX(fgUINT8);
00094 #endif
00095 #endif
00096 }
00097
00098 void flgr1d_measure_min_max_fgUINT16(FLGR_Data1D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
00099 FLGR_MACRO_MEASURE1D_MIN_MAX(fgUINT16);
00100 }
00101
00102 void flgr1d_measure_min_max_fgUINT32(FLGR_Data1D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
00103 FLGR_MACRO_MEASURE1D_MIN_MAX(fgUINT32);
00104 }
00105
00106 void flgr1d_measure_min_max_fgINT8(FLGR_Data1D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
00107 FLGR_MACRO_MEASURE1D_MIN_MAX(fgINT8);
00108 }
00109
00110 void flgr1d_measure_min_max_fgINT16(FLGR_Data1D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
00111 #ifdef __SSE2__
00112 if(dat->spp==1) {
00113 flgr1d_measure_min_max_spp1_SSE2_fgINT16(dat, mini, maxi);
00114 }else {
00115 FLGR_MACRO_MEASURE1D_MIN_MAX(fgINT16);
00116 }
00117 #else
00118 #ifdef __SSE__
00119 if(dat->spp==1) {
00120 flgr1d_measure_min_max_spp1_SSE_fgINT16(dat, mini, maxi);
00121 }else {
00122 FLGR_MACRO_MEASURE1D_MIN_MAX(fgINT16);
00123 }
00124 #else
00125 FLGR_MACRO_MEASURE1D_MIN_MAX(fgINT16);
00126 #endif
00127 #endif
00128 }
00129
00130 void flgr1d_measure_min_max_fgINT32(FLGR_Data1D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
00131 FLGR_MACRO_MEASURE1D_MIN_MAX(fgINT32);
00132 }
00133
00134 void flgr1d_measure_min_max_fgFLOAT32(FLGR_Data1D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
00135 FLGR_MACRO_MEASURE1D_MIN_MAX(fgFLOAT32);
00136 }
00137
00138 void flgr1d_measure_min_max_fgFLOAT64(FLGR_Data1D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
00139 FLGR_MACRO_MEASURE1D_MIN_MAX(fgFLOAT64);
00140 }
00141
00143
00149
00150 FLGR_Ret flgr1d_measure_min_max(FLGR_Data1D *dat, FLGR_Vector *minimum, FLGR_Vector *maximum) {
00151
00152
00153 if((dat==NULL) || (minimum==NULL) || (maximum==NULL)){
00154 POST_ERROR("Null objects!\n");
00155 return FLGR_RET_NULL_OBJECT;
00156 }
00157
00158 if(dat->spp != minimum->spp) {
00159 POST_ERROR("Sample per pixel are different\n");
00160 return FLGR_RET_UNDEFINED_ERROR;
00161 }
00162
00163 if(dat->spp != maximum->spp) {
00164 POST_ERROR("Sample per pixel are different\n");
00165 return FLGR_RET_UNDEFINED_ERROR;
00166 }
00167
00168 FLGR_DISPATCH_PROCEDURE(dat->type,flgr1d_measure_min_max,dat,minimum,maximum);
00169
00170 }
00171
00172
00173
00174 #define FLGR_MACRO_MEASURE1D_VOLUME_OLD(dtype,dtype_volume) \
00175 FLGR_Vector *tmp = flgr_vector_create(dat->spp, dat->type); \
00176 FLGR_Vector *tmp2 = flgr_vector_create(volume->spp, volume->type); \
00177 int j; \
00178 \
00179 \
00180 \
00181 flgr_vector_clear(tmp); \
00182 flgr_vector_clear(tmp2); \
00183 flgr_vector_clear(volume); \
00184 \
00185 for(j=0 ; j<dat->length ; j++) { \
00186 flgr1d_get_data_vector_##dtype(dat,j,tmp); \
00187 flgr_vector_copy_##dtype_volume##_##dtype(tmp2,tmp); \
00188 flgr_vector_add(volume,tmp2,volume); \
00189 } \
00190 \
00191 flgr_vector_destroy(tmp); \
00192 flgr_vector_destroy(tmp2); \
00193 \
00194 return
00195
00196
00197 #define FLGR_MACRO_MEASURE1D_VOLUME(dtype,dtype_volume) \
00198 int i,k; \
00199 int spp=dat->spp; \
00200 int length=dat->length*spp; \
00201 dtype *pdat = (dtype*) dat->array; \
00202 dtype_volume *pvol = (dtype_volume*) volume->array; \
00203 dtype val; \
00204 \
00205 \
00206 \
00207 for(k=0 ; k<spp ; k++) { \
00208 pvol[k] = flgr_get_array_##dtype(pdat,k); \
00209 \
00210 for(i=spp+k ; i<length ; i+=spp) { \
00211 val = flgr_get_array_##dtype(pdat,i); \
00212 pvol[k] += (dtype_volume)(val); \
00213 } \
00214 } \
00215 return
00216
00217
00218 void flgr1d_measure_volume_u32_fgBIT(FLGR_Data1D *dat, FLGR_Vector *volume) {
00219 FLGR_MACRO_MEASURE1D_VOLUME(fgBIT,fgUINT32);
00220 }
00221 void flgr1d_measure_volume_u32_fgUINT8(FLGR_Data1D *dat, FLGR_Vector *volume) {
00222 #ifdef __SSE2__
00223 if(dat->spp==1) {
00224 flgr1d_measure_volume_u32_spp1_SSE2_fgUINT8(dat, volume);
00225 }else {
00226 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT8,fgUINT32);
00227 }
00228 #else
00229 #ifdef __SSE__
00230 if(dat->spp==1) {
00231 flgr1d_measure_volume_u32_spp1_SSE_fgUINT8(dat, volume);
00232 }else {
00233 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT8,fgUINT32);
00234 }
00235 #else
00236 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT8,fgUINT32);
00237 #endif
00238 #endif
00239 }
00240 void flgr1d_measure_volume_u32_fgUINT16(FLGR_Data1D *dat, FLGR_Vector *volume) {
00241 #ifdef __SSE2__
00242 if(dat->spp==1) {
00243 flgr1d_measure_volume_u32_spp1_SSE2_fgUINT16(dat, volume);
00244 }else {
00245 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT16,fgUINT32);
00246 }
00247 #else
00248 #ifdef __SSE__
00249 if(dat->spp==1) {
00250 flgr1d_measure_volume_u32_spp1_SSE_fgUINT16(dat, volume);
00251 }else {
00252 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT16,fgUINT32);
00253 }
00254 #else
00255 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT16,fgUINT32);
00256 #endif
00257 #endif
00258 }
00259 void flgr1d_measure_volume_u32_fgUINT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00260 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT32,fgUINT32);
00261 }
00262 void flgr1d_measure_volume_u32_fgINT8(FLGR_Data1D *dat, FLGR_Vector *volume) {
00263 FLGR_MACRO_MEASURE1D_VOLUME(fgINT8,fgUINT32);
00264 }
00265 void flgr1d_measure_volume_u32_fgINT16(FLGR_Data1D *dat, FLGR_Vector *volume) {
00266 #ifdef __SSE2__
00267 if(dat->spp==1) {
00268 flgr1d_measure_volume_u32_spp1_SSE2_fgINT16(dat, volume);
00269 }else {
00270 FLGR_MACRO_MEASURE1D_VOLUME(fgINT16,fgUINT32);
00271 }
00272 #else
00273 #ifdef __SSE__
00274 if(dat->spp==1) {
00275 flgr1d_measure_volume_u32_spp1_SSE_fgINT16(dat, volume);
00276 }else {
00277 FLGR_MACRO_MEASURE1D_VOLUME(fgINT16,fgUINT32);
00278 }
00279 #else
00280 FLGR_MACRO_MEASURE1D_VOLUME(fgINT16,fgUINT32);
00281 #endif
00282 #endif
00283 }
00284 void flgr1d_measure_volume_u32_fgINT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00285 FLGR_MACRO_MEASURE1D_VOLUME(fgINT32,fgUINT32);
00286 }
00287 void flgr1d_measure_volume_u32_fgFLOAT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00288 FLGR_MACRO_MEASURE1D_VOLUME(fgFLOAT32,fgUINT32);
00289 }
00290 void flgr1d_measure_volume_u32_fgFLOAT64(FLGR_Data1D *dat, FLGR_Vector *volume) {
00291 FLGR_MACRO_MEASURE1D_VOLUME(fgFLOAT64,fgUINT32);
00292 }
00293
00294
00295
00296
00297 void flgr1d_measure_volume_s32_fgBIT(FLGR_Data1D *dat, FLGR_Vector *volume) {
00298 FLGR_MACRO_MEASURE1D_VOLUME(fgBIT,fgINT32);
00299 }
00300 void flgr1d_measure_volume_s32_fgUINT8(FLGR_Data1D *dat, FLGR_Vector *volume) {
00301 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT8,fgINT32);
00302 }
00303 void flgr1d_measure_volume_s32_fgUINT16(FLGR_Data1D *dat, FLGR_Vector *volume) {
00304 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT16,fgINT32);
00305 }
00306 void flgr1d_measure_volume_s32_fgUINT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00307 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT32,fgINT32);
00308 }
00309 void flgr1d_measure_volume_s32_fgINT8(FLGR_Data1D *dat, FLGR_Vector *volume) {
00310 FLGR_MACRO_MEASURE1D_VOLUME(fgINT8,fgINT32);
00311 }
00312 void flgr1d_measure_volume_s32_fgINT16(FLGR_Data1D *dat, FLGR_Vector *volume) {
00313 #ifdef __SSE2__
00314 if(dat->spp==1) {
00315 flgr1d_measure_volume_s32_spp1_SSE2_fgINT16(dat, volume);
00316 }else {
00317 FLGR_MACRO_MEASURE1D_VOLUME(fgINT16,fgINT32);
00318 }
00319 #else
00320 #ifdef __SSE__
00321 if(dat->spp==1) {
00322 flgr1d_measure_volume_s32_spp1_SSE_fgINT16(dat, volume);
00323 }else {
00324 FLGR_MACRO_MEASURE1D_VOLUME(fgINT16,fgINT32);
00325 }
00326 #else
00327 FLGR_MACRO_MEASURE1D_VOLUME(fgINT16,fgINT32);
00328 #endif
00329 #endif
00330 }
00331 void flgr1d_measure_volume_s32_fgINT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00332 FLGR_MACRO_MEASURE1D_VOLUME(fgINT32,fgINT32);
00333 }
00334 void flgr1d_measure_volume_s32_fgFLOAT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00335 FLGR_MACRO_MEASURE1D_VOLUME(fgFLOAT32,fgINT32);
00336 }
00337 void flgr1d_measure_volume_s32_fgFLOAT64(FLGR_Data1D *dat, FLGR_Vector *volume) {
00338 FLGR_MACRO_MEASURE1D_VOLUME(fgFLOAT64,fgINT32);
00339 }
00340
00341
00342
00343
00344
00345 void flgr1d_measure_volume_u64_fgBIT(FLGR_Data1D *dat, FLGR_Vector *volume) {
00346 FLGR_MACRO_MEASURE1D_VOLUME(fgBIT,fgUINT64);
00347 }
00348 void flgr1d_measure_volume_u64_fgUINT8(FLGR_Data1D *dat, FLGR_Vector *volume) {
00349 #ifdef __SSE2__
00350 if(dat->spp==1) {
00351 flgr1d_measure_volume_u64_spp1_SSE2_fgUINT8(dat, volume);
00352 }else {
00353 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT8,fgUINT64);
00354 }
00355 #else
00356 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT8,fgUINT64);
00357 #endif
00358 }
00359 void flgr1d_measure_volume_u64_fgUINT16(FLGR_Data1D *dat, FLGR_Vector *volume) {
00360 #ifdef __SSE2__
00361 if(dat->spp==1) {
00362 flgr1d_measure_volume_u64_spp1_SSE2_fgUINT16(dat, volume);
00363 }else {
00364 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT16,fgUINT64);
00365 }
00366 #else
00367 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT16,fgUINT64);
00368 #endif
00369 }
00370 void flgr1d_measure_volume_u64_fgUINT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00371 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT32,fgUINT64);
00372 }
00373 void flgr1d_measure_volume_u64_fgINT8(FLGR_Data1D *dat, FLGR_Vector *volume) {
00374 FLGR_MACRO_MEASURE1D_VOLUME(fgINT8,fgUINT64);
00375 }
00376 void flgr1d_measure_volume_u64_fgINT16(FLGR_Data1D *dat, FLGR_Vector *volume) {
00377 #ifdef __SSE2__
00378 if(dat->spp==1) {
00379 flgr1d_measure_volume_u64_spp1_SSE2_fgINT16(dat, volume);
00380 }else {
00381 FLGR_MACRO_MEASURE1D_VOLUME(fgINT16,fgUINT64);
00382 }
00383 #else
00384 FLGR_MACRO_MEASURE1D_VOLUME(fgINT16,fgUINT64);
00385 #endif
00386 }
00387 void flgr1d_measure_volume_u64_fgINT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00388 FLGR_MACRO_MEASURE1D_VOLUME(fgINT32,fgUINT64);
00389 }
00390 void flgr1d_measure_volume_u64_fgFLOAT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00391 FLGR_MACRO_MEASURE1D_VOLUME(fgFLOAT32,fgUINT64);
00392 }
00393 void flgr1d_measure_volume_u64_fgFLOAT64(FLGR_Data1D *dat, FLGR_Vector *volume) {
00394 FLGR_MACRO_MEASURE1D_VOLUME(fgFLOAT64,fgUINT64);
00395 }
00396
00397
00398
00399
00400 void flgr1d_measure_volume_s64_fgBIT(FLGR_Data1D *dat, FLGR_Vector *volume) {
00401 FLGR_MACRO_MEASURE1D_VOLUME(fgBIT,fgINT64);
00402 }
00403 void flgr1d_measure_volume_s64_fgUINT8(FLGR_Data1D *dat, FLGR_Vector *volume) {
00404 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT8,fgINT64);
00405 }
00406 void flgr1d_measure_volume_s64_fgUINT16(FLGR_Data1D *dat, FLGR_Vector *volume) {
00407 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT16,fgINT64);
00408 }
00409 void flgr1d_measure_volume_s64_fgUINT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00410 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT32,fgINT64);
00411 }
00412 void flgr1d_measure_volume_s64_fgINT8(FLGR_Data1D *dat, FLGR_Vector *volume) {
00413 FLGR_MACRO_MEASURE1D_VOLUME(fgINT8,fgINT64);
00414 }
00415 void flgr1d_measure_volume_s64_fgINT16(FLGR_Data1D *dat, FLGR_Vector *volume) {
00416 FLGR_MACRO_MEASURE1D_VOLUME(fgINT16,fgINT64);
00417 }
00418 void flgr1d_measure_volume_s64_fgINT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00419 FLGR_MACRO_MEASURE1D_VOLUME(fgINT32,fgINT64);
00420 }
00421 void flgr1d_measure_volume_s64_fgFLOAT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00422 FLGR_MACRO_MEASURE1D_VOLUME(fgFLOAT32,fgINT64);
00423 }
00424 void flgr1d_measure_volume_s64_fgFLOAT64(FLGR_Data1D *dat, FLGR_Vector *volume) {
00425 FLGR_MACRO_MEASURE1D_VOLUME(fgFLOAT64,fgINT64);
00426 }
00427
00428
00429
00430
00431
00432
00433
00434
00435 void flgr1d_measure_volume_f32_fgBIT(FLGR_Data1D *dat, FLGR_Vector *volume) {
00436 FLGR_MACRO_MEASURE1D_VOLUME(fgBIT,fgFLOAT32);
00437 }
00438 void flgr1d_measure_volume_f32_fgUINT8(FLGR_Data1D *dat, FLGR_Vector *volume) {
00439 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT8,fgFLOAT32);
00440 }
00441 void flgr1d_measure_volume_f32_fgUINT16(FLGR_Data1D *dat, FLGR_Vector *volume) {
00442 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT16,fgFLOAT32);
00443 }
00444 void flgr1d_measure_volume_f32_fgUINT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00445 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT32,fgFLOAT32);
00446 }
00447 void flgr1d_measure_volume_f32_fgINT8(FLGR_Data1D *dat, FLGR_Vector *volume) {
00448 FLGR_MACRO_MEASURE1D_VOLUME(fgINT8,fgFLOAT32);
00449 }
00450 void flgr1d_measure_volume_f32_fgINT16(FLGR_Data1D *dat, FLGR_Vector *volume) {
00451 FLGR_MACRO_MEASURE1D_VOLUME(fgINT16,fgFLOAT32);
00452 }
00453 void flgr1d_measure_volume_f32_fgINT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00454 FLGR_MACRO_MEASURE1D_VOLUME(fgINT32,fgFLOAT32);
00455 }
00456 void flgr1d_measure_volume_f32_fgFLOAT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00457 FLGR_MACRO_MEASURE1D_VOLUME(fgFLOAT32,fgFLOAT32);
00458 }
00459 void flgr1d_measure_volume_f32_fgFLOAT64(FLGR_Data1D *dat, FLGR_Vector *volume) {
00460 FLGR_MACRO_MEASURE1D_VOLUME(fgFLOAT64,fgFLOAT32);
00461 }
00462
00463
00464
00465
00466 void flgr1d_measure_volume_f64_fgBIT(FLGR_Data1D *dat, FLGR_Vector *volume) {
00467 FLGR_MACRO_MEASURE1D_VOLUME(fgBIT,fgFLOAT64);
00468 }
00469 void flgr1d_measure_volume_f64_fgUINT8(FLGR_Data1D *dat, FLGR_Vector *volume) {
00470 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT8,fgFLOAT64);
00471 }
00472 void flgr1d_measure_volume_f64_fgUINT16(FLGR_Data1D *dat, FLGR_Vector *volume) {
00473 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT16,fgFLOAT64);
00474 }
00475 void flgr1d_measure_volume_f64_fgUINT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00476 FLGR_MACRO_MEASURE1D_VOLUME(fgUINT32,fgFLOAT64);
00477 }
00478 void flgr1d_measure_volume_f64_fgINT8(FLGR_Data1D *dat, FLGR_Vector *volume) {
00479 FLGR_MACRO_MEASURE1D_VOLUME(fgINT8,fgFLOAT64);
00480 }
00481 void flgr1d_measure_volume_f64_fgINT16(FLGR_Data1D *dat, FLGR_Vector *volume) {
00482 FLGR_MACRO_MEASURE1D_VOLUME(fgINT16,fgFLOAT64);
00483 }
00484 void flgr1d_measure_volume_f64_fgINT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00485 FLGR_MACRO_MEASURE1D_VOLUME(fgINT32,fgFLOAT64);
00486 }
00487 void flgr1d_measure_volume_f64_fgFLOAT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00488 FLGR_MACRO_MEASURE1D_VOLUME(fgFLOAT32,fgFLOAT64);
00489 }
00490 void flgr1d_measure_volume_f64_fgFLOAT64(FLGR_Data1D *dat, FLGR_Vector *volume) {
00491 FLGR_MACRO_MEASURE1D_VOLUME(fgFLOAT64,fgFLOAT64);
00492 }
00493
00494
00495
00496 #define FLGR_MEASURE_VOLUME1D_PREDISPATCH(dtype,vector_type,...) \
00497 switch(vector_type) { \
00498 case FLGR_UINT32: \
00499 flgr1d_measure_volume_u32_##dtype(__VA_ARGS__);break; \
00500 case FLGR_UINT64: \
00501 flgr1d_measure_volume_u64_##dtype(__VA_ARGS__);break; \
00502 case FLGR_INT32: \
00503 flgr1d_measure_volume_s32_##dtype(__VA_ARGS__);break; \
00504 case FLGR_INT64: \
00505 flgr1d_measure_volume_s64_##dtype(__VA_ARGS__);break; \
00506 case FLGR_FLOAT32: \
00507 flgr1d_measure_volume_f32_##dtype(__VA_ARGS__);break; \
00508 case FLGR_FLOAT64: \
00509 flgr1d_measure_volume_f64_##dtype(__VA_ARGS__);break; \
00510 default: \
00511 POST_ERROR("Unsupported volume vector type : %s\n", \
00512 flgr_get_type_string(vector_type)); \
00513 } \
00514 return
00515
00516
00517
00518 void flgr1d_measure_volume_fgBIT(FLGR_Data1D *dat, FLGR_Vector *volume) {
00519 FLGR_MEASURE_VOLUME1D_PREDISPATCH(fgBIT,volume->type,dat,volume);
00520 }
00521 void flgr1d_measure_volume_fgUINT8(FLGR_Data1D *dat, FLGR_Vector *volume) {
00522 FLGR_MEASURE_VOLUME1D_PREDISPATCH(fgUINT8,volume->type,dat,volume);
00523 }
00524 void flgr1d_measure_volume_fgUINT16(FLGR_Data1D *dat, FLGR_Vector *volume) {
00525 FLGR_MEASURE_VOLUME1D_PREDISPATCH(fgUINT16,volume->type,dat,volume);
00526 }
00527 void flgr1d_measure_volume_fgUINT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00528 FLGR_MEASURE_VOLUME1D_PREDISPATCH(fgUINT32,volume->type,dat,volume);
00529 }
00530 void flgr1d_measure_volume_fgINT8(FLGR_Data1D *dat, FLGR_Vector *volume) {
00531 FLGR_MEASURE_VOLUME1D_PREDISPATCH(fgINT8,volume->type,dat,volume);
00532 }
00533 void flgr1d_measure_volume_fgINT16(FLGR_Data1D *dat, FLGR_Vector *volume) {
00534 FLGR_MEASURE_VOLUME1D_PREDISPATCH(fgINT16,volume->type,dat,volume);
00535 }
00536 void flgr1d_measure_volume_fgINT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00537 FLGR_MEASURE_VOLUME1D_PREDISPATCH(fgINT32,volume->type,dat,volume);
00538 }
00539 void flgr1d_measure_volume_fgFLOAT32(FLGR_Data1D *dat, FLGR_Vector *volume) {
00540 FLGR_MEASURE_VOLUME1D_PREDISPATCH(fgFLOAT32,volume->type,dat,volume);
00541 }
00542 void flgr1d_measure_volume_fgFLOAT64(FLGR_Data1D *dat, FLGR_Vector *volume) {
00543 FLGR_MEASURE_VOLUME1D_PREDISPATCH(fgFLOAT64,volume->type,dat,volume);
00544 }
00545
00546
00548
00558
00559 FLGR_Ret flgr1d_measure_volume(FLGR_Data1D *dat, FLGR_Vector *volume) {
00560
00561
00562 if((dat == NULL) || (volume==NULL)) {
00563 POST_ERROR("Null object\n");
00564 return FLGR_RET_NULL_OBJECT;
00565 }
00566
00567 FLGR_DISPATCH_PROCEDURE(dat->type,flgr1d_measure_volume,dat,volume);
00568 }
00569
00570
00571 #define FLGR_MACRO_MEASURE1D_SAD(dtype,dtype_sad) \
00572 int i,k; \
00573 int spp=dat1->spp; \
00574 int length=dat1->length*spp; \
00575 dtype *pdat1 = (dtype*) dat1->array; \
00576 dtype *pdat2 = (dtype*) dat2->array; \
00577 dtype_sad *pvol = (dtype_sad*) sad->array; \
00578 dtype val1; \
00579 dtype val2; \
00580 dtype val3; \
00581 \
00582 \
00583 \
00584 for(k=0 ; k<spp ; k++) { \
00585 pvol[k] = 0; \
00586 \
00587 for(i=k ; i<length ; i+=spp) { \
00588 val1 = flgr_get_array_##dtype(pdat1,i); \
00589 val2 = flgr_get_array_##dtype(pdat2,i); \
00590 val3 = (val1>val2) ? (val1-val2) : (val2-val1); \
00591 pvol[k] += (dtype_sad)(val3); \
00592 } \
00593 } \
00594 return
00595
00596
00597 void flgr1d_measure_sad_u32_fgBIT(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00598 FLGR_MACRO_MEASURE1D_SAD(fgBIT,fgUINT32);
00599 }
00600 void flgr1d_measure_sad_u32_fgUINT8(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00601 #ifdef __SSE2__
00602 if(dat1->spp==1) {
00603 flgr1d_measure_sad_u32_spp1_SSE2_fgUINT8(dat1, dat2, sad);
00604 }else {
00605 FLGR_MACRO_MEASURE1D_SAD(fgUINT8,fgUINT32);
00606 }
00607 #else
00608 FLGR_MACRO_MEASURE1D_SAD(fgUINT8,fgUINT32);
00609 #endif
00610 }
00611 void flgr1d_measure_sad_u32_fgUINT16(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00612 FLGR_MACRO_MEASURE1D_SAD(fgUINT16,fgUINT32);
00613 }
00614 void flgr1d_measure_sad_u32_fgUINT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00615 FLGR_MACRO_MEASURE1D_SAD(fgUINT32,fgUINT32);
00616 }
00617 void flgr1d_measure_sad_u32_fgINT8(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00618 FLGR_MACRO_MEASURE1D_SAD(fgINT8,fgUINT32);
00619 }
00620 void flgr1d_measure_sad_u32_fgINT16(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00621 FLGR_MACRO_MEASURE1D_SAD(fgINT16,fgUINT32);
00622 }
00623 void flgr1d_measure_sad_u32_fgINT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00624 FLGR_MACRO_MEASURE1D_SAD(fgINT32,fgUINT32);
00625 }
00626 void flgr1d_measure_sad_u32_fgFLOAT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00627 FLGR_MACRO_MEASURE1D_SAD(fgFLOAT32,fgUINT32);
00628 }
00629 void flgr1d_measure_sad_u32_fgFLOAT64(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00630 FLGR_MACRO_MEASURE1D_SAD(fgFLOAT64,fgUINT32);
00631 }
00632
00633
00634
00635
00636
00637
00638 void flgr1d_measure_sad_u64_fgBIT(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00639 FLGR_MACRO_MEASURE1D_SAD(fgBIT,fgUINT64);
00640 }
00641 void flgr1d_measure_sad_u64_fgUINT8(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00642 FLGR_MACRO_MEASURE1D_SAD(fgUINT8,fgUINT64);
00643 }
00644 void flgr1d_measure_sad_u64_fgUINT16(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00645 FLGR_MACRO_MEASURE1D_SAD(fgUINT16,fgUINT64);
00646 }
00647 void flgr1d_measure_sad_u64_fgUINT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00648 FLGR_MACRO_MEASURE1D_SAD(fgUINT32,fgUINT64);
00649 }
00650 void flgr1d_measure_sad_u64_fgINT8(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00651 FLGR_MACRO_MEASURE1D_SAD(fgINT8,fgUINT64);
00652 }
00653 void flgr1d_measure_sad_u64_fgINT16(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00654 FLGR_MACRO_MEASURE1D_SAD(fgINT16,fgUINT64);
00655 }
00656 void flgr1d_measure_sad_u64_fgINT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00657 FLGR_MACRO_MEASURE1D_SAD(fgINT32,fgUINT64);
00658 }
00659 void flgr1d_measure_sad_u64_fgFLOAT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00660 FLGR_MACRO_MEASURE1D_SAD(fgFLOAT32,fgUINT64);
00661 }
00662 void flgr1d_measure_sad_u64_fgFLOAT64(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00663 FLGR_MACRO_MEASURE1D_SAD(fgFLOAT64,fgUINT64);
00664 }
00665
00666
00667
00668
00669
00670 void flgr1d_measure_sad_f32_fgBIT(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00671 FLGR_MACRO_MEASURE1D_SAD(fgBIT,fgFLOAT32);
00672 }
00673 void flgr1d_measure_sad_f32_fgUINT8(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00674 FLGR_MACRO_MEASURE1D_SAD(fgUINT8,fgFLOAT32);
00675 }
00676 void flgr1d_measure_sad_f32_fgUINT16(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00677 FLGR_MACRO_MEASURE1D_SAD(fgUINT16,fgFLOAT32);
00678 }
00679 void flgr1d_measure_sad_f32_fgUINT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00680 FLGR_MACRO_MEASURE1D_SAD(fgUINT32,fgFLOAT32);
00681 }
00682 void flgr1d_measure_sad_f32_fgINT8(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00683 FLGR_MACRO_MEASURE1D_SAD(fgINT8,fgFLOAT32);
00684 }
00685 void flgr1d_measure_sad_f32_fgINT16(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00686 FLGR_MACRO_MEASURE1D_SAD(fgINT16,fgFLOAT32);
00687 }
00688 void flgr1d_measure_sad_f32_fgINT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00689 FLGR_MACRO_MEASURE1D_SAD(fgINT32,fgFLOAT32);
00690 }
00691 void flgr1d_measure_sad_f32_fgFLOAT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00692 FLGR_MACRO_MEASURE1D_SAD(fgFLOAT32,fgFLOAT32);
00693 }
00694 void flgr1d_measure_sad_f32_fgFLOAT64(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00695 FLGR_MACRO_MEASURE1D_SAD(fgFLOAT64,fgFLOAT32);
00696 }
00697
00698
00699
00700
00701 void flgr1d_measure_sad_f64_fgBIT(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00702 FLGR_MACRO_MEASURE1D_SAD(fgBIT,fgFLOAT64);
00703 }
00704 void flgr1d_measure_sad_f64_fgUINT8(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00705 FLGR_MACRO_MEASURE1D_SAD(fgUINT8,fgFLOAT64);
00706 }
00707 void flgr1d_measure_sad_f64_fgUINT16(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00708 FLGR_MACRO_MEASURE1D_SAD(fgUINT16,fgFLOAT64);
00709 }
00710 void flgr1d_measure_sad_f64_fgUINT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00711 FLGR_MACRO_MEASURE1D_SAD(fgUINT32,fgFLOAT64);
00712 }
00713 void flgr1d_measure_sad_f64_fgINT8(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00714 FLGR_MACRO_MEASURE1D_SAD(fgINT8,fgFLOAT64);
00715 }
00716 void flgr1d_measure_sad_f64_fgINT16(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00717 FLGR_MACRO_MEASURE1D_SAD(fgINT16,fgFLOAT64);
00718 }
00719 void flgr1d_measure_sad_f64_fgINT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00720 FLGR_MACRO_MEASURE1D_SAD(fgINT32,fgFLOAT64);
00721 }
00722 void flgr1d_measure_sad_f64_fgFLOAT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00723 FLGR_MACRO_MEASURE1D_SAD(fgFLOAT32,fgFLOAT64);
00724 }
00725 void flgr1d_measure_sad_f64_fgFLOAT64(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00726 FLGR_MACRO_MEASURE1D_SAD(fgFLOAT64,fgFLOAT64);
00727 }
00728
00729
00730
00731 #define FLGR_MEASURE_SAD1D_PREDISPATCH(dtype,vector_type,...) \
00732 switch(vector_type) { \
00733 case FLGR_UINT32: \
00734 flgr1d_measure_sad_u32_##dtype(__VA_ARGS__);break; \
00735 case FLGR_UINT64: \
00736 flgr1d_measure_sad_u64_##dtype(__VA_ARGS__);break; \
00737 case FLGR_FLOAT32: \
00738 flgr1d_measure_sad_f32_##dtype(__VA_ARGS__);break; \
00739 case FLGR_FLOAT64: \
00740 flgr1d_measure_sad_f64_##dtype(__VA_ARGS__);break; \
00741 default: \
00742 POST_ERROR("Unsupported sad vector type : %s\n", \
00743 flgr_get_type_string(vector_type)); \
00744 } \
00745 return
00746
00747
00748
00749 void flgr1d_measure_sad_fgBIT(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00750 FLGR_MEASURE_SAD1D_PREDISPATCH(fgBIT,sad->type,dat1,dat2,sad);
00751 }
00752 void flgr1d_measure_sad_fgUINT8(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00753 FLGR_MEASURE_SAD1D_PREDISPATCH(fgUINT8,sad->type,dat1,dat2,sad);
00754 }
00755 void flgr1d_measure_sad_fgUINT16(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00756 FLGR_MEASURE_SAD1D_PREDISPATCH(fgUINT16,sad->type,dat1,dat2,sad);
00757 }
00758 void flgr1d_measure_sad_fgUINT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00759 FLGR_MEASURE_SAD1D_PREDISPATCH(fgUINT32,sad->type,dat1,dat2,sad);
00760 }
00761 void flgr1d_measure_sad_fgINT8(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00762 FLGR_MEASURE_SAD1D_PREDISPATCH(fgINT8,sad->type,dat1,dat2,sad);
00763 }
00764 void flgr1d_measure_sad_fgINT16(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00765 FLGR_MEASURE_SAD1D_PREDISPATCH(fgINT16,sad->type,dat1,dat2,sad);
00766 }
00767 void flgr1d_measure_sad_fgINT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00768 FLGR_MEASURE_SAD1D_PREDISPATCH(fgINT32,sad->type,dat1,dat2,sad);
00769 }
00770 void flgr1d_measure_sad_fgFLOAT32(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00771 FLGR_MEASURE_SAD1D_PREDISPATCH(fgFLOAT32,sad->type,dat1,dat2,sad);
00772 }
00773 void flgr1d_measure_sad_fgFLOAT64(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00774 FLGR_MEASURE_SAD1D_PREDISPATCH(fgFLOAT64,sad->type,dat1,dat2,sad);
00775 }
00776
00777
00779
00789
00790 FLGR_Ret flgr1d_measure_sad(FLGR_Data1D *dat1, FLGR_Data1D *dat2, FLGR_Vector *sad) {
00791 FLGR_Ret ret;
00792
00793
00794
00795 if((dat1 == NULL) || (dat2 == NULL) || (sad==NULL)) {
00796 POST_ERROR("Null object\n");
00797 return FLGR_RET_NULL_OBJECT;
00798 }
00799
00800 if((ret=flgr1d_is_data_same_attributes(dat1,dat2,__FUNCTION__))!=FLGR_RET_OK) return ret;
00801
00802
00803 FLGR_DISPATCH_PROCEDURE(dat1->type,flgr1d_measure_sad,dat1,dat2,sad);
00804 }
00805
00806
00807
00808
00809 #define FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(dtype,dtypeV) \
00810 dtype *psrc = (dtype*) datsrc->array; \
00811 dtypeV *pvec = (dtypeV*) expval->array; \
00812 dtype val; \
00813 int spp = datsrc->spp; \
00814 int len = datsrc->length; \
00815 int i,j,k; \
00816 \
00817 for(k=0 ; k<spp ; k++) { \
00818 pvec[k]=0; \
00819 for(i=0,j=0 ; j<spp*len ; j+=spp,i++) { \
00820 val = flgr_get_array_##dtype(psrc,j+k); \
00821 pvec[k] += (dtypeV) ((i+1)*val); \
00822 } \
00823 } \
00824 \
00825 return
00826
00827
00828 void flgr1d_measure_expected_value_u32_fgBIT(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00829 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgBIT,fgUINT32);
00830 }
00831 void flgr1d_measure_expected_value_u32_fgUINT8(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00832 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgUINT8,fgUINT32);
00833 }
00834 void flgr1d_measure_expected_value_u32_fgUINT16(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00835 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgUINT16,fgUINT32);
00836 }
00837 void flgr1d_measure_expected_value_u32_fgUINT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00838 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgUINT32,fgUINT32);
00839 }
00840 void flgr1d_measure_expected_value_u32_fgINT8(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00841 flgr_no_define_type_function(FLGR_INT8);
00842 }
00843 void flgr1d_measure_expected_value_u32_fgINT16(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00844 flgr_no_define_type_function(FLGR_INT16);
00845 }
00846 void flgr1d_measure_expected_value_u32_fgINT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00847 flgr_no_define_type_function(FLGR_INT32);
00848 }
00849 void flgr1d_measure_expected_value_u32_fgFLOAT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00850 flgr_no_define_type_function(FLGR_FLOAT32);
00851 }
00852 void flgr1d_measure_expected_value_u32_fgFLOAT64(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00853 flgr_no_define_type_function(FLGR_FLOAT64);
00854 }
00855
00856 void flgr1d_measure_expected_value_s32_fgBIT(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00857 flgr_no_define_type_function(FLGR_BIT);
00858 }
00859 void flgr1d_measure_expected_value_s32_fgUINT8(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00860 flgr_no_define_type_function(FLGR_UINT8);
00861 }
00862 void flgr1d_measure_expected_value_s32_fgUINT16(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00863 flgr_no_define_type_function(FLGR_UINT16);
00864 }
00865 void flgr1d_measure_expected_value_s32_fgUINT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00866 flgr_no_define_type_function(FLGR_UINT32);
00867 }
00868 void flgr1d_measure_expected_value_s32_fgINT8(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00869 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgINT8,fgINT32);
00870 }
00871 void flgr1d_measure_expected_value_s32_fgINT16(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00872 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgINT16,fgINT32);
00873 }
00874 void flgr1d_measure_expected_value_s32_fgINT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00875 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgINT32,fgINT32);
00876 }
00877 void flgr1d_measure_expected_value_s32_fgFLOAT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00878 flgr_no_define_type_function(FLGR_FLOAT32);
00879 }
00880 void flgr1d_measure_expected_value_s32_fgFLOAT64(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00881 flgr_no_define_type_function(FLGR_FLOAT64);
00882 }
00883
00884 void flgr1d_measure_expected_value_u64_fgBIT(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00885 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgBIT,fgUINT64);
00886 }
00887 void flgr1d_measure_expected_value_u64_fgUINT8(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00888 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgUINT8,fgUINT64);
00889 }
00890 void flgr1d_measure_expected_value_u64_fgUINT16(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00891 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgUINT16,fgUINT64);
00892 }
00893 void flgr1d_measure_expected_value_u64_fgUINT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00894 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgUINT32,fgUINT64);
00895 }
00896 void flgr1d_measure_expected_value_u64_fgINT8(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00897 flgr_no_define_type_function(FLGR_INT8);
00898 }
00899 void flgr1d_measure_expected_value_u64_fgINT16(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00900 flgr_no_define_type_function(FLGR_INT16);
00901 }
00902 void flgr1d_measure_expected_value_u64_fgINT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00903 flgr_no_define_type_function(FLGR_INT32);
00904 }
00905 void flgr1d_measure_expected_value_u64_fgFLOAT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00906 flgr_no_define_type_function(FLGR_FLOAT32);
00907 }
00908 void flgr1d_measure_expected_value_u64_fgFLOAT64(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00909 flgr_no_define_type_function(FLGR_FLOAT64);
00910 }
00911
00912 void flgr1d_measure_expected_value_s64_fgBIT(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00913 flgr_no_define_type_function(FLGR_BIT);
00914 }
00915 void flgr1d_measure_expected_value_s64_fgUINT8(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00916 flgr_no_define_type_function(FLGR_UINT8);
00917 }
00918 void flgr1d_measure_expected_value_s64_fgUINT16(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00919 flgr_no_define_type_function(FLGR_UINT16);
00920 }
00921 void flgr1d_measure_expected_value_s64_fgUINT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00922 flgr_no_define_type_function(FLGR_UINT32);
00923 }
00924 void flgr1d_measure_expected_value_s64_fgINT8(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00925 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgINT8,fgINT64);
00926 }
00927 void flgr1d_measure_expected_value_s64_fgINT16(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00928 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgINT16,fgINT64);
00929 }
00930 void flgr1d_measure_expected_value_s64_fgINT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00931 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgINT32,fgINT64);
00932 }
00933 void flgr1d_measure_expected_value_s64_fgFLOAT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00934 flgr_no_define_type_function(FLGR_FLOAT32);
00935 }
00936 void flgr1d_measure_expected_value_s64_fgFLOAT64(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00937 flgr_no_define_type_function(FLGR_FLOAT64);
00938 }
00939
00940 void flgr1d_measure_expected_value_f32_fgBIT(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00941 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgBIT,fgFLOAT32);
00942 }
00943 void flgr1d_measure_expected_value_f32_fgUINT8(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00944 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgUINT8,fgFLOAT32);
00945 }
00946 void flgr1d_measure_expected_value_f32_fgUINT16(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00947 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgUINT16,fgFLOAT32);
00948 }
00949 void flgr1d_measure_expected_value_f32_fgUINT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00950 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgUINT32,fgFLOAT32);
00951 }
00952 void flgr1d_measure_expected_value_f32_fgINT8(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00953 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgINT8,fgFLOAT32);
00954 }
00955 void flgr1d_measure_expected_value_f32_fgINT16(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00956 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgINT16,fgFLOAT32);
00957 }
00958 void flgr1d_measure_expected_value_f32_fgINT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00959 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgINT32,fgFLOAT32);
00960 }
00961 void flgr1d_measure_expected_value_f32_fgFLOAT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00962 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgFLOAT32,fgFLOAT32);
00963 }
00964 void flgr1d_measure_expected_value_f32_fgFLOAT64(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00965 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgFLOAT64,fgFLOAT32);
00966 }
00967
00968 void flgr1d_measure_expected_value_f64_fgBIT(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00969 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgBIT,fgFLOAT64);
00970 }
00971 void flgr1d_measure_expected_value_f64_fgUINT8(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00972 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgUINT8,fgFLOAT64);
00973 }
00974 void flgr1d_measure_expected_value_f64_fgUINT16(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00975 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgUINT16,fgFLOAT64);
00976 }
00977 void flgr1d_measure_expected_value_f64_fgUINT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00978 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgUINT32,fgFLOAT64);
00979 }
00980 void flgr1d_measure_expected_value_f64_fgINT8(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00981 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgINT8,fgFLOAT64);
00982 }
00983 void flgr1d_measure_expected_value_f64_fgINT16(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00984 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgINT16,fgFLOAT64);
00985 }
00986 void flgr1d_measure_expected_value_f64_fgINT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00987 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgINT32,fgFLOAT64);
00988 }
00989 void flgr1d_measure_expected_value_f64_fgFLOAT32(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00990 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgFLOAT32,fgFLOAT64);
00991 }
00992 void flgr1d_measure_expected_value_f64_fgFLOAT64(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
00993 FLGR1D_MACRO_MEASURE_EXPECTED_VALUE(fgFLOAT64,fgFLOAT64);
00994 }
00995
00996 #define FLGR1D_MEASURE_EXP_VAL_PREDISPATCH(dtype,vector_type,...) \
00997 switch(vector_type) { \
00998 case FLGR_UINT32: \
00999 flgr1d_measure_expected_value_u32_##dtype(__VA_ARGS__);break; \
01000 case FLGR_UINT64: \
01001 flgr1d_measure_expected_value_u64_##dtype(__VA_ARGS__);break; \
01002 case FLGR_INT32: \
01003 flgr1d_measure_expected_value_s32_##dtype(__VA_ARGS__);break; \
01004 case FLGR_INT64: \
01005 flgr1d_measure_expected_value_s64_##dtype(__VA_ARGS__);break; \
01006 case FLGR_FLOAT32: \
01007 flgr1d_measure_expected_value_f32_##dtype(__VA_ARGS__);break; \
01008 case FLGR_FLOAT64: \
01009 flgr1d_measure_expected_value_f64_##dtype(__VA_ARGS__);break; \
01010 default: \
01011 POST_ERROR("Unsupported expected_value vector type : %s\n", \
01012 flgr_get_type_string(vector_type)); \
01013 } \
01014 return
01015
01016
01017
01018 void flgr1d_measure_expected_value_fgBIT(FLGR_Data1D *dat, FLGR_Vector *expected_value) {
01019 FLGR1D_MEASURE_EXP_VAL_PREDISPATCH(fgBIT,expected_value->type,dat,expected_value);
01020 }
01021 void flgr1d_measure_expected_value_fgUINT8(FLGR_Data1D *dat, FLGR_Vector *expected_value) {
01022 FLGR1D_MEASURE_EXP_VAL_PREDISPATCH(fgUINT8,expected_value->type,dat,expected_value);
01023 }
01024 void flgr1d_measure_expected_value_fgUINT16(FLGR_Data1D *dat, FLGR_Vector *expected_value) {
01025 FLGR1D_MEASURE_EXP_VAL_PREDISPATCH(fgUINT16,expected_value->type,dat,expected_value);
01026 }
01027 void flgr1d_measure_expected_value_fgUINT32(FLGR_Data1D *dat, FLGR_Vector *expected_value) {
01028 FLGR1D_MEASURE_EXP_VAL_PREDISPATCH(fgUINT32,expected_value->type,dat,expected_value);
01029 }
01030 void flgr1d_measure_expected_value_fgINT8(FLGR_Data1D *dat, FLGR_Vector *expected_value) {
01031 FLGR1D_MEASURE_EXP_VAL_PREDISPATCH(fgINT8,expected_value->type,dat,expected_value);
01032 }
01033 void flgr1d_measure_expected_value_fgINT16(FLGR_Data1D *dat, FLGR_Vector *expected_value) {
01034 FLGR1D_MEASURE_EXP_VAL_PREDISPATCH(fgINT16,expected_value->type,dat,expected_value);
01035 }
01036 void flgr1d_measure_expected_value_fgINT32(FLGR_Data1D *dat, FLGR_Vector *expected_value) {
01037 FLGR1D_MEASURE_EXP_VAL_PREDISPATCH(fgINT32,expected_value->type,dat,expected_value);
01038 }
01039 void flgr1d_measure_expected_value_fgFLOAT32(FLGR_Data1D *dat, FLGR_Vector *expected_value) {
01040 FLGR1D_MEASURE_EXP_VAL_PREDISPATCH(fgFLOAT32,expected_value->type,dat,expected_value);
01041 }
01042 void flgr1d_measure_expected_value_fgFLOAT64(FLGR_Data1D *dat, FLGR_Vector *expected_value) {
01043 FLGR1D_MEASURE_EXP_VAL_PREDISPATCH(fgFLOAT64,expected_value->type,dat,expected_value);
01044 }
01045
01046
01048
01054
01055 FLGR_Ret flgr1d_measure_expected_value(FLGR_Data1D *datsrc, FLGR_Vector *expval) {
01056
01057
01058 if((datsrc == NULL) || (expval==NULL)) {
01059 POST_ERROR("Null object\n");
01060 return FLGR_RET_NULL_OBJECT;
01061 }
01062
01063 FLGR_DISPATCH_PROCEDURE(datsrc->type,flgr1d_measure_expected_value,datsrc,expval);
01064 return FLGR_RET_OK;
01065 }
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075 #define FLGR_MACRO_MEASURE2D_MIN_MAX(dtype) \
01076 FLGR_Data1D **pdat = dat->row; \
01077 FLGR_Vector *vec1 = flgr_vector_create(dat->spp, dat->type); \
01078 FLGR_Vector *vec2 = flgr_vector_create(dat->spp, dat->type); \
01079 int i; \
01080 \
01081 \
01082 \
01083 flgr1d_measure_min_max_##dtype(*pdat++,mini,maxi); \
01084 \
01085 for(i=1 ; i<dat->size_y ; i++,pdat++) { \
01086 flgr1d_measure_min_max_##dtype(*pdat,vec1,vec2); \
01087 flgr_vector_inf_##dtype(mini,vec1,mini); \
01088 flgr_vector_sup_##dtype(maxi,vec2,maxi); \
01089 } \
01090 \
01091 flgr_vector_destroy(vec1); \
01092 flgr_vector_destroy(vec2)
01093
01094
01095 void flgr2d_measure_min_max_fgBIT(FLGR_Data2D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
01096 FLGR_MACRO_MEASURE2D_MIN_MAX(fgBIT);
01097 }
01098
01099 void flgr2d_measure_min_max_fgUINT8(FLGR_Data2D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
01100 FLGR_MACRO_MEASURE2D_MIN_MAX(fgUINT8);
01101 }
01102
01103 void flgr2d_measure_min_max_fgUINT16(FLGR_Data2D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
01104 FLGR_MACRO_MEASURE2D_MIN_MAX(fgUINT16);
01105 }
01106
01107 void flgr2d_measure_min_max_fgUINT32(FLGR_Data2D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
01108 FLGR_MACRO_MEASURE2D_MIN_MAX(fgUINT32);
01109 }
01110
01111 void flgr2d_measure_min_max_fgINT8(FLGR_Data2D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
01112 FLGR_MACRO_MEASURE2D_MIN_MAX(fgINT8);
01113 }
01114
01115 void flgr2d_measure_min_max_fgINT16(FLGR_Data2D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
01116 FLGR_MACRO_MEASURE2D_MIN_MAX(fgINT16);
01117 }
01118
01119 void flgr2d_measure_min_max_fgINT32(FLGR_Data2D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
01120 FLGR_MACRO_MEASURE2D_MIN_MAX(fgINT32);
01121 }
01122
01123 void flgr2d_measure_min_max_fgFLOAT32(FLGR_Data2D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
01124 FLGR_MACRO_MEASURE2D_MIN_MAX(fgFLOAT32);
01125 }
01126
01127 void flgr2d_measure_min_max_fgFLOAT64(FLGR_Data2D *dat, FLGR_Vector *mini, FLGR_Vector *maxi) {
01128 FLGR_MACRO_MEASURE2D_MIN_MAX(fgFLOAT64);
01129 }
01130
01132
01138
01139 FLGR_Ret flgr2d_measure_min_max(FLGR_Data2D *dat, FLGR_Vector *minimum, FLGR_Vector *maximum) {
01140
01141
01142 if((dat==NULL) || (minimum==NULL) || (maximum==NULL)){
01143 POST_ERROR("Null objects!\n");
01144 return FLGR_RET_NULL_OBJECT;
01145 }
01146
01147 if(dat->spp != minimum->spp) {
01148 POST_ERROR("Sample per pixel are different\n");
01149 return FLGR_RET_UNDEFINED_ERROR;
01150 }
01151
01152 if(dat->spp != maximum->spp) {
01153 POST_ERROR("Sample per pixel are different\n");
01154 return FLGR_RET_UNDEFINED_ERROR;
01155 }
01156
01157 FLGR_DISPATCH_PROCEDURE(dat->type,flgr2d_measure_min_max,dat,minimum,maximum);
01158
01159 }
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174 #define FLGR_MACRO_MEASURE2D_VOLUME_U32(dtype) \
01175 FLGR_Data1D **pdat = dat->row; \
01176 FLGR_Vector *vec = flgr_vector_create(volume->spp, FLGR_UINT32); \
01177 int i; \
01178 \
01179 \
01180 \
01181 flgr_vector_clear(volume); \
01182 \
01183 for(i=0 ; i<dat->size_y ; i++,pdat++) { \
01184 flgr1d_measure_volume_u32_##dtype(*pdat,vec); \
01185 flgr_vector_add_fgUINT32(volume,volume,vec); \
01186 } \
01187 flgr_vector_destroy(vec)
01188
01189
01190 #define FLGR_MACRO_MEASURE2D_VOLUME_S32(dtype) \
01191 FLGR_Data1D **pdat = dat->row; \
01192 FLGR_Vector *vec = flgr_vector_create(volume->spp, FLGR_INT32); \
01193 int i; \
01194 \
01195 \
01196 \
01197 flgr_vector_clear(volume); \
01198 \
01199 for(i=0 ; i<dat->size_y ; i++,pdat++) { \
01200 flgr1d_measure_volume_s32_##dtype(*pdat,vec); \
01201 flgr_vector_add_fgINT32(volume,volume,vec); \
01202 } \
01203 flgr_vector_destroy(vec)
01204
01205
01206 #define FLGR_MACRO_MEASURE2D_VOLUME_U64(dtype) \
01207 FLGR_Data1D **pdat = dat->row; \
01208 FLGR_Vector *vec = flgr_vector_create(volume->spp, FLGR_UINT64); \
01209 int i; \
01210 \
01211 \
01212 \
01213 flgr_vector_clear(volume); \
01214 \
01215 for(i=0 ; i<dat->size_y ; i++,pdat++) { \
01216 flgr1d_measure_volume_u64_##dtype(*pdat,vec); \
01217 flgr_vector_add_fgUINT64(volume,volume,vec); \
01218 } \
01219 flgr_vector_destroy(vec)
01220
01221 #define FLGR_MACRO_MEASURE2D_VOLUME_S64(dtype) \
01222 FLGR_Data1D **pdat = dat->row; \
01223 FLGR_Vector *vec = flgr_vector_create(volume->spp, FLGR_INT64); \
01224 int i; \
01225 \
01226 \
01227 \
01228 flgr_vector_clear(volume); \
01229 \
01230 for(i=0 ; i<dat->size_y ; i++,pdat++) { \
01231 flgr1d_measure_volume_s64_##dtype(*pdat,vec); \
01232 flgr_vector_add_fgINT64(volume,volume,vec); \
01233 } \
01234 flgr_vector_destroy(vec)
01235
01236
01237 #define FLGR_MACRO_MEASURE2D_VOLUME_F32(dtype) \
01238 FLGR_Data1D **pdat = dat->row; \
01239 FLGR_Vector *vec = flgr_vector_create(volume->spp, FLGR_FLOAT32); \
01240 int i; \
01241 \
01242 \
01243 \
01244 flgr_vector_clear(volume); \
01245 \
01246 for(i=0 ; i<dat->size_y ; i++,pdat++) { \
01247 flgr1d_measure_volume_f32_##dtype(*pdat,vec); \
01248 flgr_vector_add_fgFLOAT32(volume,volume,vec); \
01249 } \
01250 flgr_vector_destroy(vec)
01251
01252 #define FLGR_MACRO_MEASURE2D_VOLUME_F64(dtype) \
01253 FLGR_Data1D **pdat = dat->row; \
01254 FLGR_Vector *vec = flgr_vector_create(volume->spp, FLGR_FLOAT64); \
01255 int i; \
01256 \
01257 \
01258 \
01259 flgr_vector_clear(volume); \
01260 \
01261 for(i=0 ; i<dat->size_y ; i++,pdat++) { \
01262 flgr1d_measure_volume_f64_##dtype(*pdat,vec); \
01263 flgr_vector_add_fgFLOAT64(volume,volume,vec); \
01264 } \
01265 flgr_vector_destroy(vec)
01266
01267
01268 #define FLGR_MACRO_MEASURE2D_VOLUME(dtype,dtype_volume) \
01269 FLGR_Vector *tmp = flgr_vector_create(dat->spp, dat->type); \
01270 FLGR_Vector *tmp2 = flgr_vector_create(volume->spp, volume->type); \
01271 int i,j; \
01272 \
01273 \
01274 \
01275 flgr_vector_clear(tmp); \
01276 flgr_vector_clear(tmp2); \
01277 flgr_vector_clear(volume); \
01278 \
01279 for(i=0 ; i<dat->size_y ; i++) { \
01280 for(j=0 ; j<dat->size_x ; j++) { \
01281 flgr2d_get_data_vector_##dtype(dat,i,j,tmp); \
01282 flgr_vector_copy_##dtype_volume##_##dtype(tmp2,tmp); \
01283 flgr_vector_add_##dtype(volume,tmp2,volume); \
01284 } \
01285 } \
01286 \
01287 flgr_vector_destroy(tmp); \
01288 flgr_vector_destroy(tmp2); \
01289 \
01290 return
01291
01292
01293
01294 void flgr2d_measure_volume_u32_fgBIT(FLGR_Data2D *dat, FLGR_Vector *volume) {
01295 FLGR_MACRO_MEASURE2D_VOLUME_U32(fgBIT);
01296 }
01297 void flgr2d_measure_volume_u32_fgUINT8(FLGR_Data2D *dat, FLGR_Vector *volume) {
01298 FLGR_MACRO_MEASURE2D_VOLUME_U32(fgUINT8);
01299 }
01300 void flgr2d_measure_volume_u32_fgUINT16(FLGR_Data2D *dat, FLGR_Vector *volume) {
01301 FLGR_MACRO_MEASURE2D_VOLUME_U32(fgUINT16);
01302 }
01303 void flgr2d_measure_volume_u32_fgUINT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01304 FLGR_MACRO_MEASURE2D_VOLUME_U32(fgUINT32);
01305 }
01306 void flgr2d_measure_volume_u32_fgINT8(FLGR_Data2D *dat, FLGR_Vector *volume) {
01307 FLGR_MACRO_MEASURE2D_VOLUME_U32(fgINT8);
01308 }
01309 void flgr2d_measure_volume_u32_fgINT16(FLGR_Data2D *dat, FLGR_Vector *volume) {
01310 FLGR_MACRO_MEASURE2D_VOLUME_U32(fgINT16);
01311 }
01312 void flgr2d_measure_volume_u32_fgINT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01313 FLGR_MACRO_MEASURE2D_VOLUME_U32(fgINT32);
01314 }
01315 void flgr2d_measure_volume_u32_fgFLOAT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01316 FLGR_MACRO_MEASURE2D_VOLUME_U32(fgFLOAT32);
01317 }
01318 void flgr2d_measure_volume_u32_fgFLOAT64(FLGR_Data2D *dat, FLGR_Vector *volume) {
01319 FLGR_MACRO_MEASURE2D_VOLUME_U32(fgFLOAT64);
01320 }
01321
01322
01323
01324
01325 void flgr2d_measure_volume_s32_fgBIT(FLGR_Data2D *dat, FLGR_Vector *volume) {
01326 FLGR_MACRO_MEASURE2D_VOLUME_S32(fgBIT);
01327 }
01328 void flgr2d_measure_volume_s32_fgUINT8(FLGR_Data2D *dat, FLGR_Vector *volume) {
01329 FLGR_MACRO_MEASURE2D_VOLUME_S32(fgUINT8);
01330 }
01331 void flgr2d_measure_volume_s32_fgUINT16(FLGR_Data2D *dat, FLGR_Vector *volume) {
01332 FLGR_MACRO_MEASURE2D_VOLUME_S32(fgUINT16);
01333 }
01334 void flgr2d_measure_volume_s32_fgUINT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01335 FLGR_MACRO_MEASURE2D_VOLUME_S32(fgUINT32);
01336 }
01337 void flgr2d_measure_volume_s32_fgINT8(FLGR_Data2D *dat, FLGR_Vector *volume) {
01338 FLGR_MACRO_MEASURE2D_VOLUME_S32(fgINT8);
01339 }
01340 void flgr2d_measure_volume_s32_fgINT16(FLGR_Data2D *dat, FLGR_Vector *volume) {
01341 FLGR_MACRO_MEASURE2D_VOLUME_S32(fgINT16);
01342 }
01343 void flgr2d_measure_volume_s32_fgINT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01344 FLGR_MACRO_MEASURE2D_VOLUME_S32(fgINT32);
01345 }
01346 void flgr2d_measure_volume_s32_fgFLOAT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01347 FLGR_MACRO_MEASURE2D_VOLUME_S32(fgFLOAT32);
01348 }
01349 void flgr2d_measure_volume_s32_fgFLOAT64(FLGR_Data2D *dat, FLGR_Vector *volume) {
01350 FLGR_MACRO_MEASURE2D_VOLUME_S32(fgFLOAT64);
01351 }
01352
01353
01354
01355
01356
01357 void flgr2d_measure_volume_u64_fgBIT(FLGR_Data2D *dat, FLGR_Vector *volume) {
01358 FLGR_MACRO_MEASURE2D_VOLUME_U64(fgBIT);
01359 }
01360 void flgr2d_measure_volume_u64_fgUINT8(FLGR_Data2D *dat, FLGR_Vector *volume) {
01361 FLGR_MACRO_MEASURE2D_VOLUME_U64(fgUINT8);
01362 }
01363 void flgr2d_measure_volume_u64_fgUINT16(FLGR_Data2D *dat, FLGR_Vector *volume) {
01364 FLGR_MACRO_MEASURE2D_VOLUME_U64(fgUINT16);
01365 }
01366 void flgr2d_measure_volume_u64_fgUINT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01367 FLGR_MACRO_MEASURE2D_VOLUME_U64(fgUINT32);
01368 }
01369 void flgr2d_measure_volume_u64_fgINT8(FLGR_Data2D *dat, FLGR_Vector *volume) {
01370 FLGR_MACRO_MEASURE2D_VOLUME_U64(fgINT8);
01371 }
01372 void flgr2d_measure_volume_u64_fgINT16(FLGR_Data2D *dat, FLGR_Vector *volume) {
01373 FLGR_MACRO_MEASURE2D_VOLUME_U64(fgINT16);
01374 }
01375 void flgr2d_measure_volume_u64_fgINT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01376 FLGR_MACRO_MEASURE2D_VOLUME_U64(fgINT32);
01377 }
01378 void flgr2d_measure_volume_u64_fgFLOAT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01379 FLGR_MACRO_MEASURE2D_VOLUME_U64(fgFLOAT32);
01380 }
01381 void flgr2d_measure_volume_u64_fgFLOAT64(FLGR_Data2D *dat, FLGR_Vector *volume) {
01382 FLGR_MACRO_MEASURE2D_VOLUME_U64(fgFLOAT64);
01383 }
01384
01385
01386
01387
01388 void flgr2d_measure_volume_s64_fgBIT(FLGR_Data2D *dat, FLGR_Vector *volume) {
01389 FLGR_MACRO_MEASURE2D_VOLUME_S64(fgBIT);
01390 }
01391 void flgr2d_measure_volume_s64_fgUINT8(FLGR_Data2D *dat, FLGR_Vector *volume) {
01392 FLGR_MACRO_MEASURE2D_VOLUME_S64(fgUINT8);
01393 }
01394 void flgr2d_measure_volume_s64_fgUINT16(FLGR_Data2D *dat, FLGR_Vector *volume) {
01395 FLGR_MACRO_MEASURE2D_VOLUME_S64(fgUINT16);
01396 }
01397 void flgr2d_measure_volume_s64_fgUINT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01398 FLGR_MACRO_MEASURE2D_VOLUME_S64(fgUINT32);
01399 }
01400 void flgr2d_measure_volume_s64_fgINT8(FLGR_Data2D *dat, FLGR_Vector *volume) {
01401 FLGR_MACRO_MEASURE2D_VOLUME_S64(fgINT8);
01402 }
01403 void flgr2d_measure_volume_s64_fgINT16(FLGR_Data2D *dat, FLGR_Vector *volume) {
01404 FLGR_MACRO_MEASURE2D_VOLUME_S64(fgINT16);
01405 }
01406 void flgr2d_measure_volume_s64_fgINT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01407 FLGR_MACRO_MEASURE2D_VOLUME_S64(fgINT32);
01408 }
01409 void flgr2d_measure_volume_s64_fgFLOAT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01410 FLGR_MACRO_MEASURE2D_VOLUME_S64(fgFLOAT32);
01411 }
01412 void flgr2d_measure_volume_s64_fgFLOAT64(FLGR_Data2D *dat, FLGR_Vector *volume) {
01413 FLGR_MACRO_MEASURE2D_VOLUME_S64(fgFLOAT64);
01414 }
01415
01416
01417
01418
01419
01420
01421
01422
01423 void flgr2d_measure_volume_f32_fgBIT(FLGR_Data2D *dat, FLGR_Vector *volume) {
01424 FLGR_MACRO_MEASURE2D_VOLUME_F32(fgBIT);
01425 }
01426 void flgr2d_measure_volume_f32_fgUINT8(FLGR_Data2D *dat, FLGR_Vector *volume) {
01427 FLGR_MACRO_MEASURE2D_VOLUME_F32(fgUINT8);
01428 }
01429 void flgr2d_measure_volume_f32_fgUINT16(FLGR_Data2D *dat, FLGR_Vector *volume) {
01430 FLGR_MACRO_MEASURE2D_VOLUME_F32(fgUINT16);
01431 }
01432 void flgr2d_measure_volume_f32_fgUINT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01433 FLGR_MACRO_MEASURE2D_VOLUME_F32(fgUINT32);
01434 }
01435 void flgr2d_measure_volume_f32_fgINT8(FLGR_Data2D *dat, FLGR_Vector *volume) {
01436 FLGR_MACRO_MEASURE2D_VOLUME_F32(fgINT8);
01437 }
01438 void flgr2d_measure_volume_f32_fgINT16(FLGR_Data2D *dat, FLGR_Vector *volume) {
01439 FLGR_MACRO_MEASURE2D_VOLUME_F32(fgINT16);
01440 }
01441 void flgr2d_measure_volume_f32_fgINT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01442 FLGR_MACRO_MEASURE2D_VOLUME_F32(fgINT32);
01443 }
01444 void flgr2d_measure_volume_f32_fgFLOAT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01445 FLGR_MACRO_MEASURE2D_VOLUME_F32(fgFLOAT32);
01446 }
01447 void flgr2d_measure_volume_f32_fgFLOAT64(FLGR_Data2D *dat, FLGR_Vector *volume) {
01448 FLGR_MACRO_MEASURE2D_VOLUME_F32(fgFLOAT64);
01449 }
01450
01451
01452
01453
01454 void flgr2d_measure_volume_f64_fgBIT(FLGR_Data2D *dat, FLGR_Vector *volume) {
01455 FLGR_MACRO_MEASURE2D_VOLUME_F64(fgBIT);
01456 }
01457 void flgr2d_measure_volume_f64_fgUINT8(FLGR_Data2D *dat, FLGR_Vector *volume) {
01458 FLGR_MACRO_MEASURE2D_VOLUME_F64(fgUINT8);
01459 }
01460 void flgr2d_measure_volume_f64_fgUINT16(FLGR_Data2D *dat, FLGR_Vector *volume) {
01461 FLGR_MACRO_MEASURE2D_VOLUME_F64(fgUINT16);
01462 }
01463 void flgr2d_measure_volume_f64_fgUINT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01464 FLGR_MACRO_MEASURE2D_VOLUME_F64(fgUINT32);
01465 }
01466 void flgr2d_measure_volume_f64_fgINT8(FLGR_Data2D *dat, FLGR_Vector *volume) {
01467 FLGR_MACRO_MEASURE2D_VOLUME_F64(fgINT8);
01468 }
01469 void flgr2d_measure_volume_f64_fgINT16(FLGR_Data2D *dat, FLGR_Vector *volume) {
01470 FLGR_MACRO_MEASURE2D_VOLUME_F64(fgINT16);
01471 }
01472 void flgr2d_measure_volume_f64_fgINT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01473 FLGR_MACRO_MEASURE2D_VOLUME_F64(fgINT32);
01474 }
01475 void flgr2d_measure_volume_f64_fgFLOAT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01476 FLGR_MACRO_MEASURE2D_VOLUME_F64(fgFLOAT32);
01477 }
01478 void flgr2d_measure_volume_f64_fgFLOAT64(FLGR_Data2D *dat, FLGR_Vector *volume) {
01479 FLGR_MACRO_MEASURE2D_VOLUME_F64(fgFLOAT64);
01480 }
01481
01482
01483
01484 #define FLGR_MEASURE_VOLUME2D_PREDISPATCH(dtype,vector_type,...) \
01485 switch(vector_type) { \
01486 case FLGR_UINT32: \
01487 flgr2d_measure_volume_u32_##dtype(__VA_ARGS__);break; \
01488 case FLGR_UINT64: \
01489 flgr2d_measure_volume_u64_##dtype(__VA_ARGS__);break; \
01490 case FLGR_INT32: \
01491 flgr2d_measure_volume_s32_##dtype(__VA_ARGS__);break; \
01492 case FLGR_INT64: \
01493 flgr2d_measure_volume_s64_##dtype(__VA_ARGS__);break; \
01494 case FLGR_FLOAT32: \
01495 flgr2d_measure_volume_f32_##dtype(__VA_ARGS__);break; \
01496 case FLGR_FLOAT64: \
01497 flgr2d_measure_volume_f64_##dtype(__VA_ARGS__);break; \
01498 default: \
01499 POST_ERROR("Unsupported volume vector type : %s\n", \
01500 flgr_get_type_string(vector_type)); \
01501 } \
01502 return
01503
01504
01505
01506 void flgr2d_measure_volume_fgBIT(FLGR_Data2D *dat, FLGR_Vector *volume) {
01507 FLGR_MEASURE_VOLUME2D_PREDISPATCH(fgBIT,volume->type,dat,volume);
01508 }
01509 void flgr2d_measure_volume_fgUINT8(FLGR_Data2D *dat, FLGR_Vector *volume) {
01510 FLGR_MEASURE_VOLUME2D_PREDISPATCH(fgUINT8,volume->type,dat,volume);
01511 }
01512 void flgr2d_measure_volume_fgUINT16(FLGR_Data2D *dat, FLGR_Vector *volume) {
01513 FLGR_MEASURE_VOLUME2D_PREDISPATCH(fgUINT16,volume->type,dat,volume);
01514 }
01515 void flgr2d_measure_volume_fgUINT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01516 FLGR_MEASURE_VOLUME2D_PREDISPATCH(fgUINT32,volume->type,dat,volume);
01517 }
01518 void flgr2d_measure_volume_fgINT8(FLGR_Data2D *dat, FLGR_Vector *volume) {
01519 FLGR_MEASURE_VOLUME2D_PREDISPATCH(fgINT8,volume->type,dat,volume);
01520 }
01521 void flgr2d_measure_volume_fgINT16(FLGR_Data2D *dat, FLGR_Vector *volume) {
01522 FLGR_MEASURE_VOLUME2D_PREDISPATCH(fgINT16,volume->type,dat,volume);
01523 }
01524 void flgr2d_measure_volume_fgINT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01525 FLGR_MEASURE_VOLUME2D_PREDISPATCH(fgINT32,volume->type,dat,volume);
01526 }
01527 void flgr2d_measure_volume_fgFLOAT32(FLGR_Data2D *dat, FLGR_Vector *volume) {
01528 FLGR_MEASURE_VOLUME2D_PREDISPATCH(fgFLOAT32,volume->type,dat,volume);
01529 }
01530 void flgr2d_measure_volume_fgFLOAT64(FLGR_Data2D *dat, FLGR_Vector *volume) {
01531 FLGR_MEASURE_VOLUME2D_PREDISPATCH(fgFLOAT64,volume->type,dat,volume);
01532 }
01533
01534
01536
01546
01547 FLGR_Ret flgr2d_measure_volume(FLGR_Data2D *dat, FLGR_Vector *volume) {
01548
01549 if((dat == NULL) || (volume==NULL)) {
01550 POST_ERROR("Null object\n");
01551 return FLGR_RET_NULL_OBJECT;
01552 }
01553
01554 FLGR_DISPATCH_PROCEDURE(dat->type,flgr2d_measure_volume,dat,volume);
01555 }
01556
01557
01558
01559
01560
01561
01562
01563
01564
01565 #define FLGR_MACRO_MEASURE2D_SAD_U32(dtype) \
01566 FLGR_Data1D **pdat1 = dat1->row; \
01567 FLGR_Data1D **pdat2 = dat2->row; \
01568 FLGR_Vector *vec = flgr_vector_create(sad->spp, FLGR_UINT32); \
01569 int i; \
01570 \
01571 \
01572 \
01573 flgr_vector_clear(sad); \
01574 \
01575 for(i=0 ; i<dat1->size_y ; i++,pdat1++,pdat2++) { \
01576 flgr1d_measure_sad_u32_##dtype(*pdat1,*pdat2,vec); \
01577 flgr_vector_add_fgUINT32(sad,sad,vec); \
01578 } \
01579 flgr_vector_destroy(vec)
01580
01581
01582
01583 #define FLGR_MACRO_MEASURE2D_SAD_U64(dtype) \
01584 FLGR_Data1D **pdat1 = dat1->row; \
01585 FLGR_Data1D **pdat2 = dat2->row; \
01586 FLGR_Vector *vec = flgr_vector_create(sad->spp, FLGR_UINT64); \
01587 int i; \
01588 \
01589 \
01590 \
01591 flgr_vector_clear(sad); \
01592 \
01593 for(i=0 ; i<dat1->size_y ; i++,pdat1++,pdat2++) { \
01594 flgr1d_measure_sad_u64_##dtype(*pdat1,*pdat2,vec); \
01595 flgr_vector_add_fgUINT64(sad,sad,vec); \
01596 } \
01597 flgr_vector_destroy(vec)
01598
01599
01600 #define FLGR_MACRO_MEASURE2D_SAD_F32(dtype) \
01601 FLGR_Data1D **pdat1 = dat1->row; \
01602 FLGR_Data1D **pdat2 = dat2->row; \
01603 FLGR_Vector *vec = flgr_vector_create(sad->spp, FLGR_FLOAT32); \
01604 int i; \
01605 \
01606 \
01607 \
01608 flgr_vector_clear(sad); \
01609 \
01610 for(i=0 ; i<dat1->size_y ; i++,pdat1++,pdat2++) { \
01611 flgr1d_measure_sad_f32_##dtype(*pdat1,*pdat2,vec); \
01612 flgr_vector_add_fgFLOAT32(sad,sad,vec); \
01613 } \
01614 flgr_vector_destroy(vec)
01615
01616
01617 #define FLGR_MACRO_MEASURE2D_SAD_F64(dtype) \
01618 FLGR_Data1D **pdat1 = dat1->row; \
01619 FLGR_Data1D **pdat2 = dat2->row; \
01620 FLGR_Vector *vec = flgr_vector_create(sad->spp, FLGR_FLOAT64); \
01621 int i; \
01622 \
01623 \
01624 \
01625 flgr_vector_clear(sad); \
01626 \
01627 for(i=0 ; i<dat1->size_y ; i++,pdat1++,pdat2++) { \
01628 flgr1d_measure_sad_f64_##dtype(*pdat1,*pdat2,vec); \
01629 flgr_vector_add_fgFLOAT64(sad,sad,vec); \
01630 } \
01631 flgr_vector_destroy(vec)
01632
01633
01634
01635 void flgr2d_measure_sad_u32_fgBIT(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01636 FLGR_MACRO_MEASURE2D_SAD_U32(fgBIT);
01637 }
01638 void flgr2d_measure_sad_u32_fgUINT8(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01639 FLGR_MACRO_MEASURE2D_SAD_U32(fgUINT8);
01640 }
01641 void flgr2d_measure_sad_u32_fgUINT16(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01642 FLGR_MACRO_MEASURE2D_SAD_U32(fgUINT16);
01643 }
01644 void flgr2d_measure_sad_u32_fgUINT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01645 FLGR_MACRO_MEASURE2D_SAD_U32(fgUINT32);
01646 }
01647 void flgr2d_measure_sad_u32_fgINT8(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01648 FLGR_MACRO_MEASURE2D_SAD_U32(fgINT8);
01649 }
01650 void flgr2d_measure_sad_u32_fgINT16(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01651 FLGR_MACRO_MEASURE2D_SAD_U32(fgINT16);
01652 }
01653 void flgr2d_measure_sad_u32_fgINT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01654 FLGR_MACRO_MEASURE2D_SAD_U32(fgINT32);
01655 }
01656 void flgr2d_measure_sad_u32_fgFLOAT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01657 FLGR_MACRO_MEASURE2D_SAD_U32(fgFLOAT32);
01658 }
01659 void flgr2d_measure_sad_u32_fgFLOAT64(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01660 FLGR_MACRO_MEASURE2D_SAD_U32(fgFLOAT64);
01661 }
01662
01663
01664
01665
01666 void flgr2d_measure_sad_u64_fgBIT(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01667 FLGR_MACRO_MEASURE2D_SAD_U64(fgBIT);
01668 }
01669 void flgr2d_measure_sad_u64_fgUINT8(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01670 FLGR_MACRO_MEASURE2D_SAD_U64(fgUINT8);
01671 }
01672 void flgr2d_measure_sad_u64_fgUINT16(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01673 FLGR_MACRO_MEASURE2D_SAD_U64(fgUINT16);
01674 }
01675 void flgr2d_measure_sad_u64_fgUINT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01676 FLGR_MACRO_MEASURE2D_SAD_U64(fgUINT32);
01677 }
01678 void flgr2d_measure_sad_u64_fgINT8(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01679 FLGR_MACRO_MEASURE2D_SAD_U64(fgINT8);
01680 }
01681 void flgr2d_measure_sad_u64_fgINT16(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01682 FLGR_MACRO_MEASURE2D_SAD_U64(fgINT16);
01683 }
01684 void flgr2d_measure_sad_u64_fgINT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01685 FLGR_MACRO_MEASURE2D_SAD_U64(fgINT32);
01686 }
01687 void flgr2d_measure_sad_u64_fgFLOAT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01688 FLGR_MACRO_MEASURE2D_SAD_U64(fgFLOAT32);
01689 }
01690 void flgr2d_measure_sad_u64_fgFLOAT64(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01691 FLGR_MACRO_MEASURE2D_SAD_U64(fgFLOAT64);
01692 }
01693
01694
01695
01696
01697 void flgr2d_measure_sad_f32_fgBIT(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01698 FLGR_MACRO_MEASURE2D_SAD_F32(fgBIT);
01699 }
01700 void flgr2d_measure_sad_f32_fgUINT8(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01701 FLGR_MACRO_MEASURE2D_SAD_F32(fgUINT8);
01702 }
01703 void flgr2d_measure_sad_f32_fgUINT16(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01704 FLGR_MACRO_MEASURE2D_SAD_F32(fgUINT16);
01705 }
01706 void flgr2d_measure_sad_f32_fgUINT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01707 FLGR_MACRO_MEASURE2D_SAD_F32(fgUINT32);
01708 }
01709 void flgr2d_measure_sad_f32_fgINT8(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01710 FLGR_MACRO_MEASURE2D_SAD_F32(fgINT8);
01711 }
01712 void flgr2d_measure_sad_f32_fgINT16(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01713 FLGR_MACRO_MEASURE2D_SAD_F32(fgINT16);
01714 }
01715 void flgr2d_measure_sad_f32_fgINT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01716 FLGR_MACRO_MEASURE2D_SAD_F32(fgINT32);
01717 }
01718 void flgr2d_measure_sad_f32_fgFLOAT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01719 FLGR_MACRO_MEASURE2D_SAD_F32(fgFLOAT32);
01720 }
01721 void flgr2d_measure_sad_f32_fgFLOAT64(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01722 FLGR_MACRO_MEASURE2D_SAD_F32(fgFLOAT64);
01723 }
01724
01725
01726
01727
01728 void flgr2d_measure_sad_f64_fgBIT(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01729 FLGR_MACRO_MEASURE2D_SAD_F64(fgBIT);
01730 }
01731 void flgr2d_measure_sad_f64_fgUINT8(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01732 FLGR_MACRO_MEASURE2D_SAD_F64(fgUINT8);
01733 }
01734 void flgr2d_measure_sad_f64_fgUINT16(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01735 FLGR_MACRO_MEASURE2D_SAD_F64(fgUINT16);
01736 }
01737 void flgr2d_measure_sad_f64_fgUINT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01738 FLGR_MACRO_MEASURE2D_SAD_F64(fgUINT32);
01739 }
01740 void flgr2d_measure_sad_f64_fgINT8(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01741 FLGR_MACRO_MEASURE2D_SAD_F64(fgINT8);
01742 }
01743 void flgr2d_measure_sad_f64_fgINT16(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01744 FLGR_MACRO_MEASURE2D_SAD_F64(fgINT16);
01745 }
01746 void flgr2d_measure_sad_f64_fgINT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01747 FLGR_MACRO_MEASURE2D_SAD_F64(fgINT32);
01748 }
01749 void flgr2d_measure_sad_f64_fgFLOAT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01750 FLGR_MACRO_MEASURE2D_SAD_F64(fgFLOAT32);
01751 }
01752 void flgr2d_measure_sad_f64_fgFLOAT64(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01753 FLGR_MACRO_MEASURE2D_SAD_F64(fgFLOAT64);
01754 }
01755
01756
01757
01758 #define FLGR_MEASURE_SAD2D_PREDISPATCH(dtype,vector_type,...) \
01759 switch(vector_type) { \
01760 case FLGR_UINT32: \
01761 flgr2d_measure_sad_u32_##dtype(__VA_ARGS__);break; \
01762 case FLGR_UINT64: \
01763 flgr2d_measure_sad_u64_##dtype(__VA_ARGS__);break; \
01764 case FLGR_FLOAT32: \
01765 flgr2d_measure_sad_f32_##dtype(__VA_ARGS__);break; \
01766 case FLGR_FLOAT64: \
01767 flgr2d_measure_sad_f64_##dtype(__VA_ARGS__);break; \
01768 default: \
01769 POST_ERROR("Unsupported sad vector type : %s\n", \
01770 flgr_get_type_string(vector_type)); \
01771 } \
01772 return
01773
01774
01775
01776 void flgr2d_measure_sad_fgBIT(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01777 FLGR_MEASURE_SAD2D_PREDISPATCH(fgBIT,sad->type,dat1,dat2,sad);
01778 }
01779 void flgr2d_measure_sad_fgUINT8(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01780 FLGR_MEASURE_SAD2D_PREDISPATCH(fgUINT8,sad->type,dat1,dat2,sad);
01781 }
01782 void flgr2d_measure_sad_fgUINT16(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01783 FLGR_MEASURE_SAD2D_PREDISPATCH(fgUINT16,sad->type,dat1,dat2,sad);
01784 }
01785 void flgr2d_measure_sad_fgUINT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01786 FLGR_MEASURE_SAD2D_PREDISPATCH(fgUINT32,sad->type,dat1,dat2,sad);
01787 }
01788 void flgr2d_measure_sad_fgINT8(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01789 FLGR_MEASURE_SAD2D_PREDISPATCH(fgINT8,sad->type,dat1,dat2,sad);
01790 }
01791 void flgr2d_measure_sad_fgINT16(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01792 FLGR_MEASURE_SAD2D_PREDISPATCH(fgINT16,sad->type,dat1,dat2,sad);
01793 }
01794 void flgr2d_measure_sad_fgINT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01795 FLGR_MEASURE_SAD2D_PREDISPATCH(fgINT32,sad->type,dat1,dat2,sad);
01796 }
01797 void flgr2d_measure_sad_fgFLOAT32(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01798 FLGR_MEASURE_SAD2D_PREDISPATCH(fgFLOAT32,sad->type,dat1,dat2,sad);
01799 }
01800 void flgr2d_measure_sad_fgFLOAT64(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01801 FLGR_MEASURE_SAD2D_PREDISPATCH(fgFLOAT64,sad->type,dat1,dat2,sad);
01802 }
01803
01804
01806
01816
01817 FLGR_Ret flgr2d_measure_sad(FLGR_Data2D *dat1, FLGR_Data2D *dat2, FLGR_Vector *sad) {
01818 FLGR_Ret ret;
01819
01820
01821 if((dat1 == NULL) || (dat2 == NULL) || (sad==NULL)) {
01822 POST_ERROR("Null object\n");
01823 return FLGR_RET_NULL_OBJECT;
01824 }
01825
01826 if((ret=flgr2d_is_data_same_attributes(dat1,dat2,__FUNCTION__))!=FLGR_RET_OK) return ret;
01827
01828 FLGR_DISPATCH_PROCEDURE(dat1->type,flgr2d_measure_sad,dat1,dat2,sad);
01829 }
01830
01831
01832
01833
01834
01835
01836