From 5543435e17c5b9bdbaeb979b76fdd5a2de727e93 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Tue, 23 Mar 2010 14:00:58 -0700 Subject: [PATCH] Add tune for still image compression There has been some demand for this from companies looking to use x264 for still image compression (it can outperform JPEG or JPEG-2000 by a factor of 2 or more). Still image compression is a bit different; because temporal stability isn't an issue, we can get away with far more powerful psy settings. --- common/common.c | 9 +++++++++ x264.c | 6 +++++- x264.h | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/common/common.c b/common/common.c index 6ef9767c..00cdc4fa 100644 --- a/common/common.c +++ b/common/common.c @@ -309,6 +309,15 @@ static int x264_param_apply_tune( x264_param_t *param, const char *tune ) param->analyse.i_luma_deadzone[1] = 6; param->rc.f_qcompress = 0.8; } + else if( !strncasecmp( s, "stillimage", 5 ) ) + { + if( psy_tuning_used++ ) goto psy_failure; + param->i_deblocking_filter_alphac0 = -3; + param->i_deblocking_filter_beta = -3; + param->analyse.f_psy_rd = 2.0; + param->analyse.f_psy_trellis = 0.7; + param->rc.f_aq_strength = 1.2; + } else if( !strncasecmp( s, "psnr", 4 ) ) { if( psy_tuning_used++ ) goto psy_failure; diff --git a/x264.c b/x264.c index 5aecacad..22fd2ce3 100644 --- a/x264.c +++ b/x264.c @@ -336,6 +336,9 @@ static void Help( x264_param_t *defaults, int longhelp ) " --deblock -2:-2 --ipratio 1.1 \n" " --pbratio 1.1 --psy-rd :0.25\n" " --qcomp 0.8\n" + " - stillimage (psy tuning):\n" + " --aq-strength 1.2 --deblock -3:-3\n" + " --psy-rd 2.0:0.7\n" " - psnr (psy tuning):\n" " --aq-mode 0 --no-psy\n" " - ssim (psy tuning):\n" @@ -346,7 +349,8 @@ static void Help( x264_param_t *defaults, int longhelp ) " - zerolatency:\n" " --bframes 0 --force-cfr --rc-lookahead 0\n" " --sync-lookahead 0 --sliced-threads\n" ); - else H0( " - psy tunings: film,animation,grain,psnr,ssim\n" + else H0( " - psy tunings: film,animation,grain,\n" + " stillimage,psnr,ssim\n" " - other tunings: fastdecode,zerolatency\n" ); H2( " --slow-firstpass Don't force these faster settings with --pass 1:\n" " --no-8x8dct --me dia --partitions none --ref 1\n" diff --git a/x264.h b/x264.h index 9f5eb1df..8b753f51 100644 --- a/x264.h +++ b/x264.h @@ -35,7 +35,7 @@ #include -#define X264_BUILD 90 +#define X264_BUILD 91 /* x264_t: * opaque handler for encoder */ @@ -432,7 +432,7 @@ static const char * const x264_preset_names[] = { "ultrafast", "veryfast", "fast * 100 times faster than placebo! * * Currently available tunings are: */ -static const char * const x264_tune_names[] = { "film", "animation", "grain", "psnr", "ssim", "fastdecode", "zerolatency", 0 }; +static const char * const x264_tune_names[] = { "film", "animation", "grain", "stillimage", "psnr", "ssim", "fastdecode", "zerolatency", 0 }; /* Multiple tunings can be used if separated by a delimiter in ",./-+", * however multiple psy tunings cannot be used. -- 2.47.3