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#ifndef VP9_ENCODER_VP9_VARIANCE_H_
12#define VP9_ENCODER_VP9_VARIANCE_H_
13
14#include "vpx/vpx_integer.h"
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20void variance(const uint8_t *a, int a_stride,
21              const uint8_t *b, int b_stride,
22              int  w, int  h,
23              unsigned int *sse, int *sum);
24
25typedef unsigned int(*vp9_sad_fn_t)(const uint8_t *src_ptr,
26                                    int source_stride,
27                                    const uint8_t *ref_ptr,
28                                    int ref_stride,
29                                    unsigned int max_sad);
30
31typedef unsigned int(*vp9_sad_avg_fn_t)(const uint8_t *src_ptr,
32                                        int source_stride,
33                                        const uint8_t *ref_ptr,
34                                        int ref_stride,
35                                        const uint8_t *second_pred,
36                                        unsigned int max_sad);
37
38typedef void (*vp9_sad_multi_fn_t)(const uint8_t *src_ptr,
39                                   int source_stride,
40                                   const uint8_t *ref_ptr,
41                                   int  ref_stride,
42                                   unsigned int *sad_array);
43
44typedef void (*vp9_sad_multi_d_fn_t)(const uint8_t *src_ptr,
45                                     int source_stride,
46                                     const uint8_t* const ref_ptr[],
47                                     int  ref_stride, unsigned int *sad_array);
48
49typedef unsigned int (*vp9_variance_fn_t)(const uint8_t *src_ptr,
50                                          int source_stride,
51                                          const uint8_t *ref_ptr,
52                                          int ref_stride,
53                                          unsigned int *sse);
54
55typedef unsigned int (*vp9_subpixvariance_fn_t)(const uint8_t *src_ptr,
56                                                int source_stride,
57                                                int xoffset,
58                                                int yoffset,
59                                                const uint8_t *ref_ptr,
60                                                int Refstride,
61                                                unsigned int *sse);
62
63typedef unsigned int (*vp9_subp_avg_variance_fn_t)(const uint8_t *src_ptr,
64                                                   int source_stride,
65                                                   int xoffset,
66                                                   int yoffset,
67                                                   const uint8_t *ref_ptr,
68                                                   int Refstride,
69                                                   unsigned int *sse,
70                                                   const uint8_t *second_pred);
71
72typedef struct vp9_variance_vtable {
73  vp9_sad_fn_t               sdf;
74  vp9_sad_avg_fn_t           sdaf;
75  vp9_variance_fn_t          vf;
76  vp9_subpixvariance_fn_t    svf;
77  vp9_subp_avg_variance_fn_t svaf;
78  vp9_sad_multi_fn_t         sdx3f;
79  vp9_sad_multi_fn_t         sdx8f;
80  vp9_sad_multi_d_fn_t       sdx4df;
81} vp9_variance_fn_ptr_t;
82
83void vp9_comp_avg_pred(uint8_t *comp_pred, const uint8_t *pred, int width,
84                       int height, const uint8_t *ref, int ref_stride);
85
86#ifdef __cplusplus
87}  // extern "C"
88#endif
89
90#endif  // VP9_ENCODER_VP9_VARIANCE_H_
91