]> git.sesse.net Git - x264/commitdiff
Add tune for still image compression
authorFiona Glaser <fiona@x264.com>
Tue, 23 Mar 2010 21:00:58 +0000 (14:00 -0700)
committerFiona Glaser <fiona@x264.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 6ef9767c05a18300f00b208f2b348ac191233689..00cdc4fa100af1d26ae2002c0483e76edcbed136 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 5aecacaddede92959b6060b71dd2ca48239a3efd..22fd2ce339f5570d88f0502e4d75b10e739cc375 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 9f5eb1dffd89fc9a4cbb868e28c55eab74796fb3..8b753f51faa93110f5d51e8e5ee4f893e6e0055e 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.