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>
30 static int Open (vlc_object_t *);
33 set_description (N_("ARM NEON video chroma conversions"))
34 set_capability ("video filter2", 250)
35 set_callbacks (Open, NULL)
36 add_requirement (NEON)
39 void i420_yuyv_neon (uint8_t *out, const uint8_t **in,
40 uintptr_t pitch, uintptr_t height);
42 static void I420_YUYV (filter_t *filter, picture_t *src, picture_t *dst)
44 uint8_t *out = dst->p->p_pixels;
45 const uint8_t *yuv[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS, };
46 size_t pitch = (filter->fmt_in.video.i_width + 15) & ~15;
47 size_t height = filter->fmt_in.video.i_height;
49 i420_yuyv_neon (out, yuv, pitch, height);
52 void i420_uyvy_neon (uint8_t *out, const uint8_t **in,
53 uintptr_t pitch, uintptr_t height);
55 static void I420_UYVY (filter_t *filter, picture_t *src, picture_t *dst)
57 uint8_t *out = dst->p->p_pixels;
58 const uint8_t *yuv[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS, };
59 size_t pitch = (filter->fmt_in.video.i_width + 15) & ~15;
60 size_t height = filter->fmt_in.video.i_height;
62 i420_yuyv_neon (out, yuv, pitch, height);
65 VIDEO_FILTER_WRAPPER (I420_YUYV)
66 VIDEO_FILTER_WRAPPER (I420_UYVY)
68 static int Open (vlc_object_t *obj)
70 filter_t *filter = (filter_t *)obj;
72 if (((filter->fmt_in.video.i_width | filter->fmt_in.video.i_height) & 1)
73 || (filter->fmt_in.video.i_width != filter->fmt_out.video.i_width)
74 || (filter->fmt_in.video.i_height != filter->fmt_out.video.i_height))
77 switch (filter->fmt_in.video.i_chroma)
81 switch (filter->fmt_out.video.i_chroma)
84 filter->pf_video_filter = I420_YUYV_Filter;
87 filter->pf_video_filter = I420_UYVY_Filter;