]> granicus.if.org Git - handbrake/commitdiff
qsv: fix build
authorJohn Stebbins <jstebbins.hb@gmail.com>
Thu, 10 Mar 2016 21:46:50 +0000 (14:46 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Fri, 11 Mar 2016 21:13:33 +0000 (14:13 -0700)
I missed some of the qsv filter settings bits that needed changing.

libhb/decomb.h
libhb/hb.c
libhb/param.c
libhb/param.h
libhb/work.c
test/test.c

index 4aa60a60870b467fe58d52ee3d69dd85ec8c1c3d..473dd3f7fa7535bf5abafeabba6b2e6fff9d0b8c 100644 (file)
@@ -20,5 +20,6 @@
 #define MODE_YADIF_ENABLE       1
 #define MODE_YADIF_SPATIAL      2
 #define MODE_YADIF_BOB          4
+#define MODE_DEINTERLACE_QSV    8
 
 #endif // HB_DECOMB_H
index 5937ae1ba6b1c3a3b4aca26706c510d5dfac65bd..393ced34194a1f7ed086aafaf4f916403b0131d5 100644 (file)
@@ -1807,6 +1807,7 @@ int hb_global_init()
         hb_error("hb_qsv_info_init failed!");
         return -1;
     }
+    hb_param_configure_qsv();
 #endif
 
     /* libavcodec */
index 46bc80f06b99dfd28a8f11d4b05daccfaecfca81..e83d919e588c514a5f54e88abc710775709c75c3 100644 (file)
@@ -12,6 +12,9 @@
 #include "param.h"
 #include "common.h"
 #include "colormap.h"
+#ifdef USE_QSV
+#include "qsv_common.h"
+#endif
 #include <regex.h>
 
 static hb_filter_param_t nlmeans_presets[] =
@@ -106,10 +109,14 @@ static hb_filter_param_t deinterlace_presets[] =
     { 3, "Default",            "default",      "mode=3"         },
     { 2, "Skip Spatial Check", "skip-spatial", "mode=1"         },
     { 5, "Bob",                "bob",          "mode=7"         },
+#ifdef USE_QSV
+    { 6, "QSV",                "qsv",          "mode=11"        },
+#endif
     { 0,  NULL,                NULL,           NULL             },
     { 2, "Fast",               "fast",         "mode=1"         },
     { 3, "Slow",               "slow",         "mode=1"         },
-    { 4, "Slower",             "slower",       "mode=3"         }
+    { 4, "Slower",             "slower",       "mode=3"         },
+    { 7, "QSV",                "qsv",          "mode=3"         }
 };
 
 typedef struct
@@ -143,6 +150,16 @@ static filter_param_map_t param_map[] =
     { HB_FILTER_INVALID,     NULL,                NULL,  0       }
 };
 
