job->metadata = hb_metadata_copy( title->metadata );
#ifdef USE_QSV
- job->qsv_decode = title->qsv_decode_support;
+ job->qsv_decode = title->qsv_decode_support;
+ job->qsv_async_depth = AV_QSV_ASYNC_DEPTH_DEFAULT;
#endif
}
#ifdef USE_QSV
av_qsv_context *qsv;
int qsv_decode;
+ int qsv_async_depth;
#endif
#ifdef __LIBHB__
#ifdef USE_QSV
if (hb_qsv_decode_is_enabled(job))
{
- int ret;
- hb_dict_t *qsv_opts = NULL;
- hb_dict_entry_t *entry = NULL;
- qsv_param_set_defaults(&pv->qsv_config);
- // parse QSV encoding options to determine AsyncDepth
- if (job->advanced_opts != NULL && *job->advanced_opts != '\0')
- {
- qsv_opts = hb_encopts_to_dict(job->advanced_opts, job->vcodec);
- }
- while ((entry = hb_dict_next(qsv_opts, entry)) != NULL)
- {
- ret = qsv_param_parse(&pv->qsv_config, entry->key, entry->value);
- if (ret == QSV_PARAM_BAD_NAME)
- hb_log("QSV options: Unknown suboption %s", entry->key);
- if (ret == QSV_PARAM_BAD_VALUE)
- hb_log("QSV options: Bad argument %s=%s", entry->key, entry->value);
- }
- hb_dict_free(&qsv_opts);
// setup the QSV configuration
pv->qsv_config.impl_requested = MFX_IMPL_AUTO_ANY|MFX_IMPL_VIA_ANY;
pv->qsv_config.io_pattern = MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
+ pv->qsv_config.async_depth = job->qsv_async_depth;
pv->qsv_config.sync_need = 0;
pv->qsv_config.usage_threaded = 1;
pv->qsv_config.additional_buffers = 64; // FIFO_LARGE
job->color_transfer = color_transfer;
job->color_matrix = color_matrix;
- if(pv->qsv_config.async_depth)
- qsv_encode->m_mfxVideoParam.AsyncDepth = pv->qsv_config.async_depth;
-
- pv->max_async_depth = pv->qsv_config.async_depth;
- pv->async_depth = 0;
+ qsv_encode->m_mfxVideoParam.AsyncDepth = job->qsv_async_depth;
+ pv->max_async_depth = job->qsv_async_depth;
+ pv->async_depth = 0;
char *rc_method = NULL;
switch (qsv_encode->m_mfxVideoParam.mfx.RateControlMethod){
if(pv->is_sys_mem){
- qsv_encode->surface_num = FFMIN( qsv_encode->request[0].NumFrameSuggested + pv->qsv_config.async_depth,AV_QSV_SURFACE_NUM );
+ qsv_encode->surface_num = FFMIN(qsv_encode->request[0].NumFrameSuggested +
+ pv->job->qsv_async_depth, AV_QSV_SURFACE_NUM);
if(qsv_encode->surface_num <= 0 )
qsv_encode->surface_num = AV_QSV_SURFACE_NUM;
if(!config)
return QSV_PARAM_BAD_CONFIG;
- if(!strcmp(name,QSV_NAME_async_depth))
- config->async_depth = FFMAX( atoi(value),0 );
- else
if(!strcmp(name,QSV_NAME_target_usage))
config->target_usage = FFMAX( atoi(value),0 );
else
int is_frc_used;
av_qsv_space *vpp_space;
- av_qsv_config qsv_config;
// FRC param(s)
mfxExtVPPFrameRateConversion frc_config;
av_qsv_add_context_usage(qsv,HAVE_THREADS);
-
- qsv_param_set_defaults(&pv->qsv_config);
- hb_dict_t * qsv_opts = NULL;
- if( pv->job->advanced_opts != NULL && *pv->job->advanced_opts != '\0' )
- qsv_opts = hb_encopts_to_dict( pv->job->advanced_opts, pv->job->vcodec );
-
- int ret;
- hb_dict_entry_t * entry = NULL;
- while( ( entry = hb_dict_next( qsv_opts, entry ) ) )
- {
- ret = qsv_param_parse( &pv->qsv_config, entry->key, entry->value );
- if( ret == QSV_PARAM_BAD_NAME )
- hb_log( "QSV options: Unknown suboption %s", entry->key );
- else
- if( ret == QSV_PARAM_BAD_VALUE )
- hb_log( "QSV options: Bad argument %s=%s", entry->key, entry->value ? entry->value : "(null)" );
- }
- hb_dict_free( &qsv_opts );
-
// see params needed like at mediasdk-man.pdf:"Appendix A: Configuration Parameter Constraints"
// for now - most will take from the decode
{
qsv_vpp->m_mfxVideoParam.IOPattern = MFX_IOPATTERN_IN_OPAQUE_MEMORY | MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
- qsv_vpp->m_mfxVideoParam.AsyncDepth = pv->qsv_config.async_depth;
+ qsv_vpp->m_mfxVideoParam.AsyncDepth = pv->job->qsv_async_depth;
memset(&qsv_vpp->request, 0, sizeof(mfxFrameAllocRequest)*2);
static int stop_at_frame = 0;
static uint64_t min_title_duration = 10;
#ifdef USE_QSV
-static int qsv_decode = 1;
+static int qsv_decode = 1;
+static int qsv_async_depth = -1;
#endif
/* Exit cleanly on Ctrl-C */
}
#ifdef USE_QSV
+ if (qsv_async_depth >= 0)
+ {
+ job->qsv_async_depth = qsv_async_depth;
+ }
job->qsv_decode = qsv_decode;
#endif
fprintf( out,
"### Intel Quick Sync Video------------------------------------------------------\n\n"
" --disable-qsv-decoding Force software decoding of the video track.\n"
+ " --qsv-async-depth Specifies how many asynchronous operations should be\n"
+ " performed before the result is explicitly synchronized.\n"
+ " Default: 4. If zero, the value is not specified.\n"
"\n"
" Advanced encoding options, via --encopts=\"option1=value1:option2=value2\":\n"
" - target-usage A range of numbers that indicate trade-offs between\n"
" - gop-ref-dist Distance between I- or P- key frames; if it is zero,\n"
" <number> the GOP structure is unspecified.\n"
" Note: If GopRefDist = 1, there are no B-frames used.\n"
- " - async-depth Specifies how many asynchronous operations an\n"
- " <number> application performsbefore the application\n"
- " explicitly synchronizes the result.\n"
- " If zero, the value is not specified. Default is 4\n"
" - mbbrc Setting this flag enables macroblock level bitrate\n"
" <number> control that generally improves subjective\n"
" visual quality.\n"
#define NORMALIZE_MIX 287
#define AUDIO_DITHER 288
#define QSV_BASELINE 289
+ #define QSV_ASYNC_DEPTH 290
for( ;; )
{
{ "no-dvdnav", no_argument, NULL, DVDNAV },
#ifdef USE_QSV
{ "qsv-baseline", no_argument, NULL, QSV_BASELINE },
+ { "qsv-async-depth", required_argument, NULL, QSV_ASYNC_DEPTH },
{ "disable-qsv-decoding", no_argument, &qsv_decode, 0 },
#endif
case MIN_DURATION:
min_title_duration = strtol( optarg, NULL, 0 );
break;
- case QSV_BASELINE:
#ifdef USE_QSV
+ case QSV_BASELINE:
if (hb_qsv_available())
{
/* XXX: for testing workarounds */
hb_qsv_info->capabilities &= ~HB_QSV_CAP_OPTION2_BRC;
hb_qsv_info->capabilities &= ~HB_QSV_CAP_OPTION2_LOOKAHEAD;
}
-#endif
break;
+ case QSV_ASYNC_DEPTH:
+ qsv_async_depth = atoi(optarg);
+ break;
+#endif
default:
fprintf( stderr, "unknown option (%s)\n", argv[cur_optind] );
return -1;