Fix TEXTRELs in the ARM asm.
[profile/ivi/libvpx.git] / vp8 / common / arm / variance_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 #include "vpx_config.h"
12 #include "vpx_rtcd.h"
13 #include "vp8/common/variance.h"
14 #include "vp8/common/filter.h"
15
16 #if HAVE_MEDIA
17 #include "vp8/common/arm/bilinearfilter_arm.h"
18
19 unsigned int vp8_sub_pixel_variance8x8_armv6
20 (
21     const unsigned char  *src_ptr,
22     int  src_pixels_per_line,
23     int  xoffset,
24     int  yoffset,
25     const unsigned char *dst_ptr,
26     int dst_pixels_per_line,
27     unsigned int *sse
28 )
29 {
30     unsigned short first_pass[10*8];
31     unsigned char  second_pass[8*8];
32     const short *HFilter, *VFilter;
33
34     HFilter = vp8_bilinear_filters[xoffset];
35     VFilter = vp8_bilinear_filters[yoffset];
36
37     vp8_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass,
38                                             src_pixels_per_line,
39                                             9, 8, HFilter);
40     vp8_filter_block2d_bil_second_pass_armv6(first_pass, second_pass,
41                                              8, 8, 8, VFilter);
42
43     return vp8_variance8x8_armv6(second_pass, 8, dst_ptr,
44                                    dst_pixels_per_line, sse);
45 }
46
47 unsigned int vp8_sub_pixel_variance16x16_armv6
48 (
49     const unsigned char  *src_ptr,
50     int  src_pixels_per_line,
51     int  xoffset,
52     int  yoffset,
53     const unsigned char *dst_ptr,
54     int dst_pixels_per_line,
55     unsigned int *sse
56 )
57 {
58     unsigned short first_pass[36*16];
59     unsigned char  second_pass[20*16];
60     const short *HFilter, *VFilter;
61     unsigned int var;
62
63     if (xoffset == 4 && yoffset == 0)
64     {
65         var = vp8_variance_halfpixvar16x16_h_armv6(src_ptr, src_pixels_per_line,
66                                                    dst_ptr, dst_pixels_per_line, sse);
67     }
68     else if (xoffset == 0 && yoffset == 4)
69     {
70         var = vp8_variance_halfpixvar16x16_v_armv6(src_ptr, src_pixels_per_line,
71                                                    dst_ptr, dst_pixels_per_line, sse);
72     }
73     else if (xoffset == 4 && yoffset == 4)
74     {
75         var = vp8_variance_halfpixvar16x16_hv_armv6(src_ptr, src_pixels_per_line,
76                                                    dst_ptr, dst_pixels_per_line, sse);
77     }
78     else
79     {
80         HFilter = vp8_bilinear_filters[xoffset];
81         VFilter = vp8_bilinear_filters[yoffset];
82
83         vp8_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass,
84                                                 src_pixels_per_line,
85                                                 17, 16, HFilter);
86         vp8_filter_block2d_bil_second_pass_armv6(first_pass, second_pass,
87                                                  16, 16, 16, VFilter);
88
89         var = vp8_variance16x16_armv6(second_pass, 16, dst_ptr,
90                                        dst_pixels_per_line, sse);
91     }
92     return var;
93 }
94
95 #endif /* HAVE_MEDIA */
96
97
98 #if HAVE_NEON
99
100 unsigned int vp8_sub_pixel_variance16x16_neon
101 (
102     const unsigned char  *src_ptr,
103     int  src_pixels_per_line,
104     int  xoffset,
105     int  yoffset,
106     const unsigned char *dst_ptr,
107     int dst_pixels_per_line,
108     unsigned int *sse
109 )
110 {
111   if (xoffset == 4 && yoffset == 0)
112     return vp8_variance_halfpixvar16x16_h_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
113   else if (xoffset == 0 && yoffset == 4)
114     return vp8_variance_halfpixvar16x16_v_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
115   else if (xoffset == 4 && yoffset == 4)
116     return vp8_variance_halfpixvar16x16_hv_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
117   else
118     return vp8_sub_pixel_variance16x16_neon_func(src_ptr, src_pixels_per_line, xoffset, yoffset, dst_ptr, dst_pixels_per_line, sse);
119 }
120
121 #endif