Fix TEXTRELs in the ARM asm.
[profile/ivi/libvpx.git] / vp8 / common / arm / filter_arm.c
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
12 #include "vpx_config.h"
13 #include "vpx_rtcd.h"
14 #include <math.h>
15 #include "vp8/common/filter.h"
16 #include "vpx_ports/mem.h"
17
18 extern void vp8_filter_block2d_first_pass_armv6
19 (
20     unsigned char *src_ptr,
21     short         *output_ptr,
22     unsigned int src_pixels_per_line,
23     unsigned int output_width,
24     unsigned int output_height,
25     const short *vp8_filter
26 );
27
28 // 8x8
29 extern void vp8_filter_block2d_first_pass_8x8_armv6
30 (
31     unsigned char *src_ptr,
32     short         *output_ptr,
33     unsigned int src_pixels_per_line,
34     unsigned int output_width,
35     unsigned int output_height,
36     const short *vp8_filter
37 );
38
39 // 16x16
40 extern void vp8_filter_block2d_first_pass_16x16_armv6
41 (
42     unsigned char *src_ptr,
43     short         *output_ptr,
44     unsigned int src_pixels_per_line,
45     unsigned int output_width,
46     unsigned int output_height,
47     const short *vp8_filter
48 );
49
50 extern void vp8_filter_block2d_second_pass_armv6
51 (
52     short         *src_ptr,
53     unsigned char *output_ptr,
54     unsigned int output_pitch,
55     unsigned int cnt,
56     const short *vp8_filter
57 );
58
59 extern void vp8_filter4_block2d_second_pass_armv6
60 (
61     short         *src_ptr,
62     unsigned char *output_ptr,
63     unsigned int output_pitch,
64     unsigned int cnt,
65     const short *vp8_filter
66 );
67
68 extern void vp8_filter_block2d_first_pass_only_armv6
69 (
70     unsigned char *src_ptr,
71     unsigned char *output_ptr,
72     unsigned int src_pixels_per_line,
73     unsigned int cnt,
74     unsigned int output_pitch,
75     const short *vp8_filter
76 );
77
78
79 extern void vp8_filter_block2d_second_pass_only_armv6
80 (
81     unsigned char *src_ptr,
82     unsigned char *output_ptr,
83     unsigned int src_pixels_per_line,
84     unsigned int cnt,
85     unsigned int output_pitch,
86     const short *vp8_filter
87 );
88
89 #if HAVE_MEDIA
90 void vp8_sixtap_predict4x4_armv6
91 (
92     unsigned char  *src_ptr,
93     int  src_pixels_per_line,
94     int  xoffset,
95     int  yoffset,
96     unsigned char *dst_ptr,
97     int  dst_pitch
98 )
99 {
100     const short  *HFilter;
101     const short  *VFilter;
102     DECLARE_ALIGNED_ARRAY(4, short, FData, 12*4); /* Temp data buffer used in filtering */
103
104
105     HFilter = vp8_sub_pel_filters[xoffset];   /* 6 tap */
106     VFilter = vp8_sub_pel_filters[yoffset];   /* 6 tap */
107
108     /* Vfilter is null. First pass only */
109     if (xoffset && !yoffset)
110     {
111         /*vp8_filter_block2d_first_pass_armv6 ( src_ptr, FData+2, src_pixels_per_line, 4, 4, HFilter );
112         vp8_filter_block2d_second_pass_armv6 ( FData+2, dst_ptr, dst_pitch, 4, VFilter );*/
113
114         vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 4, dst_pitch, HFilter);
115     }
116     /* Hfilter is null. Second pass only */
117     else if (!xoffset && yoffset)
118     {
119         vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 4, dst_pitch, VFilter);
120     }
121     else
122     {
123         /* Vfilter is a 4 tap filter */
124         if (yoffset & 0x1)
125         {
126             vp8_filter_block2d_first_pass_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 4, 7, HFilter);
127             vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 4, VFilter);
128         }
129         /* Vfilter is 6 tap filter */
130         else
131         {
132             vp8_filter_block2d_first_pass_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 4, 9, HFilter);
133             vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 4, VFilter);
134         }
135     }
136 }
137
138 void vp8_sixtap_predict8x8_armv6
139 (
140     unsigned char  *src_ptr,
141     int  src_pixels_per_line,
142     int  xoffset,
143     int  yoffset,
144     unsigned char *dst_ptr,
145     int  dst_pitch
146 )
147 {
148     const short  *HFilter;
149     const short  *VFilter;
150     DECLARE_ALIGNED_ARRAY(4, short, FData, 16*8); /* Temp data buffer used in filtering */
151
152     HFilter = vp8_sub_pel_filters[xoffset];   /* 6 tap */
153     VFilter = vp8_sub_pel_filters[yoffset];   /* 6 tap */
154
155     if (xoffset && !yoffset)
156     {
157         vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, HFilter);
158     }
159     /* Hfilter is null. Second pass only */
160     else if (!xoffset && yoffset)
161     {
162         vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 8, dst_pitch, VFilter);
163     }
164     else
165     {
166         if (yoffset & 0x1)
167         {
168             vp8_filter_block2d_first_pass_8x8_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 8, 11, HFilter);
169             vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 8, VFilter);
170         }
171         else
172         {
173             vp8_filter_block2d_first_pass_8x8_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 8, 13, HFilter);
174             vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 8, VFilter);
175         }
176     }
177 }
178
179
180 void vp8_sixtap_predict16x16_armv6
181 (
182     unsigned char  *src_ptr,
183     int  src_pixels_per_line,
184     int  xoffset,
185     int  yoffset,
186     unsigned char *dst_ptr,
187     int  dst_pitch
188 )
189 {
190     const short  *HFilter;
191     const short  *VFilter;
192     DECLARE_ALIGNED_ARRAY(4, short, FData, 24*16);    /* Temp data buffer used in filtering */
193
194     HFilter = vp8_sub_pel_filters[xoffset];   /* 6 tap */
195     VFilter = vp8_sub_pel_filters[yoffset];   /* 6 tap */
196
197     if (xoffset && !yoffset)
198     {
199         vp8_filter_block2d_first_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 16, dst_pitch, HFilter);
200     }
201     /* Hfilter is null. Second pass only */
202     else if (!xoffset && yoffset)
203     {
204         vp8_filter_block2d_second_pass_only_armv6(src_ptr, dst_ptr, src_pixels_per_line, 16, dst_pitch, VFilter);
205     }
206     else
207     {
208         if (yoffset & 0x1)
209         {
210             vp8_filter_block2d_first_pass_16x16_armv6(src_ptr - src_pixels_per_line, FData + 1, src_pixels_per_line, 16, 19, HFilter);
211             vp8_filter4_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 16, VFilter);
212         }
213         else
214         {
215             vp8_filter_block2d_first_pass_16x16_armv6(src_ptr - (2 * src_pixels_per_line), FData, src_pixels_per_line, 16, 21, HFilter);
216             vp8_filter_block2d_second_pass_armv6(FData + 2, dst_ptr, dst_pitch, 16, VFilter);
217         }
218     }
219
220 }
221 #endif