This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit d812c8b0eb3f689552ec3df372f71c05d6fd3a1e Author: Ramiro Polla <[email protected]> AuthorDate: Fri May 1 01:12:04 2026 +0200 Commit: Ramiro Polla <[email protected]> CommitDate: Fri May 15 14:12:48 2026 +0000 swscale/tests/swscale: log test parameters on loss error When running with "-v 0", the test parameters were not being printed, which made it hard to track down which conversion the error referred to. Now the test parameters are logged with av_log() when a loss error happens. --- libswscale/tests/swscale.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c index b08ae5fac4..868fc6e1f1 100644 --- a/libswscale/tests/swscale.c +++ b/libswscale/tests/swscale.c @@ -426,6 +426,22 @@ error: return ret; } +static void print_test_params(char *buf, size_t buf_size, + const AVFrame *src, const AVFrame *dst, + const struct mode *mode, const struct options *opts) +{ + snprintf(buf, buf_size, + "%-*s %*dx%*d -> %-*s %*dx%*d, flags=0x%0*x dither=%u", + opts->pretty ? 14 : 0, av_get_pix_fmt_name(src->format), + opts->pretty ? 4 : 0, src->width, + opts->pretty ? 4 : 0, src->height, + opts->pretty ? 14 : 0, av_get_pix_fmt_name(dst->format), + opts->pretty ? 4 : 0, dst->width, + opts->pretty ? 4 : 0, dst->height, + opts->pretty ? 8 : 0, mode->flags, + mode->dither); +} + static void print_results(const AVFrame *ref, const AVFrame *src, const AVFrame *dst, int dst_w, int dst_h, const struct mode *mode, const struct options *opts, @@ -433,16 +449,11 @@ static void print_results(const AVFrame *ref, const AVFrame *src, const AVFrame const struct test_results *ref_r, float expected_loss) { + char buf[128]; + if (av_log_get_level() >= AV_LOG_INFO) { - printf("%-*s %*dx%*d -> %-*s %*dx%*d, flags=0x%0*x dither=%u", - opts->pretty ? 14 : 0, av_get_pix_fmt_name(src->format), - opts->pretty ? 4 : 0, src->width, - opts->pretty ? 4 : 0, src->height, - opts->pretty ? 14 : 0, av_get_pix_fmt_name(dst->format), - opts->pretty ? 4 : 0, dst->width, - opts->pretty ? 4 : 0, dst->height, - opts->pretty ? 8 : 0, mode->flags, - mode->dither); + print_test_params(buf, sizeof(buf), src, dst, mode, opts); + printf("%s", buf); if (!opts->bench || !ref_r) { printf(", SSIM={Y=%f U=%f V=%f A=%f} loss=%e", @@ -480,6 +491,10 @@ static void print_results(const AVFrame *ref, const AVFrame *src, const AVFrame const int bad = r->loss - expected_loss > 1e-2; const int level = bad ? AV_LOG_ERROR : AV_LOG_WARNING; const char *worse_str = bad ? "WORSE" : "worse"; + if (bad) { + print_test_params(buf, sizeof(buf), src, dst, mode, opts); + av_log(NULL, level, "%s\n", buf); + } av_log(NULL, level, " loss %e is %s by %e, expected loss %e\n", r->loss, worse_str, r->loss - expected_loss, expected_loss); @@ -498,6 +513,10 @@ static void print_results(const AVFrame *ref, const AVFrame *src, const AVFrame const int bad = r->loss - ref_r->loss > 1e-2 && dst_bits > 1; const int level = bad ? AV_LOG_ERROR : AV_LOG_WARNING; const char *worse_str = bad ? "WORSE" : "worse"; + if (bad) { + print_test_params(buf, sizeof(buf), src, dst, mode, opts); + av_log(NULL, level, "%s\n", buf); + } av_log(NULL, level, " loss %e is %s by %e, ref loss %e SSIM={Y=%f U=%f V=%f A=%f}\n", r->loss, worse_str, r->loss - ref_r->loss, ref_r->loss, _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
