/src/libavc/encoder/svc/isvce_ilp_mv_utils.h
Line | Count | Source (jump to first uncovered line) |
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 | | * @file |
23 | | * isvce_ilp_mv_utils.h |
24 | | * |
25 | | * @brief |
26 | | * Defs to perform experiments in ilp mv |
27 | | * |
28 | | * |
29 | | * @remarks |
30 | | * None |
31 | | * |
32 | | ******************************************************************************* |
33 | | */ |
34 | | #ifndef _ISVCE_ILP_MV_UTILS_H_ |
35 | | #define _ISVCE_ILP_MV_UTILS_H_ |
36 | | |
37 | | #include <stdbool.h> |
38 | | |
39 | | #include "ih264_typedefs.h" |
40 | | #include "isvc_defs.h" |
41 | | #include "isvc_macros.h" |
42 | | #include "isvce_pred_structs.h" |
43 | | #include "isvce_structs.h" |
44 | | |
45 | 1.22M | #define MAX_CAND_IF_NUM_ILP_MV_LT_2 8 |
46 | 318k | #define MAX_CAND_IF_NUM_ILP_MV_GTEQ_2 6 |
47 | | |
48 | | /* nbr_mb.x, nbr_mb.y, pu_pos.x, pu_pos.y */ |
49 | | #define NBR_PU_AND_MB_POS 4 |
50 | | |
51 | | static const WORD8 gai1_nbr_ilp_mv_map[MAX_ILP_MV_IN_NBR_RGN][NBR_PU_AND_MB_POS] = { |
52 | | {-1, 0, 3, 0}, |
53 | | {0, -1, 0, 3}, |
54 | | {1, 0, 0, 0}, |
55 | | {0, 1, 0, 0}, |
56 | | }; |
57 | | |
58 | | /** |
59 | | ******************************************************************************* |
60 | | * |
61 | | * @brief |
62 | | * This function checks if the max difference between ILP MVs is less than four |
63 | | * or not if number of ILP MVs is greater than or equal to two |
64 | | * |
65 | | * @param[in] ps_me |
66 | | * Pointer to ilp_me_cands |
67 | | * |
68 | | * @returns One if number of ILP MVs is greater than equal to two and max |
69 | | * difference between them is less than 4 otherwise returns zero |
70 | | * |
71 | | * @remarks none |
72 | | * |
73 | | ******************************************************************************* |
74 | | */ |
75 | | static FORCEINLINE bool isvce_check_max_mv_diff_lt_4(ilp_me_cands_t *ps_ilp_me_cands, |
76 | | WORD32 i4_reflist) |
77 | 89.7k | { |
78 | 89.7k | UWORD32 i, j; |
79 | 89.7k | UWORD32 u4_mv_diff_x, u4_mv_diff_y; |
80 | | |
81 | 111k | for(i = 1; i < ps_ilp_me_cands->u4_num_ilp_mvs; i++) |
82 | 94.3k | { |
83 | 117k | for(j = 0; j < i; j++) |
84 | 95.2k | { |
85 | 95.2k | if(((ps_ilp_me_cands->ae_pred_mode[i] == ((PRED_MODE_T) i4_reflist)) || |
86 | 95.2k | ((ps_ilp_me_cands->ae_pred_mode[i] == BI))) && |
87 | 95.2k | ((ps_ilp_me_cands->ae_pred_mode[j] == ((PRED_MODE_T) i4_reflist)) || |
88 | 95.2k | ((ps_ilp_me_cands->ae_pred_mode[j] == BI)))) |
89 | 95.2k | { |
90 | 95.2k | u4_mv_diff_x = ABS(ps_ilp_me_cands->as_mv[i][i4_reflist].s_mv.i2_mvx - |
91 | 95.2k | ps_ilp_me_cands->as_mv[j][i4_reflist].s_mv.i2_mvx); |
92 | | |
93 | 95.2k | u4_mv_diff_y = ABS(ps_ilp_me_cands->as_mv[i][i4_reflist].s_mv.i2_mvy - |
94 | 95.2k | ps_ilp_me_cands->as_mv[j][i4_reflist].s_mv.i2_mvy); |
95 | | |
96 | 95.2k | if(u4_mv_diff_x >= 4 || u4_mv_diff_y >= 4) |
97 | 72.4k | { |
98 | 72.4k | return false; |
99 | 72.4k | } |
100 | 95.2k | } |
101 | 16 | else |
102 | 16 | { |
103 | 16 | return false; |
104 | 16 | } |
105 | 95.2k | } |
106 | 94.3k | } |
107 | | |
108 | 17.2k | return true; |
109 | 89.7k | } Unexecuted instantiation: isvce_ilp_mv.c:isvce_check_max_mv_diff_lt_4 isvce_me.c:isvce_check_max_mv_diff_lt_4 Line | Count | Source | 77 | 89.7k | { | 78 | 89.7k | UWORD32 i, j; | 79 | 89.7k | UWORD32 u4_mv_diff_x, u4_mv_diff_y; | 80 | | | 81 | 111k | for(i = 1; i < ps_ilp_me_cands->u4_num_ilp_mvs; i++) | 82 | 94.3k | { | 83 | 117k | for(j = 0; j < i; j++) | 84 | 95.2k | { | 85 | 95.2k | if(((ps_ilp_me_cands->ae_pred_mode[i] == ((PRED_MODE_T) i4_reflist)) || | 86 | 95.2k | ((ps_ilp_me_cands->ae_pred_mode[i] == BI))) && | 87 | 95.2k | ((ps_ilp_me_cands->ae_pred_mode[j] == ((PRED_MODE_T) i4_reflist)) || | 88 | 95.2k | ((ps_ilp_me_cands->ae_pred_mode[j] == BI)))) | 89 | 95.2k | { | 90 | 95.2k | u4_mv_diff_x = ABS(ps_ilp_me_cands->as_mv[i][i4_reflist].s_mv.i2_mvx - | 91 | 95.2k | ps_ilp_me_cands->as_mv[j][i4_reflist].s_mv.i2_mvx); | 92 | | | 93 | 95.2k | u4_mv_diff_y = ABS(ps_ilp_me_cands->as_mv[i][i4_reflist].s_mv.i2_mvy - | 94 | 95.2k | ps_ilp_me_cands->as_mv[j][i4_reflist].s_mv.i2_mvy); | 95 | | | 96 | 95.2k | if(u4_mv_diff_x >= 4 || u4_mv_diff_y >= 4) | 97 | 72.4k | { | 98 | 72.4k | return false; | 99 | 72.4k | } | 100 | 95.2k | } | 101 | 16 | else | 102 | 16 | { | 103 | 16 | return false; | 104 | 16 | } | 105 | 95.2k | } | 106 | 94.3k | } | 107 | | | 108 | 17.2k | return true; | 109 | 89.7k | } |
|
110 | | |
111 | | #endif |