1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "vpx_config.h"
12 #include "vp8_rtcd.h"
13 #include "vp8/common/loopfilter.h"
14 #include "vp8/common/onyxc_int.h"
15
16 typedef void loopfilter_y_neon(unsigned char *src, int pitch,
17 unsigned char blimit, unsigned char limit,
18 unsigned char thresh);
19 typedef void loopfilter_uv_neon(unsigned char *u, int pitch,
20 unsigned char blimit, unsigned char limit,
21 unsigned char thresh, unsigned char *v);
22
23 extern loopfilter_y_neon vp8_loop_filter_horizontal_edge_y_neon;
24 extern loopfilter_y_neon vp8_loop_filter_vertical_edge_y_neon;
25 extern loopfilter_uv_neon vp8_loop_filter_horizontal_edge_uv_neon;
26 extern loopfilter_uv_neon vp8_loop_filter_vertical_edge_uv_neon;
27
28 extern loopfilter_y_neon vp8_mbloop_filter_horizontal_edge_y_neon;
29 extern loopfilter_y_neon vp8_mbloop_filter_vertical_edge_y_neon;
30 extern loopfilter_uv_neon vp8_mbloop_filter_horizontal_edge_uv_neon;
31 extern loopfilter_uv_neon vp8_mbloop_filter_vertical_edge_uv_neon;
32
33 /* NEON loopfilter functions */
34 /* Horizontal MB filtering */
vp8_loop_filter_mbh_neon(unsigned char * y_ptr,unsigned char * u_ptr,unsigned char * v_ptr,int y_stride,int uv_stride,loop_filter_info * lfi)35 void vp8_loop_filter_mbh_neon(unsigned char *y_ptr, unsigned char *u_ptr,
36 unsigned char *v_ptr, int y_stride, int uv_stride,
37 loop_filter_info *lfi) {
38 unsigned char mblim = *lfi->mblim;
39 unsigned char lim = *lfi->lim;
40 unsigned char hev_thr = *lfi->hev_thr;
41 vp8_mbloop_filter_horizontal_edge_y_neon(y_ptr, y_stride, mblim, lim,
42 hev_thr);
43
44 if (u_ptr)
45 vp8_mbloop_filter_horizontal_edge_uv_neon(u_ptr, uv_stride, mblim, lim,
46 hev_thr, v_ptr);
47 }
48
49 /* Vertical MB Filtering */
vp8_loop_filter_mbv_neon(unsigned char * y_ptr,unsigned char * u_ptr,unsigned char * v_ptr,int y_stride,int uv_stride,loop_filter_info * lfi)50 void vp8_loop_filter_mbv_neon(unsigned char *y_ptr, unsigned char *u_ptr,
51 unsigned char *v_ptr, int y_stride, int uv_stride,
52 loop_filter_info *lfi) {
53 unsigned char mblim = *lfi->mblim;
54 unsigned char lim = *lfi->lim;
55 unsigned char hev_thr = *lfi->hev_thr;
56
57 vp8_mbloop_filter_vertical_edge_y_neon(y_ptr, y_stride, mblim, lim, hev_thr);
58
59 if (u_ptr)
60 vp8_mbloop_filter_vertical_edge_uv_neon(u_ptr, uv_stride, mblim, lim,
61 hev_thr, v_ptr);
62 }
63
64 /* Horizontal B Filtering */
vp8_loop_filter_bh_neon(unsigned char * y_ptr,unsigned char * u_ptr,unsigned char * v_ptr,int y_stride,int uv_stride,loop_filter_info * lfi)65 void vp8_loop_filter_bh_neon(unsigned char *y_ptr, unsigned char *u_ptr,
66 unsigned char *v_ptr, int y_stride, int uv_stride,
67 loop_filter_info *lfi) {
68 unsigned char blim = *lfi->blim;
69 unsigned char lim = *lfi->lim;
70 unsigned char hev_thr = *lfi->hev_thr;
71
72 vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 4 * y_stride, y_stride, blim,
73 lim, hev_thr);
74 vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 8 * y_stride, y_stride, blim,
75 lim, hev_thr);
76 vp8_loop_filter_horizontal_edge_y_neon(y_ptr + 12 * y_stride, y_stride, blim,
77 lim, hev_thr);
78
79 if (u_ptr)
80 vp8_loop_filter_horizontal_edge_uv_neon(u_ptr + 4 * uv_stride, uv_stride,
81 blim, lim, hev_thr,
82 v_ptr + 4 * uv_stride);
83 }
84
85 /* Vertical B Filtering */
vp8_loop_filter_bv_neon(unsigned char * y_ptr,unsigned char * u_ptr,unsigned char * v_ptr,int y_stride,int uv_stride,loop_filter_info * lfi)86 void vp8_loop_filter_bv_neon(unsigned char *y_ptr, unsigned char *u_ptr,
87 unsigned char *v_ptr, int y_stride, int uv_stride,
88 loop_filter_info *lfi) {
89 unsigned char blim = *lfi->blim;
90 unsigned char lim = *lfi->lim;
91 unsigned char hev_thr = *lfi->hev_thr;
92
93 vp8_loop_filter_vertical_edge_y_neon(y_ptr + 4, y_stride, blim, lim, hev_thr);
94 vp8_loop_filter_vertical_edge_y_neon(y_ptr + 8, y_stride, blim, lim, hev_thr);
95 vp8_loop_filter_vertical_edge_y_neon(y_ptr + 12, y_stride, blim, lim,
96 hev_thr);
97
98 if (u_ptr)
99 vp8_loop_filter_vertical_edge_uv_neon(u_ptr + 4, uv_stride, blim, lim,
100 hev_thr, v_ptr + 4);
101 }
102