summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2016-12-12 13:16:36 -0800
committerJohn Stebbins <[email protected]>2016-12-17 07:28:51 -0800
commit480d018ee0012a5adb9609195a951496f7d3c62a (patch)
treef0b79cbde2042111a8005c45fd3e67cbddada1a3
parenta4a6332a90b21eb246b5147dc3285b36cd6f631e (diff)
qsv: rename av_qsv* to hb_qsv*
-rw-r--r--libhb/common.c2
-rw-r--r--libhb/common.h2
-rw-r--r--libhb/decavcodec.c2
-rw-r--r--libhb/enc_qsv.c132
-rw-r--r--libhb/fifo.c8
-rw-r--r--libhb/internal.h2
-rw-r--r--libhb/qsv_common.c4
-rw-r--r--libhb/qsv_common.h4
-rw-r--r--libhb/qsv_filter.c118
-rw-r--r--libhb/qsv_filter.h2
-rw-r--r--libhb/qsv_filter_pp.c118
-rw-r--r--libhb/qsv_filter_pp.h2
-rw-r--r--libhb/qsv_libav.c248
-rw-r--r--libhb/qsv_libav.h222
-rw-r--r--libhb/qsv_memory.c4
15 files changed, 435 insertions, 435 deletions
diff --git a/libhb/common.c b/libhb/common.c
index c85bd21df..01f0bb2bb 100644
--- a/libhb/common.c
+++ b/libhb/common.c
@@ -3648,7 +3648,7 @@ static void job_setup(hb_job_t * job, hb_title_t * title)
#ifdef USE_QSV
job->qsv.enc_info.is_init_done = 0;
- job->qsv.async_depth = AV_QSV_ASYNC_DEPTH_DEFAULT;
+ job->qsv.async_depth = HB_QSV_ASYNC_DEPTH_DEFAULT;
job->qsv.decode = !!(title->video_decode_support &
HB_DECODE_SUPPORT_QSV);
#endif
diff --git a/libhb/common.h b/libhb/common.h
index 9950f0e2d..b3895897c 100644
--- a/libhb/common.h
+++ b/libhb/common.h
@@ -625,7 +625,7 @@ struct hb_job_s
int decode;
int async_depth;
#ifdef USE_QSV
- av_qsv_context *ctx;
+ hb_qsv_context *ctx;
#endif
// shared encoding parameters
// initialized by the QSV encoder, then used upstream (e.g. by filters)
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index d17fd1575..cbc03cf6a 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -132,7 +132,7 @@ struct hb_work_private_s
struct
{
int decode;
- av_qsv_config config;
+ hb_qsv_config config;
const char * codec_name;
} qsv;
#endif
diff --git a/libhb/enc_qsv.c b/libhb/enc_qsv.c
index c048f93be..0e983eaa4 100644
--- a/libhb/enc_qsv.c
+++ b/libhb/enc_qsv.c
@@ -73,7 +73,7 @@ struct hb_work_private_s
int64_t last_start;
hb_qsv_param_t param;
- av_qsv_space enc_space;
+ hb_qsv_space enc_space;
hb_qsv_info_t * qsv_info;
hb_chapter_queue_t * chapter_queue;
@@ -337,7 +337,7 @@ static int qsv_hevc_make_header(hb_work_object_t *w, mfxSession session)
}
if (status == MFX_WRN_DEVICE_BUSY)
{
- av_qsv_sleep(1);
+ hb_qsv_sleep(1);
}
}
while (status >= MFX_ERR_NONE);
@@ -367,7 +367,7 @@ static int qsv_hevc_make_header(hb_work_object_t *w, mfxSession session)
}
if (status == MFX_WRN_DEVICE_BUSY)
{
- av_qsv_sleep(1);
+ hb_qsv_sleep(1);
}
}
while (status >= MFX_ERR_NONE);
@@ -444,7 +444,7 @@ end:
int qsv_enc_init(hb_work_private_t *pv)
{
- av_qsv_context *qsv = pv->job->qsv.ctx;
+ hb_qsv_context *qsv = pv->job->qsv.ctx;
hb_job_t *job = pv->job;
mfxVersion version;
mfxStatus sts;
@@ -463,17 +463,17 @@ int qsv_enc_init(hb_work_private_t *pv)
hb_error("qsv_enc_init: decode enabled but no context!");
return 3;
}
- job->qsv.ctx = qsv = av_mallocz(sizeof(av_qsv_context));
+ job->qsv.ctx = qsv = av_mallocz(sizeof(hb_qsv_context));
}
- av_qsv_space *qsv_encode = qsv->enc_space;
+ hb_qsv_space *qsv_encode = qsv->enc_space;
if (qsv_encode == NULL)
{
// if only for encode
if (pv->is_sys_mem)
{
// no need to use additional sync as encode only -> single thread
- av_qsv_add_context_usage(qsv, 0);
+ hb_qsv_add_context_usage(qsv, 0);
// re-use the session from encqsvInit
qsv->mfx_session = pv->mfx_session;
@@ -504,9 +504,9 @@ int qsv_enc_init(hb_work_private_t *pv)
{
return 2;
}
- for (i = 0; i < av_qsv_list_count(qsv->vpp_space); i++)
+ for (i = 0; i < hb_qsv_list_count(qsv->vpp_space); i++)
{
- av_qsv_space *vpp = av_qsv_list_item(qsv->vpp_space, i);
+ hb_qsv_space *vpp = hb_qsv_list_item(qsv->vpp_space, i);
if (!vpp->is_init_done)
{
return 2;
@@ -514,7 +514,7 @@ int qsv_enc_init(hb_work_private_t *pv)
}
}
- av_qsv_space *dec_space = qsv->dec_space;
+ hb_qsv_space *dec_space = qsv->dec_space;
if (dec_space == NULL || !dec_space->is_init_done)
{
return 2;
@@ -532,17 +532,17 @@ int qsv_enc_init(hb_work_private_t *pv)
}
// allocate tasks
- qsv_encode->p_buf_max_size = AV_QSV_BUF_SIZE_DEFAULT;
- qsv_encode->tasks = av_qsv_list_init(HAVE_THREADS);
+ qsv_encode->p_buf_max_size = HB_QSV_BUF_SIZE_DEFAULT;
+ qsv_encode->tasks = hb_qsv_list_init(HAVE_THREADS);
for (i = 0; i < pv->max_async_depth; i++)
{
- av_qsv_task *task = av_mallocz(sizeof(av_qsv_task));
+ hb_qsv_task *task = av_mallocz(sizeof(hb_qsv_task));
task->bs = av_mallocz(sizeof(mfxBitstream));
task->bs->Data = av_mallocz(sizeof(uint8_t) * qsv_encode->p_buf_max_size);
task->bs->MaxLength = qsv_encode->p_buf_max_size;
task->bs->DataLength = 0;
task->bs->DataOffset = 0;
- av_qsv_list_add(qsv_encode->tasks, task);
+ hb_qsv_list_add(qsv_encode->tasks, task);
}
// plugins should be loaded before querying for surface allocation
@@ -585,10 +585,10 @@ int qsv_enc_init(hb_work_private_t *pv)
if (pv->is_sys_mem)
{
qsv_encode->surface_num = FFMIN(qsv_encode->request[0].NumFrameSuggested +
- pv->max_async_depth, AV_QSV_SURFACE_NUM);
+ pv->max_async_depth, HB_QSV_SURFACE_NUM);
if (qsv_encode->surface_num <= 0)
{
- qsv_encode->surface_num = AV_QSV_SURFACE_NUM;
+ qsv_encode->surface_num = HB_QSV_SURFACE_NUM;
}
for (i = 0; i < qsv_encode->surface_num; i++)
{
@@ -603,12 +603,12 @@ int qsv_enc_init(hb_work_private_t *pv)
}
else
{
- av_qsv_space *in_space = qsv->dec_space;
+ hb_qsv_space *in_space = qsv->dec_space;
if (pv->is_vpp_present)
{
// we get our input from VPP instead
- in_space = av_qsv_list_item(qsv->vpp_space,
- av_qsv_list_count(qsv->vpp_space) - 1);
+ in_space = hb_qsv_list_item(qsv->vpp_space,
+ hb_qsv_list_count(qsv->vpp_space) - 1);
}
// introduced in API 1.3
memset(&qsv_encode->ext_opaque_alloc, 0, sizeof(mfxExtOpaqueSurfaceAlloc));
@@ -622,14 +622,14 @@ int qsv_enc_init(hb_work_private_t *pv)
// allocate sync points
qsv_encode->sync_num = (qsv_encode->surface_num ?
- FFMIN(qsv_encode->surface_num, AV_QSV_SYNC_NUM) :
- AV_QSV_SYNC_NUM);
+ FFMIN(qsv_encode->surface_num, HB_QSV_SYNC_NUM) :
+ HB_QSV_SYNC_NUM);
for (i = 0; i < qsv_encode->sync_num; i++)
{
- qsv_encode->p_syncp[i] = av_mallocz(sizeof(av_qsv_sync));
- AV_QSV_CHECK_POINTER(qsv_encode->p_syncp[i], MFX_ERR_MEMORY_ALLOC);
+ qsv_encode->p_syncp[i] = av_mallocz(sizeof(hb_qsv_sync));
+ HB_QSV_CHECK_POINTER(qsv_encode->p_syncp[i], MFX_ERR_MEMORY_ALLOC);
qsv_encode->p_syncp[i]->p_sync = av_mallocz(sizeof(mfxSyncPoint));
- AV_QSV_CHECK_POINTER(qsv_encode->p_syncp[i]->p_sync, MFX_ERR_MEMORY_ALLOC);
+ HB_QSV_CHECK_POINTER(qsv_encode->p_syncp[i]->p_sync, MFX_ERR_MEMORY_ALLOC);
}
// initialize the encoder
@@ -792,14 +792,14 @@ int encqsvInit(hb_work_object_t *w, hb_job_t *job)
switch (pv->qsv_info->codec_id)
{
case MFX_CODEC_HEVC:
- job->qsv.enc_info.align_width = AV_QSV_ALIGN32(job->width);
- job->qsv.enc_info.align_height = AV_QSV_ALIGN32(job->height);
+ job->qsv.enc_info.align_width = HB_QSV_ALIGN32(job->width);
+ job->qsv.enc_info.align_height = HB_QSV_ALIGN32(job->height);
break;
case MFX_CODEC_AVC:
default:
- job->qsv.enc_info.align_width = AV_QSV_ALIGN16(job->width);
- job->qsv.enc_info.align_height = AV_QSV_ALIGN16(job->height);
+ job->qsv.enc_info.align_width = HB_QSV_ALIGN16(job->width);
+ job->qsv.enc_info.align_height = HB_QSV_ALIGN16(job->height);
break;
}
if (pv->param.videoParam->mfx.FrameInfo.PicStruct != MFX_PICSTRUCT_PROGRESSIVE)
@@ -808,7 +808,7 @@ int encqsvInit(hb_work_object_t *w, hb_job_t *job)
switch (pv->qsv_info->codec_id)
{
case MFX_CODEC_AVC:
- job->qsv.enc_info.align_height = AV_QSV_ALIGN32(job->qsv.enc_info.align_height);
+ job->qsv.enc_info.align_height = HB_QSV_ALIGN32(job->qsv.enc_info.align_height);
break;
default:
@@ -1397,7 +1397,7 @@ int encqsvInit(hb_work_object_t *w, hb_job_t *job)
// AsyncDepth has now been set and/or modified by Media SDK
// fall back to default if zero
- pv->max_async_depth = videoParam.AsyncDepth ? videoParam.AsyncDepth : AV_QSV_ASYNC_DEPTH_DEFAULT;
+ pv->max_async_depth = videoParam.AsyncDepth ? videoParam.AsyncDepth : HB_QSV_ASYNC_DEPTH_DEFAULT;
pv->async_depth = 0;
return 0;
@@ -1413,8 +1413,8 @@ void encqsvClose(hb_work_object_t *w)
pv->job->qsv.ctx->is_context_active)
{
- av_qsv_context *qsv_ctx = pv->job->qsv.ctx;
- av_qsv_space *qsv_enc_space = pv->job->qsv.ctx->enc_space;
+ hb_qsv_context *qsv_ctx = pv->job->qsv.ctx;
+ hb_qsv_space *qsv_enc_space = pv->job->qsv.ctx->enc_space;
if (qsv_ctx != NULL)
{
@@ -1425,15 +1425,15 @@ void encqsvClose(hb_work_object_t *w)
}
/* QSV context cleanup and MFXClose */
- av_qsv_context_clean(qsv_ctx);
+ hb_qsv_context_clean(qsv_ctx);
if (qsv_enc_space != NULL)
{
if (qsv_enc_space->is_init_done)
{
- for (i = av_qsv_list_count(qsv_enc_space->tasks); i > 1; i--)
+ for (i = hb_qsv_list_count(qsv_enc_space->tasks); i > 1; i--)
{
- av_qsv_task *task = av_qsv_list_item(qsv_enc_space->tasks,
+ hb_qsv_task *task = hb_qsv_list_item(qsv_enc_space->tasks,
i - 1);
if (task != NULL)
{
@@ -1441,12 +1441,12 @@ void encqsvClose(hb_work_object_t *w)
{
av_freep(&task->bs->Data);
}
- av_qsv_list_rem(qsv_enc_space->tasks, task);
+ hb_qsv_list_rem(qsv_enc_space->tasks, task);
av_freep(&task->bs);
av_freep(&task);
}
}
- av_qsv_list_close(&qsv_enc_space->tasks);
+ hb_qsv_list_close(&qsv_enc_space->tasks);
for (i = 0; i < qsv_enc_space->surface_num; i++)
{
@@ -1712,22 +1712,22 @@ fail:
}
static int qsv_enc_work(hb_work_private_t *pv,
- av_qsv_list *qsv_atom,
+ hb_qsv_list *qsv_atom,
mfxFrameSurface1 *surface)
{
mfxStatus sts;
- av_qsv_context *qsv_ctx = pv->job->qsv.ctx;
- av_qsv_space *qsv_enc_space = pv->job->qsv.ctx->enc_space;
+ hb_qsv_context *qsv_ctx = pv->job->qsv.ctx;
+ hb_qsv_space *qsv_enc_space = pv->job->qsv.ctx->enc_space;
do
{
- int sync_idx = av_qsv_get_free_sync(qsv_enc_space, qsv_ctx);
+ int sync_idx = hb_qsv_get_free_sync(qsv_enc_space, qsv_ctx);
if (sync_idx == -1)
{
- hb_error("encqsv: av_qsv_get_free_sync failed");
+ hb_error("encqsv: hb_qsv_get_free_sync failed");
return -1;
}
- av_qsv_task *task = av_qsv_list_item(qsv_enc_space->tasks,
+ hb_qsv_task *task = hb_qsv_list_item(qsv_enc_space->tasks,
pv->async_depth);
do
@@ -1761,13 +1761,13 @@ static int qsv_enc_work(hb_work_private_t *pv,
}
else if (sts == MFX_WRN_DEVICE_BUSY)
{
- av_qsv_sleep(10); // device is busy, wait then repeat the call
+ hb_qsv_sleep(10); // device is busy, wait then repeat the call
continue;
}
else
{
- av_qsv_stage *new_stage = av_qsv_stage_init();
- new_stage->type = AV_QSV_ENCODE;
+ hb_qsv_stage *new_stage = hb_qsv_stage_init();
+ new_stage->type = HB_QSV_ENCODE;
new_stage->in.p_surface = surface;
new_stage->out.sync = qsv_enc_space->p_syncp[sync_idx];
new_stage->out.p_bs = task->bs;
@@ -1776,25 +1776,25 @@ static int qsv_enc_work(hb_work_private_t *pv,
if (qsv_atom != NULL)
{
- av_qsv_add_stagee(&qsv_atom, new_stage, HAVE_THREADS);
+ hb_qsv_add_stagee(&qsv_atom, new_stage, HAVE_THREADS);
}
else
{
/* encode-only or flushing */
- av_qsv_list *new_qsv_atom = av_qsv_list_init(HAVE_THREADS);
- av_qsv_add_stagee(&new_qsv_atom, new_stage, HAVE_THREADS);
- av_qsv_list_add (qsv_ctx->pipes, new_qsv_atom);
+ hb_qsv_list *new_qsv_atom = hb_qsv_list_init(HAVE_THREADS);
+ hb_qsv_add_stagee(&new_qsv_atom, new_stage, HAVE_THREADS);
+ hb_qsv_list_add (qsv_ctx->pipes, new_qsv_atom);
}
int i = hb_list_count(pv->delayed_processing);
while (--i >= 0)
{
- av_qsv_list *item = hb_list_item(pv->delayed_processing, i);
+ hb_qsv_list *item = hb_list_item(pv->delayed_processing, i);
if (item != NULL)
{
hb_list_rem(pv->delayed_processing, item);
- av_qsv_flush_stages(qsv_ctx->pipes, &item);
+ hb_qsv_flush_stages(qsv_ctx->pipes, &item);
}
}
break;
@@ -1812,17 +1812,17 @@ static int qsv_enc_work(hb_work_private_t *pv,
/* we've done enough asynchronous operations or we're flushing */
if (pv->async_depth >= pv->max_async_depth || surface == NULL)
{
- av_qsv_task *task = av_qsv_list_item(qsv_enc_space->tasks, 0);
+ hb_qsv_task *task = hb_qsv_list_item(qsv_enc_space->tasks, 0);
pv->async_depth--;
/* perform a sync operation to get the output bitstream */
- av_qsv_wait_on_sync(qsv_ctx, task->stage);
+ hb_qsv_wait_on_sync(qsv_ctx, task->stage);
if (task->bs->DataLength > 0)
{
- av_qsv_list *pipe = av_qsv_pipe_by_stage(qsv_ctx->pipes,
+ hb_qsv_list *pipe = hb_qsv_pipe_by_stage(qsv_ctx->pipes,
task->stage);
- av_qsv_flush_stages(qsv_ctx->pipes, &pipe);
+ hb_qsv_flush_stages(qsv_ctx->pipes, &pipe);
/* get the encoded frame from the bitstream */
qsv_bitstream_slurp(pv, task->bs);
@@ -1830,8 +1830,8 @@ static int qsv_enc_work(hb_work_private_t *pv,
/* shift for fifo */
if (pv->async_depth)
{
- av_qsv_list_rem(qsv_enc_space->tasks, task);
- av_qsv_list_add(qsv_enc_space->tasks, task);
+ hb_qsv_list_rem(qsv_enc_space->tasks, task);
+ hb_qsv_list_add(qsv_enc_space->tasks, task);
}
task->stage = NULL;
}
@@ -1852,7 +1852,7 @@ int encqsvWork(hb_work_object_t *w, hb_buffer_t **buf_in, hb_buffer_t **buf_out)
while (qsv_enc_init(pv) >= 2)
{
- av_qsv_sleep(1); // encoding not initialized, wait and repeat the call
+ hb_qsv_sleep(1); // encoding not initialized, wait and repeat the call
}
if (*job->die)
@@ -1874,18 +1874,18 @@ int encqsvWork(hb_work_object_t *w, hb_buffer_t **buf_in, hb_buffer_t **buf_out)
}
mfxFrameSurface1 *surface = NULL;
- av_qsv_list *qsv_atom = NULL;
- av_qsv_context *qsv_ctx = job->qsv.ctx;
- av_qsv_space *qsv_enc_space = job->qsv.ctx->enc_space;
+ hb_qsv_list *qsv_atom = NULL;
+ hb_qsv_context *qsv_ctx = job->qsv.ctx;
+ hb_qsv_space *qsv_enc_space = job->qsv.ctx->enc_space;
if (pv->is_sys_mem)
{
mfxFrameInfo *info = &pv->param.videoParam->mfx.FrameInfo;
- int surface_index = av_qsv_get_free_surface(qsv_enc_space, qsv_ctx, info,
+ int surface_index = hb_qsv_get_free_surface(qsv_enc_space, qsv_ctx, info,
QSV_PART_ANY);
if (surface_index == -1)
{
- hb_error("encqsv: av_qsv_get_free_surface failed");
+ hb_error("encqsv: hb_qsv_get_free_surface failed");
goto fail;
}
@@ -1895,7 +1895,7 @@ int encqsvWork(hb_work_object_t *w, hb_buffer_t **buf_in, hb_buffer_t **buf_out)
else
{
qsv_atom = in->qsv_details.qsv_atom;
- surface = av_qsv_get_last_stage(qsv_atom)->out.p_surface;
+ surface = hb_qsv_get_last_stage(qsv_atom)->out.p_surface;
// At this point, enc_qsv takes ownership of the QSV resources
// in the 'in' buffer.
in->qsv_details.qsv_atom = NULL;
@@ -1904,7 +1904,7 @@ int encqsvWork(hb_work_object_t *w, hb_buffer_t **buf_in, hb_buffer_t **buf_out)
* QSV decoding fills the QSV context's dts_seq list, we need to
* pop this surface's DTS so dts_seq doesn't grow unnecessarily.
*/
- av_qsv_dts_pop(qsv_ctx);
+ hb_qsv_dts_pop(qsv_ctx);
}
/*
diff --git a/libhb/fifo.c b/libhb/fifo.c
index a07545ed5..40702d4f0 100644
--- a/libhb/fifo.c
+++ b/libhb/fifo.c
@@ -726,10 +726,10 @@ void hb_buffer_close( hb_buffer_t ** _b )
// when decoding without QSV, the QSV atom will be NULL.
if (b->qsv_details.qsv_atom != NULL && b->qsv_details.ctx != NULL)
{
- av_qsv_stage *stage = av_qsv_get_last_stage(b->qsv_details.qsv_atom);
+ hb_qsv_stage *stage = hb_qsv_get_last_stage(b->qsv_details.qsv_atom);
if (stage != NULL)
{
- av_qsv_wait_on_sync(b->qsv_details.ctx, stage);
+ hb_qsv_wait_on_sync(b->qsv_details.ctx, stage);
if (stage->out.sync->in_use > 0)
{
ff_qsv_atomic_dec(&stage->out.sync->in_use);
@@ -739,8 +739,8 @@ void hb_buffer_close( hb_buffer_t ** _b )
ff_qsv_atomic_dec(&stage->out.p_surface->Data.Locked);
}
}
- av_qsv_flush_stages(b->qsv_details.ctx->pipes,
- (av_qsv_list**)&b->qsv_details.qsv_atom);
+ hb_qsv_flush_stages(b->qsv_details.ctx->pipes,
+ (hb_qsv_list**)&b->qsv_details.qsv_atom);
}
#endif
diff --git a/libhb/internal.h b/libhb/internal.h
index 9344636bf..c006c4e58 100644
--- a/libhb/internal.h
+++ b/libhb/internal.h
@@ -142,7 +142,7 @@ struct hb_buffer_s
{
void * qsv_atom;
void * filter_details;
- av_qsv_context * ctx;
+ hb_qsv_context * ctx;
} qsv_details;
#endif
diff --git a/libhb/qsv_common.c b/libhb/qsv_common.c
index 3c4a8441c..effd10813 100644
--- a/libhb/qsv_common.c
+++ b/libhb/qsv_common.c
@@ -196,7 +196,7 @@ static void init_video_param(mfxVideoParam *videoParam)
videoParam->mfx.FrameInfo.Height = 1088;
videoParam->mfx.FrameInfo.CropH = 1080;
videoParam->mfx.FrameInfo.AspectRatioH = 1;
- videoParam->AsyncDepth = AV_QSV_ASYNC_DEPTH_DEFAULT;
+ videoParam->AsyncDepth = HB_QSV_ASYNC_DEPTH_DEFAULT;
videoParam->IOPattern = MFX_IOPATTERN_IN_SYSTEM_MEMORY;
}
@@ -1895,7 +1895,7 @@ int hb_qsv_param_default(hb_qsv_param_t *param, mfxVideoParam *videoParam,
param->videoParam->mfx.GopPicSize = 0; // use Media SDK default
param->videoParam->mfx.GopRefDist = 0; // use Media SDK default
// introduced in API 1.1
- param->videoParam->AsyncDepth = AV_QSV_ASYNC_DEPTH_DEFAULT;
+ param->videoParam->AsyncDepth = HB_QSV_ASYNC_DEPTH_DEFAULT;
// introduced in API 1.3
param->videoParam->mfx.BRCParamMultiplier = 0; // no multiplier
diff --git a/libhb/qsv_common.h b/libhb/qsv_common.h
index 543a283d9..d7bfe5a7d 100644
--- a/libhb/qsv_common.h
+++ b/libhb/qsv_common.h
@@ -15,8 +15,8 @@
#include "libavcodec/avcodec.h"
/* Minimum Intel Media SDK version (currently 1.3, for Sandy Bridge support) */
-#define HB_QSV_MINVERSION_MAJOR AV_QSV_MSDK_VERSION_MAJOR
-#define HB_QSV_MINVERSION_MINOR AV_QSV_MSDK_VERSION_MINOR
+#define HB_QSV_MINVERSION_MAJOR HB_QSV_MSDK_VERSION_MAJOR
+#define HB_QSV_MINVERSION_MINOR HB_QSV_MSDK_VERSION_MINOR
/*
* Get & store all available Intel Quick Sync information:
diff --git a/libhb/qsv_filter.c b/libhb/qsv_filter.c
index 2a1ae0e40..9ff4aa27c 100644
--- a/libhb/qsv_filter.c
+++ b/libhb/qsv_filter.c
@@ -54,7 +54,7 @@ struct hb_filter_private_s
mfxU16 CropH;
mfxU16 CropW;
- av_qsv_space * vpp_space;
+ hb_qsv_space * vpp_space;
// FRC param(s)
mfxExtVPPFrameRateConversion frc_config;
@@ -90,7 +90,7 @@ hb_filter_object_t hb_filter_qsv =
.settings_template = qsv_filter_template,
};
-static int filter_init( av_qsv_context* qsv, hb_filter_private_t * pv ){
+static int filter_init( hb_qsv_context* qsv, hb_filter_private_t * pv ){
mfxStatus sts;
int i=0;
@@ -98,12 +98,12 @@ static int filter_init( av_qsv_context* qsv, hb_filter_private_t * pv ){
if(!qsv->vpp_space){
- qsv->vpp_space = av_qsv_list_init(HAVE_THREADS);
+ qsv->vpp_space = hb_qsv_list_init(HAVE_THREADS);
}
if(!pv->vpp_space){
- for(i=0; i<av_qsv_list_count(qsv->vpp_space);i++){
- av_qsv_space *qsv_vpp = av_qsv_list_item( qsv->vpp_space, i );
- if(qsv_vpp->type == AV_QSV_VPP_DEFAULT){
+ for(i=0; i<hb_qsv_list_count(qsv->vpp_space);i++){
+ hb_qsv_space *qsv_vpp = hb_qsv_list_item( qsv->vpp_space, i );
+ if(qsv_vpp->type == HB_QSV_VPP_DEFAULT){
pv->vpp_space = qsv_vpp;
break;
}
@@ -111,9 +111,9 @@ static int filter_init( av_qsv_context* qsv, hb_filter_private_t * pv ){
}
if(!pv->vpp_space){
- pv->vpp_space = calloc( 1, sizeof( av_qsv_space ));
- pv->vpp_space->type = AV_QSV_VPP_DEFAULT;
- av_qsv_list_add( qsv->vpp_space, pv->vpp_space );
+ pv->vpp_space = calloc( 1, sizeof( hb_qsv_space ));
+ pv->vpp_space->type = HB_QSV_VPP_DEFAULT;
+ hb_qsv_list_add( qsv->vpp_space, pv->vpp_space );
}
else
if(pv->vpp_space->is_init_done ) return 1;
@@ -126,13 +126,13 @@ static int filter_init( av_qsv_context* qsv, hb_filter_private_t * pv ){
return 2;
}
- av_qsv_add_context_usage(qsv,HAVE_THREADS);
+ hb_qsv_add_context_usage(qsv,HAVE_THREADS);
// see params needed like at mediasdk-man.pdf:"Appendix A: Configuration Parameter Constraints"
// for now - most will take from the decode
{
- av_qsv_space *qsv_vpp = pv->vpp_space;
- AV_QSV_ZERO_MEMORY(qsv_vpp->m_mfxVideoParam);
+ hb_qsv_space *qsv_vpp = pv->vpp_space;
+ HB_QSV_ZERO_MEMORY(qsv_vpp->m_mfxVideoParam);
if (pv->deinterlace)
{
@@ -216,32 +216,32 @@ static int filter_init( av_qsv_context* qsv, hb_filter_private_t * pv ){
memset(&qsv_vpp->request, 0, sizeof(mfxFrameAllocRequest)*2);
sts = MFXVideoVPP_QueryIOSurf(qsv->mfx_session, &qsv_vpp->m_mfxVideoParam, qsv_vpp->request );
- AV_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
+ HB_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
int num_surfaces_in = qsv_vpp->request[0].NumFrameSuggested;
int num_surfaces_out = qsv_vpp->request[1].NumFrameSuggested;
- av_qsv_config *config = qsv->qsv_config;
+ hb_qsv_config *config = qsv->qsv_config;
- qsv_vpp->surface_num = FFMIN( num_surfaces_in + num_surfaces_out + qsv_vpp->m_mfxVideoParam.AsyncDepth + config ? config->additional_buffers/2 :0 , AV_QSV_SURFACE_NUM );
+ qsv_vpp->surface_num = FFMIN( num_surfaces_in + num_surfaces_out + qsv_vpp->m_mfxVideoParam.AsyncDepth + config ? config->additional_buffers/2 :0 , HB_QSV_SURFACE_NUM );
if(qsv_vpp->surface_num <= 0 )
- qsv_vpp->surface_num = AV_QSV_SURFACE_NUM;
+ qsv_vpp->surface_num = HB_QSV_SURFACE_NUM;
int i = 0;
for (i = 0; i < qsv_vpp->surface_num; i++){
qsv_vpp->p_surfaces[i] = av_mallocz( sizeof(mfxFrameSurface1) );
- AV_QSV_CHECK_POINTER(qsv_vpp->p_surfaces[i], MFX_ERR_MEMORY_ALLOC);
+ HB_QSV_CHECK_POINTER(qsv_vpp->p_surfaces[i], MFX_ERR_MEMORY_ALLOC);
memcpy(&(qsv_vpp->p_surfaces[i]->Info), &(qsv_vpp->m_mfxVideoParam.vpp.Out), sizeof(mfxFrameInfo));
}
- qsv_vpp->sync_num = FFMIN( qsv_vpp->surface_num, AV_QSV_SYNC_NUM );
+ qsv_vpp->sync_num = FFMIN( qsv_vpp->surface_num, HB_QSV_SYNC_NUM );
for (i = 0; i < qsv_vpp->sync_num; i++){
- qsv_vpp->p_syncp[i] = av_mallocz(sizeof(av_qsv_sync));
- AV_QSV_CHECK_POINTER(qsv_vpp->p_syncp[i], MFX_ERR_MEMORY_ALLOC);
+ qsv_vpp->p_syncp[i] = av_mallocz(sizeof(hb_qsv_sync));
+ HB_QSV_CHECK_POINTER(qsv_vpp->p_syncp[i], MFX_ERR_MEMORY_ALLOC);
qsv_vpp->p_syncp[i]->p_sync = av_mallocz(sizeof(mfxSyncPoint));
- AV_QSV_CHECK_POINTER(qsv_vpp->p_syncp[i]->p_sync, MFX_ERR_MEMORY_ALLOC);
+ HB_QSV_CHECK_POINTER(qsv_vpp->p_syncp[i]->p_sync, MFX_ERR_MEMORY_ALLOC);
}
/*
about available VPP filters, see "Table 4 Configurable VPP filters", mediasdk-man.pdf
@@ -303,7 +303,7 @@ static int filter_init( av_qsv_context* qsv, hb_filter_private_t * pv ){
qsv_vpp->m_mfxVideoParam.NumExtParam = qsv_vpp->p_ext_param_num = 1 + pv->is_frc_used;
qsv_vpp->p_ext_params = av_mallocz(sizeof(mfxExtBuffer *)*qsv_vpp->p_ext_param_num);
- AV_QSV_CHECK_POINTER(qsv_vpp->p_ext_params, MFX_ERR_MEMORY_ALLOC);
+ HB_QSV_CHECK_POINTER(qsv_vpp->p_ext_params, MFX_ERR_MEMORY_ALLOC);
qsv_vpp->m_mfxVideoParam.ExtParam = qsv_vpp->p_ext_params;
@@ -330,8 +330,8 @@ static int filter_init( av_qsv_context* qsv, hb_filter_private_t * pv ){
sts = MFXVideoVPP_Init(qsv->mfx_session, &qsv_vpp->m_mfxVideoParam);
- AV_QSV_IGNORE_MFX_STS(sts, MFX_WRN_PARTIAL_ACCELERATION);
- AV_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
+ HB_QSV_IGNORE_MFX_STS(sts, MFX_WRN_PARTIAL_ACCELERATION);
+ HB_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
qsv_vpp->is_init_done = 1;
}
@@ -406,17 +406,17 @@ static hb_filter_info_t * hb_qsv_filter_info( hb_filter_object_t * filter )
return info;
}
-void qsv_filter_close( av_qsv_context* qsv, AV_QSV_STAGE_TYPE vpp_type ){
+void qsv_filter_close( hb_qsv_context* qsv, HB_QSV_STAGE_TYPE vpp_type ){
int i = 0;
- av_qsv_space* vpp_space = 0;
+ hb_qsv_space* vpp_space = 0;
if(qsv && qsv->is_context_active && qsv->vpp_space)
- for(i=av_qsv_list_count( qsv->vpp_space);i>0;i--){
+ for(i=hb_qsv_list_count( qsv->vpp_space);i>0;i--){
- vpp_space = av_qsv_list_item( qsv->vpp_space, i-1 );
+ vpp_space = hb_qsv_list_item( qsv->vpp_space, i-1 );
if( vpp_space->type == vpp_type && vpp_space->is_init_done){
- hb_log( "qsv_filter[%s] done: max_surfaces: %u/%u , max_syncs: %u/%u", ((vpp_type == AV_QSV_VPP_DEFAULT)?"Default": "User") ,vpp_space->surface_num_max_used, vpp_space->surface_num, vpp_space->sync_num_max_used, vpp_space->sync_num );
+ hb_log( "qsv_filter[%s] done: max_surfaces: %u/%u , max_syncs: %u/%u", ((vpp_type == HB_QSV_VPP_DEFAULT)?"Default": "User") ,vpp_space->surface_num_max_used, vpp_space->surface_num, vpp_space->sync_num_max_used, vpp_space->sync_num );
for (i = 0; i < vpp_space->surface_num; i++){
av_freep(&vpp_space->p_surfaces[i]);
@@ -433,9 +433,9 @@ void qsv_filter_close( av_qsv_context* qsv, AV_QSV_STAGE_TYPE vpp_type ){
}
vpp_space->sync_num = 0;
- av_qsv_list_rem(qsv->vpp_space,vpp_space);
- if( av_qsv_list_count(qsv->vpp_space) == 0 )
- av_qsv_list_close(&qsv->vpp_space);
+ hb_qsv_list_rem(qsv->vpp_space,vpp_space);
+ if( hb_qsv_list_count(qsv->vpp_space) == 0 )
+ hb_qsv_list_close(&qsv->vpp_space);
vpp_space->is_init_done = 0;
break;
@@ -452,37 +452,37 @@ static void hb_qsv_filter_close( hb_filter_object_t * filter )
return;
}
- av_qsv_context* qsv = pv->job->qsv.ctx;
- if(qsv && qsv->vpp_space && av_qsv_list_count(qsv->vpp_space) > 0){
+ hb_qsv_context* qsv = pv->job->qsv.ctx;
+ if(qsv && qsv->vpp_space && hb_qsv_list_count(qsv->vpp_space) > 0){
// closing local stuff
- qsv_filter_close(qsv,AV_QSV_VPP_DEFAULT);
+ qsv_filter_close(qsv,HB_QSV_VPP_DEFAULT);
// closing the commong stuff
- av_qsv_context_clean(qsv);
+ hb_qsv_context_clean(qsv);
}
hb_buffer_list_close(&pv->list);
free( pv );
filter->private_data = NULL;
}
-int process_frame(av_qsv_list* received_item, av_qsv_context* qsv, hb_filter_private_t * pv ){
+int process_frame(hb_qsv_list* received_item, hb_qsv_context* qsv, hb_filter_private_t * pv ){
// 1 if have results , 0 - otherwise
int ret = 1;
mfxStatus sts = MFX_ERR_NONE;
mfxFrameSurface1 *work_surface = NULL;
- av_qsv_stage* stage = 0;
+ hb_qsv_stage* stage = 0;
- av_qsv_space *qsv_vpp = pv->vpp_space;
+ hb_qsv_space *qsv_vpp = pv->vpp_space;
if(received_item){
- stage = av_qsv_get_last_stage( received_item );
+ stage = hb_qsv_get_last_stage( received_item );
work_surface = stage->out.p_surface;
}
- int sync_idx = av_qsv_get_free_sync(qsv_vpp, qsv);
+ int sync_idx = hb_qsv_get_free_sync(qsv_vpp, qsv);
int surface_idx = -1;
for(;;)
@@ -494,7 +494,7 @@ int process_frame(av_qsv_list* received_item, av_qsv_context* qsv, hb_filter_pri
break;
}
if( sts == MFX_ERR_MORE_SURFACE || sts == MFX_ERR_NONE )
- surface_idx = av_qsv_get_free_surface(qsv_vpp, qsv, &(qsv_vpp->m_mfxVideoParam.vpp.Out), QSV_PART_ANY);
+ surface_idx = hb_qsv_get_free_surface(qsv_vpp, qsv, &(qsv_vpp->m_mfxVideoParam.vpp.Out), QSV_PART_ANY);
if (surface_idx == -1) {
hb_error("qsv: Not enough resources allocated for QSV filter");
ret = 0;
@@ -512,11 +512,11 @@ int process_frame(av_qsv_list* received_item, av_qsv_context* qsv, hb_filter_pri
if( MFX_ERR_MORE_DATA == sts ){
if(!qsv_vpp->pending){
- qsv_vpp->pending = av_qsv_list_init(0);
+ qsv_vpp->pending = hb_qsv_list_init(0);
}
// if we have no results, we should not miss resource(s)
- av_qsv_list_add( qsv_vpp->pending, received_item);
+ hb_qsv_list_add( qsv_vpp->pending, received_item);
ff_qsv_atomic_dec(&qsv_vpp->p_syncp[sync_idx]->in_use);
@@ -538,37 +538,37 @@ int process_frame(av_qsv_list* received_item, av_qsv_context* qsv, hb_filter_pri
ff_qsv_atomic_inc(&qsv_vpp->p_surfaces[surface_idx]->Data.Locked);
}
- AV_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
+ HB_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
if (MFX_ERR_NONE <= sts ) // repeat the call if warning and no output
{
if (MFX_WRN_DEVICE_BUSY == sts){
- av_qsv_sleep(10); // wait if device is busy
+ hb_qsv_sleep(10); // wait if device is busy
continue;
}
// shouldnt be a case but drain
if(stage){
- av_qsv_stage* new_stage = av_qsv_stage_init();
+ hb_qsv_stage* new_stage = hb_qsv_stage_init();
- new_stage->type = AV_QSV_VPP_DEFAULT;
+ new_stage->type = HB_QSV_VPP_DEFAULT;
new_stage->in.p_surface = work_surface;
new_stage->out.p_surface = qsv_vpp->p_surfaces[surface_idx];
new_stage->out.sync = qsv_vpp->p_syncp[sync_idx];
- av_qsv_add_stagee( &received_item, new_stage,HAVE_THREADS );
+ hb_qsv_add_stagee( &received_item, new_stage,HAVE_THREADS );
// add pending resources for the proper reclaim later
if( qsv_vpp->pending ){
- if( av_qsv_list_count(qsv_vpp->pending)>0 ){
+ if( hb_qsv_list_count(qsv_vpp->pending)>0 ){
new_stage->pending = qsv_vpp->pending;
}
qsv_vpp->pending = 0;
// making free via decrement for all pending
int i = 0;
- for (i = av_qsv_list_count(new_stage->pending); i > 0; i--){
- av_qsv_list *atom_list = av_qsv_list_item(new_stage->pending, i-1);
- av_qsv_stage *stage = av_qsv_get_last_stage( atom_list );
+ for (i = hb_qsv_list_count(new_stage->pending); i > 0; i--){
+ hb_qsv_list *atom_list = hb_qsv_list_item(new_stage->pending, i-1);
+ hb_qsv_stage *stage = hb_qsv_get_last_stage( atom_list );
mfxFrameSurface1 *work_surface = stage->out.p_surface;
if (work_surface)
ff_qsv_atomic_dec(&work_surface->Data.Locked);
@@ -606,13 +606,13 @@ static int hb_qsv_filter_work( hb_filter_object_t * filter,
return HB_FILTER_OK;
}
- av_qsv_context* qsv = pv->job->qsv.ctx;
+ hb_qsv_context* qsv = pv->job->qsv.ctx;
while(1)
{
int ret = filter_init(qsv,pv);
if(ret >= 2)
- av_qsv_sleep(1);
+ hb_qsv_sleep(1);
else
break;
}
@@ -647,15 +647,15 @@ static int hb_qsv_filter_work( hb_filter_object_t * filter,
{
if (out->qsv_details.qsv_atom)
{
- av_qsv_stage* stage;
+ hb_qsv_stage* stage;
mfxFrameSurface1 *work_surface;
int64_t duration;
- av_qsv_space *qsv_vpp;
+ hb_qsv_space *qsv_vpp;
- stage = av_qsv_get_last_stage(out->qsv_details.qsv_atom);
+ stage = hb_qsv_get_last_stage(out->qsv_details.qsv_atom);
work_surface = stage->out.p_surface;
- av_qsv_wait_on_sync( qsv,stage );
+ hb_qsv_wait_on_sync( qsv,stage );
qsv_vpp = pv->vpp_space;
duration =
diff --git a/libhb/qsv_filter.h b/libhb/qsv_filter.h
index 6c456edf1..a9552564d 100644
--- a/libhb/qsv_filter.h
+++ b/libhb/qsv_filter.h
@@ -29,6 +29,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef QSV_FILTER_H
#define QSV_FILTER_H
-void qsv_filter_close( av_qsv_context* qsv, AV_QSV_STAGE_TYPE vpp_type );
+void qsv_filter_close( hb_qsv_context* qsv, HB_QSV_STAGE_TYPE vpp_type );
#endif // QSV_FILTER_H
diff --git a/libhb/qsv_filter_pp.c b/libhb/qsv_filter_pp.c
index 207c92a79..a82b5f452 100644
--- a/libhb/qsv_filter_pp.c
+++ b/libhb/qsv_filter_pp.c
@@ -78,29 +78,29 @@ hb_filter_object_t hb_filter_qsv_post =
};
-static int filter_pre_init( av_qsv_context* qsv, hb_filter_private_t * pv ){
+static int filter_pre_init( hb_qsv_context* qsv, hb_filter_private_t * pv ){
mfxStatus sts = MFX_ERR_NONE;
int i=0;
if(!qsv) return 3;
- av_qsv_space *prev_vpp = 0;
+ hb_qsv_space *prev_vpp = 0;
if(!qsv->vpp_space){
- qsv->vpp_space = av_qsv_list_init(HAVE_THREADS);
+ qsv->vpp_space = hb_qsv_list_init(HAVE_THREADS);
// note some change as : when no size changes -> no VPP used
// impact on : prev_vpp
}
if(!pv->vpp_space){
- for(i=0; i<av_qsv_list_count(qsv->vpp_space);i++){
- av_qsv_space *qsv_vpp = av_qsv_list_item( qsv->vpp_space, i );
- if(qsv_vpp->type == AV_QSV_VPP_USER){
+ for(i=0; i<hb_qsv_list_count(qsv->vpp_space);i++){
+ hb_qsv_space *qsv_vpp = hb_qsv_list_item( qsv->vpp_space, i );
+ if(qsv_vpp->type == HB_QSV_VPP_USER){
pv->vpp_space = qsv_vpp;
break;
}
else
- if(qsv_vpp->type == AV_QSV_VPP_DEFAULT){
+ if(qsv_vpp->type == HB_QSV_VPP_DEFAULT){
prev_vpp = qsv_vpp;
}
@@ -108,19 +108,19 @@ static int filter_pre_init( av_qsv_context* qsv, hb_filter_private_t * pv ){
}
if(!pv->vpp_space){
- pv->vpp_space = calloc( 1, sizeof( av_qsv_space ));
- pv->vpp_space->type = AV_QSV_VPP_USER;
- av_qsv_list_add( qsv->vpp_space, pv->vpp_space );
- av_qsv_add_context_usage(qsv,HAVE_THREADS);
+ pv->vpp_space = calloc( 1, sizeof( hb_qsv_space ));
+ pv->vpp_space->type = HB_QSV_VPP_USER;
+ hb_qsv_list_add( qsv->vpp_space, pv->vpp_space );
+ hb_qsv_add_context_usage(qsv,HAVE_THREADS);
}
else
if(pv->vpp_space->is_init_done ) return 1;
if(!qsv->dec_space || !qsv->dec_space->is_init_done) return 2;
- av_qsv_space *qsv_vpp = pv->vpp_space;
+ hb_qsv_space *qsv_vpp = pv->vpp_space;
- AV_QSV_ZERO_MEMORY(qsv_vpp->m_mfxVideoParam);
+ HB_QSV_ZERO_MEMORY(qsv_vpp->m_mfxVideoParam);
if (prev_vpp)
@@ -129,7 +129,7 @@ static int filter_pre_init( av_qsv_context* qsv, hb_filter_private_t * pv ){
}
else
{
- AV_QSV_ZERO_MEMORY(qsv_vpp->m_mfxVideoParam);
+ HB_QSV_ZERO_MEMORY(qsv_vpp->m_mfxVideoParam);
// FrameRate is important for VPP to start with
if( qsv->dec_space->m_mfxVideoParam.mfx.FrameInfo.FrameRateExtN == 0 &&
@@ -149,9 +149,9 @@ static int filter_pre_init( av_qsv_context* qsv, hb_filter_private_t * pv ){
qsv_vpp->m_mfxVideoParam.vpp.In.FrameRateExtD = qsv->dec_space->m_mfxVideoParam.mfx.FrameInfo.FrameRateExtD;
qsv_vpp->m_mfxVideoParam.vpp.In.AspectRatioW = qsv->dec_space->m_mfxVideoParam.mfx.FrameInfo.AspectRatioW;
qsv_vpp->m_mfxVideoParam.vpp.In.AspectRatioH = qsv->dec_space->m_mfxVideoParam.mfx.FrameInfo.AspectRatioH;
- qsv_vpp->m_mfxVideoParam.vpp.In.Width = AV_QSV_ALIGN16(pv->job->title->geometry.width);
+ qsv_vpp->m_mfxVideoParam.vpp.In.Width = HB_QSV_ALIGN16(pv->job->title->geometry.width);
qsv_vpp->m_mfxVideoParam.vpp.In.Height = (MFX_PICSTRUCT_PROGRESSIVE == qsv_vpp->m_mfxVideoParam.vpp.In.PicStruct)?
- AV_QSV_ALIGN16(pv->job->title->geometry.height) : AV_QSV_ALIGN32(pv->job->title->geometry.height);
+ HB_QSV_ALIGN16(pv->job->title->geometry.height) : HB_QSV_ALIGN32(pv->job->title->geometry.height);
qsv_vpp->m_mfxVideoParam.vpp.Out.FourCC = qsv->dec_space->m_mfxVideoParam.mfx.FrameInfo.FourCC;
qsv_vpp->m_mfxVideoParam.vpp.Out.ChromaFormat = qsv->dec_space->m_mfxVideoParam.mfx.FrameInfo.ChromaFormat;
@@ -164,36 +164,36 @@ static int filter_pre_init( av_qsv_context* qsv, hb_filter_private_t * pv ){
qsv_vpp->m_mfxVideoParam.vpp.Out.FrameRateExtD = qsv->dec_space->m_mfxVideoParam.mfx.FrameInfo.FrameRateExtD;
qsv_vpp->m_mfxVideoParam.vpp.Out.AspectRatioW = qsv->dec_space->m_mfxVideoParam.mfx.FrameInfo.AspectRatioW;
qsv_vpp->m_mfxVideoParam.vpp.Out.AspectRatioH = qsv->dec_space->m_mfxVideoParam.mfx.FrameInfo.AspectRatioH;
- qsv_vpp->m_mfxVideoParam.vpp.Out.Width = AV_QSV_ALIGN16(pv->job->title->geometry.width);
+ qsv_vpp->m_mfxVideoParam.vpp.Out.Width = HB_QSV_ALIGN16(pv->job->title->geometry.width);
qsv_vpp->m_mfxVideoParam.vpp.Out.Height = (MFX_PICSTRUCT_PROGRESSIVE == qsv_vpp->m_mfxVideoParam.vpp.In.PicStruct)?
- AV_QSV_ALIGN16(pv->job->title->geometry.height) : AV_QSV_ALIGN32(pv->job->title->geometry.height);
+ HB_QSV_ALIGN16(pv->job->title->geometry.height) : HB_QSV_ALIGN32(pv->job->title->geometry.height);
memset(&qsv_vpp->request, 0, sizeof(mfxFrameAllocRequest)*2);
}
qsv_vpp->m_mfxVideoParam.IOPattern = MFX_IOPATTERN_IN_OPAQUE_MEMORY | MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
- qsv_vpp->surface_num = FFMIN(prev_vpp ? prev_vpp->surface_num : qsv->dec_space->surface_num/2, AV_QSV_SURFACE_NUM);
+ qsv_vpp->surface_num = FFMIN(prev_vpp ? prev_vpp->surface_num : qsv->dec_space->surface_num/2, HB_QSV_SURFACE_NUM);
for(i = 0; i < qsv_vpp->surface_num; i++){
qsv_vpp->p_surfaces[i] = av_mallocz( sizeof(mfxFrameSurface1) );
- AV_QSV_CHECK_POINTER(qsv_vpp->p_surfaces[i], MFX_ERR_MEMORY_ALLOC);
+ HB_QSV_CHECK_POINTER(qsv_vpp->p_surfaces[i], MFX_ERR_MEMORY_ALLOC);
memcpy(&(qsv_vpp->p_surfaces[i]->Info), &(qsv_vpp->m_mfxVideoParam.vpp.Out), sizeof(mfxFrameInfo));
}
- qsv_vpp->sync_num = FFMIN(prev_vpp ? prev_vpp->sync_num : qsv->dec_space->sync_num, AV_QSV_SYNC_NUM);
+ qsv_vpp->sync_num = FFMIN(prev_vpp ? prev_vpp->sync_num : qsv->dec_space->sync_num, HB_QSV_SYNC_NUM);
for (i = 0; i < qsv_vpp->sync_num; i++){
- qsv_vpp->p_syncp[i] = av_mallocz(sizeof(av_qsv_sync));
- AV_QSV_CHECK_POINTER(qsv_vpp->p_syncp[i], MFX_ERR_MEMORY_ALLOC);
+ qsv_vpp->p_syncp[i] = av_mallocz(sizeof(hb_qsv_sync));
+ HB_QSV_CHECK_POINTER(qsv_vpp->p_syncp[i], MFX_ERR_MEMORY_ALLOC);
qsv_vpp->p_syncp[i]->p_sync = av_mallocz(sizeof(mfxSyncPoint));
- AV_QSV_CHECK_POINTER(qsv_vpp->p_syncp[i]->p_sync, MFX_ERR_MEMORY_ALLOC);
+ HB_QSV_CHECK_POINTER(qsv_vpp->p_syncp[i]->p_sync, MFX_ERR_MEMORY_ALLOC);
}
memset(&qsv_vpp->ext_opaque_alloc, 0, sizeof(mfxExtOpaqueSurfaceAlloc));
qsv_vpp->m_mfxVideoParam.NumExtParam = qsv_vpp->p_ext_param_num = 1;
qsv_vpp->p_ext_params = av_mallocz(sizeof(mfxExtBuffer *)*qsv_vpp->p_ext_param_num);
- AV_QSV_CHECK_POINTER(qsv_vpp->p_ext_params, MFX_ERR_MEMORY_ALLOC);
+ HB_QSV_CHECK_POINTER(qsv_vpp->p_ext_params, MFX_ERR_MEMORY_ALLOC);
qsv_vpp->m_mfxVideoParam.ExtParam = qsv_vpp->p_ext_params;
@@ -231,7 +231,7 @@ static int filter_pre_init( av_qsv_context* qsv, hb_filter_private_t * pv ){
hb_list_add(pv->qsv_user,plugin);
sts=MFXVideoUSER_Register(qsv->mfx_session,0,&plugin->plug);
- AV_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
+ HB_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
plugin_init(plugin,&qsv_vpp->m_mfxVideoParam);
@@ -297,26 +297,26 @@ static int hb_qsv_filter_pre_init( hb_filter_object_t * filter,
SWS_LANCZOS|SWS_ACCURATE_RND, SWS_CS_DEFAULT);
return 0;
}
-int pre_process_frame(hb_buffer_t *in, av_qsv_context* qsv, hb_filter_private_t * pv ){
+int pre_process_frame(hb_buffer_t *in, hb_qsv_context* qsv, hb_filter_private_t * pv ){
// 1 if have results , 0 otherwise
int ret = 1;
- av_qsv_list* received_item = in->qsv_details.qsv_atom;
+ hb_qsv_list* received_item = in->qsv_details.qsv_atom;
mfxStatus sts = MFX_ERR_NONE;
mfxFrameSurface1 *work_surface = NULL;
- av_qsv_stage* stage = 0;
+ hb_qsv_stage* stage = 0;
- av_qsv_space *qsv_vpp = pv->vpp_space;
+ hb_qsv_space *qsv_vpp = pv->vpp_space;
if (received_item)
{
- stage = av_qsv_get_last_stage( received_item );
+ stage = hb_qsv_get_last_stage( received_item );
work_surface = stage->out.p_surface;
}
- int sync_idx = av_qsv_get_free_sync(qsv_vpp, qsv);
+ int sync_idx = hb_qsv_get_free_sync(qsv_vpp, qsv);
int surface_idx = -1;
for (;;)
@@ -329,7 +329,7 @@ int pre_process_frame(hb_buffer_t *in, av_qsv_context* qsv, hb_filter_private_t
}
if (sts == MFX_ERR_MORE_SURFACE || sts == MFX_ERR_NONE)
- surface_idx = av_qsv_get_free_surface(qsv_vpp, qsv, &(qsv_vpp->m_mfxVideoParam.vpp.Out), QSV_PART_ANY);
+ surface_idx = hb_qsv_get_free_surface(qsv_vpp, qsv, &(qsv_vpp->m_mfxVideoParam.vpp.Out), QSV_PART_ANY);
if (surface_idx == -1) {
hb_error("qsv: Not enough resources allocated for the preprocessing filter");
ret = 0;
@@ -342,11 +342,11 @@ int pre_process_frame(hb_buffer_t *in, av_qsv_context* qsv, hb_filter_private_t
{
if (!qsv_vpp->pending)
{
- qsv_vpp->pending = av_qsv_list_init(0);
+ qsv_vpp->pending = hb_qsv_list_init(0);
}
// if we have no results, we should not miss resource(s)
- av_qsv_list_add( qsv_vpp->pending, received_item);
+ hb_qsv_list_add( qsv_vpp->pending, received_item);
ff_qsv_atomic_dec(&qsv_vpp->p_syncp[sync_idx]->in_use);
@@ -362,7 +362,7 @@ int pre_process_frame(hb_buffer_t *in, av_qsv_context* qsv, hb_filter_private_t
ff_qsv_atomic_inc(&qsv_vpp->p_surfaces[surface_idx]->Data.Locked);
}
- AV_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
+ HB_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
if (MFX_ERR_NONE <= sts ) // repeat the call if warning and no output
{
@@ -395,26 +395,26 @@ int pre_process_frame(hb_buffer_t *in, av_qsv_context* qsv, hb_filter_private_t
// inserting for the future, will be locked until very ready
if(stage){
- av_qsv_stage* new_stage = av_qsv_stage_init();
+ hb_qsv_stage* new_stage = hb_qsv_stage_init();
- new_stage->type = AV_QSV_VPP_USER;
+ new_stage->type = HB_QSV_VPP_USER;
new_stage->in.p_surface = work_surface;
new_stage->out.p_surface = qsv_vpp->p_surfaces[surface_idx];
new_stage->out.sync = qsv_vpp->p_syncp[sync_idx];
- av_qsv_add_stagee( &received_item, new_stage,HAVE_THREADS );
+ hb_qsv_add_stagee( &received_item, new_stage,HAVE_THREADS );
// add pending resources for the proper reclaim later
if( qsv_vpp->pending ){
- if( av_qsv_list_count(qsv_vpp->pending)>0 ){
+ if( hb_qsv_list_count(qsv_vpp->pending)>0 ){
new_stage->pending = qsv_vpp->pending;
}
qsv_vpp->pending = 0;
// making free via decrement for all pending
int i = 0;
- for (i = av_qsv_list_count(new_stage->pending); i > 0; i--){
- av_qsv_list *atom_list = av_qsv_list_item(new_stage->pending, i-1);
- av_qsv_stage *stage = av_qsv_get_last_stage( atom_list );
+ for (i = hb_qsv_list_count(new_stage->pending); i > 0; i--){
+ hb_qsv_list *atom_list = hb_qsv_list_item(new_stage->pending, i-1);
+ hb_qsv_stage *stage = hb_qsv_get_last_stage( atom_list );
mfxFrameSurface1 *work_surface = stage->out.p_surface;
if (work_surface)
ff_qsv_atomic_dec(&work_surface->Data.Locked);
@@ -444,7 +444,7 @@ static int hb_qsv_filter_pre_work( hb_filter_object_t * filter,
hb_buffer_t * out = *buf_out;
int sts = 0;
- av_qsv_context* qsv = pv->job->qsv.ctx;
+ hb_qsv_context* qsv = pv->job->qsv.ctx;
if(!in->qsv_details.filter_details)
in->qsv_details.filter_details = pv;
@@ -459,7 +459,7 @@ static int hb_qsv_filter_pre_work( hb_filter_object_t * filter,
while(1){
int ret = filter_pre_init(qsv,pv);
if(ret >= 2)
- av_qsv_sleep(1);
+ hb_qsv_sleep(1);
else
break;
}
@@ -499,12 +499,12 @@ static void hb_qsv_filter_pre_close( hb_filter_object_t * filter ){
sws_freeContext(pv->sws_context_to_nv12);
sws_freeContext(pv->sws_context_from_nv12);
- av_qsv_context* qsv = pv->job->qsv.ctx;
- if(qsv && qsv->vpp_space && av_qsv_list_count(qsv->vpp_space) > 0 ){
+ hb_qsv_context* qsv = pv->job->qsv.ctx;
+ if(qsv && qsv->vpp_space && hb_qsv_list_count(qsv->vpp_space) > 0 ){
if(pv->qsv_user && qsv->mfx_session){
sts=MFXVideoUSER_Unregister(qsv->mfx_session,0);
- AV_QSV_CHECK_RET(sts, MFX_ERR_NONE, sts);
+ HB_QSV_CHECK_RET(sts, MFX_ERR_NONE, sts);
for(i=hb_list_count(pv->qsv_user);i>0;i--){
qsv_filter_t *plugin = hb_list_item(pv->qsv_user,i-1);
@@ -515,10 +515,10 @@ static void hb_qsv_filter_pre_close( hb_filter_object_t * filter ){
}
// closing local stuff
- qsv_filter_close(qsv,AV_QSV_VPP_USER);
+ qsv_filter_close(qsv,HB_QSV_VPP_USER);
// closing the commong stuff
- av_qsv_context_clean(qsv);
+ hb_qsv_context_clean(qsv);
}
hb_cond_close(&pv->pre.frame_completed);
hb_lock_close(&pv->pre.frame_completed_lock);
@@ -576,7 +576,7 @@ static int hb_qsv_filter_post_work( hb_filter_object_t * filter,
return HB_FILTER_DONE;
}
- av_qsv_context* qsv = pv->job->qsv.ctx;
+ hb_qsv_context* qsv = pv->job->qsv.ctx;
pv = in->qsv_details.filter_details;
if (!pv)
@@ -589,7 +589,7 @@ static int hb_qsv_filter_post_work( hb_filter_object_t * filter,
while(1){
int ret = filter_pre_init(qsv,pv);
if(ret >= 2)
- av_qsv_sleep(1);
+ hb_qsv_sleep(1);
else
break;
}
@@ -680,10 +680,10 @@ mfxStatus MFX_CDECL qsv_Submit(mfxHDL pthis, const mfxHDL *in, mfxU32 in_num, co
mfxFrameSurface1 *real_surface_out = surface_out;
sts = plugin->core->GetRealSurface(plugin->core->pthis, surface_in, &real_surface_in);
- AV_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, MFX_ERR_MEMORY_ALLOC);
+ HB_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, MFX_ERR_MEMORY_ALLOC);
sts = plugin->core->GetRealSurface(plugin->core->pthis, surface_out, &real_surface_out);
- AV_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, MFX_ERR_MEMORY_ALLOC);
+ HB_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, MFX_ERR_MEMORY_ALLOC);
int task_idx = get_free_task(plugin->tasks);
@@ -715,7 +715,7 @@ mfxStatus MFX_CDECL qsv_Execute(mfxHDL pthis, mfxThreadTask task, mfxU32 uid_p,
qsv_filter_task_t *current_task = (qsv_filter_task_t *)task;
sts = (current_task->processor.process)(current_task,0);
- AV_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
+ HB_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
sts = MFX_TASK_DONE;
return sts;
@@ -755,12 +755,12 @@ mfxStatus plugin_init(qsv_filter_t* plugin, mfxVideoParam *param){
sts = plugin->core->MapOpaqueSurface(plugin->core->pthis, plugin_opaque_alloc->In.NumSurface,
plugin_opaque_alloc->In.Type, plugin_opaque_alloc->In.Surfaces);
- AV_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
+ HB_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
sts = plugin->core->MapOpaqueSurface(plugin->core->pthis, plugin_opaque_alloc->Out.NumSurface,
plugin_opaque_alloc->Out.Type, plugin_opaque_alloc->Out.Surfaces);
- AV_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
+ HB_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
plugin->tasks = hb_list_init();
@@ -793,12 +793,12 @@ mfxStatus plugin_close(qsv_filter_t* plugin){
sts = plugin->core->UnmapOpaqueSurface(plugin->core->pthis, plugin_opaque_alloc->In.NumSurface,
plugin_opaque_alloc->In.Type, plugin_opaque_alloc->In.Surfaces);
- AV_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
+ HB_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
sts = plugin->core->UnmapOpaqueSurface(plugin->core->pthis, plugin_opaque_alloc->Out.NumSurface,
plugin_opaque_alloc->Out.Type, plugin_opaque_alloc->Out.Surfaces);
- AV_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
+ HB_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
if(plugin->tasks){
for(i=hb_list_count(plugin->tasks);i>0;i--){
diff --git a/libhb/qsv_filter_pp.h b/libhb/qsv_filter_pp.h
index 99835b8a6..df5d7d554 100644
--- a/libhb/qsv_filter_pp.h
+++ b/libhb/qsv_filter_pp.h
@@ -82,7 +82,7 @@ typedef struct hb_filter_private_s
hb_qsv_sync_t post;
hb_qsv_sync_t post_busy;
- av_qsv_space *vpp_space;
+ hb_qsv_space *vpp_space;
hb_list_t *qsv_user;
struct SwsContext* sws_context_to_nv12;
diff --git a/libhb/qsv_libav.c b/libhb/qsv_libav.c
index f439c0ffe..b24e9f74c 100644
--- a/libhb/qsv_libav.c
+++ b/libhb/qsv_libav.c
@@ -31,13 +31,13 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "hbffmpeg.h"
#include "qsv_libav.h"
-int av_qsv_get_free_encode_task(av_qsv_list * tasks)
+int hb_qsv_get_free_encode_task(hb_qsv_list * tasks)
{
int ret = MFX_ERR_NOT_FOUND;
int i = 0;
if (tasks)
- for (i = 0; i < av_qsv_list_count(tasks); i++) {
- av_qsv_task *task = av_qsv_list_item(tasks, i);
+ for (i = 0; i < hb_qsv_list_count(tasks); i++) {
+ hb_qsv_task *task = hb_qsv_list_item(tasks, i);
if (task->stage && task->stage->out.sync)
if (!(*task->stage->out.sync->p_sync)) {
ret = i;
@@ -47,7 +47,7 @@ int av_qsv_get_free_encode_task(av_qsv_list * tasks)
return ret;
}
-int av_qsv_get_free_sync(av_qsv_space * space, av_qsv_context * qsv)
+int hb_qsv_get_free_sync(hb_qsv_space * space, hb_qsv_context * qsv)
{
int ret = -1;
int counter = 0;
@@ -62,17 +62,17 @@ int av_qsv_get_free_sync(av_qsv_space * space, av_qsv_context * qsv)
return i;
}
}
- if (++counter >= AV_QSV_REPEAT_NUM_DEFAULT) {
+ if (++counter >= HB_QSV_REPEAT_NUM_DEFAULT) {
hb_error("QSV: not enough to have %d sync point(s) allocated", space->sync_num);
break;
}
- av_qsv_sleep(5);
+ hb_qsv_sleep(5);
}
return ret;
}
-int av_qsv_get_free_surface(av_qsv_space * space, av_qsv_context * qsv,
- mfxFrameInfo * info, av_qsv_split part)
+int hb_qsv_get_free_surface(hb_qsv_space * space, hb_qsv_context * qsv,
+ mfxFrameInfo * info, hb_qsv_split part)
{
int ret = -1;
int from = 0;
@@ -96,31 +96,31 @@ int av_qsv_get_free_surface(av_qsv_space * space, av_qsv_context * qsv,
return i;
}
}
- if (++counter >= AV_QSV_REPEAT_NUM_DEFAULT) {
+ if (++counter >= HB_QSV_REPEAT_NUM_DEFAULT) {
hb_error("QSV: not enough to have %d surface(s) allocated", up);
break;
}
- av_qsv_sleep(5);
+ hb_qsv_sleep(5);
}
return ret;
}
-int ff_qsv_is_surface_in_pipe(mfxFrameSurface1 * p_surface, av_qsv_context * qsv)
+int ff_qsv_is_surface_in_pipe(mfxFrameSurface1 * p_surface, hb_qsv_context * qsv)
{
int ret = 0;
int a, b;
- av_qsv_list *list = 0;
- av_qsv_stage *stage = 0;
+ hb_qsv_list *list = 0;
+ hb_qsv_stage *stage = 0;
if (!p_surface)
return ret;
if (!qsv->pipes)
return ret;
- for (a = 0; a < av_qsv_list_count(qsv->pipes); a++) {
- list = av_qsv_list_item(qsv->pipes, a);
- for (b = 0; b < av_qsv_list_count(list); b++) {
- stage = av_qsv_list_item(list, b);
+ for (a = 0; a < hb_qsv_list_count(qsv->pipes); a++) {
+ list = hb_qsv_list_item(qsv->pipes, a);
+ for (b = 0; b < hb_qsv_list_count(list); b++) {
+ stage = hb_qsv_list_item(list, b);
if (p_surface == stage->out.p_surface)
return (stage->type << 16) | 2;
if (p_surface == stage->in.p_surface)
@@ -130,22 +130,22 @@ int ff_qsv_is_surface_in_pipe(mfxFrameSurface1 * p_surface, av_qsv_context * qsv
return ret;
}
-int ff_qsv_is_sync_in_pipe(mfxSyncPoint * sync, av_qsv_context * qsv)
+int ff_qsv_is_sync_in_pipe(mfxSyncPoint * sync, hb_qsv_context * qsv)
{
int ret = 0;
int a, b;
- av_qsv_list *list = 0;
- av_qsv_stage *stage = 0;
+ hb_qsv_list *list = 0;
+ hb_qsv_stage *stage = 0;
if (!sync)
return ret;
if (!qsv->pipes)
return ret;
- for (a = 0; a < av_qsv_list_count(qsv->pipes); a++) {
- list = av_qsv_list_item(qsv->pipes, a);
- for (b = 0; b < av_qsv_list_count(list); b++) {
- stage = av_qsv_list_item(list, b);
+ for (a = 0; a < hb_qsv_list_count(qsv->pipes); a++) {
+ list = hb_qsv_list_item(qsv->pipes, a);
+ for (b = 0; b < hb_qsv_list_count(list); b++) {
+ stage = hb_qsv_list_item(list, b);
if (sync == stage->out.sync->p_sync) {
return 1;
}
@@ -154,13 +154,13 @@ int ff_qsv_is_sync_in_pipe(mfxSyncPoint * sync, av_qsv_context * qsv)
return ret;
}
-av_qsv_stage *av_qsv_stage_init(void)
+hb_qsv_stage *hb_qsv_stage_init(void)
{
- av_qsv_stage *stage = av_mallocz(sizeof(av_qsv_stage));
+ hb_qsv_stage *stage = av_mallocz(sizeof(hb_qsv_stage));
return stage;
}
-void av_qsv_stage_clean(av_qsv_stage ** stage)
+void hb_qsv_stage_clean(hb_qsv_stage ** stage)
{
if ((*stage)->out.sync) {
if ((*stage)->out.sync->p_sync)
@@ -180,7 +180,7 @@ void av_qsv_stage_clean(av_qsv_stage ** stage)
av_freep(stage);
}
-void av_qsv_add_context_usage(av_qsv_context * qsv, int is_threaded)
+void hb_qsv_add_context_usage(hb_qsv_context * qsv, int is_threaded)
{
int is_active = 0;
int mut_ret = 0;
@@ -188,9 +188,9 @@ void av_qsv_add_context_usage(av_qsv_context * qsv, int is_threaded)
is_active = ff_qsv_atomic_inc(&qsv->is_context_active);
if (is_active == 1) {
memset(&qsv->mfx_session, 0, sizeof(mfxSession));
- av_qsv_pipe_list_create(&qsv->pipes, is_threaded);
+ hb_qsv_pipe_list_create(&qsv->pipes, is_threaded);
- qsv->dts_seq = av_qsv_list_init(is_threaded);
+ qsv->dts_seq = hb_qsv_list_init(is_threaded);
if (is_threaded) {
qsv->qts_seq_mutex = av_mallocz(sizeof(pthread_mutex_t));
@@ -205,7 +205,7 @@ void av_qsv_add_context_usage(av_qsv_context * qsv, int is_threaded)
}
}
-int av_qsv_context_clean(av_qsv_context * qsv)
+int hb_qsv_context_clean(hb_qsv_context * qsv)
{
int is_active = 0;
mfxStatus sts = MFX_ERR_NONE;
@@ -218,10 +218,10 @@ int av_qsv_context_clean(av_qsv_context * qsv)
if (is_active == 0) {
if (qsv->dts_seq) {
- while (av_qsv_list_count(qsv->dts_seq))
- av_qsv_dts_pop(qsv);
+ while (hb_qsv_list_count(qsv->dts_seq))
+ hb_qsv_dts_pop(qsv);
- av_qsv_list_close(&qsv->dts_seq);
+ hb_qsv_list_close(&qsv->dts_seq);
}
if (qsv->qts_seq_mutex) {
mut_ret = pthread_mutex_destroy(qsv->qts_seq_mutex);
@@ -231,101 +231,101 @@ int av_qsv_context_clean(av_qsv_context * qsv)
}
if (qsv->pipes)
- av_qsv_pipe_list_clean(&qsv->pipes);
+ hb_qsv_pipe_list_clean(&qsv->pipes);
if (qsv->mfx_session) {
sts = MFXClose(qsv->mfx_session);
- AV_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
+ HB_QSV_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
qsv->mfx_session = 0;
}
}
return 0;
}
-void av_qsv_pipe_list_create(av_qsv_list ** list, int is_threaded)
+void hb_qsv_pipe_list_create(hb_qsv_list ** list, int is_threaded)
{
if (!*list)
- *list = av_qsv_list_init(is_threaded);
+ *list = hb_qsv_list_init(is_threaded);
}
-void av_qsv_pipe_list_clean(av_qsv_list ** list)
+void hb_qsv_pipe_list_clean(hb_qsv_list ** list)
{
- av_qsv_list *stage;
+ hb_qsv_list *stage;
int i = 0;
if (*list) {
- for (i = av_qsv_list_count(*list); i > 0; i--) {
- stage = av_qsv_list_item(*list, i - 1);
- av_qsv_flush_stages(*list, &stage);
+ for (i = hb_qsv_list_count(*list); i > 0; i--) {
+ stage = hb_qsv_list_item(*list, i - 1);
+ hb_qsv_flush_stages(*list, &stage);
}
- av_qsv_list_close(list);
+ hb_qsv_list_close(list);
}
}
-void av_qsv_add_stagee(av_qsv_list ** list, av_qsv_stage * stage, int is_threaded)
+void hb_qsv_add_stagee(hb_qsv_list ** list, hb_qsv_stage * stage, int is_threaded)
{
if (!*list)
- *list = av_qsv_list_init(is_threaded);
- av_qsv_list_add(*list, stage);
+ *list = hb_qsv_list_init(is_threaded);
+ hb_qsv_list_add(*list, stage);
}
-av_qsv_stage *av_qsv_get_last_stage(av_qsv_list * list)
+hb_qsv_stage *hb_qsv_get_last_stage(hb_qsv_list * list)
{
- av_qsv_stage *stage = 0;
+ hb_qsv_stage *stage = 0;
int size = 0;
- av_qsv_list_lock(list);
- size = av_qsv_list_count(list);
+ hb_qsv_list_lock(list);
+ size = hb_qsv_list_count(list);
if (size > 0)
- stage = av_qsv_list_item(list, size - 1);
- av_qsv_list_unlock(list);
+ stage = hb_qsv_list_item(list, size - 1);
+ hb_qsv_list_unlock(list);
return stage;
}
-void av_qsv_flush_stages(av_qsv_list * list, av_qsv_list ** item)
+void hb_qsv_flush_stages(hb_qsv_list * list, hb_qsv_list ** item)
{
int i = 0;
int x = 0;
- av_qsv_stage *stage = 0;
- av_qsv_list *to_remove_list = 0;
- av_qsv_list *to_remove_atom_list = 0;
- av_qsv_list *to_remove_atom = 0;
+ hb_qsv_stage *stage = 0;
+ hb_qsv_list *to_remove_list = 0;
+ hb_qsv_list *to_remove_atom_list = 0;
+ hb_qsv_list *to_remove_atom = 0;
- for (i = 0; i < av_qsv_list_count(*item); i++) {
- stage = av_qsv_list_item(*item, i);
+ for (i = 0; i < hb_qsv_list_count(*item); i++) {
+ stage = hb_qsv_list_item(*item, i);
if(stage->pending){
if(!to_remove_list)
- to_remove_list = av_qsv_list_init(0);
- av_qsv_list_add(to_remove_list, stage->pending);
+ to_remove_list = hb_qsv_list_init(0);
+ hb_qsv_list_add(to_remove_list, stage->pending);
}
- av_qsv_stage_clean(&stage);
+ hb_qsv_stage_clean(&stage);
// should actually remove from the list but ok...
}
- av_qsv_list_rem(list, *item);
- av_qsv_list_close(item);
+ hb_qsv_list_rem(list, *item);
+ hb_qsv_list_close(item);
if(to_remove_list){
- for (i = av_qsv_list_count(to_remove_list); i > 0; i--){
- to_remove_atom_list = av_qsv_list_item(to_remove_list, i-1);
- for (x = av_qsv_list_count(to_remove_atom_list); x > 0; x--){
- to_remove_atom = av_qsv_list_item(to_remove_atom_list, x-1);
- av_qsv_flush_stages(list,&to_remove_atom);
+ for (i = hb_qsv_list_count(to_remove_list); i > 0; i--){
+ to_remove_atom_list = hb_qsv_list_item(to_remove_list, i-1);
+ for (x = hb_qsv_list_count(to_remove_atom_list); x > 0; x--){
+ to_remove_atom = hb_qsv_list_item(to_remove_atom_list, x-1);
+ hb_qsv_flush_stages(list,&to_remove_atom);
}
}
- av_qsv_list_close(&to_remove_list);
+ hb_qsv_list_close(&to_remove_list);
}
}
-av_qsv_list *av_qsv_pipe_by_stage(av_qsv_list * list, av_qsv_stage * stage)
+hb_qsv_list *hb_qsv_pipe_by_stage(hb_qsv_list * list, hb_qsv_stage * stage)
{
- av_qsv_list *item = 0;
- av_qsv_stage *cur_stage = 0;
+ hb_qsv_list *item = 0;
+ hb_qsv_stage *cur_stage = 0;
int i = 0;
int a = 0;
- for (i = 0; i < av_qsv_list_count(list); i++) {
- item = av_qsv_list_item(list, i);
- for (a = 0; a < av_qsv_list_count(item); a++) {
- cur_stage = av_qsv_list_item(item, a);
+ for (i = 0; i < hb_qsv_list_count(list); i++) {
+ item = hb_qsv_list_item(list, i);
+ for (a = 0; a < hb_qsv_list_count(item); a++) {
+ cur_stage = hb_qsv_list_item(item, a);
if (cur_stage == stage)
return item;
}
@@ -334,11 +334,11 @@ av_qsv_list *av_qsv_pipe_by_stage(av_qsv_list * list, av_qsv_stage * stage)
}
// no duplicate of the same value, if end == 0 : working over full length
-void av_qsv_dts_ordered_insert(av_qsv_context * qsv, int start, int end,
+void hb_qsv_dts_ordered_insert(hb_qsv_context * qsv, int start, int end,
int64_t dts, int iter)
{
- av_qsv_dts *cur_dts = 0;
- av_qsv_dts *new_dts = 0;
+ hb_qsv_dts *cur_dts = 0;
+ hb_qsv_dts *new_dts = 0;
int i = 0;
int mut_ret = 0;
@@ -350,22 +350,22 @@ void av_qsv_dts_ordered_insert(av_qsv_context * qsv, int start, int end,
}
if (end == 0)
- end = av_qsv_list_count(qsv->dts_seq);
+ end = hb_qsv_list_count(qsv->dts_seq);
if (end <= start) {
- new_dts = av_mallocz(sizeof(av_qsv_dts));
+ new_dts = av_mallocz(sizeof(hb_qsv_dts));
if( new_dts ) {
new_dts->dts = dts;
- av_qsv_list_add(qsv->dts_seq, new_dts);
+ hb_qsv_list_add(qsv->dts_seq, new_dts);
}
} else
for (i = end; i > start; i--) {
- cur_dts = av_qsv_list_item(qsv->dts_seq, i - 1);
+ cur_dts = hb_qsv_list_item(qsv->dts_seq, i - 1);
if (cur_dts->dts < dts) {
- new_dts = av_mallocz(sizeof(av_qsv_dts));
+ new_dts = av_mallocz(sizeof(hb_qsv_dts));
if( new_dts ) {
new_dts->dts = dts;
- av_qsv_list_insert(qsv->dts_seq, i, new_dts);
+ hb_qsv_list_insert(qsv->dts_seq, i, new_dts);
}
break;
} else if (cur_dts->dts == dts)
@@ -378,9 +378,9 @@ void av_qsv_dts_ordered_insert(av_qsv_context * qsv, int start, int end,
}
}
-void av_qsv_dts_pop(av_qsv_context * qsv)
+void hb_qsv_dts_pop(hb_qsv_context * qsv)
{
- av_qsv_dts *item = 0;
+ hb_qsv_dts *item = 0;
int mut_ret = 0;
if (qsv && qsv->qts_seq_mutex){
@@ -389,9 +389,9 @@ void av_qsv_dts_pop(av_qsv_context * qsv)
hb_log("QSV: pthread_mutex_lock issue[%d] at %s", mut_ret, __FUNCTION__);
}
- 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);
+ if (hb_qsv_list_count(qsv->dts_seq)) {
+ item = hb_qsv_list_item(qsv->dts_seq, 0);
+ hb_qsv_list_rem(qsv->dts_seq, item);
av_free(item);
}
if (qsv && qsv->qts_seq_mutex){
@@ -402,18 +402,18 @@ void av_qsv_dts_pop(av_qsv_context * qsv)
}
-av_qsv_list *av_qsv_list_init(int is_threaded)
+hb_qsv_list *hb_qsv_list_init(int is_threaded)
{
- av_qsv_list *l;
+ hb_qsv_list *l;
int mut_ret;
- l = av_mallocz(sizeof(av_qsv_list));
+ l = av_mallocz(sizeof(hb_qsv_list));
if (!l)
return 0;
- l->items = av_mallocz(AV_QSV_JOB_SIZE_DEFAULT * sizeof(void *));
+ l->items = av_mallocz(HB_QSV_JOB_SIZE_DEFAULT * sizeof(void *));
if (!l->items)
return 0;
- l->items_alloc = AV_QSV_JOB_SIZE_DEFAULT;
+ l->items_alloc = HB_QSV_JOB_SIZE_DEFAULT;
if (is_threaded) {
l->mutex = av_mallocz(sizeof(pthread_mutex_t));
@@ -433,17 +433,17 @@ av_qsv_list *av_qsv_list_init(int is_threaded)
return l;
}
-int av_qsv_list_count(av_qsv_list * l)
+int hb_qsv_list_count(hb_qsv_list * l)
{
int count;
- av_qsv_list_lock(l);
+ hb_qsv_list_lock(l);
count = l->items_count;
- av_qsv_list_unlock(l);
+ hb_qsv_list_unlock(l);
return count;
}
-int av_qsv_list_add(av_qsv_list * l, void *p)
+int hb_qsv_list_add(hb_qsv_list * l, void *p)
{
int pos = -1;
@@ -451,11 +451,11 @@ int av_qsv_list_add(av_qsv_list * l, void *p)
return pos;
}
- av_qsv_list_lock(l);
+ hb_qsv_list_lock(l);
if (l->items_count == l->items_alloc) {
/* We need a bigger boat */
- l->items_alloc += AV_QSV_JOB_SIZE_DEFAULT;
+ l->items_alloc += HB_QSV_JOB_SIZE_DEFAULT;
l->items = av_realloc(l->items, l->items_alloc * sizeof(void *));
}
@@ -463,16 +463,16 @@ int av_qsv_list_add(av_qsv_list * l, void *p)
pos = (l->items_count);
l->items_count++;
- av_qsv_list_unlock(l);
+ hb_qsv_list_unlock(l);
return pos;
}
-void av_qsv_list_rem(av_qsv_list * l, void *p)
+void hb_qsv_list_rem(hb_qsv_list * l, void *p)
{
int i;
- av_qsv_list_lock(l);
+ hb_qsv_list_lock(l);
/* Find the item in the list */
for (i = 0; i < l->items_count; i++) {
@@ -486,33 +486,33 @@ void av_qsv_list_rem(av_qsv_list * l, void *p)
}
}
- av_qsv_list_unlock(l);
+ hb_qsv_list_unlock(l);
}
-void *av_qsv_list_item(av_qsv_list * l, int i)
+void *hb_qsv_list_item(hb_qsv_list * l, int i)
{
void *ret = NULL;
if (i < 0)
return NULL;
- av_qsv_list_lock(l);
+ hb_qsv_list_lock(l);
if( i < l->items_count)
ret = l->items[i];
- av_qsv_list_unlock(l);
+ hb_qsv_list_unlock(l);
return ret;
}
-void av_qsv_list_insert(av_qsv_list * l, int pos, void *p)
+void hb_qsv_list_insert(hb_qsv_list * l, int pos, void *p)
{
if (!p)
return;
- av_qsv_list_lock(l);
+ hb_qsv_list_lock(l);
if (l->items_count == l->items_alloc) {
- l->items_alloc += AV_QSV_JOB_SIZE_DEFAULT;
+ l->items_alloc += HB_QSV_JOB_SIZE_DEFAULT;
l->items = av_realloc(l->items, l->items_alloc * sizeof(void *));
}
@@ -524,15 +524,15 @@ void av_qsv_list_insert(av_qsv_list * l, int pos, void *p)
l->items[pos] = p;
l->items_count--;
- av_qsv_list_unlock(l);
+ hb_qsv_list_unlock(l);
}
-void av_qsv_list_close(av_qsv_list ** _l)
+void hb_qsv_list_close(hb_qsv_list ** _l)
{
- av_qsv_list *l = *_l;
+ hb_qsv_list *l = *_l;
int mut_ret;
- av_qsv_list_lock(l);
+ hb_qsv_list_lock(l);
av_free(l->items);
@@ -550,7 +550,7 @@ void av_qsv_list_close(av_qsv_list ** _l)
av_freep(_l);
}
-int av_qsv_list_lock(av_qsv_list *l){
+int hb_qsv_list_lock(hb_qsv_list *l){
int ret = 0;
if (l->mutex){
ret = pthread_mutex_lock(l->mutex);
@@ -560,7 +560,7 @@ int av_qsv_list_lock(av_qsv_list *l){
return ret;
}
-int av_qsv_list_unlock(av_qsv_list *l){
+int hb_qsv_list_unlock(hb_qsv_list *l){
int ret = 0;
if (l->mutex){
ret = pthread_mutex_unlock(l->mutex);
@@ -582,7 +582,7 @@ int av_is_qsv_available(mfxIMPL impl, mfxVersion * ver)
return sts;
}
-void av_qsv_wait_on_sync(av_qsv_context *qsv, av_qsv_stage *stage)
+void hb_qsv_wait_on_sync(hb_qsv_context *qsv, hb_qsv_stage *stage)
{
int iter = 0;
mfxStatus sts = MFX_ERR_NONE;
@@ -590,16 +590,16 @@ void av_qsv_wait_on_sync(av_qsv_context *qsv, av_qsv_stage *stage)
if(*stage->out.sync->p_sync){
while(1){
iter++;
- sts = MFXVideoCORE_SyncOperation(qsv->mfx_session,*stage->out.sync->p_sync, AV_QSV_SYNC_TIME_DEFAULT);
+ sts = MFXVideoCORE_SyncOperation(qsv->mfx_session,*stage->out.sync->p_sync, HB_QSV_SYNC_TIME_DEFAULT);
if(MFX_WRN_IN_EXECUTION == sts){
if(iter>20)
- AV_QSV_DEBUG_ASSERT(1, "Sync failed");
+ HB_QSV_DEBUG_ASSERT(1, "Sync failed");
- av_qsv_sleep(10);
+ hb_qsv_sleep(10);
continue;
}
- AV_QSV_CHECK_RET(sts, MFX_ERR_NONE, sts);
+ HB_QSV_CHECK_RET(sts, MFX_ERR_NONE, sts);
break;
}
}
diff --git a/libhb/qsv_libav.h b/libhb/qsv_libav.h
index 779571022..38f89e410 100644
--- a/libhb/qsv_libav.h
+++ b/libhb/qsv_libav.h
@@ -69,7 +69,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* - details:
* "per slice" support: AV_PIX_FMT_QSV with AVHWAccel based implementation
*
- * Note av_qsv_config struct required to fill in via
+ * Note hb_qsv_config struct required to fill in via
* AVCodecContext.hwaccel_context
*
* As per frame, note AVFrame.data[2] (qsv_atom) used for frame atom id,
@@ -86,19 +86,19 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Target OS: as per available dispatcher and driver support
*
* Implementation details:
- * Provided struct av_qsv_context contain several struct av_qsv_space(s) for decode,
+ * Provided struct hb_qsv_context contain several struct hb_qsv_space(s) for decode,
* VPP and encode.
- * av_qsv_space just contain needed environment for the appropriate action.
+ * hb_qsv_space just contain needed environment for the appropriate action.
* Based on this - pipeline (see pipes) will be build to pass details such as
* mfxFrameSurface1* and mfxSyncPoint* from one action to the next.
*
- * Resources re-usage (av_qsv_flush_stages):
- * av_qsv_context *qsv = (av_qsv_context *)video_codec_ctx->priv_data;
- * av_qsv_list *pipe = (av_qsv_list *)video_frame->data[2];
- * av_qsv_flush_stages( qsv->pipes, &pipe );
+ * Resources re-usage (hb_qsv_flush_stages):
+ * hb_qsv_context *qsv = (hb_qsv_context *)video_codec_ctx->priv_data;
+ * hb_qsv_list *pipe = (hb_qsv_list *)video_frame->data[2];
+ * hb_qsv_flush_stages( qsv->pipes, &pipe );
*
* DTS re-usage:
- * av_qsv_dts_pop(qsv);
+ * hb_qsv_dts_pop(qsv);
*
* for video,DX9/11 memory it has to be Unlock'ed as well
*
@@ -108,8 +108,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* For the details of MediaSDK usage and options available - please refer to the
* available documentation at MediaSDK.
*
- * Feature set used from MSDK is defined by AV_QSV_MSDK_VERSION_MAJOR and
- * AV_QSV_MSDK_VERSION_MINOR
+ * Feature set used from MSDK is defined by HB_QSV_MSDK_VERSION_MAJOR and
+ * HB_QSV_MSDK_VERSION_MINOR
*
* @{
*/
@@ -137,58 +137,58 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// sleep is defined in milliseconds
-#define av_qsv_sleep(x) av_usleep((x)*1000)
+#define hb_qsv_sleep(x) av_usleep((x)*1000)
-#define AV_QSV_ZERO_MEMORY(VAR) {memset(&VAR, 0, sizeof(VAR));}
-#define AV_QSV_ALIGN32(X) (((mfxU32)((X)+31)) & (~ (mfxU32)31))
-#define AV_QSV_ALIGN16(value) (((value + 15) >> 4) << 4)
-#ifndef AV_QSV_PRINT_RET_MSG
-#define AV_QSV_PRINT_RET_MSG(ERR) { fprintf(stderr, "Error code %d,\t%s\t%d\n", ERR, __FUNCTION__, __LINE__); }
+#define HB_QSV_ZERO_MEMORY(VAR) {memset(&VAR, 0, sizeof(VAR));}
+#define HB_QSV_ALIGN32(X) (((mfxU32)((X)+31)) & (~ (mfxU32)31))
+#define HB_QSV_ALIGN16(value) (((value + 15) >> 4) << 4)
+#ifndef HB_QSV_PRINT_RET_MSG
+#define HB_QSV_PRINT_RET_MSG(ERR) { fprintf(stderr, "Error code %d,\t%s\t%d\n", ERR, __FUNCTION__, __LINE__); }
#endif
-#ifndef AV_QSV_DEBUG_ASSERT
-#define AV_QSV_DEBUG_ASSERT(x,y) { if ((x)) { fprintf(stderr, "\nASSERT: %s\n", y); } }
+#ifndef HB_QSV_DEBUG_ASSERT
+#define HB_QSV_DEBUG_ASSERT(x,y) { if ((x)) { fprintf(stderr, "\nASSERT: %s\n", y); } }
#endif
-#define AV_QSV_CHECK_RET(P, X, ERR) {if ((X) > (P)) {AV_QSV_PRINT_RET_MSG(ERR); return;}}
-#define AV_QSV_CHECK_RESULT(P, X, ERR) {if ((X) > (P)) {AV_QSV_PRINT_RET_MSG(ERR); return ERR;}}
-#define AV_QSV_CHECK_POINTER(P, ERR) {if (!(P)) {AV_QSV_PRINT_RET_MSG(ERR); return ERR;}}
-#define AV_QSV_IGNORE_MFX_STS(P, X) {if ((X) == (P)) {P = MFX_ERR_NONE;}}
+#define HB_QSV_CHECK_RET(P, X, ERR) {if ((X) > (P)) {HB_QSV_PRINT_RET_MSG(ERR); return;}}
+#define HB_QSV_CHECK_RESULT(P, X, ERR) {if ((X) > (P)) {HB_QSV_PRINT_RET_MSG(ERR); return ERR;}}
+#define HB_QSV_CHECK_POINTER(P, ERR) {if (!(P)) {HB_QSV_PRINT_RET_MSG(ERR); return ERR;}}
+#define HB_QSV_IGNORE_MFX_STS(P, X) {if ((X) == (P)) {P = MFX_ERR_NONE;}}
-#define AV_QSV_ID_BUFFER MFX_MAKEFOURCC('B','U','F','F')
-#define AV_QSV_ID_FRAME MFX_MAKEFOURCC('F','R','M','E')
+#define HB_QSV_ID_BUFFER MFX_MAKEFOURCC('B','U','F','F')
+#define HB_QSV_ID_FRAME MFX_MAKEFOURCC('F','R','M','E')
-#define AV_QSV_SURFACE_NUM 80
-#define AV_QSV_SYNC_NUM AV_QSV_SURFACE_NUM*3/4
-#define AV_QSV_BUF_SIZE_DEFAULT 4096*2160*10
-#define AV_QSV_JOB_SIZE_DEFAULT 10
-#define AV_QSV_SYNC_TIME_DEFAULT 10000
-// see av_qsv_get_free_sync, av_qsv_get_free_surface , 100 if usleep(10*1000)(10ms) == 1 sec
-#define AV_QSV_REPEAT_NUM_DEFAULT 100
-#define AV_QSV_ASYNC_DEPTH_DEFAULT 4
+#define HB_QSV_SURFACE_NUM 80
+#define HB_QSV_SYNC_NUM HB_QSV_SURFACE_NUM*3/4
+#define HB_QSV_BUF_SIZE_DEFAULT 4096*2160*10
+#define HB_QSV_JOB_SIZE_DEFAULT 10
+#define HB_QSV_SYNC_TIME_DEFAULT 10000
+// see hb_qsv_get_free_sync, hb_qsv_get_free_surface , 100 if usleep(10*1000)(10ms) == 1 sec
+#define HB_QSV_REPEAT_NUM_DEFAULT 100
+#define HB_QSV_ASYNC_DEPTH_DEFAULT 4
// version of MSDK/QSV API currently used
-#define AV_QSV_MSDK_VERSION_MAJOR 1
-#define AV_QSV_MSDK_VERSION_MINOR 3
+#define HB_QSV_MSDK_VERSION_MAJOR 1
+#define HB_QSV_MSDK_VERSION_MINOR 3
-typedef enum AV_QSV_STAGE_TYPE {
+typedef enum HB_QSV_STAGE_TYPE {
-#define AV_QSV_DECODE_MASK 0x001
- AV_QSV_DECODE = 0x001,
+#define HB_QSV_DECODE_MASK 0x001
+ HB_QSV_DECODE = 0x001,
-#define AV_QSV_VPP_MASK 0x0F0
+#define HB_QSV_VPP_MASK 0x0F0
// "Mandatory VPP filter" , might be with "Hint-based VPP filters"
- AV_QSV_VPP_DEFAULT = 0x010,
+ HB_QSV_VPP_DEFAULT = 0x010,
// "User Modules" etc
- AV_QSV_VPP_USER = 0x020,
+ HB_QSV_VPP_USER = 0x020,
#define av_QSV_ENCODE_MASK 0x100
- AV_QSV_ENCODE = 0x100
-#define AV_QSV_ANY_MASK 0xFFF
-} AV_QSV_STAGE_TYPE;
+ HB_QSV_ENCODE = 0x100
+#define HB_QSV_ANY_MASK 0xFFF
+} HB_QSV_STAGE_TYPE;
-typedef struct av_qsv_list {
+typedef struct hb_qsv_list {
// practically pthread_mutex_t
void *mutex;
pthread_mutexattr_t mta;
@@ -197,15 +197,15 @@ typedef struct av_qsv_list {
int items_alloc;
int items_count;
-} av_qsv_list;
+} hb_qsv_list;
-typedef struct av_qsv_sync {
+typedef struct hb_qsv_sync {
mfxSyncPoint* p_sync;
int in_use;
-} av_qsv_sync;
+} hb_qsv_sync;
-typedef struct av_qsv_stage {
- AV_QSV_STAGE_TYPE type;
+typedef struct hb_qsv_stage {
+ HB_QSV_STAGE_TYPE type;
struct {
mfxBitstream *p_bs;
mfxFrameSurface1 *p_surface;
@@ -213,22 +213,22 @@ typedef struct av_qsv_stage {
struct {
mfxBitstream *p_bs;
mfxFrameSurface1 *p_surface;
- av_qsv_sync *sync;
+ hb_qsv_sync *sync;
} out;
- av_qsv_list *pending;
-} av_qsv_stage;
+ hb_qsv_list *pending;
+} hb_qsv_stage;
-typedef struct av_qsv_task {
+typedef struct hb_qsv_task {
mfxBitstream *bs;
- av_qsv_stage *stage;
-} av_qsv_task;
+ hb_qsv_stage *stage;
+} hb_qsv_task;
-typedef struct av_qsv_space {
+typedef struct hb_qsv_space {
uint8_t is_init_done;
- AV_QSV_STAGE_TYPE type;
+ HB_QSV_STAGE_TYPE type;
mfxVideoParam m_mfxVideoParam;
@@ -241,26 +241,26 @@ typedef struct av_qsv_space {
uint16_t surface_num_max_used;
uint16_t surface_num;
- mfxFrameSurface1 *p_surfaces[AV_QSV_SURFACE_NUM];
+ mfxFrameSurface1 *p_surfaces[HB_QSV_SURFACE_NUM];
uint16_t sync_num_max_used;
uint16_t sync_num;
- av_qsv_sync *p_syncp[AV_QSV_SYNC_NUM];
+ hb_qsv_sync *p_syncp[HB_QSV_SYNC_NUM];
mfxBitstream bs;
uint8_t *p_buf;
size_t p_buf_max_size;
// only for encode and tasks
- av_qsv_list *tasks;
+ hb_qsv_list *tasks;
- av_qsv_list *pending;
+ hb_qsv_list *pending;
// storage for allocations/mfxMemId*
mfxMemId *mids;
-} av_qsv_space;
+} hb_qsv_space;
-typedef struct av_qsv_context {
+typedef struct hb_qsv_context {
volatile int is_context_active;
mfxIMPL impl;
@@ -268,18 +268,18 @@ typedef struct av_qsv_context {
mfxVersion ver;
// decode
- av_qsv_space *dec_space;
+ hb_qsv_space *dec_space;
// encode
- av_qsv_space *enc_space;
+ hb_qsv_space *enc_space;
// vpp
- av_qsv_list *vpp_space;
+ hb_qsv_list *vpp_space;
- av_qsv_list *pipes;
+ hb_qsv_list *pipes;
// MediaSDK starting from API version 1.6 includes DecodeTimeStamp
// in addition to TimeStamp
- // see also AV_QSV_MSDK_VERSION_MINOR , AV_QSV_MSDK_VERSION_MAJOR
- av_qsv_list *dts_seq;
+ // see also HB_QSV_MSDK_VERSION_MINOR , HB_QSV_MSDK_VERSION_MAJOR
+ hb_qsv_list *dts_seq;
// practically pthread_mutex_t
void *qts_seq_mutex;
@@ -288,36 +288,36 @@ typedef struct av_qsv_context {
void *qsv_config;
-} av_qsv_context;
+} hb_qsv_context;
typedef enum {
QSV_PART_ANY = 0,
QSV_PART_LOWER,
QSV_PART_UPPER
-} av_qsv_split;
+} hb_qsv_split;
typedef struct {
int64_t dts;
-} av_qsv_dts;
+} hb_qsv_dts;
-typedef struct av_qsv_alloc_frame {
+typedef struct hb_qsv_alloc_frame {
mfxU32 id;
mfxFrameInfo info;
-} av_qsv_alloc_frame;
+} hb_qsv_alloc_frame;
-typedef struct av_qsv_alloc_buffer {
+typedef struct hb_qsv_alloc_buffer {
mfxU32 id;
mfxU32 nbytes;
mfxU16 type;
-} av_qsv_alloc_buffer;
+} hb_qsv_alloc_buffer;
-typedef struct av_qsv_allocators_space {
- av_qsv_space *space;
+typedef struct hb_qsv_allocators_space {
+ hb_qsv_space *space;
mfxFrameAllocator frame_alloc;
mfxBufferAllocator buffer_alloc;
-} av_qsv_allocators_space;
+} hb_qsv_allocators_space;
-typedef struct av_qsv_config {
+typedef struct hb_qsv_config {
/**
* Set asynch depth of processing with QSV
* Format: 0 and more
@@ -385,7 +385,7 @@ typedef struct av_qsv_config {
/**
* If pipeline should be sync.
* Format: wait time in milliseconds,
- * AV_QSV_SYNC_TIME_DEFAULT/10000 might be a good value
+ * HB_QSV_SYNC_TIME_DEFAULT/10000 might be a good value
*
* - encoding: Set by user.
* - decoding: Set by user.
@@ -427,9 +427,9 @@ typedef struct av_qsv_config {
* - encoding: Set by user.
* - decoding: Set by user.
*/
- av_qsv_allocators_space *allocators;
+ hb_qsv_allocators_space *allocators;
-} av_qsv_config;
+} hb_qsv_config;
#define ANEX_UNKNOWN 0
#define ANEX_PREFIX 1
@@ -437,44 +437,44 @@ typedef struct av_qsv_config {
static const uint8_t ff_prefix_code[] = { 0x00, 0x00, 0x00, 0x01 };
-int av_qsv_get_free_sync(av_qsv_space *, av_qsv_context *);
-int av_qsv_get_free_surface(av_qsv_space *, av_qsv_context *, mfxFrameInfo *,
- av_qsv_split);
-int av_qsv_get_free_encode_task(av_qsv_list *);
+int hb_qsv_get_free_sync(hb_qsv_space *, hb_qsv_context *);
+int hb_qsv_get_free_surface(hb_qsv_space *, hb_qsv_context *, mfxFrameInfo *,
+ hb_qsv_split);
+int hb_qsv_get_free_encode_task(hb_qsv_list *);
int av_is_qsv_available(mfxIMPL, mfxVersion *);
-void av_qsv_wait_on_sync(av_qsv_context *, av_qsv_stage *);
+void hb_qsv_wait_on_sync(hb_qsv_context *, hb_qsv_stage *);
-void av_qsv_add_context_usage(av_qsv_context *, int);
+void hb_qsv_add_context_usage(hb_qsv_context *, int);
-void av_qsv_pipe_list_create(av_qsv_list **, int);
-void av_qsv_pipe_list_clean(av_qsv_list **);
+void hb_qsv_pipe_list_create(hb_qsv_list **, int);
+void hb_qsv_pipe_list_clean(hb_qsv_list **);
-void av_qsv_add_stagee(av_qsv_list **, av_qsv_stage *, int);
-av_qsv_stage *av_qsv_get_last_stage(av_qsv_list *);
-av_qsv_list *av_qsv_pipe_by_stage(av_qsv_list *, av_qsv_stage *);
-void av_qsv_flush_stages(av_qsv_list *, av_qsv_list **);
+void hb_qsv_add_stagee(hb_qsv_list **, hb_qsv_stage *, int);
+hb_qsv_stage *hb_qsv_get_last_stage(hb_qsv_list *);
+hb_qsv_list *hb_qsv_pipe_by_stage(hb_qsv_list *, hb_qsv_stage *);
+void hb_qsv_flush_stages(hb_qsv_list *, hb_qsv_list **);
-void av_qsv_dts_ordered_insert(av_qsv_context *, int, int, int64_t, int);
-void av_qsv_dts_pop(av_qsv_context *);
+void hb_qsv_dts_ordered_insert(hb_qsv_context *, int, int, int64_t, int);
+void hb_qsv_dts_pop(hb_qsv_context *);
-av_qsv_stage *av_qsv_stage_init(void);
-void av_qsv_stage_clean(av_qsv_stage **);
-int av_qsv_context_clean(av_qsv_context *);
+hb_qsv_stage *hb_qsv_stage_init(void);
+void hb_qsv_stage_clean(hb_qsv_stage **);
+int hb_qsv_context_clean(hb_qsv_context *);
-int ff_qsv_is_sync_in_pipe(mfxSyncPoint *, av_qsv_context *);
-int ff_qsv_is_surface_in_pipe(mfxFrameSurface1 *, av_qsv_context *);
+int ff_qsv_is_sync_in_pipe(mfxSyncPoint *, hb_qsv_context *);
+int ff_qsv_is_surface_in_pipe(mfxFrameSurface1 *, hb_qsv_context *);
-av_qsv_list *av_qsv_list_init(int);
-int av_qsv_list_lock(av_qsv_list *);
-int av_qsv_list_unlock(av_qsv_list *);
-int av_qsv_list_add(av_qsv_list *, void *);
-void av_qsv_list_rem(av_qsv_list *, void *);
-void av_qsv_list_insert(av_qsv_list *, int, void *);
-void av_qsv_list_close(av_qsv_list **);
+hb_qsv_list *hb_qsv_list_init(int);
+int hb_qsv_list_lock(hb_qsv_list *);
+int hb_qsv_list_unlock(hb_qsv_list *);
+int hb_qsv_list_add(hb_qsv_list *, void *);
+void hb_qsv_list_rem(hb_qsv_list *, void *);
+void hb_qsv_list_insert(hb_qsv_list *, int, void *);
+void hb_qsv_list_close(hb_qsv_list **);
-int av_qsv_list_count(av_qsv_list *);
-void *av_qsv_list_item(av_qsv_list *, int);
+int hb_qsv_list_count(hb_qsv_list *);
+void *hb_qsv_list_item(hb_qsv_list *, int);
/* @} */
diff --git a/libhb/qsv_memory.c b/libhb/qsv_memory.c
index 3d56923d2..7200b0ab3 100644
--- a/libhb/qsv_memory.c
+++ b/libhb/qsv_memory.c
@@ -36,8 +36,8 @@ int qsv_nv12_to_yuv420(struct SwsContext* sws_context,hb_buffer_t* dst, mfxFrame
int ret = 0;
int in_pitch = src->Data.Pitch;
- int w = AV_QSV_ALIGN16(src->Info.Width);
- int h = (MFX_PICSTRUCT_PROGRESSIVE == src->Info.PicStruct) ? AV_QSV_ALIGN16(src->Info.Height) : AV_QSV_ALIGN32(src->Info.Height);
+ int w = HB_QSV_ALIGN16(src->Info.Width);
+ int h = (MFX_PICSTRUCT_PROGRESSIVE == src->Info.PicStruct) ? HB_QSV_ALIGN16(src->Info.Height) : HB_QSV_ALIGN32(src->Info.Height);
uint8_t *in_luma = 0;
uint8_t *in_chroma = 0;
static int copyframe_in_use = 1;