]> granicus.if.org Git - handbrake/commitdiff
encx264: auto-enable metrics when the relevant tune is requested.
authorRodeo <tdskywalker@gmail.com>
Sat, 17 Aug 2013 23:21:45 +0000 (23:21 +0000)
committerRodeo <tdskywalker@gmail.com>
Sat, 17 Aug 2013 23:21:45 +0000 (23:21 +0000)
Thanks to s55 for the suggestion.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5710 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/encx264.c

index 3396ea3c590d51b4364c716d135c672d5f2707b1..6f91c8b2bd8875153420c52cc5b3364c8d29791f 100644 (file)
@@ -90,6 +90,28 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
         return 1;
     }
 
+    /* If the PSNR or SSIM tunes are in use, enable the relevant metric */
+    if (job->x264_tune != NULL && job->x264_tune[0] != '\0')
+    {
+        char *tmp = strdup(job->x264_tune);
+        char *tok = strtok(tmp,   ",./-+");
+        do
+        {
+            if (!strncasecmp(tok, "psnr", 4))
+            {
+                param.analyse.b_psnr = 1;
+                break;
+            }
+            if (!strncasecmp(tok, "ssim", 4))
+            {
+                param.analyse.b_ssim = 1;
+                break;
+            }
+        }
+        while ((tok = strtok(NULL, ",./-+")) != NULL);
+        free(tmp);
+    }
+
     /* Some HandBrake-specific defaults; users can override them
      * using the advanced_opts string. */
     if( job->pass == 2 && job->cfr != 1 )