Unified · Split
| @@ -239,10 +239,17 @@ static int run_test(enum AVPixelFormat src_fmt, enum AVPixelFormat dst_fmt, · 238 unmodified lines | ||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | if (opts.bench && time_ref) { |
| 242 | − printf(" time=%"PRId64" us, ref=%"PRId64" us, speedup=%.3fx %s\n", | |
| 243 | − time / opts.iters, time_ref / opts.iters, | |
| 244 | − (double) time_ref / time, | |
| 245 | − time <= time_ref ? "faster" : "\033[1;33mslower\033[0m"); | |
| 242 | + double ratio = (double) time_ref / time; | |
| 243 | + const char *color = ratio > 1.10 ? "\033[1;32m" : /* bold green */ | |
| 244 | + ratio > 1.02 ? "\033[32m" : /* green */ | |
| 245 | + ratio > 0.98 ? "" : /* default */ | |
| 246 | + ratio > 0.95 ? "\033[33m" : /* yellow */ | |
| 247 | + ratio > 0.90 ? "\033[31m" : /* red */ | |
| 248 | + "\033[1;31m"; /* bold red */ | |
| 249 | + | |
| 250 | + printf(" time=%"PRId64" us, ref=%"PRId64" us, speedup=%.3fx %s%s\033[0m\n", | |
| 251 | + time / opts.iters, time_ref / opts.iters, ratio, color, | |
| 252 | + ratio >= 1.0 ? "faster" : "slower"); | |
| 246 | 253 | } else if (opts.bench) { |
| 247 | 254 | printf(" time=%"PRId64" us\n", time / opts.iters); |
| 248 | 255 | } |