summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorRodeo <[email protected]>2013-10-11 13:17:17 +0000
committerRodeo <[email protected]>2013-10-11 13:17:17 +0000
commit58bd6b80db26fc71a101c0dbdf4633deea5c0c34 (patch)
treeaafdf5dcb4e1ce061fdbd44a7b6be9f14cf6efb3 /libhb
parent54fde2698cac2a49a0ce786ec04a13fd7360e529 (diff)
QSV: use encode-only path when we have CPU filters enabled and CopyFrame is unavailable.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5831 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/qsv_common.c8
-rw-r--r--libhb/qsv_common.h1
-rw-r--r--libhb/work.c47
3 files changed, 54 insertions, 2 deletions
diff --git a/libhb/qsv_common.c b/libhb/qsv_common.c
index d191fadf1..704a6e86a 100644
--- a/libhb/qsv_common.c
+++ b/libhb/qsv_common.c
@@ -93,6 +93,10 @@ int hb_qsv_info_init()
hb_qsv_info->capabilities |= HB_QSV_CAP_MSDK_API_1_6;
hb_qsv_info->capabilities |= HB_QSV_CAP_OPTION2_EXTBRC;
}
+ if (HB_CHECK_MFX_VERSION(qsv_hardware_version, 1, 7))
+ {
+ hb_qsv_info->capabilities |= HB_QSV_CAP_COPYFRAME;
+ }
if (hb_get_cpu_platform() == HB_CPU_PLATFORM_INTEL_HSW)
{
if (HB_CHECK_MFX_VERSION(qsv_hardware_version, 1, 6))
@@ -114,6 +118,10 @@ int hb_qsv_info_init()
hb_qsv_info->capabilities |= HB_QSV_CAP_MSDK_API_1_6;
hb_qsv_info->capabilities |= HB_QSV_CAP_H264_BPYRAMID;
}
+ if (HB_CHECK_MFX_VERSION(qsv_software_version, 1, 7))
+ {
+ hb_qsv_info->capabilities |= HB_QSV_CAP_COPYFRAME;
+ }
}
// note: we pass a pointer to MFXInit but it never gets modified
diff --git a/libhb/qsv_common.h b/libhb/qsv_common.h
index 083065be6..ab9ca9024 100644
--- a/libhb/qsv_common.h
+++ b/libhb/qsv_common.h
@@ -36,6 +36,7 @@ typedef struct hb_qsv_info_s
#define HB_QSV_CAP_OPTION2_MBBRC (1 << 3) // mfxExtCodingOption2: MBBRC
#define HB_QSV_CAP_OPTION2_LOOKAHEAD (1 << 4) // mfxExtCodingOption2: LookAhead
#define HB_QSV_CAP_OPTION2_TRELLIS (1 << 5) // mfxExtCodingOption2: Trellis
+#define HB_QSV_CAP_COPYFRAME (1 << 6) // mfxCoreInterface: CopyFrame
// TODO: add available decoders, filters, encoders,
// maximum decode and encode resolution, etc.
diff --git a/libhb/work.c b/libhb/work.c
index a5c3190d1..bd5b66529 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -700,6 +700,48 @@ static void do_job(hb_job_t *job)
#ifdef USE_QSV
/*
+ * XXX: mfxCoreInterface's CopyFrame doesn't work in old drivers, and our
+ * workaround is really slow. If we have validated CPU-based filters in
+ * the list and we can't use CopyFrame, disable QSV decoding until a
+ * better solution is implemented.
+ */
+ if (!(hb_qsv_info->capabilities & HB_QSV_CAP_COPYFRAME))
+ {
+ if (job->list_filter != NULL)
+ {
+ for (i = 0;
+ i < hb_list_count(job->list_filter) && hb_qsv_decode_is_enabled(job);
+ i++)
+ {
+ hb_filter_object_t *filter = hb_list_item(job->list_filter, i);
+ switch (filter->id)
+ {
+ // validated, CPU-based filters
+ case HB_FILTER_ROTATE:
+ case HB_FILTER_RENDER_SUB:
+ hb_log("do_job: QSV: CopyFrame unavailable, using encode-only path");
+ job->qsv.decode = 0;
+ break;
+
+ // CPU-based deinterlace (validated)
+ case HB_FILTER_DEINTERLACE:
+ if (filter->settings != NULL &&
+ strcasecmp(filter->settings, "qsv") != 0)
+ {
+ hb_log("do_job: QSV: CopyFrame unavailable, using encode-only path");
+ job->qsv.decode = 0;
+ }
+ break;
+
+ // other filters will be removed
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ /*
* When QSV is used for decoding, not all CPU-based filters are supported,
* so we need to do a little extra setup here.
*/
@@ -744,7 +786,8 @@ static void do_job(hb_job_t *job)
// pick VPP or CPU deinterlace depending on settings
case HB_FILTER_DEINTERLACE:
- if (filter->settings == NULL || !strcmp(filter->settings, "qsv"))
+ if (filter->settings == NULL ||
+ strcasecmp(filter->settings, "qsv") == 0)
{
// deinterlacing via VPP filter
vpp_settings[6] = 1;
@@ -766,7 +809,7 @@ static void do_job(hb_job_t *job)
// finally, drop all unsupported filters
default:
- hb_log("do_job: full QSV path, removing unsupported filter '%s'",
+ hb_log("do_job: QSV: full path, removing unsupported filter '%s'",
filter->name);
hb_list_rem(job->list_filter, filter);
hb_filter_close(&filter);