diff options
author | wm4 <wm4@nowhere> | 2015-01-03 03:01:58 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-03 03:01:58 +0100 |
commit | f5ed13bcd4aacd362db9da3b5ad3f8747f13d944 (patch) | |
tree | 289bf7a376236d2da9547f5bbcdb9e62529025b2 /video/filter/vf_vapoursynth.c | |
parent | 73ea0ddc080a53b5474205703ba3b189d0352d3a (diff) | |
download | mpv-f5ed13bcd4aacd362db9da3b5ad3f8747f13d944.tar.bz2 mpv-f5ed13bcd4aacd362db9da3b5ad3f8747f13d944.tar.xz |
video: better pipelining with vf_vapoursynth
Most of this is explained in the code comments. This change should
improve performance with vapoursynth, especially if concurrent requests
are used.
This should change nothing if vf_vapoursynth is not in the filter chain,
since non-threaded filters obviously can not asynchronously finish
filtering of frames.
Diffstat (limited to 'video/filter/vf_vapoursynth.c')
-rw-r--r-- | video/filter/vf_vapoursynth.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/video/filter/vf_vapoursynth.c b/video/filter/vf_vapoursynth.c index ba630f8df1..30fd992071 100644 --- a/video/filter/vf_vapoursynth.c +++ b/video/filter/vf_vapoursynth.c @@ -381,6 +381,17 @@ static int filter_out(struct vf_instance *vf) return ret; } +static bool needs_input(struct vf_instance *vf) +{ + struct vf_priv_s *p = vf->priv; + bool r = false; + pthread_mutex_lock(&p->lock); + locked_read_output(vf); + r = vf->num_out_queued < p->max_requests && locked_need_input(vf); + pthread_mutex_unlock(&p->lock); + return r; +} + static void VS_CC infiltInit(VSMap *in, VSMap *out, void **instanceData, VSNode *node, VSCore *core, const VSAPI *vsapi) { @@ -451,6 +462,8 @@ static const VSFrameRef *VS_CC infiltGetFrame(int frameno, int activationReason, if (p->num_buffered) { drain_oldest_buffered_frame(p); pthread_cond_broadcast(&p->wakeup); + if (vf->chain->wakeup_callback) + vf->chain->wakeup_callback(vf->chain->wakeup_callback_ctx); continue; } } @@ -682,6 +695,7 @@ static int vf_open(vf_instance_t *vf) vf->config = config; vf->filter_ext = filter_ext; vf->filter_out = filter_out; + vf->needs_input = needs_input; vf->query_format = query_format; vf->control = control; vf->uninit = uninit; |