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.
12 #include "vp8/encoder/variance.h"
13 #include "vp8/common/pragmas.h"
14 #include "vpx_ports/mem.h"
16 extern unsigned int vp8_get16x16var_sse2
18 const unsigned char *src_ptr
,
20 const unsigned char *ref_ptr
,
25 extern void vp8_half_horiz_vert_variance16x_h_sse2
27 const unsigned char *ref_ptr
,
28 int ref_pixels_per_line
,
29 const unsigned char *src_ptr
,
30 int src_pixels_per_line
,
33 unsigned int *sumsquared
35 extern void vp8_half_horiz_variance16x_h_sse2
37 const unsigned char *ref_ptr
,
38 int ref_pixels_per_line
,
39 const unsigned char *src_ptr
,
40 int src_pixels_per_line
,
43 unsigned int *sumsquared
45 extern void vp8_half_vert_variance16x_h_sse2
47 const unsigned char *ref_ptr
,
48 int ref_pixels_per_line
,
49 const unsigned char *src_ptr
,
50 int src_pixels_per_line
,
53 unsigned int *sumsquared
55 extern void vp8_filter_block2d_bil_var_ssse3
57 const unsigned char *ref_ptr
,
58 int ref_pixels_per_line
,
59 const unsigned char *src_ptr
,
60 int src_pixels_per_line
,
65 unsigned int *sumsquared
68 unsigned int vp8_sub_pixel_variance16x16_ssse3
70 const unsigned char *src_ptr
,
71 int src_pixels_per_line
,
74 const unsigned char *dst_ptr
,
75 int dst_pixels_per_line
,
82 // note we could avoid these if statements if the calling function
83 // just called the appropriate functions inside.
84 if (xoffset
== 4 && yoffset
== 0)
86 vp8_half_horiz_variance16x_h_sse2(
87 src_ptr
, src_pixels_per_line
,
88 dst_ptr
, dst_pixels_per_line
, 16,
91 else if (xoffset
== 0 && yoffset
== 4)
93 vp8_half_vert_variance16x_h_sse2(
94 src_ptr
, src_pixels_per_line
,
95 dst_ptr
, dst_pixels_per_line
, 16,
98 else if (xoffset
== 4 && yoffset
== 4)
100 vp8_half_horiz_vert_variance16x_h_sse2(
101 src_ptr
, src_pixels_per_line
,
102 dst_ptr
, dst_pixels_per_line
, 16,
107 vp8_filter_block2d_bil_var_ssse3(
108 src_ptr
, src_pixels_per_line
,
109 dst_ptr
, dst_pixels_per_line
, 16,
115 return (xxsum0
- ((xsum0
* xsum0
) >> 8));
118 unsigned int vp8_sub_pixel_variance16x8_ssse3
120 const unsigned char *src_ptr
,
121 int src_pixels_per_line
,
124 const unsigned char *dst_ptr
,
125 int dst_pixels_per_line
,
133 if (xoffset
== 4 && yoffset
== 0)
135 vp8_half_horiz_variance16x_h_sse2(
136 src_ptr
, src_pixels_per_line
,
137 dst_ptr
, dst_pixels_per_line
, 8,
140 else if (xoffset
== 0 && yoffset
== 4)
142 vp8_half_vert_variance16x_h_sse2(
143 src_ptr
, src_pixels_per_line
,
144 dst_ptr
, dst_pixels_per_line
, 8,
147 else if (xoffset
== 4 && yoffset
== 4)
149 vp8_half_horiz_vert_variance16x_h_sse2(
150 src_ptr
, src_pixels_per_line
,
151 dst_ptr
, dst_pixels_per_line
, 8,
156 vp8_filter_block2d_bil_var_ssse3(
157 src_ptr
, src_pixels_per_line
,
158 dst_ptr
, dst_pixels_per_line
, 8,
164 return (xxsum0
- ((xsum0
* xsum0
) >> 7));