loopfilter_arm.c 7.46 KB
Newer Older
John Koleszar's avatar
John Koleszar committed
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar's avatar
John Koleszar committed
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
6
 *  that can be found in the LICENSE file in the root of the source
 *  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.
John Koleszar's avatar
John Koleszar committed
9
10
11
 */


12
#include "vpx_config.h"
John Koleszar's avatar
John Koleszar committed
13
14
#include "vp8/common/loopfilter.h"
#include "vp8/common/onyxc_int.h"
John Koleszar's avatar
John Koleszar committed
15

16
#if HAVE_ARMV6
17
18
19
20
extern prototype_loopfilter(vp9_loop_filter_horizontal_edge_armv6);
extern prototype_loopfilter(vp9_loop_filter_vertical_edge_armv6);
extern prototype_loopfilter(vp9_mbloop_filter_horizontal_edge_armv6);
extern prototype_loopfilter(vp9_mbloop_filter_vertical_edge_armv6);
21
#endif
John Koleszar's avatar
John Koleszar committed
22

23
24
#if HAVE_ARMV7
typedef void loopfilter_y_neon(unsigned char *src, int pitch,
John Koleszar's avatar
John Koleszar committed
25
                               unsigned char blimit, unsigned char limit, unsigned char thresh);
26
typedef void loopfilter_uv_neon(unsigned char *u, int pitch,
John Koleszar's avatar
John Koleszar committed
27
28
                                unsigned char blimit, unsigned char limit, unsigned char thresh,
                                unsigned char *v);
29

30
31
32
33
extern loopfilter_y_neon vp9_loop_filter_horizontal_edge_y_neon;
extern loopfilter_y_neon vp9_loop_filter_vertical_edge_y_neon;
extern loopfilter_y_neon vp9_mbloop_filter_horizontal_edge_y_neon;
extern loopfilter_y_neon vp9_mbloop_filter_vertical_edge_y_neon;
34

35
36
37
38
extern loopfilter_uv_neon vp9_loop_filter_horizontal_edge_uv_neon;
extern loopfilter_uv_neon vp9_loop_filter_vertical_edge_uv_neon;
extern loopfilter_uv_neon vp9_mbloop_filter_horizontal_edge_uv_neon;
extern loopfilter_uv_neon vp9_mbloop_filter_vertical_edge_uv_neon;
39
#endif
John Koleszar's avatar
John Koleszar committed
40
41

