summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2016-03-10 14:46:50 -0700
committerJohn Stebbins <[email protected]>2016-03-11 14:13:33 -0700
commitfc3a836f30ff50f556c0267efbb41ee84a4b74a8 (patch)
tree86abe81114fcaa9df2b106b0cd55a634fd6615ba
parentc3c076a86e8c3a9b97b1ed352c88365728e3879a (diff)
qsv: fix build
I missed some of the qsv filter settings bits that needed changing.
-rw-r--r--libhb/decomb.h1
-rw-r--r--libhb/hb.c1
-rw-r--r--libhb/param.c19
-rw-r--r--libhb/param.h2
-rw-r--r--libhb/work.c40
-rw-r--r--test/test.c14
6 files changed, 44 insertions, 33 deletions
diff --git a/libhb/decomb.h b/libhb/decomb.h
index 4aa60a608..473dd3f7f 100644
--- a/libhb/decomb.h
+++ b/libhb/decomb.h
@@ -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
diff --git a/libhb/hb.c b/libhb/hb.c
index 5937ae1ba..393ced341 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -1807,6 +1807,7 @@ int hb_global_init()
hb_error("hb_qsv_info_init failed!");
return -1;
}
+ hb_param_configure_qsv();
#endif
/* libavcodec */
diff --git a/libhb/param.c b/libhb/param.c
index 46bc80f06..e83d919e5 100644
--- a/libhb/param.c
+++ b/libhb/param.c
@@ -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:
diff --git a/libhb/param.h b/libhb/param.h
index d61fd389c..0222de39b 100644
--- a/libhb/param.h
+++ b/libhb/param.h
@@ -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,
diff --git a/libhb/work.c b/libhb/work.c
index eaa7facab..4fca293fb 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -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
diff --git a/test/test.c b/test/test.c
index ca4062424..726e4fc8a 100644
--- a/test/test.c
+++ b/test/test.c
@@ -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);
}