From 97797d2dd4b41e22af651accd41c29e2a469decb Mon Sep 17 00:00:00 2001 From: Fiona Glaser Date: Tue, 12 Apr 2011 01:16:48 -0700 Subject: [PATCH] Warn users when using --(psnr|ssim) without --tune (psnr|ssim) This is a counter to the proliferation of incredibly stupid psnr/ssim "benchmarks" of x264 in which the benchmarker conveniently "forgot" --tune psnr/ssim, crippling x264 in the test. --- encoder/encoder.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/encoder/encoder.c b/encoder/encoder.c index 502ae636..8a1f8dcf 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -705,6 +705,36 @@ static int x264_validate_parameters( x264_t *h ) } h->param.analyse.i_chroma_qp_offset = x264_clip3(h->param.analyse.i_chroma_qp_offset, -12, 12); h->param.analyse.i_trellis = x264_clip3( h->param.analyse.i_trellis, 0, 2 ); + + if( h->param.i_log_level < X264_LOG_INFO ) + { + h->param.analyse.b_psnr = 0; + h->param.analyse.b_ssim = 0; + } + /* Warn users trying to measure PSNR/SSIM with psy opts on. */ + if( h->param.analyse.b_psnr || h->param.analyse.b_ssim ) + { + char *s = NULL; + + if( h->param.analyse.b_psy ) + { + s = h->param.analyse.b_psnr ? "psnr" : "ssim"; + x264_log( h, X264_LOG_WARNING, "--%s used with psy on: results will be invalid!\n", s ); + } + else if( !h->param.rc.i_aq_mode && h->param.analyse.b_ssim ) + { + x264_log( h, X264_LOG_WARNING, "--ssim used with AQ off: results will be invalid!\n" ); + s = "ssim"; + } + else if( h->param.rc.i_aq_mode && h->param.analyse.b_psnr ) + { + x264_log( h, X264_LOG_WARNING, "--psnr used with AQ on: results will be invalid!\n" ); + s = "psnr"; + } + if( s ) + x264_log( h, X264_LOG_WARNING, "--tune %s should be used if attempting to benchmark %s!\n", s, s ); + } + if( !h->param.analyse.b_psy ) { h->param.analyse.f_psy_rd = 0; @@ -805,12 +835,6 @@ static int x264_validate_parameters( x264_t *h ) h->param.i_sps_id &= 31; - if( h->param.i_log_level < X264_LOG_INFO ) - { - h->param.analyse.b_psnr = 0; - h->param.analyse.b_ssim = 0; - } - if( h->param.b_interlaced ) h->param.b_pic_struct = 1; -- 2.39.2