#if HAVE_ARMV6
42
43
/*ARMV6 loopfilter functions*/
/* Horizontal MB filtering */
44
void vp9_loop_filter_mbh_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
John Koleszar's avatar
John Koleszar committed
45
                               int y_stride, int uv_stride, loop_filter_info *lfi) {
46
  vp9_mbloop_filter_horizontal_edge_armv6(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
John Koleszar's avatar
John Koleszar committed
47

John Koleszar's avatar
John Koleszar committed
48
  if (u_ptr)
49
    vp9_mbloop_filter_horizontal_edge_armv6(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
John Koleszar's avatar
John Koleszar committed
50

John Koleszar's avatar
John Koleszar committed
51
  if (v_ptr)
52
    vp9_mbloop_filter_horizontal_edge_armv6(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
John Koleszar's avatar
John Koleszar committed
53
54
}

55
/* Vertical MB Filtering */
56
void vp9_loop_filter_mbv_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
John Koleszar's avatar
John Koleszar committed
57
                               int y_stride, int uv_stride, loop_filter_info *lfi) {
58
  vp9_mbloop_filter_vertical_edge_armv6(y_ptr, y_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 2);
John Koleszar's avatar
John Koleszar committed
59

John Koleszar's avatar
John Koleszar committed
60
  if (u_ptr)
61
    vp9_mbloop_filter_vertical_edge_armv6(u_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
John Koleszar's avatar
John Koleszar committed
62

John Koleszar's avatar
John Koleszar committed
63
  if (v_ptr)
64
    vp9_mbloop_filter_vertical_edge_armv6(v_ptr, uv_stride, lfi->mblim, lfi->lim, lfi->hev_thr, 1);
John Koleszar's avatar
John Koleszar committed
65
66
}

67
/* Horizontal B Filtering */
68
void vp9_loop_filter_bh_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
John Koleszar's avatar
John Koleszar committed
69
                              int y_stride, int uv_stride, loop_filter_info *lfi) {
70
71
72
  vp9_loop_filter_horizontal_edge_armv6(y_ptr + 4 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
  vp9_loop_filter_horizontal_edge_armv6(y_ptr + 8 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
  vp9_loop_filter_horizontal_edge_armv6(y_ptr + 12 * y_stride, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
John Koleszar's avatar
John Koleszar committed
73

John Koleszar's avatar
John Koleszar committed
74
  if (u_ptr)
75
    vp9_loop_filter_horizontal_edge_armv6(u_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
John Koleszar's avatar
John Koleszar committed
76

John Koleszar's avatar
John Koleszar committed
77
  if (v_ptr)
78
    vp9_loop_filter_horizontal_edge_armv6(v_ptr + 4 * uv_stride, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
John Koleszar's avatar
John Koleszar committed
79
80
}

81
void vp9_loop_filter_bhs_armv6(unsigned char *y_ptr, int y_stride,
John Koleszar's avatar
John Koleszar committed
82
                               const unsigned char *blimit) {
83
84
85
  vp9_loop_filter_simple_horizontal_edge_armv6(y_ptr + 4 * y_stride, y_stride, blimit);
  vp9_loop_filter_simple_horizontal_edge_armv6(y_ptr + 8 * y_stride, y_stride, blimit);
  vp9_loop_filter_simple_horizontal_edge_armv6(y_ptr + 12 * y_stride, y_stride, blimit);
John Koleszar's avatar
John Koleszar committed
86
87
}

88
/* Vertical B Filtering */
89
void vp9_loop_filter_bv_armv6(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
John Koleszar's avatar
John Koleszar committed
90
                              int y_stride, int uv_stride, loop_filter_info *lfi) {
91
92
93
  vp9_loop_filter_vertical_edge_armv6(y_ptr + 4, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
  vp9_loop_filter_vertical_edge_armv6(y_ptr + 8, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
  vp9_loop_filter_vertical_edge_armv6(y_ptr + 12, y_stride, lfi->blim, lfi->lim, lfi->hev_thr, 2);
John Koleszar's avatar
John Koleszar committed
94

John Koleszar's avatar
John Koleszar committed
95
  if (u_ptr)
96
    vp9_loop_filter_vertical_edge_armv6(u_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
John Koleszar's avatar
John Koleszar committed
97

John Koleszar's avatar
John Koleszar committed
98
  if (v_ptr)
99
    vp9_loop_filter_vertical_edge_armv6(v_ptr + 4, uv_stride, lfi->blim, lfi->lim, lfi->hev_thr, 1);
John Koleszar's avatar
John Koleszar committed
100
101
}

102
void vp9_loop_filter_bvs_armv6(unsigned char *y_ptr, int y_stride,
John Koleszar's avatar
John Koleszar committed
103
                               const unsigned char *blimit) {
104
105
106
  vp9_loop_filter_simple_vertical_edge_armv6(y_ptr + 4, y_stride, blimit);
  vp9_loop_filter_simple_vertical_edge_armv6(y_ptr + 8, y_stride, blimit);
  vp9_loop_filter_simple_vertical_edge_armv6(y_ptr + 12, y_stride, blimit);
John Koleszar's avatar
John Koleszar committed
107
108
109
110
}
#endif

#if HAVE_ARMV7
111
112
/* NEON loopfilter functions */
/* Horizontal MB filtering */
113
void vp9_loop_filter_mbh_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
John Koleszar's avatar
John Koleszar committed
114
115
116
117
                              int y_stride, int uv_stride, loop_filter_info *lfi) {
  unsigned char mblim = *lfi->mblim;
  unsigned char lim = *lfi->lim;
  unsigned char hev_thr = *lfi->hev_thr;
118
  vp9_mbloop_filter_horizontal_edge_y_neon(y_ptr, y_stride, mblim, lim, hev_thr);
John Koleszar's avatar
John Koleszar committed
119
120

  if (u_ptr)
121
    vp9_mbloop_filter_horizontal_edge_uv_neon(u_ptr, uv_stride, mblim, lim, hev_thr, v_ptr);
John Koleszar's avatar
John Koleszar committed
122
123
}

124
/* Vertical MB Filtering */
125
void vp9_loop_filter_mbv_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
John Koleszar's avatar
John Koleszar committed
126
127
128
129
                              int y_stride, int uv_stride, loop_filter_info *lfi) {
  unsigned char mblim = *lfi->mblim;
  unsigned char lim = *lfi->lim;
  unsigned char hev_thr = *lfi->hev_thr;
John Koleszar's avatar
John Koleszar committed
130

131
  vp9_mbloop_filter_vertical_edge_y_neon(y_ptr, y_stride, mblim, lim, hev_thr);
John Koleszar's avatar
John Koleszar committed
132

John Koleszar's avatar
John Koleszar committed
133
  if (u_ptr)
134
    vp9_mbloop_filter_vertical_edge_uv_neon(u_ptr, uv_stride, mblim, lim, hev_thr, v_ptr);
John Koleszar's avatar
John Koleszar committed
135
136
}

137
/* Horizontal B Filtering */
138
void vp9_loop_filter_bh_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
John Koleszar's avatar
John Koleszar committed
139
140
141
142
143
                             int y_stride, int uv_stride, loop_filter_info *lfi) {
  unsigned char blim = *lfi->blim;
  unsigned char lim = *lfi->lim;
  unsigned char hev_thr = *lfi->hev_thr;

144
145
146
  vp9_loop_filter_horizontal_edge_y_neon(y_ptr + 4 * y_stride, y_stride, blim, lim, hev_thr);
  vp9_loop_filter_horizontal_edge_y_neon(y_ptr + 8 * y_stride, y_stride, blim, lim, hev_thr);
  vp9_loop_filter_horizontal_edge_y_neon(y_ptr + 12 * y_stride, y_stride, blim, lim, hev_thr);
John Koleszar's avatar
John Koleszar committed
147
148

  if (u_ptr)
149
    vp9_loop_filter_horizontal_edge_uv_neon(u_ptr + 4 * uv_stride, uv_stride, blim, lim, hev_thr, v_ptr + 4 * uv_stride);
John Koleszar's avatar
John Koleszar committed
150
151
}

152
/* Vertical B Filtering */
153
void vp9_loop_filter_bv_neon(unsigned char *y_ptr, unsigned char *u_ptr, unsigned char *v_ptr,
John Koleszar's avatar
John Koleszar committed
154
155
156
157
158
                             int y_stride, int uv_stride, loop_filter_info *lfi) {
  unsigned char blim = *lfi->blim;
  unsigned char lim = *lfi->lim;
  unsigned char hev_thr = *lfi->hev_thr;

159
160
161
  vp9_loop_filter_vertical_edge_y_neon(y_ptr + 4, y_stride, blim, lim, hev_thr);
  vp9_loop_filter_vertical_edge_y_neon(y_ptr + 8, y_stride, blim, lim, hev_thr);
  vp9_loop_filter_vertical_edge_y_neon(y_ptr + 12, y_stride, blim, lim, hev_thr);
John Koleszar's avatar
John Koleszar committed
162
163

  if (u_ptr)
164
    vp9_loop_filter_vertical_edge_uv_neon(u_ptr + 4, uv_stride, blim, lim, hev_thr, v_ptr + 4);
John Koleszar's avatar
John Koleszar committed
165
166
}
#endif