I missed some of the qsv filter settings bits that needed changing.
#define MODE_YADIF_ENABLE 1
#define MODE_YADIF_SPATIAL 2
#define MODE_YADIF_BOB 4
+#define MODE_DEINTERLACE_QSV 8
#endif // HB_DECOMB_H
hb_error("hb_qsv_info_init failed!");
return -1;
}
+ hb_param_configure_qsv();
#endif
/* libavcodec */
#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[] =
{ 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
{ 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:
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,
// 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:
{
// 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)
{
// 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;
// validated
num_cpu_filters++;
}
- break;
+ } break;
// then, validated filters
case HB_FILTER_ROTATE: // TODO: use Media SDK for this
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++)
{
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);
}