Fix qoibench avg calculation: ignore non-png entries
This commit is contained in:
parent
81b438cb56
commit
30f8a39ec8
25
qoibench.c
25
qoibench.c
@ -467,11 +467,12 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
printf("## Benchmarking %s/*.png -- %d runs\n\n", argv[2], runs);
|
printf("## Benchmarking %s/*.png -- %d runs\n\n", argv[2], runs);
|
||||||
struct dirent *file;
|
struct dirent *file;
|
||||||
int i;
|
int count = 0;
|
||||||
for (i = 0; dir && (file = readdir(dir)) != NULL; i++) {
|
for (int i = 0; dir && (file = readdir(dir)) != NULL; i++) {
|
||||||
if (strcmp(file->d_name + strlen(file->d_name) - 4, ".png") != 0) {
|
if (strcmp(file->d_name + strlen(file->d_name) - 4, ".png") != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
count++;
|
||||||
|
|
||||||
char *file_path = malloc(strlen(file->d_name) + strlen(argv[2])+8);
|
char *file_path = malloc(strlen(file->d_name) + strlen(argv[2])+8);
|
||||||
sprintf(file_path, "%s/%s", argv[2], file->d_name);
|
sprintf(file_path, "%s/%s", argv[2], file->d_name);
|
||||||
@ -495,16 +496,16 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
|
||||||
totals.px /= i;
|
totals.px /= count;
|
||||||
totals.libpng.encode_time /= i;
|
totals.libpng.encode_time /= count;
|
||||||
totals.libpng.decode_time /= i;
|
totals.libpng.decode_time /= count;
|
||||||
totals.libpng.size /= i;
|
totals.libpng.size /= count;
|
||||||
totals.stbi.encode_time /= i;
|
totals.stbi.encode_time /= count;
|
||||||
totals.stbi.decode_time /= i;
|
totals.stbi.decode_time /= count;
|
||||||
totals.stbi.size /= i;
|
totals.stbi.size /= count;
|
||||||
totals.qoi.encode_time /= i;
|
totals.qoi.encode_time /= count;
|
||||||
totals.qoi.decode_time /= i;
|
totals.qoi.decode_time /= count;
|
||||||
totals.qoi.size /= i;
|
totals.qoi.size /= count;
|
||||||
|
|
||||||
benchmark_print_result("Totals (AVG)", totals);
|
benchmark_print_result("Totals (AVG)", totals);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user