diff options
author | Artem Galin <[email protected]> | 2020-07-10 02:31:17 +0100 |
---|---|---|
committer | Scott <[email protected]> | 2020-07-20 16:56:43 +0100 |
commit | bdee4bef65609aea9f56e0a87ad3d713f62033a7 (patch) | |
tree | e272feb3b83b7f8b2d3b31f1763541eb0d60c498 /libhb/decavcodec.c | |
parent | 3fbdd5f5bef30f6180e984f578bbe7e12ba087e4 (diff) |
qsv: added HW offload of resize filter
Started to close gap of filters to be offloaded for HW acceleration,
when possible.
Resize filter is validated and others are in the pipeline, including
DX11.
Diffstat (limited to 'libhb/decavcodec.c')
-rw-r--r-- | libhb/decavcodec.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index d562b295e..3dbb4a918 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -52,6 +52,7 @@ #include "libavutil/hwcontext_qsv.h" #include "handbrake/qsv_common.h" #include "handbrake/qsv_libav.h" +extern HBQSVFramesContext hb_dec_qsv_frames_ctx; #endif static void compute_frame_duration( hb_work_private_t *pv ); @@ -954,7 +955,7 @@ static hb_buffer_t *copy_frame( hb_work_private_t *pv ) if (pv->qsv.decode && pv->qsv.config.io_pattern == MFX_IOPATTERN_OUT_VIDEO_MEMORY) { - out = hb_qsv_copy_frame(pv->frame, pv->job->qsv.ctx); + out = hb_qsv_copy_frame(&hb_dec_qsv_frames_ctx, pv->frame, pv->job->qsv.ctx, 0); } else #endif @@ -1173,16 +1174,27 @@ int reinit_video_filters(hb_work_private_t * pv) orig_width != pv->frame->width || orig_height != pv->frame->height) { - settings = hb_dict_init(); - hb_dict_set(settings, "w", hb_value_int(orig_width)); - hb_dict_set(settings, "h", hb_value_int(orig_height)); - hb_dict_set(settings, "flags", hb_value_string("lanczos+accurate_rnd")); - hb_avfilter_append_dict(filters, "scale", settings); +#if HB_PROJECT_FEATURE_QSV + if (pv->qsv.decode && + pv->qsv.config.io_pattern == MFX_IOPATTERN_OUT_VIDEO_MEMORY) + { + hb_dict_set(settings, "w", hb_value_int(orig_width)); + hb_dict_set(settings, "h", hb_value_int(orig_height)); + hb_avfilter_append_dict(filters, "scale_qsv", settings); + } + else +#endif + { + hb_dict_set(settings, "w", hb_value_int(orig_width)); + hb_dict_set(settings, "h", hb_value_int(orig_height)); + hb_dict_set(settings, "flags", hb_value_string("lanczos+accurate_rnd")); + hb_avfilter_append_dict(filters, "scale", settings); - settings = hb_dict_init(); - hb_dict_set(settings, "pix_fmts", hb_value_string("yuv420p")); - hb_avfilter_append_dict(filters, "format", settings); + settings = hb_dict_init(); + hb_dict_set(settings, "pix_fmts", hb_value_string("yuv420p")); + hb_avfilter_append_dict(filters, "format", settings); + } } if (pv->title->rotation != HB_ROTATION_0) { |