variance.h 2.71 KB
Newer Older
Johann's avatar
Johann committed
1
/*
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Johann's avatar
Johann committed
3
 *
4 5 6 7 8 9
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
Johann's avatar
Johann committed
10 11
 */

Adrian Grange's avatar
Adrian Grange committed
12 13
#ifndef AOM_DSP_VARIANCE_H_
#define AOM_DSP_VARIANCE_H_
Johann's avatar
Johann committed
14

Adrian Grange's avatar
Adrian Grange committed
15
#include "./aom_config.h"
Johann's avatar
Johann committed
16

Adrian Grange's avatar
Adrian Grange committed
17
#include "aom/aom_integer.h"
Johann's avatar
Johann committed
18 19 20 21 22 23 24 25

#ifdef __cplusplus
extern "C" {
#endif

#define FILTER_BITS 7
#define FILTER_WEIGHT 128

Adrian Grange's avatar
Adrian Grange committed
26
typedef unsigned int (*aom_sad_fn_t)(const uint8_t *a, int a_stride,
clang-format's avatar
clang-format committed
27
                                     const uint8_t *b_ptr, int b_stride);
Johann's avatar
Johann committed
28

Adrian Grange's avatar
Adrian Grange committed
29
typedef unsigned int (*aom_sad_avg_fn_t)(const uint8_t *a_ptr, int a_stride,
clang-format's avatar
clang-format committed
30 31
                                         const uint8_t *b_ptr, int b_stride,
                                         const uint8_t *second_pred);
Johann's avatar
Johann committed
32

Adrian Grange's avatar
Adrian Grange committed
33
typedef void (*aom_copy32xn_fn_t)(const uint8_t *a, int a_stride, uint8_t *b,
clang-format's avatar
clang-format committed
34
                                  int b_stride, int n);
Johann's avatar
Johann committed
35

Adrian Grange's avatar
Adrian Grange committed
36
typedef void (*aom_sad_multi_fn_t)(const uint8_t *a, int a_stride,
Johann's avatar
Johann committed
37 38 39
                                   const uint8_t *b, int b_stride,
                                   unsigned int *sad_array);

Adrian Grange's avatar
Adrian Grange committed
40
typedef void (*aom_sad_multi_d_fn_t)(const uint8_t *a, int a_stride,
Johann's avatar
Johann committed
41
                                     const uint8_t *const b_array[],
clang-format's avatar
clang-format committed
42
                                     int b_stride, unsigned int *sad_array);
Johann's avatar
Johann committed
43

Adrian Grange's avatar
Adrian Grange committed
44
typedef unsigned int (*aom_variance_fn_t)(const uint8_t *a, int a_stride,
Johann's avatar
Johann committed
45 46 47
                                          const uint8_t *b, int b_stride,
                                          unsigned int *sse);

Adrian Grange's avatar
Adrian Grange committed
48
typedef unsigned int (*aom_subpixvariance_fn_t)(const uint8_t *a, int a_stride,
Johann's avatar
Johann committed
49 50 51 52
                                                int xoffset, int yoffset,
                                                const uint8_t *b, int b_stride,
                                                unsigned int *sse);

Adrian Grange's avatar
Adrian Grange committed
53
typedef unsigned int (*aom_subp_avg_variance_fn_t)(
clang-format's avatar
clang-format committed
54 55 56
    const uint8_t *a_ptr, int a_stride, int xoffset, int yoffset,
    const uint8_t *b_ptr, int b_stride, unsigned int *sse,
    const uint8_t *second_pred);
57
#if CONFIG_AV1
Adrian Grange's avatar
Adrian Grange committed
58 59 60 61 62 63 64 65 66 67
typedef struct aom_variance_vtable {
  aom_sad_fn_t sdf;
  aom_sad_avg_fn_t sdaf;
  aom_variance_fn_t vf;
  aom_subpixvariance_fn_t svf;
  aom_subp_avg_variance_fn_t svaf;
  aom_sad_multi_fn_t sdx3f;
  aom_sad_multi_fn_t sdx8f;
  aom_sad_multi_d_fn_t sdx4df;
} aom_variance_fn_ptr_t;
68
#endif  // CONFIG_AV1
Johann's avatar
Johann committed
69 70 71 72 73

#ifdef __cplusplus
}  // extern "C"
#endif

Adrian Grange's avatar
Adrian Grange committed
74
#endif  // AOM_DSP_VARIANCE_H_