• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_downscaler.h
25 *
26 * @brief
27 *  Contains downscaler functions required by the SVC encoder
28 *
29 * @author
30 *  ittiam
31 *
32 * @par List of Functions:
33 *  - isvce_get_downscaler_data_size()
34 *  - isvce_get_downscaler_padding_dims()
35 *  - isvce_isvce_process_ctxt_t_downscaler()
36 *  - isvce_get_downscaler_normalized_filtered_pixel()
37 *  - isvce_horizontal_downscale_and_transpose()
38 *  - isvce_process_downscaler()
39 *  - isvce_initialize_downscaler()
40 *
41 * @remarks
42 *  None
43 *
44 *******************************************************************************
45 */
46 
47 #ifndef _ISVCE_DOWNSCALER_H_
48 #define _ISVCE_DOWNSCALER_H_
49 
50 #include "ih264_typedefs.h"
51 #include "iv2.h"
52 #include "isvc_defs.h"
53 #include "isvc_structs.h"
54 #include "isvce_defs.h"
55 
56 typedef struct
57 {
58     /**
59      * pointer to the state of downscaler
60      */
61     void *pv_scaler_state;
62 
63     /**
64      * scaling factor between the dimensions of two consecutive SVC layers
65      */
66     DOUBLE d_scaling_factor;
67 
68     /**
69      * Num spatial layers
70      */
71     UWORD8 u1_num_spatial_layers;
72 
73 } downscaler_ctxt_t;
74 
75 typedef struct
76 {
77     UWORD8 u1_left_pad_size;
78 
79     UWORD8 u1_right_pad_size;
80 
81     UWORD8 u1_top_pad_size;
82 
83     UWORD8 u1_bottom_pad_size;
84 
85 } padding_dims_t;
86 
87 /**
88 *******************************************************************************
89 *
90 * @brief
91 *   initializes the downscaler context
92 *
93 * @par Description:
94 *   initializes the downscaler context for the given scaling factor
95 *   with padding size, filter size, etc.
96 *
97 * @param[in] ps_scaler
98 *   pointer downscaler context
99 *
100 * @param[in] ps_mem_rec
101 *   pointer to memory allocated to downscaler process
102 *
103 * @param[in] d_scaling_factor
104 *   scaling reatio of width/ height between two consecutive SVC layers
105 *
106 * @param[in] u1_num_spatial_layers
107 *   scaling reatio of width/ height between two consecutive SVC layers
108 *
109 * @param[in] u4_wd
110 *   width of the input
111 *
112 * @param[in] u4_ht
113 *   height of the input
114 *
115 * @param[in] e_arch
116 *   architecure type
117 *
118 * @returns
119 *
120 * @remarks
121 *  when ARM intrinsics are added, update should be done here
122 *
123 *******************************************************************************
124 */
125 
126 extern void isvce_initialize_downscaler(downscaler_ctxt_t *ps_scaler, iv_mem_rec_t *ps_mem_rec,
127                                         DOUBLE d_scaling_factor, UWORD8 u1_num_spatial_layers,
128                                         UWORD32 u4_in_width, UWORD32 u4_in_height,
129                                         IV_ARCH_T e_arch);
130 
131 /**
132 *******************************************************************************
133 *
134 * @brief
135 *   gets the memory size required for downscaler
136 *
137 * @par Description:
138 *   returns the memory required by the downscaler context and state structs
139 *   for allocation.
140 *
141 * @returns
142 *
143 * @remarks
144 *
145 *
146 *******************************************************************************
147 */
148 
149 extern UWORD32 isvce_get_downscaler_data_size(UWORD8 u1_num_spatial_layers, DOUBLE d_scaling_factor,
150                                               UWORD32 u4_width, UWORD32 u4_height);
151 
152 /**
153 *******************************************************************************
154 *
155 * @brief
156 *   processes downscaler
157 *
158 * @par Description:
159 *   calls the function for padding and scaling
160 *
161 * @param[in] ps_scaler
162 *  pointer to downdownscaler context
163 *
164 * @param[in] ps_src_buf_props
165 *  pointer to source buffer props struct
166 *
167 * @param[in] u4_blk_wd
168 *  width of the block to be processed
169 *
170 * @param[in] u4_blk_ht
171 *  height of the block to be processed
172 *
173 * @returns
174 *
175 * @remarks
176 *
177 *
178 *******************************************************************************
179 */
180 
181 extern void isvce_process_downscaler(downscaler_ctxt_t *ps_scaler,
182                                      yuv_buf_props_t *ps_src_buf_props,
183                                      yuv_buf_props_t *ps_dst_buf_props, UWORD32 u4_blk_wd,
184                                      UWORD32 u4_blk_ht);
185 
186 /**
187 *******************************************************************************
188 *
189 * @brief
190 *   gets the padding size required for filtering
191 *
192 * @par Description:
193 *   gets the padding size required for filtering
194 *
195 * @returns
196 *
197 * @remarks
198 *
199 *
200 *******************************************************************************
201 */
202 
203 extern void isvce_get_downscaler_padding_dims(padding_dims_t *ps_pad_dims);
204 
205 #endif
206