• 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 typedef struct {
22   int64_t rd;
23   int drl_cost;
24 
25   int rate_mv;
26   int_mv mv;
27 
28   int_mv full_search_mv;
29   int full_mv_rate;
30 } inter_mode_info;
31 
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 
37 void av1_joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
38                              BLOCK_SIZE bsize, int_mv *cur_mv,
39                              const uint8_t *mask, int mask_stride,
40                              int *rate_mv);
41 
42 int av1_interinter_compound_motion_search(const AV1_COMP *const cpi,
43                                           MACROBLOCK *x,
44                                           const int_mv *const cur_mv,
45                                           const BLOCK_SIZE bsize,
46                                           const PREDICTION_MODE this_mode);
47 
48 void av1_compound_single_motion_search_interinter(
49     const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int_mv *cur_mv,
50     const uint8_t *mask, int mask_stride, int *rate_mv, int ref_idx);
51 
52 void av1_compound_single_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
53                                        BLOCK_SIZE bsize, MV *this_mv,
54                                        const uint8_t *second_pred,
55                                        const uint8_t *mask, int mask_stride,
56                                        int *rate_mv, int ref_idx);
57 
58 // Performs a motion search in SIMPLE_TRANSLATION mode using reference frame
59 // ref. Note that this sets the offset of mbmi, so we will need to reset it
60 // after calling this function.
61 int_mv av1_simple_motion_search(struct AV1_COMP *const cpi, MACROBLOCK *x,
62                                 int mi_row, int mi_col, BLOCK_SIZE bsize,
63                                 int ref, FULLPEL_MV start_mv, int num_planes,
64                                 int use_subpixel);
65 
66 // Performs a simple motion search to calculate the sse and var of the residue
67 int_mv av1_simple_motion_sse_var(struct AV1_COMP *cpi, MACROBLOCK *x,
68                                  int mi_row, int mi_col, BLOCK_SIZE bsize,
69                                  const FULLPEL_MV start_mv, int use_subpixel,
70                                  unsigned int *sse, unsigned int *var);
71 
72 #ifdef __cplusplus
73 }  // extern "C"
74 #endif
75 
76 #endif  // AOM_AV1_ENCODER_MOTION_SEARCH_H_
77