Add tune for still image compression
authorJason Garrett-Glaser <darkshikari@gmail.com>
Tue, 23 Mar 2010 21:00:58 +0000 (14:00 -0700)
committerJason Garrett-Glaser <darkshikari@gmail.com>
Sat, 27 Mar 2010 19:47:31 +0000 (12:47 -0700)
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
x264.c
x264.h

index 6ef9767..00cdc4f 100644 (file)
@@ -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 5aecaca..22fd2ce 100644 (file)
--- 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 <unset>: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 9f5eb1d..8b753f5 100644 (file)
--- a/x264.h
+++ b/x264.h
@@ -35,7 +35,7 @@
 
 #include <stdarg.h>
 
-#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.