xref: /aosp_15_r20/external/libaom/aom_dsp/flow_estimation/corner_match.h (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
1 /*
2  * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
3  *
4  * 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.
10  */
11 
12 #ifndef AOM_AOM_DSP_FLOW_ESTIMATION_CORNER_MATCH_H_
13 #define AOM_AOM_DSP_FLOW_ESTIMATION_CORNER_MATCH_H_
14 
15 #include <stdbool.h>
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <memory.h>
19 
20 #include "aom_dsp/flow_estimation/corner_detect.h"
21 #include "aom_dsp/flow_estimation/flow_estimation.h"
22 #include "aom_scale/yv12config.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #define MATCH_SZ 16
29 #define MATCH_SZ_BY2 ((MATCH_SZ - 1) / 2)
30 #define MATCH_SZ_SQ (MATCH_SZ * MATCH_SZ)
31 
32 // Minimum threshold for the variance of a patch, in order for it to be
33 // considered useful for matching.
34 // This is evaluated against the scaled variance MATCH_SZ_SQ * sigma^2,
35 // so a setting of 1 * MATCH_SZ_SQ corresponds to an unscaled variance of 1
36 #define MIN_FEATURE_VARIANCE (1 * MATCH_SZ_SQ)
37 
38 bool av1_compute_global_motion_feature_match(
39     TransformationType type, YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *ref,
40     int bit_depth, int downsample_level, MotionModel *motion_models,
41     int num_motion_models, bool *mem_alloc_failed);
42 
43 #ifdef __cplusplus
44 }
45 #endif
46 
47 #endif  // AOM_AOM_DSP_FLOW_ESTIMATION_CORNER_MATCH_H_
48