• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright (C) 2018 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************
18  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 /*!
21 ******************************************************************************
22 * \file hme_search_algo.h
23 *
24 * \brief
25 *    contains prototypes for search algorithms called by coarse/refinement
26 *    layers.
27 *
28 * \date
29 *    18/09/2012
30 *
31 * \author
32 *    Ittiam
33 *
34 ******************************************************************************
35 */
36 
37 #ifndef _HME_SEARCH_ALGO_H_
38 #define _HME_SEARCH_ALGO_H_
39 
40 /*****************************************************************************/
41 /* Functions                                                                 */
42 /*****************************************************************************/
43 /**
44 ********************************************************************************
45 *  @fn     void hme_pred_search_square_stepn(hme_search_prms_t *ps_search_prms,
46 *                                   layer_ctxt_t *ps_layer_ctxt)
47 *
48 *  @brief  Implements predictive search, with square grid refinement. In this
49 *          case, we start with a bigger step size, like 4, refining upto a
50 *          variable number of pts, till we hit end of search range or hit a
51 *          minima. Then we refine using smaller steps. The bigger step size
52 *          like 4 or 2, do not use optimized SAD functions, they evaluate
53 *          SAD for each individual pt.
54 *
55 *  @param[in,out]  ps_search_prms: All the params to this function
56 *
57 *  @param[in] ps_layer_ctxt: Context for the layer
58 *
59 *  @return None
60 ********************************************************************************
61 */
62 void hme_pred_search_square_stepn(
63     hme_search_prms_t *ps_search_prms,
64     layer_ctxt_t *ps_layer_ctxt,
65     wgt_pred_ctxt_t *ps_wt_inp_prms,
66     ME_QUALITY_PRESETS_T e_me_quality_preset,
67     ihevce_me_optimised_function_list_t *ps_me_optimised_function_list);
68 
69 /**
70 ********************************************************************************
71 *  @fn     hme_do_fullsearch(hme_search_prms_t *ps_search_prms,
72 *                               layer_ctxt_t *ps_layer_ctxt,
73 *                               hme_mv_t *ps_best_mv,
74 *                               pred_ctxt_t *ps_pred_ctxt,
75 *                               PF_MV_COST_FXN pf_mv_cost_compute)
76 *
77 *  @brief  Does a full search on entire srch window with a given step size
78 *
79 *  @param[in] ps_search_prms : Search prms structure containing info like
80 *               blk dimensions, search range etc
81 *
82 *  @param[in] ps_layer_ctxt: All info about this layer
83 *
84 *  @param[out] ps_best_mv  : type hme_mv_t contains best mv x and y
85 *
86 *  @param[in] ps_pred_ctxt : Prediction ctxt for cost computation
87 *
88 *  @param[in] pf_mv_cost_compute : mv cost computation function
89 *
90 *  @return void
91 ********************************************************************************
92 */
93 void hme_do_fullsearch(
94     hme_search_prms_t *ps_search_prms,
95     layer_ctxt_t *ps_layer_ctxt,
96     hme_mv_t *ps_best_mv,
97     pred_ctxt_t *ps_pred_ctxt,
98     PF_MV_COST_FXN pf_mv_cost_compute,
99     wgt_pred_ctxt_t *ps_wt_inp_prms,
100     ME_QUALITY_PRESETS_T e_me_quality_preset,
101     range_prms_t *ps_range_prms);
102 
103 /**
104 ********************************************************************************
105 *  @fn     hme_pred_search(hme_search_prms_t *ps_search_prms,
106 *                               layer_ctxt_t *ps_layer_ctxt)
107 *
108 *  @brief  Implements predictive search after removing duplicate candidates
109 *          from initial list. Each square grid (of step 1) is expanded
110 *          to nine search pts before the dedeuplication process. one point
111 *          cost is then evaluated for each unique node after the deduplication
112 *          process
113 *
114 *  @param[in,out]  ps_search_prms: All the params to this function
115 *
116 *  @param[in] ps_layer_ctxt: All info about this layer
117 *
118 *  @param[out] pi4_valid_part_ids: Array to hold valid partitions
119 *
120 *  @param[in] i4_disable_refine flag to disable refinement
121 *
122 *  @return None
123 ********************************************************************************
124 */
125 void hme_pred_search(
126     hme_search_prms_t *ps_search_prms,
127     layer_ctxt_t *ps_layer_ctxt,
128     wgt_pred_ctxt_t *ps_wt_inp_prms,
129     S08 i1_grid_flag,
130     ihevce_me_optimised_function_list_t *ps_me_optimised_function_list);
131 
132 /**
133 ********************************************************************************
134 *  @fn     void hme_pred_search_no_encode(hme_search_prms_t *ps_search_prms,
135 *                                         layer_ctxt_t *ps_layer_ctxt,
136 *                                         wgt_pred_ctxt_t *ps_wt_inp_prms,
137 *                                         S32 *pi4_valid_part_ids,
138 *                                         S32 disable_refine,
139 *                                         ME_QUALITY_PRESETS_T e_me_quality_preset)
140 *
141 *  @brief  Implements predictive search after removing duplicate candidates
142 *          from initial list. Each square grid (of step 1) is expanded
143 *          to nine search pts before the dedeuplication process. one point
144 *          cost is then evaluated for each unique node after the deduplication
145 *          process
146 *
147 *  @param[in,out]  ps_search_prms: All the params to this function
148 *
149 *  @param[in] ps_layer_ctxt: All info about this layer
150 *
151 *  @return None
152 ********************************************************************************
153 */
154 void hme_pred_search_no_encode(
155     hme_search_prms_t *ps_search_prms,
156     layer_ctxt_t *ps_layer_ctxt,
157     wgt_pred_ctxt_t *ps_wt_inp_prms,
158     S32 *pi4_valid_part_ids,
159     S32 disable_refine,
160     ME_QUALITY_PRESETS_T e_me_quality_preset,
161     S08 i1_grid_enable,
162     ihevce_me_optimised_function_list_t *ps_me_optimised_function_list);
163 
164 #endif /* #ifndef _HME_SEARCH_ALGO_H_*/
165