• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef VARIANCE_H
13 #define VARIANCE_H
14 
15 #define prototype_sad(sym)\
16     unsigned int (sym)\
17     (\
18      const unsigned char *src_ptr, \
19      int source_stride, \
20      const unsigned char *ref_ptr, \
21      int  ref_stride, \
22      int max_sad\
23     )
24 
25 #define prototype_sad_multi_same_address(sym)\
26     void (sym)\
27     (\
28      const unsigned char *src_ptr, \
29      int source_stride, \
30      const unsigned char *ref_ptr, \
31      int  ref_stride, \
32      unsigned int *sad_array\
33     )
34 
35 #define prototype_sad_multi_same_address_1(sym)\
36     void (sym)\
37     (\
38      const unsigned char *src_ptr, \
39      int source_stride, \
40      const unsigned char *ref_ptr, \
41      int  ref_stride, \
42      unsigned short *sad_array\
43     )
44 
45 #define prototype_sad_multi_dif_address(sym)\
46     void (sym)\
47     (\
48      const unsigned char *src_ptr, \
49      int source_stride, \
50      unsigned char *ref_ptr[4], \
51      int  ref_stride, \
52      unsigned int *sad_array\
53     )
54 
55 #define prototype_variance(sym) \
56     unsigned int (sym) \
57     (\
58      const unsigned char *src_ptr, \
59      int source_stride, \
60      const unsigned char *ref_ptr, \
61      int  ref_stride, \
62      unsigned int *sse\
63     )
64 
65 #define prototype_variance2(sym) \
66     unsigned int (sym) \
67     (\
68      const unsigned char *src_ptr, \
69      int source_stride, \
70      const unsigned char *ref_ptr, \
71      int  ref_stride, \
72      unsigned int *sse,\
73      int *sum\
74     )
75 
76 #define prototype_subpixvariance(sym) \
77     unsigned int (sym) \
78     ( \
79       const unsigned char  *src_ptr, \
80       int  source_stride, \
81       int  xoffset, \
82       int  yoffset, \
83       const unsigned char *ref_ptr, \
84       int Refstride, \
85       unsigned int *sse \
86     );
87 
88 
89 #define prototype_getmbss(sym) unsigned int (sym)(const short *)
90 
91 #if ARCH_X86 || ARCH_X86_64
92 #include "x86/variance_x86.h"
93 #endif
94 
95 #if ARCH_ARM
96 #include "arm/variance_arm.h"
97 #endif
98 
99 #ifndef vp8_variance_sad4x4
100 #define vp8_variance_sad4x4 vp8_sad4x4_c
101 #endif
102 extern prototype_sad(vp8_variance_sad4x4);
103 
104 #ifndef vp8_variance_sad8x8
105 #define vp8_variance_sad8x8 vp8_sad8x8_c
106 #endif
107 extern prototype_sad(vp8_variance_sad8x8);
108 
109 #ifndef vp8_variance_sad8x16
110 #define vp8_variance_sad8x16 vp8_sad8x16_c
111 #endif
112 extern prototype_sad(vp8_variance_sad8x16);
113 
114 #ifndef vp8_variance_sad16x8
115 #define vp8_variance_sad16x8 vp8_sad16x8_c
116 #endif
117 extern prototype_sad(vp8_variance_sad16x8);
118 
119 #ifndef vp8_variance_sad16x16
120 #define vp8_variance_sad16x16 vp8_sad16x16_c
121 #endif
122 extern prototype_sad(vp8_variance_sad16x16);
123 
124 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
125 
126 #ifndef vp8_variance_sad16x16x3
127 #define vp8_variance_sad16x16x3 vp8_sad16x16x3_c
128 #endif
129 extern prototype_sad_multi_same_address(vp8_variance_sad16x16x3);
130 
131 #ifndef vp8_variance_sad16x8x3
132 #define vp8_variance_sad16x8x3 vp8_sad16x8x3_c
133 #endif
134 extern prototype_sad_multi_same_address(vp8_variance_sad16x8x3);
135 
136 #ifndef vp8_variance_sad8x8x3
137 #define vp8_variance_sad8x8x3 vp8_sad8x8x3_c
138 #endif
139 extern prototype_sad_multi_same_address(vp8_variance_sad8x8x3);
140 
141 #ifndef vp8_variance_sad8x16x3
142 #define vp8_variance_sad8x16x3 vp8_sad8x16x3_c
143 #endif
144 extern prototype_sad_multi_same_address(vp8_variance_sad8x16x3);
145 
146 #ifndef vp8_variance_sad4x4x3
147 #define vp8_variance_sad4x4x3 vp8_sad4x4x3_c
148 #endif
149 extern prototype_sad_multi_same_address(vp8_variance_sad4x4x3);
150 
151 #ifndef vp8_variance_sad16x16x8
152 #define vp8_variance_sad16x16x8 vp8_sad16x16x8_c
153 #endif
154 extern prototype_sad_multi_same_address_1(vp8_variance_sad16x16x8);
155 
156 #ifndef vp8_variance_sad16x8x8
157 #define vp8_variance_sad16x8x8 vp8_sad16x8x8_c
158 #endif
159 extern prototype_sad_multi_same_address_1(vp8_variance_sad16x8x8);
160 
161 #ifndef vp8_variance_sad8x8x8
162 #define vp8_variance_sad8x8x8 vp8_sad8x8x8_c
163 #endif
164 extern prototype_sad_multi_same_address_1(vp8_variance_sad8x8x8);
165 
166 #ifndef vp8_variance_sad8x16x8
167 #define vp8_variance_sad8x16x8 vp8_sad8x16x8_c
168 #endif
169 extern prototype_sad_multi_same_address_1(vp8_variance_sad8x16x8);
170 
171 #ifndef vp8_variance_sad4x4x8
172 #define vp8_variance_sad4x4x8 vp8_sad4x4x8_c
173 #endif
174 extern prototype_sad_multi_same_address_1(vp8_variance_sad4x4x8);
175 
176 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
177 
178 #ifndef vp8_variance_sad16x16x4d
179 #define vp8_variance_sad16x16x4d vp8_sad16x16x4d_c
180 #endif
181 extern prototype_sad_multi_dif_address(vp8_variance_sad16x16x4d);
182 
183 #ifndef vp8_variance_sad16x8x4d
184 #define vp8_variance_sad16x8x4d vp8_sad16x8x4d_c
185 #endif
186 extern prototype_sad_multi_dif_address(vp8_variance_sad16x8x4d);
187 
188 #ifndef vp8_variance_sad8x8x4d
189 #define vp8_variance_sad8x8x4d vp8_sad8x8x4d_c
190 #endif
191 extern prototype_sad_multi_dif_address(vp8_variance_sad8x8x4d);
192 
193 #ifndef vp8_variance_sad8x16x4d
194 #define vp8_variance_sad8x16x4d vp8_sad8x16x4d_c
195 #endif
196 extern prototype_sad_multi_dif_address(vp8_variance_sad8x16x4d);
197 
198 #ifndef vp8_variance_sad4x4x4d
199 #define vp8_variance_sad4x4x4d vp8_sad4x4x4d_c
200 #endif
201 extern prototype_sad_multi_dif_address(vp8_variance_sad4x4x4d);
202 
203 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
204 
205 #ifndef vp8_variance_var4x4
206 #define vp8_variance_var4x4 vp8_variance4x4_c
207 #endif
208 extern prototype_variance(vp8_variance_var4x4);
209 
210 #ifndef vp8_variance_var8x8
211 #define vp8_variance_var8x8 vp8_variance8x8_c
212 #endif
213 extern prototype_variance(vp8_variance_var8x8);
214 
215 #ifndef vp8_variance_var8x16
216 #define vp8_variance_var8x16 vp8_variance8x16_c
217 #endif
218 extern prototype_variance(vp8_variance_var8x16);
219 
220 #ifndef vp8_variance_var16x8
221 #define vp8_variance_var16x8 vp8_variance16x8_c
222 #endif
223 extern prototype_variance(vp8_variance_var16x8);
224 
225 #ifndef vp8_variance_var16x16
226 #define vp8_variance_var16x16 vp8_variance16x16_c
227 #endif
228 extern prototype_variance(vp8_variance_var16x16);
229 
230 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
231 
232 #ifndef vp8_variance_subpixvar4x4
233 #define vp8_variance_subpixvar4x4 vp8_sub_pixel_variance4x4_c
234 #endif
235 extern prototype_subpixvariance(vp8_variance_subpixvar4x4);
236 
237 #ifndef vp8_variance_subpixvar8x8
238 #define vp8_variance_subpixvar8x8 vp8_sub_pixel_variance8x8_c
239 #endif
240 extern prototype_subpixvariance(vp8_variance_subpixvar8x8);
241 
242 #ifndef vp8_variance_subpixvar8x16
243 #define vp8_variance_subpixvar8x16 vp8_sub_pixel_variance8x16_c
244 #endif
245 extern prototype_subpixvariance(vp8_variance_subpixvar8x16);
246 
247 #ifndef vp8_variance_subpixvar16x8
248 #define vp8_variance_subpixvar16x8 vp8_sub_pixel_variance16x8_c
249 #endif
250 extern prototype_subpixvariance(vp8_variance_subpixvar16x8);
251 
252 #ifndef vp8_variance_subpixvar16x16
253 #define vp8_variance_subpixvar16x16 vp8_sub_pixel_variance16x16_c
254 #endif
255 extern prototype_subpixvariance(vp8_variance_subpixvar16x16);
256 
257 #ifndef vp8_variance_halfpixvar16x16_h
258 #define vp8_variance_halfpixvar16x16_h vp8_variance_halfpixvar16x16_h_c
259 #endif
260 extern prototype_variance(vp8_variance_halfpixvar16x16_h);
261 
262 #ifndef vp8_variance_halfpixvar16x16_v
263 #define vp8_variance_halfpixvar16x16_v vp8_variance_halfpixvar16x16_v_c
264 #endif
265 extern prototype_variance(vp8_variance_halfpixvar16x16_v);
266 
267 #ifndef vp8_variance_halfpixvar16x16_hv
268 #define vp8_variance_halfpixvar16x16_hv vp8_variance_halfpixvar16x16_hv_c
269 #endif
270 extern prototype_variance(vp8_variance_halfpixvar16x16_hv);
271 
272 #ifndef vp8_variance_subpixmse16x16
273 #define vp8_variance_subpixmse16x16 vp8_sub_pixel_mse16x16_c
274 #endif
275 extern prototype_subpixvariance(vp8_variance_subpixmse16x16);
276 
277 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
278 
279 #ifndef vp8_variance_getmbss
280 #define vp8_variance_getmbss vp8_get_mb_ss_c
281 #endif
282 extern prototype_getmbss(vp8_variance_getmbss);
283 
284 #ifndef vp8_variance_mse16x16
285 #define vp8_variance_mse16x16 vp8_mse16x16_c
286 #endif
287 extern prototype_variance(vp8_variance_mse16x16);
288 
289 #ifndef vp8_variance_get16x16prederror
290 #define vp8_variance_get16x16prederror vp8_get16x16pred_error_c
291 #endif
292 extern prototype_sad(vp8_variance_get16x16prederror);
293 
294 #ifndef vp8_variance_get8x8var
295 #define vp8_variance_get8x8var vp8_get8x8var_c
296 #endif
297 extern prototype_variance2(vp8_variance_get8x8var);
298 
299 #ifndef vp8_variance_get16x16var
300 #define vp8_variance_get16x16var vp8_get16x16var_c
301 #endif
302 extern prototype_variance2(vp8_variance_get16x16var);
303 
304 #ifndef vp8_variance_get4x4sse_cs
305 #define vp8_variance_get4x4sse_cs vp8_get4x4sse_cs_c
306 #endif
307 extern prototype_sad(vp8_variance_get4x4sse_cs);
308 
309 
310 typedef prototype_sad(*vp8_sad_fn_t);
311 typedef prototype_sad_multi_same_address(*vp8_sad_multi_fn_t);
312 typedef prototype_sad_multi_same_address_1(*vp8_sad_multi1_fn_t);
313 typedef prototype_sad_multi_dif_address(*vp8_sad_multi_d_fn_t);
314 typedef prototype_variance(*vp8_variance_fn_t);
315 typedef prototype_variance2(*vp8_variance2_fn_t);
316 typedef prototype_subpixvariance(*vp8_subpixvariance_fn_t);
317 typedef prototype_getmbss(*vp8_getmbss_fn_t);
318 typedef struct
319 {
320     vp8_sad_fn_t             sad4x4;
321     vp8_sad_fn_t             sad8x8;
322     vp8_sad_fn_t             sad8x16;
323     vp8_sad_fn_t             sad16x8;
324     vp8_sad_fn_t             sad16x16;
325 
326     vp8_variance_fn_t        var4x4;
327     vp8_variance_fn_t        var8x8;
328     vp8_variance_fn_t        var8x16;
329     vp8_variance_fn_t        var16x8;
330     vp8_variance_fn_t        var16x16;
331 
332     vp8_subpixvariance_fn_t  subpixvar4x4;
333     vp8_subpixvariance_fn_t  subpixvar8x8;
334     vp8_subpixvariance_fn_t  subpixvar8x16;
335     vp8_subpixvariance_fn_t  subpixvar16x8;
336     vp8_subpixvariance_fn_t  subpixvar16x16;
337     vp8_variance_fn_t        halfpixvar16x16_h;
338     vp8_variance_fn_t        halfpixvar16x16_v;
339     vp8_variance_fn_t        halfpixvar16x16_hv;
340     vp8_subpixvariance_fn_t  subpixmse16x16;
341 
342     vp8_getmbss_fn_t         getmbss;
343     vp8_variance_fn_t        mse16x16;
344 
345     vp8_sad_fn_t             get16x16prederror;
346     vp8_variance2_fn_t       get8x8var;
347     vp8_variance2_fn_t       get16x16var;
348     vp8_sad_fn_t             get4x4sse_cs;
349 
350     vp8_sad_multi_fn_t       sad16x16x3;
351     vp8_sad_multi_fn_t       sad16x8x3;
352     vp8_sad_multi_fn_t       sad8x16x3;
353     vp8_sad_multi_fn_t       sad8x8x3;
354     vp8_sad_multi_fn_t       sad4x4x3;
355 
356     vp8_sad_multi1_fn_t      sad16x16x8;
357     vp8_sad_multi1_fn_t      sad16x8x8;
358     vp8_sad_multi1_fn_t      sad8x16x8;
359     vp8_sad_multi1_fn_t      sad8x8x8;
360     vp8_sad_multi1_fn_t      sad4x4x8;
361 
362     vp8_sad_multi_d_fn_t     sad16x16x4d;
363     vp8_sad_multi_d_fn_t     sad16x8x4d;
364     vp8_sad_multi_d_fn_t     sad8x16x4d;
365     vp8_sad_multi_d_fn_t     sad8x8x4d;
366     vp8_sad_multi_d_fn_t     sad4x4x4d;
367 
368 } vp8_variance_rtcd_vtable_t;
369 
370 typedef struct
371 {
372     vp8_sad_fn_t            sdf;
373     vp8_variance_fn_t       vf;
374     vp8_subpixvariance_fn_t svf;
375     vp8_variance_fn_t       svf_halfpix_h;
376     vp8_variance_fn_t       svf_halfpix_v;
377     vp8_variance_fn_t       svf_halfpix_hv;
378     vp8_sad_multi_fn_t      sdx3f;
379     vp8_sad_multi1_fn_t     sdx8f;
380     vp8_sad_multi_d_fn_t    sdx4df;
381 } vp8_variance_fn_ptr_t;
382 
383 #if CONFIG_RUNTIME_CPU_DETECT
384 #define VARIANCE_INVOKE(ctx,fn) (ctx)->fn
385 #else
386 #define VARIANCE_INVOKE(ctx,fn) vp8_variance_##fn
387 #endif
388 
389 #endif
390