int compare_scalar_BLIP2_to_vector_BLIP(unsigned short* img, pixel* vbx_input, int width, int height, int max_print_errors, int scale_factor) { int j, errors = 0; int scaled_width, scaled_height; /* scale facetor v/v+1, v is between 1-10 */ scaled_width = width*scale_factor/(scale_factor+1); scaled_height= height*scale_factor/(scale_factor+1); unsigned short *scaled_img, *vbx_img, *vbx_scaled_img; unsigned char *vbx_img8, *vbx_scaled_img8; unsigned int *iImg, *iiImg, *vbx_iImg, *vbx_iiImg; scaled_img = (unsigned short*)vbx_shared_malloc(scaled_width*scaled_height*sizeof(unsigned short)); iImg = (unsigned int*)vbx_shared_malloc(scaled_width*scaled_height*sizeof(unsigned int)); iiImg = (unsigned int*)vbx_shared_malloc(scaled_width*scaled_height*sizeof(unsigned int)); vbx_scaled_img = (unsigned short*)vbx_shared_malloc(scaled_width*scaled_height*sizeof(unsigned short)); vbx_img = (unsigned short*)vbx_shared_malloc(width*height*sizeof(unsigned short)); vbx_img8 = (unsigned char*)vbx_shared_malloc(width*height*sizeof(unsigned char)); vbx_scaled_img8 = (unsigned char*)vbx_shared_malloc(scaled_width*scaled_height*sizeof(unsigned char)); vbx_iImg = (unsigned int*)vbx_shared_malloc(width*height*sizeof(unsigned int)); vbx_iiImg = (unsigned int*)vbx_shared_malloc(width*height*sizeof(unsigned int)); #if 0 scalar_BLIP2(img, height, width, scaled_img, scaled_height, scaled_width, scale_factor); #else float percent = 1.0 * (scale_factor+1) / scale_factor; scalar_BLIP(img, height, width, scaled_img, scaled_height, scaled_width, &percent); #endif gen_integrals(scaled_img, iImg, iiImg, scaled_width, scaled_height); vector_get_img(vbx_img, vbx_iImg, vbx_iiImg, vbx_input, 1, width, height, width, 1); vector_BLIP(vbx_img, height, width, vbx_scaled_img, vbx_iImg, vbx_iiImg, scaled_height, scaled_width, scale_factor, 1); vector_get_img8(vbx_img8, vbx_input, 1, width, height, width); /* vector_BLIP8(vbx_img8, height, width, vbx_scaled_img8, scaled_height, scaled_width, scale_factor); */ vbx_timestamp_start(); vbx_timestamp_t time_start, time_stop; double vbx_time; time_start = vbx_timestamp(); #if 1 vector_BLIP8F3(vbx_img8, height, width, vbx_scaled_img8, scaled_height, scaled_width, scale_factor); #else vector_BLIP8F2(vbx_img8, height, width, vbx_scaled_img8, scaled_height, scaled_width, scale_factor); #endif time_stop = vbx_timestamp(); vbx_time = vbx_print_vector_time(time_start, time_stop, 0.0); /* test greyscale image */ for (j = 0; j < height; j++) { errors += match_array_half(img+j*width, vbx_img+j*width, "greyscale", width, 1, 0, max_print_errors, j); if(errors > max_print_errors) { max_print_errors = 0; } } /* test scaled image */ for (j = 0; j < scaled_height; j++) { errors += match_array_half(scaled_img+j*scaled_width, vbx_scaled_img+j*scaled_width, "scaled greyscale", scaled_width, 1, 1, max_print_errors, j); if(errors > max_print_errors) { max_print_errors = 0; } } for (j = 0; j < scaled_height; j++) { errors += match_array_half_byte(scaled_img+j*scaled_width, vbx_scaled_img8+j*scaled_width, "scaled greyscale8", scaled_width, 1, 1, max_print_errors, j); if(errors > max_print_errors) { max_print_errors = 0; } } #if 0 /* test scaled_integral image */ for (j = 0; j < scaled_height; j++) { errors += match_array_word(iImg+j*scaled_width, vbx_iImg+j*scaled_width, "scaled integral", scaled_width, 1, 0, max_print_errors, j); if(errors > max_print_errors) { max_print_errors = 0; } } /* test scaled squared integral image */ for (j = 0; j < scaled_height; j++) { errors += match_array_word(iiImg+j*scaled_width, vbx_iiImg+j*scaled_width, "scaled squared", scaled_width, 1, 0, max_print_errors, j); if(errors > max_print_errors) { max_print_errors = 0; } } #endif /* test scaled_integral image */ return errors; }
int compare_scalar_BLIP2_to_vector_BLIP(unsigned short* img, pixel* vbx_input, int width, int height, int max_print_errors) { int j, errors = 0; int value, scaled_width, scaled_height; /* scale facetor v/v+1, v is between 1-10 */ value = 3; //BAD 2,5,6,8 scaled_width = width*value/(value+1); scaled_height= height*value/(value+1); unsigned short *scaled_img, *vbx_img, *vbx_scaled_img; unsigned int *iImg, *iiImg, *vbx_iImg, *vbx_iiImg; scaled_img = (unsigned short*)vbx_shared_malloc(scaled_width*scaled_height*sizeof(unsigned short)); iImg = (unsigned int*)vbx_shared_malloc(scaled_width*scaled_height*sizeof(unsigned int)); iiImg = (unsigned int*)vbx_shared_malloc(scaled_width*scaled_height*sizeof(unsigned int)); vbx_scaled_img = (unsigned short*)vbx_shared_malloc(scaled_width*scaled_height*sizeof(unsigned short)); vbx_img = (unsigned short*)vbx_shared_malloc(width*height*sizeof(unsigned short)); vbx_iImg = (unsigned int*)vbx_shared_malloc(width*height*sizeof(unsigned int)); vbx_iiImg = (unsigned int*)vbx_shared_malloc(width*height*sizeof(unsigned int)); scalar_BLIP2(img, height, width, scaled_img, scaled_height, scaled_width, value); gen_integrals(scaled_img, iImg, iiImg, scaled_width, scaled_height); vector_get_img(vbx_img, vbx_iImg, vbx_iiImg, vbx_input, 1, width, height, width, 1); vector_BLIP(vbx_img, height, width, vbx_scaled_img, vbx_iImg, vbx_iiImg, scaled_height, scaled_width, value, 1); /* test greyscale image */ for (j = 0; j < height; j++) { errors += match_array_half(img+j*width, vbx_img+j*width, "greyscale", width, 1, max_print_errors, j); if(errors > max_print_errors) { max_print_errors = 0; } } /* test scaled image */ for (j = 0; j < scaled_height; j++) { errors += match_array_half(scaled_img+j*scaled_width, vbx_scaled_img+j*scaled_width, "scaled greyscale", scaled_width, 1, max_print_errors, j); if(errors > max_print_errors) { max_print_errors = 0; } } /* test scaled_integral image */ for (j = 0; j < scaled_height; j++) { errors += match_array_word(iImg+j*scaled_width, vbx_iImg+j*scaled_width, "scaled integral", scaled_width, 1, max_print_errors, j); if(errors > max_print_errors) { max_print_errors = 0; } } /* test scaled squared integral image */ for (j = 0; j < scaled_height; j++) { errors += match_array_word(iiImg+j*scaled_width, vbx_iiImg+j*scaled_width, "scaled squared", scaled_width, 1, max_print_errors, j); if(errors > max_print_errors) { max_print_errors = 0; } } return errors; }