• 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 ******************************************************************************
23 *
24 * @file ihevce_bs_compute_ctb.h
25 *
26 * @brief
27 *  This file contains encoder boundary strength related macros and
28 *  interface prototypes
29 *
30 * @author
31 *  ittiam
32 *
33 ******************************************************************************
34 */
35 
36 #ifndef _IHEVCE_BS_COMPUTE_CTB_H_
37 #define _IHEVCE_BS_COMPUTE_CTB_H_
38 
39 /*****************************************************************************/
40 /* Constant Macros                                                           */
41 /*****************************************************************************/
42 
43 /**
44 ******************************************************************************
45  *  @brief      defines the BS for a 32x32 TU in INTRA mode
46 ******************************************************************************
47  */
48 #define BS_INTRA_32 0xAAAA
49 
50 /**
51 ******************************************************************************
52  *  @brief      defines the BS for a 16x16 TU in INTRA mode
53 ******************************************************************************
54  */
55 #define BS_INTRA_16 0xAA
56 
57 /**
58 ******************************************************************************
59  *  @brief      defines the BS for a 8x8 TU in INTRA mode
60 ******************************************************************************
61  */
62 #define BS_INTRA_8 0xA
63 
64 /**
65 ******************************************************************************
66  *  @brief      defines the BS for a 4x4 TU in INTRA mode
67 ******************************************************************************
68  */
69 #define BS_INTRA_4 0x2
70 
71 /**
72 ******************************************************************************
73  *  @brief      defines the invalid BS in global array
74 ******************************************************************************
75  */
76 #define BS_INVALID 0xDEAF
77 
78 /**
79 ******************************************************************************
80  *  @brief      defines the BS for a coded inter 32x32 TU
81 ******************************************************************************
82  */
83 #define BS_CBF_32 0x5555
84 
85 /**
86 ******************************************************************************
87  *  @brief      defines the BS for a coded inter 16x16 TU
88 ******************************************************************************
89  */
90 #define BS_CBF_16 0x55
91 
92 /**
93 ******************************************************************************
94  *  @brief      defines the BS for a coded inter 8x8 TU
95 ******************************************************************************
96  */
97 #define BS_CBF_8 0x5
98 
99 /**
100 ******************************************************************************
101  *  @brief      defines the BS for a coded inter 4x4 TU
102 ******************************************************************************
103  */
104 #define BS_CBF_4 0x01
105 
106 /*****************************************************************************/
107 /* Function Macros                                                           */
108 /*****************************************************************************/
109 
110 /**
111 ******************************************************************************
112  *  @brief   Macro to set the value in input pointer with given value starting
113  *  from ( 32 - (ip_pos<<1) - (edge_size>>1) ). This is for storing in BigEndian
114  *  with 2 bits per 4x4. edge_size in pixels & ip_pos in terms of 4x4
115  * (ip_pos<<1) : since 2bits per ip_pos (which is in 4x4)
116  * (edge_size>>1) : since no. of bits of value is (edge_size>>1), edge_size in pix
117 ******************************************************************************
118  */
119 #define SET_VALUE_BIG(pu4_bs, value, ip_pos, edge_size)                                            \
120     {                                                                                              \
121         *(pu4_bs) = *(pu4_bs) | (value << (32 - (ip_pos << 1) - (edge_size >> 1)));                \
122     }
123 
124 /**
125 ******************************************************************************
126  *  @brief   extracts 2 bits starting from (30-2*ip_pos) from the value pointed
127  *  by pu4_bs. This is for extracting from a BigEndian stored ip.
128 ******************************************************************************
129  */
130 #define EXTRACT_VALUE_BIG(pu4_bs, ip_pos) (((*(pu4_bs)) >> (30 - 2 * ip_pos)) & 0x3)
131 
132 /*****************************************************************************/
133 /* Extern Function Declarations                                              */
134 /*****************************************************************************/
135 
136 void ihevce_bs_init_ctb(
137     deblk_bs_ctb_ctxt_t *ps_deblk_prms,
138     frm_ctb_ctxt_t *ps_frm_ctb_prms,
139     WORD32 ctb_ctr,
140     WORD32 vert_ctr);
141 
142 void ihevce_bs_compute_cu(
143     cu_enc_loop_out_t *ps_cu_final,
144     nbr_4x4_t *ps_top_nbr_4x4,
145     nbr_4x4_t *ps_left_nbr_4x4,
146     nbr_4x4_t *ps_curr_nbr_4x4,
147     WORD32 nbr_4x4_left_strd,
148     WORD32 num_4x4_in_ctb,
149     deblk_bs_ctb_ctxt_t *ps_deblk_prms);
150 
151 void ihevce_bs_clear_invalid(
152     deblk_bs_ctb_ctxt_t *ps_deblk_prms,
153     WORD32 last_ctb_row_flag,
154     WORD32 last_ctb_in_row_flag,
155     WORD32 last_hz_ctb_wd,
156     WORD32 last_vt_ctb_ht);
157 
158 #endif /* _IHEVCE_BS_COMPUTE_CTB_H_ */
159