+void hb_param_configure_qsv(void)
+{
+#ifdef USE_QSV
+    if (!hb_qsv_available())
+    {
+        memset(&deinterlace_presets[4], 0, sizeof(hb_filter_param_t));
+    }
+#endif
+}
+
 /* NL-means presets and tunes
  *
  * Presets adjust strength:
index d61fd389c0a796dedd9b13031b9960c6caf55347..0222de39b087b26721a446abb8ce7dae2a627fbf 100644 (file)
@@ -19,6 +19,8 @@ struct hb_filter_param_s
     const char *settings;
 };
 
+void hb_param_configure_qsv(void);
+
 hb_dict_t * hb_generate_filter_settings(int filter_id, const char *preset,
                                         const char *tune, const char *custom);
 char * hb_generate_filter_settings_json(int filter_id, const char *preset,
index eaa7facabac9d02aa0a4c1c61557b616cb78ecb0..4fca293fbb827f445bc442a1d50f4d3bfb7a1fd6 100644 (file)
@@ -1167,12 +1167,13 @@ static int sanitize_qsv( hb_job_t * job )
 
                     // CPU-based deinterlace (validated)
                     case HB_FILTER_DEINTERLACE:
-                        if (filter->settings != NULL &&
-                            strcasecmp(filter->settings, "qsv") != 0)
+                    {
+                        int mode = hb_dict_get_int(filter->settings, "mode");
+                        if (!(mode & MODE_DEINTERLACE_QSV))
                         {
                             encode_only = 1;
                         }
-                        break;
+                    } break;
 
                     // other filters will be removed
                     default:
@@ -1217,19 +1218,19 @@ static int sanitize_qsv( hb_job_t * job )
                 {
                     // cropping and scaling always done via VPP filter
                     case HB_FILTER_CROP_SCALE:
-                        if (filter->settings == NULL || *filter->settings == 0)
-                        {
-                            // VPP defaults were set above, so not a problem
-                            // however, this should never happen, print an error
-                            hb_error("do_job: '%s': no settings!", filter->name);
-                        }
-                        else
-                        {
-                            sscanf(filter->settings, "%d:%d:%d:%d:%d:%d",
-                                   &vpp_settings[0], &vpp_settings[1],
-                                   &vpp_settings[2], &vpp_settings[3],
-                                   &vpp_settings[4], &vpp_settings[5]);
-                        }
+                        hb_dict_extract_int(&vpp_settings[0], filter->settings,
+                                            "width");
+                        hb_dict_extract_int(&vpp_settings[1], filter->settings,
+                                            "height");
+                        hb_dict_extract_int(&vpp_settings[2], filter->settings,
+                                            "crop-top");
+                        hb_dict_extract_int(&vpp_settings[3], filter->settings,
+                                            "crop-bottom");
+                        hb_dict_extract_int(&vpp_settings[4], filter->settings,
+                                            "crop-left");
+                        hb_dict_extract_int(&vpp_settings[5], filter->settings,
+                                            "crop-right");
+
                         // VPP crop/scale takes precedence over OpenCL scale too
                         if (job->use_opencl)
                         {
@@ -1242,8 +1243,9 @@ static int sanitize_qsv( hb_job_t * job )
 
                     // pick VPP or CPU deinterlace depending on settings
                     case HB_FILTER_DEINTERLACE:
-                        if (filter->settings == NULL ||
-                            strcasecmp(filter->settings, "qsv") == 0)
+                    {
+                        int mode = hb_dict_get_int(filter->settings, "mode");
+                        if (mode & MODE_DEINTERLACE_QSV)
                         {
                             // deinterlacing via VPP filter
                             vpp_settings[6] = 1;
@@ -1255,7 +1257,7 @@ static int sanitize_qsv( hb_job_t * job )
                             // validated
                             num_cpu_filters++;
                         }
-                        break;
+                    } break;
 
                     // then, validated filters
                     case HB_FILTER_ROTATE: // TODO: use Media SDK for this
index ca4062424cab4865f4151038795999c3f57836c8..726e4fc8ade03eea38ad93a122fe22b1089da40c 100644 (file)
@@ -912,13 +912,6 @@ static void showFilterPresets(FILE* const out, int filter_id)
     char  * slash = "", * newline;
     int     ii, count = 0, linelen = 0;
 
-#ifdef USE_QSV
-if (filter_id == HB_FILTER_DEINTERLACE && hb_qsv_available())
-{
-    count = 1;
-}
-#endif
-
     // Count number of entries we want to display
     for (ii = 0; names[ii] != NULL; ii++)
     {
@@ -956,12 +949,7 @@ if (filter_id == HB_FILTER_DEINTERLACE && hb_qsv_available())
         linelen += len;
         slash = "/";
     }
-#ifdef USE_QSV
-if (filter_id == HB_FILTER_DEINTERLACE && hb_qsv_available())
-{
-    fprintf(out, "/qsv");
-}
-#endif
+
     fprintf(out, ">\n");
     hb_str_vfree(names);
 }