summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
Diffstat (limited to 'libhb')
-rw-r--r--libhb/common.h2
-rw-r--r--libhb/fifo.c2
-rw-r--r--libhb/internal.h2
-rw-r--r--libhb/qsv_common.c14
-rw-r--r--libhb/qsv_filter.c2
-rw-r--r--libhb/qsv_filter_pp.c2
-rw-r--r--libhb/qsv_libav.c52
-rw-r--r--libhb/qsv_libav.h20
-rw-r--r--libhb/qsv_memory.h2
9 files changed, 26 insertions, 72 deletions
diff --git a/libhb/common.h b/libhb/common.h
index 0e43c007c..9950f0e2d 100644
--- a/libhb/common.h
+++ b/libhb/common.h
@@ -103,7 +103,7 @@ typedef enum
#include "libavutil/channel_layout.h"
#ifdef USE_QSV
-#include "libavcodec/qsv.h"
+#include "qsv_libav.h"
#endif
struct hb_buffer_list_s
diff --git a/libhb/fifo.c b/libhb/fifo.c
index 7738868a1..5ec49bf86 100644
--- a/libhb/fifo.c
+++ b/libhb/fifo.c
@@ -10,7 +10,7 @@
#include "hb.h"
#include "openclwrapper.h"
#ifdef USE_QSV
-#include "libavcodec/qsv.h"
+#include "qsv_libav.h"
#endif
#ifndef SYS_DARWIN
diff --git a/libhb/internal.h b/libhb/internal.h
index c189591b4..9344636bf 100644
--- a/libhb/internal.h
+++ b/libhb/internal.h
@@ -10,7 +10,7 @@
#include "hbffmpeg.h"
#include "extras/cl.h"
#ifdef USE_QSV
-#include "libavcodec/qsv.h"
+#include "qsv_libav.h"
#endif
/***********************************************************************
diff --git a/libhb/qsv_common.c b/libhb/qsv_common.c
index bb5dbc15a..2c2d827c6 100644
--- a/libhb/qsv_common.c
+++ b/libhb/qsv_common.c
@@ -912,9 +912,17 @@ const char* hb_qsv_decode_get_codec_name(enum AVCodecID codec_id)
int hb_qsv_decode_is_enabled(hb_job_t *job)
{
- return ((job != NULL && job->qsv.decode) &&
- (job->vcodec & HB_VCODEC_QSV_MASK) &&
- (job->title->video_decode_support & HB_DECODE_SUPPORT_QSV));
+ /*
+ * XXX: we haven't yet adjusted our QSV decoder wrapper to use libav's new
+ * QSV-accelerated decoder, and our old custom QSV-accelerated decoder
+ * for libav hasn't been updated to work with newer libav releases, so
+ * we can't use QSV-accelerated decoding at all for the time being.
+ *
+ * return ((job != NULL && job->qsv.decode) &&
+ * (job->vcodec & HB_VCODEC_QSV_MASK) &&
+ * (job->title->video_decode_support & HB_DECODE_SUPPORT_QSV));
+ */
+ return 0;
}
int hb_qsv_copyframe_is_slow(int encoder)
diff --git a/libhb/qsv_filter.c b/libhb/qsv_filter.c
index 1a676ee2b..2a1ae0e40 100644
--- a/libhb/qsv_filter.c
+++ b/libhb/qsv_filter.c
@@ -30,8 +30,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "hb.h"
#include "hbffmpeg.h"
-#include "libavcodec/qsv.h"
#include "qsv_filter.h"
+#include "qsv_libav.h"
struct hb_filter_private_s
{
diff --git a/libhb/qsv_filter_pp.c b/libhb/qsv_filter_pp.c
index 7850d3b9a..05b18bf7e 100644
--- a/libhb/qsv_filter_pp.c
+++ b/libhb/qsv_filter_pp.c
@@ -30,9 +30,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "hb.h"
#include "hbffmpeg.h"
-#include "libavcodec/qsv.h"
#include "qsv_filter_pp.h"
#include "qsv_filter.h"
+#include "qsv_libav.h"
#include "qsv_memory.h"
diff --git a/libhb/qsv_libav.c b/libhb/qsv_libav.c
index 2c46111ec..230032726 100644
--- a/libhb/qsv_libav.c
+++ b/libhb/qsv_libav.c
@@ -26,10 +26,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\* ********************************************************************* */
-#include "qsv.h"
+#ifdef USE_QSV
-#include "avcodec.h"
-#include "internal.h"
+#include "hbffmpeg.h"
+#include "qsv_libav.h"
int av_qsv_get_free_encode_task(av_qsv_list * tasks)
{
@@ -62,16 +62,12 @@ int av_qsv_get_free_sync(av_qsv_space * space, av_qsv_context * qsv)
return i;
}
}
-#if HAVE_THREADS
if (++counter >= AV_QSV_REPEAT_NUM_DEFAULT) {
-#endif
av_log(NULL, AV_LOG_FATAL, "not enough to have %d sync point(s) allocated\n",
space->sync_num);
break;
-#if HAVE_THREADS
}
av_qsv_sleep(5);
-#endif
}
return ret;
}
@@ -101,16 +97,12 @@ int av_qsv_get_free_surface(av_qsv_space * space, av_qsv_context * qsv,
return i;
}
}
-#if HAVE_THREADS
if (++counter >= AV_QSV_REPEAT_NUM_DEFAULT) {
-#endif
av_log(NULL, AV_LOG_FATAL,
"not enough to have %d surface(s) allocated\n", up);
break;
-#if HAVE_THREADS
}
av_qsv_sleep(5);
-#endif
}
return ret;
}
@@ -193,9 +185,7 @@ void av_qsv_stage_clean(av_qsv_stage ** stage)
void av_qsv_add_context_usage(av_qsv_context * qsv, int is_threaded)
{
int is_active = 0;
-#if HAVE_THREADS
int mut_ret = 0;
-#endif
is_active = ff_qsv_atomic_inc(&qsv->is_context_active);
if (is_active == 1) {
@@ -204,7 +194,6 @@ void av_qsv_add_context_usage(av_qsv_context * qsv, int is_threaded)
qsv->dts_seq = av_qsv_list_init(is_threaded);
-#if HAVE_THREADS
if (is_threaded) {
qsv->qts_seq_mutex = av_mallocz(sizeof(pthread_mutex_t));
if (qsv->qts_seq_mutex){
@@ -214,7 +203,6 @@ void av_qsv_add_context_usage(av_qsv_context * qsv, int is_threaded)
}
} else
-#endif
qsv->qts_seq_mutex = 0;
}
}
@@ -223,9 +211,7 @@ int av_qsv_context_clean(av_qsv_context * qsv)
{
int is_active = 0;
mfxStatus sts = MFX_ERR_NONE;
-#if HAVE_THREADS
int mut_ret = 0;
-#endif
is_active = ff_qsv_atomic_dec(&qsv->is_context_active);
@@ -239,16 +225,12 @@ int av_qsv_context_clean(av_qsv_context * qsv)
av_qsv_list_close(&qsv->dts_seq);
}
-#if HAVE_THREADS
if (qsv->qts_seq_mutex) {
mut_ret = pthread_mutex_destroy(qsv->qts_seq_mutex);
if(mut_ret)
av_log(NULL, AV_LOG_ERROR, "pthread_mutex_destroy issue[%d] at %s\n", mut_ret,__FUNCTION__);
-#endif
qsv->qts_seq_mutex = 0;
-#if HAVE_THREADS
}
-#endif
if (qsv->pipes)
av_qsv_pipe_list_clean(&qsv->pipes);
@@ -360,18 +342,14 @@ void av_qsv_dts_ordered_insert(av_qsv_context * qsv, int start, int end,
av_qsv_dts *cur_dts = 0;
av_qsv_dts *new_dts = 0;
int i = 0;
-#if HAVE_THREADS
int mut_ret = 0;
-#endif
-#if HAVE_THREADS
if (iter == 0 && qsv->qts_seq_mutex){
mut_ret = pthread_mutex_lock(qsv->qts_seq_mutex);
if(mut_ret)
av_log(NULL, AV_LOG_ERROR, "pthread_mutex_lock issue[%d] at %s\n",mut_ret, __FUNCTION__);
}
-#endif
if (end == 0)
end = av_qsv_list_count(qsv->dts_seq);
@@ -395,51 +373,41 @@ void av_qsv_dts_ordered_insert(av_qsv_context * qsv, int start, int end,
} else if (cur_dts->dts == dts)
break;
}
-#if HAVE_THREADS
if (iter == 0 && qsv->qts_seq_mutex){
mut_ret = pthread_mutex_unlock(qsv->qts_seq_mutex);
if(mut_ret)
av_log(NULL, AV_LOG_ERROR, "pthread_mutex_unlock issue[%d] at %s\n",mut_ret, __FUNCTION__);
}
-#endif
}
void av_qsv_dts_pop(av_qsv_context * qsv)
{
av_qsv_dts *item = 0;
-#if HAVE_THREADS
int mut_ret = 0;
-#endif
-#if HAVE_THREADS
if (qsv && qsv->qts_seq_mutex){
mut_ret = pthread_mutex_lock(qsv->qts_seq_mutex);
if(mut_ret)
av_log(NULL, AV_LOG_ERROR, "pthread_mutex_lock issue[%d] at %s\n",mut_ret, __FUNCTION__);
}
-#endif
if (av_qsv_list_count(qsv->dts_seq)) {
item = av_qsv_list_item(qsv->dts_seq, 0);
av_qsv_list_rem(qsv->dts_seq, item);
av_free(item);
}
-#if HAVE_THREADS
if (qsv && qsv->qts_seq_mutex){
mut_ret = pthread_mutex_unlock(qsv->qts_seq_mutex);
if(mut_ret)
av_log(NULL, AV_LOG_ERROR, "pthread_mutex_lock issue[%d] at %s\n",mut_ret, __FUNCTION__);
}
-#endif
}
av_qsv_list *av_qsv_list_init(int is_threaded)
{
av_qsv_list *l;
-#if HAVE_THREADS
int mut_ret;
-#endif
l = av_mallocz(sizeof(av_qsv_list));
if (!l)
@@ -449,7 +417,6 @@ av_qsv_list *av_qsv_list_init(int is_threaded)
return 0;
l->items_alloc = AV_QSV_JOB_SIZE_DEFAULT;
-#if HAVE_THREADS
if (is_threaded) {
l->mutex = av_mallocz(sizeof(pthread_mutex_t));
if (l->mutex){
@@ -464,7 +431,6 @@ av_qsv_list *av_qsv_list_init(int is_threaded)
av_log(NULL, AV_LOG_ERROR, "pthread_mutex_init issue[%d] at %s\n",mut_ret, __FUNCTION__);
}
} else
-#endif
l->mutex = 0;
return l;
}
@@ -566,15 +532,12 @@ void av_qsv_list_insert(av_qsv_list * l, int pos, void *p)
void av_qsv_list_close(av_qsv_list ** _l)
{
av_qsv_list *l = *_l;
-#if HAVE_THREADS
int mut_ret;
-#endif
av_qsv_list_lock(l);
av_free(l->items);
-#if HAVE_THREADS
if (l->mutex){
mut_ret = pthread_mutex_unlock(l->mutex);
if( mut_ret )
@@ -582,31 +545,26 @@ void av_qsv_list_close(av_qsv_list ** _l)
mut_ret = pthread_mutex_destroy(&l->mutex);
mut_ret = pthread_mutexattr_destroy(&l->mta);
}
-#endif
av_freep(_l);
}
int av_qsv_list_lock(av_qsv_list *l){
int ret = 0;
-#if HAVE_THREADS
if (l->mutex){
ret = pthread_mutex_lock(l->mutex);
if( ret )
av_log(NULL, AV_LOG_ERROR, "pthread_mutex_lock issue[%d] at %s\n",ret, __FUNCTION__);
}
-#endif
return ret;
}
int av_qsv_list_unlock(av_qsv_list *l){
int ret = 0;
-#if HAVE_THREADS
if (l->mutex){
ret = pthread_mutex_unlock(l->mutex);
if( ret )
av_log(NULL, AV_LOG_ERROR, "pthread_mutex_unlock issue[%d] at %s\n",ret, __FUNCTION__);
}
-#endif
return ret;
}
@@ -643,4 +601,6 @@ void av_qsv_wait_on_sync(av_qsv_context *qsv, av_qsv_stage *stage)
break;
}
}
-} \ No newline at end of file
+}
+
+#endif // USE_QSV
diff --git a/libhb/qsv_libav.h b/libhb/qsv_libav.h
index 971e6a4b3..bd6caf7ed 100644
--- a/libhb/qsv_libav.h
+++ b/libhb/qsv_libav.h
@@ -26,8 +26,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\* ********************************************************************* */
-#ifndef AVCODEC_QSV_H
-#define AVCODEC_QSV_H
+#ifndef HB_QSV_LIBAV_H
+#define HB_QSV_LIBAV_H
/**
* @file
@@ -120,11 +120,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "libavutil/mem.h"
#include "libavutil/time.h"
-#ifdef HAVE_AV_CONFIG_H
-#include "config.h"
-#endif
-
-#if HAVE_THREADS
#if defined (__GNUC__)
#include <pthread.h>
#define ff_qsv_atomic_inc(ptr) __sync_add_and_fetch(ptr,1)
@@ -138,13 +133,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif
#define ff_qsv_atomic_inc(ptr) InterlockedIncrement(ptr)
#define ff_qsv_atomic_dec(ptr) InterlockedDecrement (ptr)
-#else
-// targeting only for MinGW or MSVC
-#endif
-
-#else
-#define ff_qsv_atomic_inc(ptr) ((*ptr)++)
-#define ff_qsv_atomic_dec(ptr) ((*ptr)--)
#endif
@@ -202,9 +190,7 @@ typedef enum AV_QSV_STAGE_TYPE {
typedef struct av_qsv_list {
// practically pthread_mutex_t
void *mutex;
-#if HAVE_THREADS
pthread_mutexattr_t mta;
-#endif
void **items;
int items_alloc;
@@ -491,4 +477,4 @@ void *av_qsv_list_item(av_qsv_list *, int);
/* @} */
-#endif //AVCODEC_QSV_H
+#endif // HB_QSV_LIBAV_H
diff --git a/libhb/qsv_memory.h b/libhb/qsv_memory.h
index b2a5b0302..397f95931 100644
--- a/libhb/qsv_memory.h
+++ b/libhb/qsv_memory.h
@@ -29,8 +29,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef QSV_MEMORY_H
#define QSV_MEMORY_H
-#include "libavcodec/qsv.h"
#include "mfx/mfxplugin.h"
+#include "qsv_libav.h"
typedef struct{