Define RDCOST only once
[libvpx.git] / vp8 / encoder / arm / variance_arm.c
blobe77be9f73a18420023bcb2b99ad6619b4cc54c37
1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
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 */
11 #include "vpx_config.h"
12 #include "vp8/encoder/variance.h"
13 #include "vp8/common/filter.h"
14 #include "vp8/common/arm/bilinearfilter_arm.h"
16 #if HAVE_ARMV6
18 unsigned int vp8_sub_pixel_variance8x8_armv6
20 const unsigned char *src_ptr,
21 int src_pixels_per_line,
22 int xoffset,
23 int yoffset,
24 const unsigned char *dst_ptr,
25 int dst_pixels_per_line,
26 unsigned int *sse
29 unsigned short first_pass[10*8];
30 unsigned char second_pass[8*8];
31 const short *HFilter, *VFilter;
33 HFilter = vp8_bilinear_filters[xoffset];
34 VFilter = vp8_bilinear_filters[yoffset];
36 vp8_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass,
37 src_pixels_per_line,
38 9, 8, HFilter);
39 vp8_filter_block2d_bil_second_pass_armv6(first_pass, second_pass,
40 8, 8, 8, VFilter);
42 return vp8_variance8x8_armv6(second_pass, 8, dst_ptr,
43 dst_pixels_per_line, sse);
46 unsigned int vp8_sub_pixel_variance16x16_armv6
48 const unsigned char *src_ptr,
49 int src_pixels_per_line,
50 int xoffset,
51 int yoffset,
52 const unsigned char *dst_ptr,
53 int dst_pixels_per_line,
54 unsigned int *sse
57 unsigned short first_pass[36*16];
58 unsigned char second_pass[20*16];
59 const short *HFilter, *VFilter;
60 unsigned int var;
62 if (xoffset == 4 && yoffset == 0)
64 var = vp8_variance_halfpixvar16x16_h_armv6(src_ptr, src_pixels_per_line,
65 dst_ptr, dst_pixels_per_line, sse);
67 else if (xoffset == 0 && yoffset == 4)
69 var = vp8_variance_halfpixvar16x16_v_armv6(src_ptr, src_pixels_per_line,
70 dst_ptr, dst_pixels_per_line, sse);
72 else if (xoffset == 4 && yoffset == 4)
74 var = vp8_variance_halfpixvar16x16_hv_armv6(src_ptr, src_pixels_per_line,
75 dst_ptr, dst_pixels_per_line, sse);
77 else
79 HFilter = vp8_bilinear_filters[xoffset];
80 VFilter = vp8_bilinear_filters[yoffset];
82 vp8_filter_block2d_bil_first_pass_armv6(src_ptr, first_pass,
83 src_pixels_per_line,
84 17, 16, HFilter);
85 vp8_filter_block2d_bil_second_pass_armv6(first_pass, second_pass,
86 16, 16, 16, VFilter);
88 var = vp8_variance16x16_armv6(second_pass, 16, dst_ptr,
89 dst_pixels_per_line, sse);
91 return var;
94 #endif /* HAVE_ARMV6 */
97 #if HAVE_ARMV7
99 unsigned int vp8_sub_pixel_variance16x16_neon
101 const unsigned char *src_ptr,
102 int src_pixels_per_line,
103 int xoffset,
104 int yoffset,
105 const unsigned char *dst_ptr,
106 int dst_pixels_per_line,
107 unsigned int *sse
110 if (xoffset == 4 && yoffset == 0)
111 return vp8_variance_halfpixvar16x16_h_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
112 else if (xoffset == 0 && yoffset == 4)
113 return vp8_variance_halfpixvar16x16_v_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
114 else if (xoffset == 4 && yoffset == 4)
115 return vp8_variance_halfpixvar16x16_hv_neon(src_ptr, src_pixels_per_line, dst_ptr, dst_pixels_per_line, sse);
116 else
117 return vp8_sub_pixel_variance16x16_neon_func(src_ptr, src_pixels_per_line, xoffset, yoffset, dst_ptr, dst_pixels_per_line, sse);
120 #endif