1 /*****************************************************************************
2 * neon.c : ARM NEONv1 chroma conversion module for VLC
3 *****************************************************************************
4 * Copyright (C) 2009 RĂ©mi Denis-Courmont
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
25 #include <vlc_common.h>
26 #include <vlc_plugin.h>
27 #include <vlc_filter.h>
29 static int Open (vlc_object_t *);
32 set_description (N_("ARM NEON video chroma conversions"))
33 set_capability ("video filter2", 250)
34 set_callbacks (Open, NULL)
35 add_requirement (NEON)
38 void i420_yuyv_neon (uint8_t *out, const uint8_t **in,
39 uintptr_t pitch, uintptr_t height);
41 static void I420_YUYV (filter_t *filter, picture_t *src, picture_t *dst)
43 uint8_t *out = dst->p->p_pixels;
44 const uint8_t *yuv[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS, };
45 size_t pitch = (filter->fmt_in.video.i_width + 15) & ~15;
46 size_t height = filter->fmt_in.video.i_height;
48 i420_yuyv_neon (out, yuv, pitch, height);
51 void i420_uyvy_neon (uint8_t *out, const uint8_t **in,
52 uintptr_t pitch, uintptr_t height);
54 static void I420_UYVY (filter_t *filter, picture_t *src, picture_t *dst)
56 uint8_t *out = dst->p->p_pixels;
57 const uint8_t *yuv[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS, };
58 size_t pitch = (filter->fmt_in.video.i_width + 15) & ~15;
59 size_t height = filter->fmt_in.video.i_height;
61 i420_yuyv_neon (out, yuv, pitch, height);
64 VIDEO_FILTER_WRAPPER (I420_YUYV)
65 VIDEO_FILTER_WRAPPER (I420_UYVY)
67 static int Open (vlc_object_t *obj)
69 filter_t *filter = (filter_t *)obj;
71 if (((filter->fmt_in.video.i_width | filter->fmt_in.video.i_height) & 1)
72 || (filter->fmt_in.video.i_width != filter->fmt_out.video.i_width)
73 || (filter->fmt_in.video.i_height != filter->fmt_out.video.i_height))
76 switch (filter->fmt_in.video.i_chroma)
80 switch (filter->fmt_out.video.i_chroma)
83 filter->pf_video_filter = I420_YUYV_Filter;
86 filter->pf_video_filter = I420_UYVY_Filter;