[vlc-commits] vdpau: simplify surface copy when deinterlacing
Rémi Denis-Courmont
git at videolan.org
Tue Jul 9 21:21:49 CEST 2013
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jul 9 22:16:54 2013 +0300| [6ffb7537005c10036e6c3641dd39ea4847a991e4] | committer: Rémi Denis-Courmont
vdpau: simplify surface copy when deinterlacing
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6ffb7537005c10036e6c3641dd39ea4847a991e4
---
modules/hw/vdpau/deinterlace.c | 9 ++++++---
modules/hw/vdpau/picture.c | 15 +++------------
modules/hw/vdpau/vlc_vdpau.h | 5 +++--
3 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/modules/hw/vdpau/deinterlace.c b/modules/hw/vdpau/deinterlace.c
index cf737ab..44d7f25 100644
--- a/modules/hw/vdpau/deinterlace.c
+++ b/modules/hw/vdpau/deinterlace.c
@@ -45,9 +45,9 @@ static picture_t *Deinterlace(filter_t *filter, picture_t *src)
vlc_vdp_video_field_t *f1 = src->context;
if (unlikely(f1 == NULL))
return src;
-
if (f1->structure != VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME)
return src; /* cannot deinterlace twice */
+
#ifdef VOUT_CORE_GETS_A_CLUE
picture_t *dst = filter_NewPicture(filter);
#else
@@ -55,12 +55,16 @@ static picture_t *Deinterlace(filter_t *filter, picture_t *src)
#endif
if (dst == NULL)
return src; /* cannot deinterlace without copying fields */
- if (vlc_vdp_video_copy(dst, src) != VDP_STATUS_OK) // shallow copy
+
+ vlc_vdp_video_field_t *f2 = vlc_vdp_video_copy(f1); // shallow copy
+ if (unlikely(f2 == NULL))
{
picture_Release(dst);
return src;
}
+
picture_CopyProperties(dst, src);
+ dst->context = f2;
if (last_pts != VLC_TS_INVALID)
dst->date = (3 * src->date - last_pts) / 2;
@@ -75,7 +79,6 @@ static picture_t *Deinterlace(filter_t *filter, picture_t *src)
assert(src->p_next == NULL);
src->p_next = dst;
- vlc_vdp_video_field_t *f2 = dst->context;
if (src->b_progressive || src->b_top_field_first)
{
f1->structure = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD;
diff --git a/modules/hw/vdpau/picture.c b/modules/hw/vdpau/picture.c
index 75f1825..fbbdc3f 100644
--- a/modules/hw/vdpau/picture.c
+++ b/modules/hw/vdpau/picture.c
@@ -94,21 +94,12 @@ VdpStatus vlc_vdp_video_attach(vdp_t *vdp, VdpVideoSurface surface,
return VDP_STATUS_OK;
}
-VdpStatus vlc_vdp_video_copy(picture_t *restrict dst, picture_t *restrict src)
+vlc_vdp_video_field_t *vlc_vdp_video_copy(vlc_vdp_video_field_t *fold)
{
- vlc_vdp_video_field_t *fold = src->context;
vlc_vdp_video_frame_t *frame = fold->frame;
vlc_vdp_video_field_t *fnew = malloc(sizeof (*fnew));
if (unlikely(fnew == NULL))
- return VDP_STATUS_RESOURCES;
-
- assert(src->format.i_chroma == VLC_CODEC_VDPAU_VIDEO_420
- || src->format.i_chroma == VLC_CODEC_VDPAU_VIDEO_422);
- assert(dst->format.i_chroma == VLC_CODEC_VDPAU_VIDEO_420
- || dst->format.i_chroma == VLC_CODEC_VDPAU_VIDEO_422);
- assert(!picture_IsReferenced(dst));
- assert(dst->context == NULL);
- dst->context = fnew;
+ return NULL;
fnew->destroy = SurfaceDestroy;
fnew->frame = frame;
@@ -117,7 +108,7 @@ VdpStatus vlc_vdp_video_copy(picture_t *restrict dst, picture_t *restrict src)
fnew->sharpen = fold->sharpen;
atomic_fetch_add(&frame->refs, 1);
- return VDP_STATUS_OK;
+ return fnew;
}
vlc_vdp_video_field_t *vlc_vdp_video_detach(picture_t *pic)
diff --git a/modules/hw/vdpau/vlc_vdpau.h b/modules/hw/vdpau/vlc_vdpau.h
index 450bf7c..cf02a85 100644
--- a/modules/hw/vdpau/vlc_vdpau.h
+++ b/modules/hw/vdpau/vlc_vdpau.h
@@ -271,9 +271,10 @@ typedef struct vlc_vdp_video_field
VdpStatus vlc_vdp_video_attach(vdp_t *, VdpVideoSurface, picture_t *);
/**
- * Copies the VDPAU video surface from a VLC picture into another VLC picture.
+ * Performs a shallow copy of a VDPAU video surface context
+ * (the underlying VDPAU video surface is shared).
*/
-VdpStatus vlc_vdp_video_copy(picture_t *dst, picture_t *src);
+vlc_vdp_video_field_t *vlc_vdp_video_copy(vlc_vdp_video_field_t *);
/**
* Detaches a VDPAU video surface as context from a VLC picture.
More information about the vlc-commits
mailing list