Commit 52008dce authored by Charron Maxime's avatar Charron Maxime
Browse files

Ajout affichage minute écoulées

parent 8221bba8
......@@ -87,7 +87,9 @@ unsigned char* CPU_calculateDiff(unsigned char* input, unsigned char* search, in
}
}
fflush(stdout);
printf("\rDone in \033[0;31m %f \033[0m seconds\n",omp_get_wtime() - compute_diff);
int* time = convert((float) (omp_get_wtime() - compute_diff));
printf("\rDone in \033[0;31m %d minutes %d seconds \033[0m\n", time[0], time[1]);
return diff;
}
......
......@@ -46,3 +46,14 @@ void savePicture (unsigned char *image, char* filename, int imgWidth, int imgHei
printf("Picture saved : %s\n",str);
}
int* convert(float t){
int time = (int) t;
int minutes = floor((time / 60) % 60);
int seconds = time % 60;
int* tab_time = (int*) malloc( 3 * sizeof(int));
tab_time[0] = minutes;
tab_time[1] = seconds;
return tab_time;
}
......@@ -3,4 +3,6 @@ unsigned char* load_img(const char * imgPath, int* imgWidth, int* imgHeight);
void free_img(unsigned char*);
void savePicture (unsigned char *image, char* filename, int imgWidth, int imgHeight);
\ No newline at end of file
void savePicture (unsigned char *image, char* filename, int imgWidth, int imgHeight);
int* convert(float t);
\ No newline at end of file
img/output/final_m1.png

1.19 MB | W: | H:

img/output/final_m1.png

3.81 MB | W: | H:

img/output/final_m1.png
img/output/final_m1.png
img/output/final_m1.png
img/output/final_m1.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -151,7 +151,8 @@ int main (int argc, char *argv[])
*/
free_img(inputImg);
free_img(searchImg);
printf("The program took \033[0;31m %f \033[0m seconds to execute\n", omp_get_wtime() - temps_initial);
int* time = convert((float)(omp_get_wtime() - temps_initial));
printf("The CPU took \033[0;31m %d minutes %d seconds \033[0m to execute\n", time[0], time[1]);
printf("Good bye!\n");
return EXIT_SUCCESS;
......
clear
echo "=============================================================================="
echo " COMPILATION"
echo "=============================================================================="
make tp_projet
echo ""
echo "=============================================================================="
echo " RUN"
echo "=============================================================================="
chmod 755 ./tp_projet
: '
Image espace
'
#./tp_projet ./img/space.png ./img/goat.png
: '
Image jungle
'
./tp_projet ./img/jungle.png ./img/goat.png
: '
Image plage
'
#./tp_projet ./img/beach.png ./img/goat.png
No preview for this file type
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment