• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020, 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_AV1_ENCODER_MOTION_SEARCH_H_
13 #define AOM_AV1_ENCODER_MOTION_SEARCH_H_
14 
15 #include "av1/encoder/encoder.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 // TODO(any): rename this struct to something else. There is already another
22 // struct called inter_modes_info, which makes this terribly confusing.
23 typedef struct {
24   int drl_cost;
25   int_mv full_search_mv;
26   int full_mv_rate;
27   int full_mv_bestsme;
28   int skip;
29 } inter_mode_info;
30 
31 struct HandleInterModeArgs;
32 void av1_single_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
33                               BLOCK_SIZE bsize, int ref_idx, int *rate_mv,
34                               int search_range, inter_mode_info *mode_info,
35                               int_mv *best_mv,
36                               struct HandleInterModeArgs *const args);
37 
38 int av1_joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
39                             BLOCK_SIZE bsize, int_mv *cur_mv,
40                             const uint8_t *mask, int mask_stride, int *rate_mv,
41                             int allow_second_mv);
42 
43 int av1_interinter_compound_motion_search(const AV1_COMP *const cpi,
44                                           MACROBLOCK *x,
45                                           const int_mv *const cur_mv,
46                                           const BLOCK_SIZE bsize,
47                                           const PREDICTION_MODE this_mode);
48 
49 int av1_compound_single_motion_search_interinter(
50     const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int_mv *cur_mv,
51     const uint8_t *mask, int mask_stride, int *rate_mv, int ref_idx);
52 
53 int av1_compound_single_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
54                                       BLOCK_SIZE bsize, MV *this_mv,
55                                       const uint8_t *second_pred,
56                                       const uint8_t *mask, int mask_stride,
57                                       int *rate_mv, int ref_idx);
58 
59 // Performs a motion search in SIMPLE_TRANSLATION mode using reference frame
60 // ref. Note that this sets the offset of mbmi, so we will need to reset it
61 // after calling this function.
62 int_mv av1_simple_motion_search(struct AV1_COMP *const cpi, MACROBLOCK *x,
63                                 int mi_row, int mi_col, BLOCK_SIZE bsize,
64                                 int ref, FULLPEL_MV start_mv, int num_planes,
65                                 int use_subpixel);
66 
67 // Performs a simple motion search to calculate the sse and var of the residue
68 int_mv av1_simple_motion_sse_var(struct AV1_COMP *cpi, MACROBLOCK *x,
69                                  int mi_row, int mi_col, BLOCK_SIZE bsize,
70                                  const FULLPEL_MV start_mv, int use_subpixel,
71                                  unsigned int *sse, unsigned int *var);
72 
73 #ifdef __cplusplus
74 }  // extern "C"
75 #endif
76 
77 #endif  // AOM_AV1_ENCODER_MOTION_SEARCH_H_
78