1 /******************************************************************************
2 *
3 * Copyright (C) 2022 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 *******************************************************************************
23 * @file
24 * isvce_ilp_mv.h
25 *
26 * @brief
27 * Contains function declarations for function declared in
28 * isvce_ilp_mv.c
29 *
30 * @author
31 * ittiam
32 *
33 * @remarks
34 * None
35 *
36 *******************************************************************************
37 */
38
39 #ifndef _ISVCE_ILP_MV_H_
40 #define _ISVCE_ILP_MV_H_
41
42 #include "ih264_typedefs.h"
43 #include "iv2.h"
44 #include "isvc_macros.h"
45 #include "ih264_debug.h"
46 #include "isvc_defs.h"
47 #include "isvc_structs.h"
48 #include "isvce_defs.h"
49 #include "isvce_pred_structs.h"
50 #include "isvce_structs.h"
51 #include "isvce_structs.h"
52 #include "isvce_utils.h"
53
54 /* Structs */
55 typedef struct ilp_mv_constants_t
56 {
57 void *pv_state;
58 } ilp_mv_constants_t;
59
60 typedef struct ilp_mv_outputs_t
61 {
62 ilp_mv_t s_ilp_mv;
63
64 ilp_me_cands_t s_ilp_me_cands;
65
66 } ilp_mv_outputs_t;
67
68 typedef struct ilp_mv_variables_t
69 {
70 svc_ilp_data_t *ps_svc_ilp_data;
71
72 coordinates_t s_mb_pos;
73
74 UWORD8 u1_spatial_layer_id;
75 } ilp_mv_variables_t;
76
77 typedef struct svc_ilp_mv_ctxt_t
78 {
79 ilp_mv_constants_t s_ilp_mv_constants;
80
81 ilp_mv_variables_t s_ilp_mv_variables;
82
83 ilp_mv_outputs_t s_ilp_mv_outputs;
84
85 } svc_ilp_mv_ctxt_t;
86
87 /* Function declarations */
88 extern UWORD32 isvce_get_ilp_mv_ctxt_size(UWORD8 u1_num_spatial_layers, DOUBLE d_spatial_res_ratio,
89 UWORD32 u4_wd, UWORD32 u4_ht);
90
91 extern void isvce_ilp_mv_ctxt_init(isvce_codec_t *ps_codec, iv_mem_rec_t *ps_mem_rec);
92
93 extern void isvce_get_mb_ilp_mv(svc_ilp_mv_ctxt_t *ps_ilp_mv_ctxt);
94
95 extern void isvce_mvp_idx_eval(isvce_mb_info_t *ps_mb_info, isvce_enc_pu_mv_t *ps_spatial_mvp,
96 isvce_enc_pu_mv_t *ps_ilp_mvp, UWORD8 *pu1_mvd_costs);
97
isvce_is_ilp_mv_winning_mv(isvce_mb_info_t * ps_mb_info,ilp_mv_t * ps_ilp_mv)98 static FORCEINLINE UWORD8 isvce_is_ilp_mv_winning_mv(isvce_mb_info_t *ps_mb_info,
99 ilp_mv_t *ps_ilp_mv)
100 {
101 if(ENABLE_ILP_MV && ps_ilp_mv && (ps_mb_info->u2_mb_type != PSKIP) &&
102 (ps_mb_info->u2_mb_type != BSKIP))
103 {
104 if((ps_mb_info->u2_mb_type == ps_ilp_mv->e_mb_type) &&
105 (((PRED_MODE_T) ps_mb_info->as_pu->u1_pred_mode) == ps_ilp_mv->ae_pred_mode[0]))
106 {
107 return isvce_check_identical_mv(ps_mb_info->as_pu->as_me_info, ps_ilp_mv->as_mv[0],
108 ps_ilp_mv->ae_pred_mode[0]);
109 }
110 }
111
112 return 0;
113 }
114
115 #endif
116