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_H_ 13 #define AOM_AOM_DSP_FLOW_ESTIMATION_H_ 14 15 #include "aom_ports/mem.h" 16 #include "aom_scale/yv12config.h" 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 #define MAX_PARAMDIM 9 23 #define MAX_CORNERS 4096 24 #define MIN_INLIER_PROB 0.1 25 26 /* clang-format off */ 27 enum { 28 IDENTITY = 0, // identity transformation, 0-parameter 29 TRANSLATION = 1, // translational motion 2-parameter 30 ROTZOOM = 2, // simplified affine with rotation + zoom only, 4-parameter 31 AFFINE = 3, // affine, 6-parameter 32 TRANS_TYPES, 33 } UENUM1BYTE(TransformationType); 34 /* clang-format on */ 35 36 // number of parameters used by each transformation in TransformationTypes 37 static const int trans_model_params[TRANS_TYPES] = { 0, 2, 4, 6 }; 38 39 typedef enum { 40 GLOBAL_MOTION_FEATURE_BASED, 41 GLOBAL_MOTION_DISFLOW_BASED, 42 } GlobalMotionEstimationType; 43 44 typedef struct { 45 double params[MAX_PARAMDIM - 1]; 46 int *inliers; 47 int num_inliers; 48 } MotionModel; 49 50 int aom_compute_global_motion(TransformationType type, 51 unsigned char *src_buffer, int src_width, 52 int src_height, int src_stride, int *src_corners, 53 int num_src_corners, YV12_BUFFER_CONFIG *ref, 54 int bit_depth, 55 GlobalMotionEstimationType gm_estimation_type, 56 int *num_inliers_by_motion, 57 MotionModel *params_by_motion, int num_motions); 58 59 unsigned char *av1_downconvert_frame(YV12_BUFFER_CONFIG *frm, int bit_depth); 60 61 #ifdef __cplusplus 62 } 63 #endif 64 65 #endif // AOM_AOM_DSP_FLOW_ESTIMATION_H_ 66