[vlc-commits] Revert "vdpau_chroma: remove copy-to-CPU plugin"
Rémi Denis-Courmont
git at videolan.org
Mon Jun 5 19:58:41 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jun 5 20:44:13 2017 +0300| [93480c7812667be25c8bd9f60b39d679af7c9dd2] | committer: Rémi Denis-Courmont
Revert "vdpau_chroma: remove copy-to-CPU plugin"
This reverts commit c64c698124f4e2604a503cb753f104f18796c361.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=93480c7812667be25c8bd9f60b39d679af7c9dd2
---
modules/hw/vdpau/chroma.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/modules/hw/vdpau/chroma.c b/modules/hw/vdpau/chroma.c
index ae51d97446..5f76c28b32 100644
--- a/modules/hw/vdpau/chroma.c
+++ b/modules/hw/vdpau/chroma.c
@@ -797,6 +797,64 @@ static void OutputClose(vlc_object_t *obj)
free(sys);
}
+static picture_t *VideoExport_Filter(filter_t *filter, picture_t *src)
+{
+ if (unlikely(src->context == NULL))
+ {
+ msg_Err(filter, "corrupt VDPAU video surface %p", src);
+ picture_Release(src);
+ return NULL;
+ }
+
+ picture_t *dst = filter_NewPicture(filter);
+ if (dst == NULL)
+ return NULL;
+
+ return VideoExport(filter, src, dst);
+}
+
+static int YCbCrOpen(vlc_object_t *obj)
+{
+ filter_t *filter = (filter_t *)obj;
+ if (filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_420
+ && filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_422
+ && filter->fmt_in.video.i_chroma != VLC_CODEC_VDPAU_VIDEO_444)
+ return VLC_EGENERIC;
+
+ if (filter->fmt_in.video.i_visible_width
+ != filter->fmt_out.video.i_visible_width
+ || filter->fmt_in.video.i_visible_height
+ != filter->fmt_out.video.i_visible_height
+ || filter->fmt_in.video.i_x_offset != filter->fmt_out.video.i_x_offset
+ || filter->fmt_in.video.i_y_offset != filter->fmt_out.video.i_y_offset
+ || (filter->fmt_in.video.i_sar_num * filter->fmt_out.video.i_sar_den
+ != filter->fmt_in.video.i_sar_den * filter->fmt_out.video.i_sar_num))
+ return VLC_EGENERIC;
+
+ filter_sys_t *sys = malloc(sizeof (*sys));
+ if (unlikely(sys == NULL))
+ return VLC_ENOMEM;
+
+ if (!vlc_fourcc_to_vdp_ycc(filter->fmt_out.video.i_chroma,
+ &sys->chroma, &sys->format))
+ {
+ free(sys);
+ return VLC_EGENERIC;
+ }
+
+ filter->pf_video_filter = VideoExport_Filter;
+ filter->p_sys = sys;
+ return VLC_SUCCESS;
+}
+
+static void YCbCrClose(vlc_object_t *obj)
+{
+ filter_t *filter = (filter_t *)obj;
+ filter_sys_t *sys = filter->p_sys;
+
+ free(sys);
+}
+
static const int algo_values[] = {
-1,
VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL,
@@ -828,4 +886,7 @@ vlc_module_begin()
N_("Noise reduction level"), N_("Noise reduction level"), true)
add_integer_with_range("vdpau-scaling", 0, 0, 9,
N_("Scaling quality"), N_("High quality scaling level"), true)
+
+ add_submodule()
+ set_callbacks(YCbCrOpen, YCbCrClose)
vlc_module_end()
More information about the vlc-commits
mailing list