summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-29 22:39:25 +0200
committerwm4 <wm4@nowhere>2015-05-29 23:01:44 +0200
commitad85203d63fdc0d9c61f9e156a79ab2e83f4cce6 (patch)
treec3b78e34ce2a5ea31c3cd2e7573e7ee7410d5e05
parentf44725b8d4a297e6bf2485b96d08c162bc42b9bf (diff)
downloadmpv-ad85203d63fdc0d9c61f9e156a79ab2e83f4cce6.tar.bz2
mpv-ad85203d63fdc0d9c61f9e156a79ab2e83f4cce6.tar.xz
vf_vavpp: simplify surface list allocation
-rw-r--r--video/filter/vf_vavpp.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/video/filter/vf_vavpp.c b/video/filter/vf_vavpp.c
index f3ca627ac2..f62788f98a 100644
--- a/video/filter/vf_vavpp.c
+++ b/video/filter/vf_vavpp.c
@@ -35,7 +35,6 @@ static bool check_error(struct vf_instance *vf, VAStatus status, const char *msg
struct surface_refs {
VASurfaceID *surfaces;
- int num_allocated;
int num_required;
};
@@ -81,15 +80,6 @@ static const int deint_algorithm[] = {
[5] = VAProcDeinterlacingMotionCompensated,
};
-static inline void realloc_refs(struct surface_refs *refs, int num)
-{
- if (refs->num_allocated < num) {
- refs->surfaces = realloc(refs->surfaces, sizeof(VASurfaceID)*num);
- refs->num_allocated = num;
- }
- refs->num_required = num;
-}
-
static bool update_pipeline(struct vf_instance *vf, bool deint)
{
struct vf_priv_s *p = vf->priv;
@@ -120,8 +110,8 @@ static bool update_pipeline(struct vf_instance *vf, bool deint)
p->pipe.num_filters = num_filters;
p->pipe.num_input_colors = caps.num_input_color_standards;
p->pipe.num_output_colors = caps.num_output_color_standards;
- realloc_refs(&p->pipe.forward, caps.num_forward_references);
- realloc_refs(&p->pipe.backward, caps.num_backward_references);
+ MP_TARRAY_GROW(vf, p->pipe.forward.surfaces, caps.num_forward_references);
+ MP_TARRAY_GROW(vf, p->pipe.backward.surfaces, caps.num_backward_references);
return true;
}
@@ -295,8 +285,6 @@ static void uninit(struct vf_instance *vf)
vaDestroyContext(p->display, p->context);
if (p->config != VA_INVALID_ID)
vaDestroyConfig(p->display, p->config);
- free(p->pipe.forward.surfaces);
- free(p->pipe.backward.surfaces);
talloc_free(p->pool);
}