summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2019-04-17 10:33:04 -0600
committerJohn Stebbins <[email protected]>2019-04-17 11:25:13 -0600
commit76e9755eb71c500ba6a69c97c959f118873e5389 (patch)
treefef14dcd242551161bc077009537037b44d43fd6
parentb2cb27773a0cc1b84c847afec0b370e59236258d (diff)
qsv: use HB_PROJECT_FEATURE_QSV instead of USE_QSV
-rw-r--r--libhb/common.c20
-rw-r--r--libhb/common.h4
-rw-r--r--libhb/decavcodec.c24
-rw-r--r--libhb/enc_qsv.c6
-rw-r--r--libhb/fifo.c6
-rw-r--r--libhb/h265_common.h4
-rw-r--r--libhb/hb.c8
-rw-r--r--libhb/internal.h11
-rw-r--r--libhb/module.defs2
-rw-r--r--libhb/param.c7
-rw-r--r--libhb/ports.c10
-rw-r--r--libhb/ports.h6
-rw-r--r--libhb/qsv_common.c6
-rw-r--r--libhb/qsv_common.h6
-rw-r--r--libhb/qsv_filter.c6
-rw-r--r--libhb/qsv_filter.h4
-rw-r--r--libhb/qsv_filter_pp.c6
-rw-r--r--libhb/qsv_filter_pp.h5
-rw-r--r--libhb/qsv_libav.c6
-rw-r--r--libhb/qsv_memory.c6
-rw-r--r--libhb/qsv_memory.h5
-rw-r--r--libhb/vce_common.c4
-rw-r--r--libhb/work.c14
-rw-r--r--test/module.defs1
-rw-r--r--test/test.c12
25 files changed, 114 insertions, 75 deletions
diff --git a/libhb/common.c b/libhb/common.c
index 5efb9fee2..2b303b03d 100644
--- a/libhb/common.c
+++ b/libhb/common.c
@@ -19,7 +19,7 @@
#include "h264_common.h"
#include "h265_common.h"
#include "encx264.h"
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
#include "qsv_common.h"
#endif
@@ -276,7 +276,7 @@ static int hb_video_encoder_is_enabled(int encoder, int disable_hardware)
// Hardware Encoders
if (!disable_hardware)
{
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (encoder & HB_VCODEC_QSV_MASK)
{
return hb_qsv_video_encoder_is_enabled(encoder);
@@ -1330,7 +1330,7 @@ const hb_rate_t* hb_audio_bitrate_get_next(const hb_rate_t *last)
void hb_video_quality_get_limits(uint32_t codec, float *low, float *high,
float *granularity, int *direction)
{
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (codec & HB_VCODEC_QSV_MASK)
{
return hb_qsv_video_quality_get_limits(codec, low, high, granularity,
@@ -1413,7 +1413,7 @@ void hb_video_quality_get_limits(uint32_t codec, float *low, float *high,
const char* hb_video_quality_get_name(uint32_t codec)
{
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (codec & HB_VCODEC_QSV_MASK)
{
return hb_qsv_video_quality_get_name(codec);
@@ -1445,7 +1445,7 @@ int hb_video_encoder_get_depth(int encoder)
{
switch (encoder)
{
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
case HB_VCODEC_QSV_H265_10BIT:
#endif
case HB_VCODEC_X264_10BIT:
@@ -1462,7 +1462,7 @@ int hb_video_encoder_get_depth(int encoder)
const char* const* hb_video_encoder_get_presets(int encoder)
{
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (encoder & HB_VCODEC_QSV_MASK)
{
return hb_qsv_preset_get_names();
@@ -1514,7 +1514,7 @@ const char* const* hb_video_encoder_get_tunes(int encoder)
const char* const* hb_video_encoder_get_profiles(int encoder)
{
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (encoder & HB_VCODEC_QSV_MASK)
{
return hb_qsv_profile_get_names(encoder);
@@ -1556,7 +1556,7 @@ const char* const* hb_video_encoder_get_profiles(int encoder)
const char* const* hb_video_encoder_get_levels(int encoder)
{
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (encoder & HB_VCODEC_QSV_MASK)
{
return hb_qsv_level_get_names(encoder);
@@ -3804,7 +3804,7 @@ static void job_setup(hb_job_t * job, hb_title_t * title)
job->list_attachment = hb_attachment_list_copy( title->list_attachment );
job->metadata = hb_metadata_copy( title->metadata );
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
job->qsv.enc_info.is_init_done = 0;
job->qsv.async_depth = HB_QSV_ASYNC_DEPTH_DEFAULT;
job->qsv.decode = !!(title->video_decode_support &
@@ -4170,7 +4170,7 @@ hb_filter_object_t * hb_filter_get( int filter_id )
filter = &hb_filter_grayscale;
break;
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
case HB_FILTER_QSV:
filter = &hb_filter_qsv;
break;
diff --git a/libhb/common.h b/libhb/common.h
index cb307e079..8c112e7ad 100644
--- a/libhb/common.h
+++ b/libhb/common.h
@@ -103,7 +103,7 @@ typedef enum
#include "audio_remap.h"
#include "libavutil/channel_layout.h"
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
#include "qsv_libav.h"
#endif
@@ -700,7 +700,7 @@ struct hb_job_s
{
int decode;
int async_depth;
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
hb_qsv_context *ctx;
#endif
// shared encoding parameters
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index 3450082e0..6fcdefa9d 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -47,7 +47,7 @@
#include "lang.h"
#include "audio_resample.h"
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
#include "qsv_common.h"
#endif
@@ -139,7 +139,7 @@ struct hb_work_private_s
hb_audio_resample_t * resample;
int drop_samples;
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
// QSV-specific settings
struct
{
@@ -361,7 +361,7 @@ static void closePrivData( hb_work_private_t ** ppv )
}
if ( pv->context && pv->context->codec )
{
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
/*
* FIXME: knowingly leaked.
*
@@ -967,7 +967,7 @@ static hb_buffer_t *copy_frame( hb_work_private_t *pv )
reordered_data_t * reordered = NULL;
hb_buffer_t * out;
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
// no need to copy the frame data when decoding with QSV to opaque memory
if (pv->qsv.decode &&
pv->qsv.config.io_pattern == MFX_IOPATTERN_OUT_OPAQUE_MEMORY)
@@ -1120,7 +1120,7 @@ int reinit_video_filters(hb_work_private_t * pv)
hb_filter_init_t filter_init;
enum AVPixelFormat pix_fmt;
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (pv->qsv.decode &&
pv->qsv.config.io_pattern == MFX_IOPATTERN_OUT_OPAQUE_MEMORY)
{
@@ -1345,7 +1345,7 @@ static int decodeFrame( hb_work_private_t * pv, packet_info_t * packet_info )
return 0;
}
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (pv->qsv.decode &&
pv->qsv.config.io_pattern == MFX_IOPATTERN_OUT_OPAQUE_MEMORY &&
pv->job->qsv.ctx == NULL && pv->video_codec_opened > 0)
@@ -1398,7 +1398,7 @@ static int decavcodecvInit( hb_work_object_t * w, hb_job_t * job )
pv->next_pts = 0;
hb_buffer_list_clear(&pv->list);
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if ((pv->qsv.decode = hb_qsv_decode_is_enabled(job)))
{
pv->qsv.codec_name = hb_qsv_decode_get_codec_name(w->codec_param);
@@ -1429,7 +1429,7 @@ static int decavcodecvInit( hb_work_object_t * w, hb_job_t * job )
pv->threads = HB_FFMPEG_THREADS_AUTO;
}
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (pv->qsv.decode)
{
pv->codec = avcodec_find_decoder_by_name(pv->qsv.codec_name);
@@ -1457,7 +1457,7 @@ static int decavcodecvInit( hb_work_object_t * w, hb_job_t * job )
avcodec_parameters_to_context(pv->context,
ic->streams[pv->title->video_id]->codecpar);
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (pv->qsv.decode &&
pv->qsv.config.io_pattern == MFX_IOPATTERN_OUT_OPAQUE_MEMORY)
{
@@ -1474,7 +1474,7 @@ static int decavcodecvInit( hb_work_object_t * w, hb_job_t * job )
av_dict_set( &av_opts, "flags", "output_corrupt", 0 );
}
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (pv->qsv.decode && pv->context->codec_id == AV_CODEC_ID_HEVC)
{
av_dict_set( &av_opts, "load_plugin", "hevc_hw", 0 );
@@ -1590,7 +1590,7 @@ static int decodePacket( hb_work_object_t * w )
pv->context->error_concealment = FF_EC_GUESS_MVS|FF_EC_DEBLOCK;
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (pv->qsv.decode &&
pv->qsv.config.io_pattern == MFX_IOPATTERN_OUT_OPAQUE_MEMORY)
{
@@ -2080,7 +2080,7 @@ static int decavcodecvInfo( hb_work_object_t *w, hb_work_info_t *info )
info->video_decode_support = HB_DECODE_SUPPORT_SW;
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (avcodec_find_decoder_by_name(hb_qsv_decode_get_codec_name(pv->context->codec_id)))
{
switch (pv->context->codec_id)
diff --git a/libhb/enc_qsv.c b/libhb/enc_qsv.c
index 1ad8223ff..7b1236184 100644
--- a/libhb/enc_qsv.c
+++ b/libhb/enc_qsv.c
@@ -26,7 +26,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\* ********************************************************************* */
-#ifdef USE_QSV
+#include "project.h"
+
+#if HB_PROJECT_FEATURE_QSV
#include "hb.h"
#include "nal_units.h"
@@ -2023,4 +2025,4 @@ fail:
return HB_WORK_ERROR;
}
-#endif // USE_QSV
+#endif // HB_PROJECT_FEATURE_QSV
diff --git a/libhb/fifo.c b/libhb/fifo.c
index 226b169e8..c52aef17f 100644
--- a/libhb/fifo.c
+++ b/libhb/fifo.c
@@ -8,7 +8,7 @@
*/
#include "hb.h"
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
#include "qsv_libav.h"
#endif
@@ -496,7 +496,7 @@ hb_buffer_t * hb_buffer_dup( const hb_buffer_t * src )
hb_buffer_init_planes( buf );
}
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
memcpy(&buf->qsv_details, &src->qsv_details, sizeof(src->qsv_details));
#endif
@@ -719,7 +719,7 @@ void hb_buffer_close( hb_buffer_t ** _b )
while( b )
{
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
// Reclaim QSV resources before dropping the buffer.
// when decoding without QSV, the QSV atom will be NULL.
if (b->qsv_details.qsv_atom != NULL && b->qsv_details.ctx != NULL)
diff --git a/libhb/h265_common.h b/libhb/h265_common.h
index 74d96031a..067b652e5 100644
--- a/libhb/h265_common.h
+++ b/libhb/h265_common.h
@@ -10,6 +10,8 @@
#ifndef HB_H265_COMMON_H
#define HB_H265_COMMON_H
+#include "project.h"
+
// inspired by libavcodec/hevc.h
// in HEVC, all "random access point" NAL units are keyframes
#define HB_HEVC_NALU_KEYFRAME(nal_unit_type) (((nal_unit_type) >= 16) && ((nal_unit_type) <= 23))
@@ -20,7 +22,7 @@ static const char * const hb_h265_profile_names_8bit[] = {
"auto", "main", "mainstillpicture", NULL, };
static const char * const hb_h265_profile_names_10bit[] = {
"auto", "main10", "main10-intra", NULL, };
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
static const char * const hb_h265_qsv_profile_names_10bit[] = {
"auto", "main10", NULL, };
#endif
diff --git a/libhb/hb.c b/libhb/hb.c
index ba40d9c37..9b3cea166 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -15,7 +15,7 @@
#include <unistd.h>
#include <fcntl.h>
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
#include "qsv_common.h"
#endif
@@ -416,7 +416,7 @@ void hb_scan( hb_handle_t * h, const char * path, int title_index,
}
hb_log(" - logical processor count: %d", hb_get_cpu_count());
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (!is_hardware_disabled())
{
/* Print QSV info here so that it's in all scan and encode logs */
@@ -1661,7 +1661,7 @@ int hb_global_init()
return -1;
}
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (!disable_hardware)
{
result = hb_qsv_info_init();
@@ -1706,7 +1706,7 @@ int hb_global_init()
#if HB_PROJECT_FEATURE_X265
hb_register(&hb_encx265);
#endif
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (!disable_hardware)
{
hb_register(&hb_encqsv);
diff --git a/libhb/internal.h b/libhb/internal.h
index eea87b0e9..1e9138a3f 100644
--- a/libhb/internal.h
+++ b/libhb/internal.h
@@ -7,9 +7,13 @@
For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
*/
+#ifndef HB_INTERNAL_H
+#define HB_INTERNAL_H
+
+#include "project.h"
#include "hbffmpeg.h"
#include "extras/cl.h"
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
#include "qsv_libav.h"
#endif
@@ -142,7 +146,7 @@ struct hb_buffer_s
int size;
} plane[4]; // 3 Color components + alpha
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
struct qsv
{
void * qsv_atom;
@@ -470,7 +474,7 @@ extern hb_filter_object_t hb_filter_avfilter;
extern hb_filter_object_t hb_filter_mt_frame;
extern hb_filter_object_t hb_filter_colorspace;
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
extern hb_filter_object_t hb_filter_qsv;
extern hb_filter_object_t hb_filter_qsv_pre;
extern hb_filter_object_t hb_filter_qsv_post;
@@ -533,3 +537,4 @@ void hb_chapter_dequeue(hb_chapter_queue_t *q, hb_buffer_t *b);
#define HB_FONT_SANS "sans-serif"
#endif
+#endif // HB_INTERNAL_H
diff --git a/libhb/module.defs b/libhb/module.defs
index 9e3f3dad4..e26b769bb 100644
--- a/libhb/module.defs
+++ b/libhb/module.defs
@@ -80,7 +80,7 @@ else
endif
ifeq (1,$(FEATURE.qsv))
- LIBHB.GCC.D += USE_QSV HAVE_THREADS=1
+ LIBHB.GCC.D += HAVE_THREADS=1
endif
ifeq (1,$(FEATURE.vce))
diff --git a/libhb/param.c b/libhb/param.c
index b19d37db6..1782651ca 100644
--- a/libhb/param.c
+++ b/libhb/param.c
@@ -8,11 +8,12 @@
* http://www.gnu.org/licenses/gpl-2.0.html
*/
+#include "project.h"
#include "hb_dict.h"
#include "param.h"
#include "common.h"
#include "colormap.h"
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
#include "qsv_common.h"
#endif
#include <regex.h>
@@ -183,7 +184,7 @@ 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
+#if HB_PROJECT_FEATURE_QSV
{ 6, "QSV", "qsv", "mode=11" },
#endif
{ 0, NULL, NULL, NULL },
@@ -240,7 +241,7 @@ static filter_param_map_t param_map[] =
void hb_param_configure_qsv(void)
{
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (!hb_qsv_available())
{
memset(&deinterlace_presets[4], 0, sizeof(hb_filter_param_t));
diff --git a/libhb/ports.c b/libhb/ports.c
index 4a7a96fcf..8da7c2274 100644
--- a/libhb/ports.c
+++ b/libhb/ports.c
@@ -7,6 +7,8 @@
For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
*/
+#include "project.h"
+
#ifdef SYS_MINGW
#define _WIN32_WINNT 0x600
#endif
@@ -70,7 +72,7 @@
#include <linux/cdrom.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
#include <libdrm/drm.h>
#endif
#elif defined( SYS_OPENBSD )
@@ -1513,7 +1515,7 @@ char * hb_strndup(const char * src, size_t len)
#endif
}
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
#ifdef SYS_LINUX
#define MAX_NODES 16
@@ -1686,7 +1688,7 @@ void hb_display_close(hb_display_t ** _d)
}
#endif // SYS_LINUX
-#else // !USE_QSV
+#else // !HB_PROJECT_FEATURE_QSV
hb_display_t * hb_display_init(const char * driver_name,
const char * const * interface_names)
@@ -1699,4 +1701,4 @@ void hb_display_close(hb_display_t ** _d)
(void)_d;
}
-#endif // USE_QSV
+#endif // HB_PROJECT_FEATURE_QSV
diff --git a/libhb/ports.h b/libhb/ports.h
index 52c4ee292..c6b045cde 100644
--- a/libhb/ports.h
+++ b/libhb/ports.h
@@ -24,7 +24,9 @@
#define IS_DIR_SEP(c) (c == '/')
#endif
-#ifdef USE_QSV
+#include "project.h"
+
+#if HB_PROJECT_FEATURE_QSV
#include "mfx/mfxstructures.h"
#ifdef SYS_LINUX
#include <va/va_drm.h>
@@ -41,7 +43,7 @@ extern const char* DRM_INTEL_DRIVER_NAME;
typedef struct
{
void * handle;
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
mfxHandleType mfxType;
#ifdef SYS_LINUX
diff --git a/libhb/qsv_common.c b/libhb/qsv_common.c
index de907bb45..58b1b0dcb 100644
--- a/libhb/qsv_common.c
+++ b/libhb/qsv_common.c
@@ -7,7 +7,9 @@
* For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
*/
-#ifdef USE_QSV
+#include "project.h"
+
+#if HB_PROJECT_FEATURE_QSV
#include <stdio.h>
#include <string.h>
@@ -2247,4 +2249,4 @@ int hb_qsv_available()
return 0;
}
-#endif // USE_QSV
+#endif // HB_PROJECT_FEATURE_QSV
diff --git a/libhb/qsv_common.h b/libhb/qsv_common.h
index 4b690a661..74e071ef2 100644
--- a/libhb/qsv_common.h
+++ b/libhb/qsv_common.h
@@ -12,7 +12,9 @@
int hb_qsv_available();
-#ifdef USE_QSV
+#include "project.h"
+
+#if HB_PROJECT_FEATURE_QSV
#include "mfx/mfxvideo.h"
#include "mfx/mfxplugin.h"
@@ -193,5 +195,5 @@ const char* hb_qsv_impl_get_via_name(int impl);
void hb_qsv_force_workarounds(); // for developers only
-#endif // USE_QSV
+#endif // HB_PROJECT_FEATURE_QSV
#endif // HB_QSV_COMMON_H
diff --git a/libhb/qsv_filter.c b/libhb/qsv_filter.c
index 9f7450c7e..a8ad4ef3c 100644
--- a/libhb/qsv_filter.c
+++ b/libhb/qsv_filter.c
@@ -26,7 +26,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\* ********************************************************************* */
-#ifdef USE_QSV
+#include "project.h"
+
+#if HB_PROJECT_FEATURE_QSV
#include "hb.h"
#include "hbffmpeg.h"
@@ -671,5 +673,5 @@ static int hb_qsv_filter_work( hb_filter_object_t * filter,
return HB_FILTER_OK;
}
-#endif // USE_QSV
+#endif // HB_PROJECT_FEATURE_QSV
diff --git a/libhb/qsv_filter.h b/libhb/qsv_filter.h
index a9552564d..fc3ba95f8 100644
--- a/libhb/qsv_filter.h
+++ b/libhb/qsv_filter.h
@@ -29,6 +29,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef QSV_FILTER_H
#define QSV_FILTER_H
+#include "project.h"
+
+#if HB_PROJECT_FEATURE_QSV
void qsv_filter_close( hb_qsv_context* qsv, HB_QSV_STAGE_TYPE vpp_type );
+#endif
#endif // QSV_FILTER_H
diff --git a/libhb/qsv_filter_pp.c b/libhb/qsv_filter_pp.c
index a82b5f452..93c5acd7c 100644
--- a/libhb/qsv_filter_pp.c
+++ b/libhb/qsv_filter_pp.c
@@ -26,7 +26,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\* ********************************************************************* */
-#ifdef USE_QSV
+#include "project.h"
+
+#if HB_PROJECT_FEATURE_QSV
#include "hb.h"
#include "hbffmpeg.h"
@@ -930,4 +932,4 @@ int process_filter(qsv_filter_task_t* task, void* params){
return sts;
}
-#endif // USE_QSV
+#endif // HB_PROJECT_FEATURE_QSV
diff --git a/libhb/qsv_filter_pp.h b/libhb/qsv_filter_pp.h
index df5d7d554..bb2c3cc68 100644
--- a/libhb/qsv_filter_pp.h
+++ b/libhb/qsv_filter_pp.h
@@ -29,6 +29,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef QSV_FILTER_PP_H
#define QSV_FILTER_PP_H
+#include "project.h"
+
+#if HB_PROJECT_FEATURE_QSV
+
#include "mfx/mfxplugin.h"
struct qsv_filter_task_s;
@@ -109,4 +113,5 @@ mfxStatus lock_frame(mfxFrameAllocator *,mfxFrameSurface1*);
mfxStatus unlock_frame(mfxFrameAllocator *,mfxFrameSurface1*);
+#endif // HB_PROJECT_FEATURE_QSV
#endif //QSV_FILTER_PP_H
diff --git a/libhb/qsv_libav.c b/libhb/qsv_libav.c
index b24e9f74c..c2e768767 100644
--- a/libhb/qsv_libav.c
+++ b/libhb/qsv_libav.c
@@ -26,7 +26,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\* ********************************************************************* */
-#ifdef USE_QSV
+#include "project.h"
+
+#if HB_PROJECT_FEATURE_QSV
#include "hbffmpeg.h"
#include "qsv_libav.h"
@@ -605,4 +607,4 @@ void hb_qsv_wait_on_sync(hb_qsv_context *qsv, hb_qsv_stage *stage)
}
}
-#endif // USE_QSV
+#endif // HB_PROJECT_FEATURE_QSV
diff --git a/libhb/qsv_memory.c b/libhb/qsv_memory.c
index 7200b0ab3..69ce2426d 100644
--- a/libhb/qsv_memory.c
+++ b/libhb/qsv_memory.c
@@ -26,7 +26,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\* ********************************************************************* */
-#ifdef USE_QSV
+#include "project.h"
+
+#if HB_PROJECT_FEATURE_QSV
#include "hb.h"
#include "hbffmpeg.h"
@@ -121,4 +123,4 @@ int qsv_yuv420_to_nv12(struct SwsContext* sws_context,mfxFrameSurface1* dst, hb_
return ret;
}
-#endif // USE_QSV
+#endif // HB_PROJECT_FEATURE_QSV
diff --git a/libhb/qsv_memory.h b/libhb/qsv_memory.h
index 397f95931..9397306f0 100644
--- a/libhb/qsv_memory.h
+++ b/libhb/qsv_memory.h
@@ -29,6 +29,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef QSV_MEMORY_H
#define QSV_MEMORY_H
+#include "project.h"
+
+#if HB_PROJECT_FEATURE_QSV
+
#include "mfx/mfxplugin.h"
#include "qsv_libav.h"
@@ -52,4 +56,5 @@ typedef struct{
int qsv_nv12_to_yuv420(struct SwsContext* sws_context,hb_buffer_t* dst, mfxFrameSurface1* src,mfxCoreInterface *core);
int qsv_yuv420_to_nv12(struct SwsContext* sws_context,mfxFrameSurface1* dst, hb_buffer_t* src);
+#endif // HB_PROJECT_FEATURE_QSV
#endif // QSV_MEMORY_H
diff --git a/libhb/vce_common.c b/libhb/vce_common.c
index a0533fd59..d0bb2a005 100644
--- a/libhb/vce_common.c
+++ b/libhb/vce_common.c
@@ -116,7 +116,7 @@ int hb_vce_h265_available()
return (check_component_available(AMFVideoEncoder_HEVC) == AMF_OK) ? 1 : 0;
}
-#else
+#else // !USE_VCE
int hb_vce_h264_available()
{
@@ -128,4 +128,4 @@ int hb_vce_h265_available()
return 0;
}
-#endif // USE_QSV
+#endif // USE_VCE
diff --git a/libhb/work.c b/libhb/work.c
index 4d7ceba42..41a705896 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -12,7 +12,7 @@
#include "decomb.h"
#include "hbavfilter.h"
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
#include "qsv_common.h"
#include "qsv_filter_pp.h"
#endif
@@ -421,7 +421,7 @@ void hb_display_job_info(hb_job_t *job)
hb_log(" * video track");
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (hb_qsv_decode_is_enabled(job))
{
hb_log(" + decoder: %s",
@@ -1204,7 +1204,7 @@ static int sanitize_audio(hb_job_t *job)
static int sanitize_qsv( hb_job_t * job )
{
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
#if 0 // TODO: re-implement QSV VPP filtering and QSV zerocopy path
int i;
@@ -1368,7 +1368,7 @@ static int sanitize_qsv( hb_job_t * job )
}
}
#endif // QSV VPP filtering and QSV zerocopy path
-#endif // USE_QSV
+#endif // HB_PROJECT_FEATURE_QSV
return 0;
}
@@ -1550,7 +1550,7 @@ static void do_job(hb_job_t *job)
hb_reduce(&job->vrate.num, &job->vrate.den,
job->vrate.num, job->vrate.den);
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
#if 0 // TODO: re-implement QSV zerocopy path
if (hb_qsv_decode_is_enabled(job) && (job->vcodec & HB_VCODEC_QSV_MASK))
{
@@ -2043,13 +2043,13 @@ static void filter_loop( void * _f )
buf_out = NULL;
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
hb_buffer_t *last_buf_in = buf_in;
#endif
f->status = f->work( f, &buf_in, &buf_out );
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (f->status == HB_FILTER_DELAY &&
last_buf_in->qsv_details.filter_details != NULL && buf_out == NULL)
{
diff --git a/test/module.defs b/test/module.defs
index c477ad1ef..6ac0159a5 100644
--- a/test/module.defs
+++ b/test/module.defs
@@ -24,7 +24,6 @@ ifeq (,$(filter $(HOST.system),darwin cygwin mingw))
endif
ifeq (1,$(FEATURE.qsv))
- TEST.GCC.D += USE_QSV HAVE_THREADS=1
TEST.GCC.l += mfx
ifeq ($(HOST.system),linux)
TEST.GCC.l += va va-drm
diff --git a/test/test.c b/test/test.c
index 75e938178..7d94ed2be 100644
--- a/test/test.c
+++ b/test/test.c
@@ -34,7 +34,7 @@
#include "lang.h"
#include "parsecsv.h"
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
#include "qsv_common.h"
#endif
@@ -190,7 +190,7 @@ static int start_at_frame = 0;
static int64_t stop_at_pts = 0;
static int stop_at_frame = 0;
static uint64_t min_title_duration = 10;
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
static int qsv_async_depth = -1;
static int qsv_decode = -1;
#endif
@@ -1901,7 +1901,7 @@ static void ShowHelp()
"\n"
);
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (hb_qsv_available())
{
fprintf( out,
@@ -2163,7 +2163,7 @@ static int ParseOptions( int argc, char ** argv )
{ "verbose", optional_argument, NULL, 'v' },
{ "no-dvdnav", no_argument, NULL, DVDNAV },
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
{ "qsv-baseline", no_argument, NULL, QSV_BASELINE, },
{ "qsv-async-depth", required_argument, NULL, QSV_ASYNC_DEPTH, },
{ "qsv-implementation", required_argument, NULL, QSV_IMPLEMENTATION, },
@@ -3053,7 +3053,7 @@ static int ParseOptions( int argc, char ** argv )
case MIN_DURATION:
min_title_duration = strtol( optarg, NULL, 0 );
break;
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
case QSV_BASELINE:
hb_qsv_force_workarounds();
break;
@@ -4122,7 +4122,7 @@ static hb_dict_t * PreparePreset(const char *preset_name)
hb_dict_set(preset, "VideoColorMatrixCodeOverride",
hb_value_int(color_matrix_code));
}
-#ifdef USE_QSV
+#if HB_PROJECT_FEATURE_QSV
if (qsv_async_depth >= 0)
{
hb_dict_set(preset, "VideoQSVAsyncDepth",