]> granicus.if.org Git - handbrake/commitdiff
libhb: Tweak Chroma Smooth filter presets and tunes.
authorBradley Sepos <bradley@bradleysepos.com>
Wed, 13 Mar 2019 21:36:43 +0000 (17:36 -0400)
committerBradley Sepos <bradley@bradleysepos.com>
Thu, 28 Mar 2019 15:57:39 +0000 (11:57 -0400)
The initial tunes were too weak.

libhb/chroma_smooth.c
libhb/param.c

index e27ecaa771385010208e889bdc65adf97e37fb2e..ec1c2ecd99237f8b57f99b5a1ac4a800353f961b 100644 (file)
@@ -226,8 +226,8 @@ static int chroma_smooth_init(hb_filter_object_t *filter,
         }
 
         // Sanitize
-        if (ctx->strength < 0)   ctx->strength = 0;
-        if (ctx->strength > 1.5) ctx->strength = 1.5;
+        if (ctx->strength < 0) ctx->strength = 0;
+        if (ctx->strength > 3) ctx->strength = 3;
         if (ctx->size % 2 == 0) ctx->size--;
         if (ctx->size < CHROMA_SMOOTH_SIZE_MIN) ctx->size = CHROMA_SMOOTH_SIZE_MIN;
         if (ctx->size > CHROMA_SMOOTH_SIZE_MAX) ctx->size = CHROMA_SMOOTH_SIZE_MAX;
index c7f9ae052e5fec26a90a0a04f095f2f9d76cc135..8c621072089c0bd3450af55541cc171cada7c828 100644 (file)
@@ -513,155 +513,63 @@ static hb_dict_t * generate_chroma_smooth_settings(const char *preset,
         double strength;
         int    size;
 
-        if (tune == NULL || !strcasecmp(tune, "none"))
+        // Strength
+        if ((tune == NULL || !strcasecmp(tune, "none")) ||
+           (!strcasecmp(tune, "tiny"))   ||
+           (!strcasecmp(tune, "small"))  ||
+           (!strcasecmp(tune, "medium")) ||
+           (!strcasecmp(tune, "wide"))   ||
+           (!strcasecmp(tune, "verywide")))
         {
-            strength = 0.25;
-            size     = 7;
+            strength = 1.2;
             if (!strcasecmp(preset, "ultralight"))
             {
-                strength = 0.05;
+                strength = 0.4;
             }
             else if (!strcasecmp(preset, "light"))
             {
-                strength = 0.15;
+                strength = 0.8;
             }
             else if (!strcasecmp(preset, "strong"))
             {
-                strength = 0.5;
+                strength = 1.6;
             }
             else if (!strcasecmp(preset, "stronger"))
             {
-                strength = 0.8;
+                strength = 2.0;
             }
             else if (!strcasecmp(preset, "verystrong"))
             {
-                strength = 1.2;
+                strength = 2.4;
             }
         }
-        else if (!strcasecmp(tune, "tiny"))
+        else
         {
-            strength = 0.4;
-            size     = 3;
-            if (!strcasecmp(preset, "ultralight"))
-            {
-                strength = 0.15;
-            }
-            else if (!strcasecmp(preset, "light"))
-            {
-                strength = 0.25;
-            }
-            else if (!strcasecmp(preset, "strong"))
-            {
-                strength = 0.8;
-            }
-            else if (!strcasecmp(preset, "stronger"))
-            {
-                strength = 1.2;
-            }
-            else if (!strcasecmp(preset, "verystrong"))
-            {
-                strength = 1.5;
-            }
+            fprintf(stderr, "Unrecognized chroma smooth tune (%s).\n", tune);
+            return NULL;
+        }
+
+        // Size
+        if (!strcasecmp(tune, "tiny"))
+        {
+            size = 3;
         }
         else if (!strcasecmp(tune, "small"))
         {
-            strength = 0.275;
-            size     = 7;
-            if (!strcasecmp(preset, "ultralight"))
-            {
-                strength = 0.055;
-            }
-            else if (!strcasecmp(preset, "light"))
-            {
-                strength = 0.165;
-            }
-            else if (!strcasecmp(preset, "strong"))
-            {
-                strength = 0.55;
-            }
-            else if (!strcasecmp(preset, "stronger"))
-            {
-                strength = 0.9;
-            }
-            else if (!strcasecmp(preset, "verystrong"))
-            {
-                strength = 1.35;
-            }
+            size = 5;
         }
-        else if (!strcasecmp(tune, "medium"))
+        else if ((tune == NULL || !strcasecmp(tune, "none")) ||
+                (!strcasecmp(tune, "medium")))
         {
-            strength = 0.275;
-            size     = 9;
-            if (!strcasecmp(preset, "ultralight"))
-            {
-                strength = 0.055;
-            }
-            else if (!strcasecmp(preset, "light"))
-            {
-                strength = 0.165;
-            }
-            else if (!strcasecmp(preset, "strong"))
-            {
-                strength = 0.55;
-            }
-            else if (!strcasecmp(preset, "stronger"))
-            {
-                strength = 0.9;
-            }
-            else if (!strcasecmp(preset, "verystrong"))
-            {
-                strength = 1.35;
-            }
+            size = 7;
         }
         else if (!strcasecmp(tune, "wide"))
         {
-            strength = 0.275;
-            size     = 11;
-            if (!strcasecmp(preset, "ultralight"))
-            {
-                strength = 0.055;
-            }
-            else if (!strcasecmp(preset, "light"))
-            {
-                strength = 0.165;
-            }
-            else if (!strcasecmp(preset, "strong"))
-            {
-                strength = 0.55;
-            }
-            else if (!strcasecmp(preset, "stronger"))
-            {
-                strength = 0.9;
-            }
-            else if (!strcasecmp(preset, "verystrong"))
-            {
-                strength = 1.35;
-            }
+            size = 9;
         }
         else if (!strcasecmp(tune, "verywide"))
         {
-            strength = 0.275;
-            size     = 13;
-            if (!strcasecmp(preset, "ultralight"))
-            {
-                strength = 0.055;
-            }
-            else if (!strcasecmp(preset, "light"))
-            {
-                strength = 0.165;
-            }
-            else if (!strcasecmp(preset, "strong"))
-            {
-                strength = 0.55;
-            }
-            else if (!strcasecmp(preset, "stronger"))
-            {
-                strength = 0.9;
-            }
-            else if (!strcasecmp(preset, "verystrong"))
-            {
-                strength = 1.35;
-            }
+            size = 11;
         }
         else
         {