blob: 222fdaf0d546d0059b98b3ad0824b7f9b19293a9 [file] [log] [blame]
Yaowu Xuc27fc142016-08-22 16:08:15 -07001/*
Yaowu Xu9c01aa12016-09-01 14:32:49 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Yaowu Xuc27fc142016-08-22 16:08:15 -07003 *
Yaowu Xu9c01aa12016-09-01 14:32:49 -07004 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
Yaowu Xuc27fc142016-08-22 16:08:15 -070010 */
11
Yaowu Xuf883b422016-08-30 14:01:10 -070012#ifndef AOM_DSP_VARIANCE_H_
13#define AOM_DSP_VARIANCE_H_
Yaowu Xuc27fc142016-08-22 16:08:15 -070014
Yaowu Xuf883b422016-08-30 14:01:10 -070015#include "./aom_config.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070016
Yaowu Xuf883b422016-08-30 14:01:10 -070017#include "aom/aom_integer.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070018
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#define FILTER_BITS 7
24#define FILTER_WEIGHT 128
25
Yaowu Xuf883b422016-08-30 14:01:10 -070026typedef unsigned int (*aom_sad_fn_t)(const uint8_t *a, int a_stride,
Yaowu Xuc27fc142016-08-22 16:08:15 -070027 const uint8_t *b, int b_stride);
28
Yaowu Xuf883b422016-08-30 14:01:10 -070029typedef unsigned int (*aom_sad_avg_fn_t)(const uint8_t *a, int a_stride,
Yaowu Xuc27fc142016-08-22 16:08:15 -070030 const uint8_t *b, int b_stride,
31 const uint8_t *second_pred);
32
Yaowu Xuf883b422016-08-30 14:01:10 -070033typedef void (*aom_copy32xn_fn_t)(const uint8_t *a, int a_stride, uint8_t *b,
Yaowu Xuc27fc142016-08-22 16:08:15 -070034 int b_stride, int n);
35
Yaowu Xuf883b422016-08-30 14:01:10 -070036typedef void (*aom_sad_multi_fn_t)(const uint8_t *a, int a_stride,
Yaowu Xuc27fc142016-08-22 16:08:15 -070037 const uint8_t *b, int b_stride,
38 unsigned int *sad_array);
39
Yaowu Xuf883b422016-08-30 14:01:10 -070040typedef void (*aom_sad_multi_d_fn_t)(const uint8_t *a, int a_stride,
Yaowu Xuc27fc142016-08-22 16:08:15 -070041 const uint8_t *const b_array[],
42 int b_stride, unsigned int *sad_array);
43
Yaowu Xuf883b422016-08-30 14:01:10 -070044typedef unsigned int (*aom_variance_fn_t)(const uint8_t *a, int a_stride,
Yaowu Xuc27fc142016-08-22 16:08:15 -070045 const uint8_t *b, int b_stride,
46 unsigned int *sse);
47
Yaowu Xuf883b422016-08-30 14:01:10 -070048typedef unsigned int (*aom_subpixvariance_fn_t)(const uint8_t *a, int a_stride,
Yaowu Xuc27fc142016-08-22 16:08:15 -070049 int xoffset, int yoffset,
50 const uint8_t *b, int b_stride,
51 unsigned int *sse);
52
Yaowu Xuf883b422016-08-30 14:01:10 -070053typedef unsigned int (*aom_subp_avg_variance_fn_t)(
Yaowu Xuc27fc142016-08-22 16:08:15 -070054 const uint8_t *a, int a_stride, int xoffset, int yoffset, const uint8_t *b,
55 int b_stride, unsigned int *sse, const uint8_t *second_pred);
56
Yaowu Xuf883b422016-08-30 14:01:10 -070057#if CONFIG_AV1 && CONFIG_EXT_INTER
58typedef unsigned int (*aom_masked_sad_fn_t)(const uint8_t *src, int src_stride,
Yaowu Xuc27fc142016-08-22 16:08:15 -070059 const uint8_t *ref, int ref_stride,
60 const uint8_t *msk_ptr,
61 int msk_stride);
Yaowu Xuf883b422016-08-30 14:01:10 -070062typedef unsigned int (*aom_masked_variance_fn_t)(
Yaowu Xuc27fc142016-08-22 16:08:15 -070063 const uint8_t *src, int src_stride, const uint8_t *ref, int ref_stride,
64 const uint8_t *msk, int msk_stride, unsigned int *sse);
Yaowu Xuf883b422016-08-30 14:01:10 -070065typedef unsigned int (*aom_masked_subpixvariance_fn_t)(
Yaowu Xuc27fc142016-08-22 16:08:15 -070066 const uint8_t *src, int src_stride, int xoffset, int yoffset,
67 const uint8_t *ref, int ref_stride, const uint8_t *msk, int msk_stride,
68 unsigned int *sse);
Yaowu Xuf883b422016-08-30 14:01:10 -070069#endif // CONFIG_AV1 && CONFIG_EXT_INTER
Yaowu Xuc27fc142016-08-22 16:08:15 -070070
Yue Chencb60b182016-10-13 15:18:22 -070071#if CONFIG_AV1 && CONFIG_MOTION_VAR
Yaowu Xuf883b422016-08-30 14:01:10 -070072typedef unsigned int (*aom_obmc_sad_fn_t)(const uint8_t *pred, int pred_stride,
Yaowu Xuc27fc142016-08-22 16:08:15 -070073 const int32_t *wsrc,
74 const int32_t *msk);
Yaowu Xuf883b422016-08-30 14:01:10 -070075typedef unsigned int (*aom_obmc_variance_fn_t)(const uint8_t *pred,
Yaowu Xuc27fc142016-08-22 16:08:15 -070076 int pred_stride,
77 const int32_t *wsrc,
78 const int32_t *msk,
79 unsigned int *sse);
Yaowu Xuf883b422016-08-30 14:01:10 -070080typedef unsigned int (*aom_obmc_subpixvariance_fn_t)(
Yaowu Xuc27fc142016-08-22 16:08:15 -070081 const uint8_t *pred, int pred_stride, int xoffset, int yoffset,
82 const int32_t *wsrc, const int32_t *msk, unsigned int *sse);
Yue Chencb60b182016-10-13 15:18:22 -070083#endif // CONFIG_AV1 && CONFIG_MOTION_VAR
Yaowu Xuc27fc142016-08-22 16:08:15 -070084
Yaowu Xuf883b422016-08-30 14:01:10 -070085#if CONFIG_AV1
86typedef struct aom_variance_vtable {
87 aom_sad_fn_t sdf;
88 aom_sad_avg_fn_t sdaf;
89 aom_variance_fn_t vf;
90 aom_subpixvariance_fn_t svf;
91 aom_subp_avg_variance_fn_t svaf;
92 aom_sad_multi_fn_t sdx3f;
93 aom_sad_multi_fn_t sdx8f;
94 aom_sad_multi_d_fn_t sdx4df;
Yaowu Xuc27fc142016-08-22 16:08:15 -070095#if CONFIG_EXT_INTER
Yaowu Xuf883b422016-08-30 14:01:10 -070096 aom_masked_sad_fn_t msdf;
97 aom_masked_variance_fn_t mvf;
98 aom_masked_subpixvariance_fn_t msvf;
Yaowu Xuc27fc142016-08-22 16:08:15 -070099#endif // CONFIG_EXT_INTER
Yue Chencb60b182016-10-13 15:18:22 -0700100#if CONFIG_MOTION_VAR
Yaowu Xuf883b422016-08-30 14:01:10 -0700101 aom_obmc_sad_fn_t osdf;
102 aom_obmc_variance_fn_t ovf;
103 aom_obmc_subpixvariance_fn_t osvf;
Yue Chencb60b182016-10-13 15:18:22 -0700104#endif // CONFIG_MOTION_VAR
Yaowu Xuf883b422016-08-30 14:01:10 -0700105} aom_variance_fn_ptr_t;
106#endif // CONFIG_AV1
Yaowu Xuc27fc142016-08-22 16:08:15 -0700107
Yaowu Xuf883b422016-08-30 14:01:10 -0700108void aom_highbd_var_filter_block2d_bil_first_pass(
Yaowu Xuc27fc142016-08-22 16:08:15 -0700109 const uint8_t *src_ptr8, uint16_t *output_ptr,
110 unsigned int src_pixels_per_line, int pixel_step,
111 unsigned int output_height, unsigned int output_width,
112 const uint8_t *filter);
113
Yaowu Xuf883b422016-08-30 14:01:10 -0700114void aom_highbd_var_filter_block2d_bil_second_pass(
Yaowu Xuc27fc142016-08-22 16:08:15 -0700115 const uint16_t *src_ptr, uint16_t *output_ptr,
116 unsigned int src_pixels_per_line, unsigned int pixel_step,
117 unsigned int output_height, unsigned int output_width,
118 const uint8_t *filter);
119
120#ifdef __cplusplus
121} // extern "C"
122#endif
123
Yaowu Xuf883b422016-08-30 14:01:10 -0700124#endif // AOM_DSP_VARIANCE_H_