/work/svt-av1/Source/Lib/Codec/utility.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright(c) 2019 Intel Corporation |
3 | | * |
4 | | * This source code is subject to the terms of the BSD 2 Clause License and |
5 | | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
6 | | * was not distributed with this source code in the LICENSE file, you can |
7 | | * obtain it at https://www.aomedia.org/license/software-license. If the Alliance for Open |
8 | | * Media Patent License 1.0 was not distributed with this source code in the |
9 | | * PATENTS file, you can obtain it at https://www.aomedia.org/license/patent-license. |
10 | | */ |
11 | | |
12 | | #include <stdio.h> |
13 | | |
14 | | #ifdef _WIN32 |
15 | | #include <windows.h> |
16 | | #else |
17 | | #include <stdlib.h> |
18 | | #include <sys/time.h> |
19 | | #endif |
20 | | |
21 | | #include "utility.h" |
22 | | #include "common_utils.h" |
23 | | #include "svt_log.h" |
24 | | #include <math.h> |
25 | | |
26 | | /* assert a certain condition and report err if condition not met */ |
27 | 318k | void svt_aom_assert_err(uint32_t condition, char* err_msg) { |
28 | 318k | assert(condition); |
29 | 318k | if (!condition) { |
30 | 0 | SVT_ERROR("\n %s \n", err_msg); |
31 | 0 | } |
32 | 318k | } |
33 | | |
34 | | static CodedBlockStats coded_unit_stats_array[] = { |
35 | | // Depth Size SizeLog2 OriginX OriginY cu_num_in_depth Index |
36 | | {0, 64, 6, 0, 0, 0, 0}, // 0 |
37 | | {1, 32, 5, 0, 0, 0, 1}, // 1 |
38 | | {2, 16, 4, 0, 0, 0, 1}, // 2 |
39 | | {3, 8, 3, 0, 0, 0, 1}, // 3 |
40 | | {3, 8, 3, 8, 0, 1, 1}, // 4 |
41 | | {3, 8, 3, 0, 8, 8, 1}, // 5 |
42 | | {3, 8, 3, 8, 8, 9, 1}, // 6 |
43 | | {2, 16, 4, 16, 0, 1, 1}, // 7 |
44 | | {3, 8, 3, 16, 0, 2, 1}, // 8 |
45 | | {3, 8, 3, 24, 0, 3, 1}, // 9 |
46 | | {3, 8, 3, 16, 8, 10, 1}, // 10 |
47 | | {3, 8, 3, 24, 8, 11, 1}, // 11 |
48 | | {2, 16, 4, 0, 16, 4, 1}, // 12 |
49 | | {3, 8, 3, 0, 16, 16, 1}, // 13 |
50 | | {3, 8, 3, 8, 16, 17, 1}, // 14 |
51 | | {3, 8, 3, 0, 24, 24, 1}, // 15 |
52 | | {3, 8, 3, 8, 24, 25, 1}, // 16 |
53 | | {2, 16, 4, 16, 16, 5, 1}, // 17 |
54 | | {3, 8, 3, 16, 16, 18, 1}, // 18 |
55 | | {3, 8, 3, 24, 16, 19, 1}, // 19 |
56 | | {3, 8, 3, 16, 24, 26, 1}, // 20 |
57 | | {3, 8, 3, 24, 24, 27, 1}, // 21 |
58 | | {1, 32, 5, 32, 0, 1, 2}, // 22 |
59 | | {2, 16, 4, 32, 0, 2, 2}, // 23 |
60 | | {3, 8, 3, 32, 0, 4, 2}, // 24 |
61 | | {3, 8, 3, 40, 0, 5, 2}, // 25 |
62 | | {3, 8, 3, 32, 8, 12, 2}, // 26 |
63 | | {3, 8, 3, 40, 8, 13, 2}, // 27 |
64 | | {2, 16, 4, 48, 0, 3, 2}, // 28 |
65 | | {3, 8, 3, 48, 0, 6, 2}, // 29 |
66 | | {3, 8, 3, 56, 0, 7, 2}, // 30 |
67 | | {3, 8, 3, 48, 8, 14, 2}, // 31 |
68 | | {3, 8, 3, 56, 8, 15, 2}, // 32 |
69 | | {2, 16, 4, 32, 16, 6, 2}, // 33 |
70 | | {3, 8, 3, 32, 16, 20, 2}, // 34 |
71 | | {3, 8, 3, 40, 16, 21, 2}, // 35 |
72 | | {3, 8, 3, 32, 24, 28, 2}, // 36 |
73 | | {3, 8, 3, 40, 24, 29, 2}, // 37 |
74 | | {2, 16, 4, 48, 16, 7, 2}, // 38 |
75 | | {3, 8, 3, 48, 16, 22, 2}, // 39 |
76 | | {3, 8, 3, 56, 16, 23, 2}, // 40 |
77 | | {3, 8, 3, 48, 24, 30, 2}, // 41 |
78 | | {3, 8, 3, 56, 24, 31, 2}, // 42 |
79 | | {1, 32, 5, 0, 32, 2, 3}, // 43 |
80 | | {2, 16, 4, 0, 32, 8, 3}, // 44 |
81 | | {3, 8, 3, 0, 32, 32, 3}, // 45 |
82 | | {3, 8, 3, 8, 32, 33, 3}, // 46 |
83 | | {3, 8, 3, 0, 40, 40, 3}, // 47 |
84 | | {3, 8, 3, 8, 40, 41, 3}, // 48 |
85 | | {2, 16, 4, 16, 32, 9, 3}, // 49 |
86 | | {3, 8, 3, 16, 32, 34, 3}, // 50 |
87 | | {3, 8, 3, 24, 32, 35, 3}, // 51 |
88 | | {3, 8, 3, 16, 40, 42, 3}, // 52 |
89 | | {3, 8, 3, 24, 40, 43, 3}, // 53 |
90 | | {2, 16, 4, 0, 48, 12, 3}, // 54 |
91 | | {3, 8, 3, 0, 48, 48, 3}, // 55 |
92 | | {3, 8, 3, 8, 48, 49, 3}, // 56 |
93 | | {3, 8, 3, 0, 56, 56, 3}, // 57 |
94 | | {3, 8, 3, 8, 56, 57, 3}, // 58 |
95 | | {2, 16, 4, 16, 48, 13, 3}, // 59 |
96 | | {3, 8, 3, 16, 48, 50, 3}, // 60 |
97 | | {3, 8, 3, 24, 48, 51, 3}, // 61 |
98 | | {3, 8, 3, 16, 56, 58, 3}, // 62 |
99 | | {3, 8, 3, 24, 56, 59, 3}, // 63 |
100 | | {1, 32, 5, 32, 32, 3, 4}, // 64 |
101 | | {2, 16, 4, 32, 32, 10, 4}, // 65 |
102 | | {3, 8, 3, 32, 32, 36, 4}, // 66 |
103 | | {3, 8, 3, 40, 32, 37, 4}, // 67 |
104 | | {3, 8, 3, 32, 40, 44, 4}, // 68 |
105 | | {3, 8, 3, 40, 40, 45, 4}, // 69 |
106 | | {2, 16, 4, 48, 32, 11, 4}, // 70 |
107 | | {3, 8, 3, 48, 32, 38, 4}, // 71 |
108 | | {3, 8, 3, 56, 32, 39, 4}, // 72 |
109 | | {3, 8, 3, 48, 40, 46, 4}, // 73 |
110 | | {3, 8, 3, 56, 40, 47, 4}, // 74 |
111 | | {2, 16, 4, 32, 48, 14, 4}, // 75 |
112 | | {3, 8, 3, 32, 48, 52, 4}, // 76 |
113 | | {3, 8, 3, 40, 48, 53, 4}, // 77 |
114 | | {3, 8, 3, 32, 56, 60, 4}, // 78 |
115 | | {3, 8, 3, 40, 56, 61, 4}, // 79 |
116 | | {2, 16, 4, 48, 48, 15, 4}, // 80 |
117 | | {3, 8, 3, 48, 48, 54, 4}, // 81 |
118 | | {3, 8, 3, 56, 48, 55, 4}, // 82 |
119 | | {3, 8, 3, 48, 56, 62, 4}, // 83 |
120 | | {3, 8, 3, 56, 56, 63, 4} // 84 |
121 | | }; |
122 | | |
123 | | /************************************************************** |
124 | | * Get Coded Unit Statistics |
125 | | **************************************************************/ |
126 | 0 | const CodedBlockStats* svt_aom_get_coded_blk_stats(const uint32_t cu_idx) { |
127 | 0 | return &coded_unit_stats_array[cu_idx]; |
128 | 0 | } |
129 | | |
130 | | /***************************************** |
131 | | * Long Log 2 |
132 | | * This is a quick adaptation of a Number |
133 | | * Leading Zeros (NLZ) algorithm to get |
134 | | * the log2f of a 32-bit number |
135 | | *****************************************/ |
136 | 728k | uint32_t svt_aom_log2f_32(uint32_t x) { |
137 | 728k | uint32_t log = 0; |
138 | 728k | int32_t i; |
139 | 4.37M | for (i = 4; i >= 0; --i) { |
140 | 3.64M | const uint32_t shift = (1 << i); |
141 | 3.64M | const uint32_t n = x >> shift; |
142 | 3.64M | if (n != 0) { |
143 | 754k | x = n; |
144 | 754k | log += shift; |
145 | 754k | } |
146 | 3.64M | } |
147 | 728k | return log; |
148 | 728k | } |
149 | | |
150 | | static const MiniGopStats mini_gop_stats_array[] = { |
151 | | // hierarchical_levels start_index end_index Length |
152 | | {5, 0, 31, 32}, // 0 |
153 | | {4, 0, 15, 16}, // 1 |
154 | | {3, 0, 7, 8}, // 2 |
155 | | {2, 0, 3, 4}, // 3 |
156 | | {1, 0, 1, 2}, // 4 |
157 | | {1, 2, 3, 2}, // 5 |
158 | | {2, 4, 7, 4}, // 6 |
159 | | {1, 4, 5, 2}, // 7 |
160 | | {1, 6, 7, 2}, // 8 |
161 | | {3, 8, 15, 8}, // 9 |
162 | | {2, 8, 11, 4}, // 10 |
163 | | {1, 8, 9, 2}, // 11 |
164 | | {1, 10, 11, 2}, // 12 |
165 | | {2, 12, 15, 4}, // 13 |
166 | | {1, 12, 13, 2}, // 14 |
167 | | {1, 14, 15, 2}, // 15 |
168 | | {4, 16, 31, 16}, // 16 |
169 | | {3, 16, 23, 8}, // 17 |
170 | | {2, 16, 19, 4}, // 18 |
171 | | {1, 16, 17, 2}, // 19 |
172 | | {1, 18, 19, 2}, // 20 |
173 | | {2, 20, 23, 4}, // 21 |
174 | | {1, 20, 21, 2}, // 22 |
175 | | {1, 22, 23, 2}, // 23 |
176 | | {3, 24, 31, 8}, // 24 |
177 | | {2, 24, 27, 4}, // 25 |
178 | | {1, 24, 25, 2}, // 26 |
179 | | {1, 26, 27, 2}, // 27 |
180 | | {2, 28, 31, 4}, // 28 |
181 | | {1, 28, 29, 2}, // 29 |
182 | | {1, 30, 31, 2} // 30 |
183 | | }; |
184 | | |
185 | | /************************************************************** |
186 | | * Get Mini GOP Statistics |
187 | | **************************************************************/ |
188 | 0 | const MiniGopStats* svt_aom_get_mini_gop_stats(const uint32_t mini_gop_index) { |
189 | 0 | return &mini_gop_stats_array[mini_gop_index]; |
190 | 0 | } |
191 | | |
192 | | static uint32_t ns_quarter_size_mult[9 /*Up to 9 part*/][2 /*h+v*/][4 /*Up to 4 ns blocks per part*/] = { |
193 | | //9 means not used. |
194 | | |
195 | | // | h | | v | |
196 | | |
197 | | /*P=0*/ {{4, 9, 9, 9}, {4, 9, 9, 9}}, |
198 | | /*P=1*/ {{4, 4, 9, 9}, {2, 2, 9, 9}}, |
199 | | /*P=2*/ {{2, 2, 9, 9}, {4, 4, 9, 9}}, |
200 | | |
201 | | /*P=7*/ {{4, 4, 4, 4}, {1, 1, 1, 1}}, |
202 | | /*P=8*/ {{1, 1, 1, 1}, {4, 4, 4, 4}}, |
203 | | |
204 | | /*P=3*/ {{2, 2, 4, 9}, {2, 2, 2, 9}}, |
205 | | /*P=4*/ {{4, 2, 2, 9}, {2, 2, 2, 9}}, |
206 | | /*P=5*/ {{2, 2, 2, 9}, {2, 2, 4, 9}}, |
207 | | /*P=6*/ {{2, 2, 2, 9}, {4, 2, 2, 9}}}; |
208 | | |
209 | | static BlockSize hvsize_to_bsize[/*H*/ 6][/*V*/ 6] = { |
210 | | {BLOCK_4X4, BLOCK_4X8, BLOCK_4X16, BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID}, |
211 | | {BLOCK_8X4, BLOCK_8X8, BLOCK_8X16, BLOCK_8X32, BLOCK_INVALID, BLOCK_INVALID}, |
212 | | {BLOCK_16X4, BLOCK_16X8, BLOCK_16X16, BLOCK_16X32, BLOCK_16X64, BLOCK_INVALID}, |
213 | | {BLOCK_INVALID, BLOCK_32X8, BLOCK_32X16, BLOCK_32X32, BLOCK_32X64, BLOCK_INVALID}, |
214 | | {BLOCK_INVALID, BLOCK_INVALID, BLOCK_64X16, BLOCK_64X32, BLOCK_64X64, BLOCK_64X128}, |
215 | | {BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, BLOCK_128X64, BLOCK_128X128}}; |
216 | | |
217 | | static uint32_t max_sb = 64; |
218 | | static uint32_t max_depth = 5; |
219 | | static uint32_t max_part = 9; |
220 | | static uint32_t max_num_active_blocks; |
221 | | |
222 | | //TODO need to remove above globals for multi-channel support |
223 | | |
224 | 80.5k | static uint32_t get_num_ns_per_part(uint32_t part_it, uint32_t sq_size) { |
225 | 80.5k | uint32_t tot_num_ns_per_part = part_it < 1 ? 1 : part_it < 3 ? 2 : part_it < 5 && sq_size < 128 ? 4 : 3; |
226 | 80.5k | return tot_num_ns_per_part; |
227 | 80.5k | } |
228 | | |
229 | | //gives the index of next quadrant child within a depth |
230 | | static const uint32_t ns_depth_offset[GEOM_TOT][6] = {{21, 5, 1, 1, NOT_USED_VALUE, NOT_USED_VALUE}, |
231 | | {41, 9, 1, 1, NOT_USED_VALUE, NOT_USED_VALUE}, |
232 | | {85, 21, 5, 1, NOT_USED_VALUE, NOT_USED_VALUE}, |
233 | | {105, 25, 5, 1, NOT_USED_VALUE, NOT_USED_VALUE}, |
234 | | {169, 41, 9, 1, NOT_USED_VALUE, NOT_USED_VALUE}, |
235 | | {425, 105, 25, 5, NOT_USED_VALUE, NOT_USED_VALUE}, |
236 | | {681, 169, 41, 9, 1, NOT_USED_VALUE}, |
237 | | {849, 209, 49, 9, 1, NOT_USED_VALUE}, |
238 | | {1101, 269, 61, 9, 1, NOT_USED_VALUE}, |
239 | | {4421, 1101, 269, 61, 9, 1}, |
240 | | {2377, 593, 145, 33, 5, NOT_USED_VALUE}}; |
241 | | //gives the next depth block(first qudrant child) from a given parent square |
242 | | static const uint32_t d1_depth_offset[GEOM_TOT][6] = {{1, 1, 1, 1, 1, NOT_USED_VALUE}, |
243 | | {5, 5, 1, 1, 1, NOT_USED_VALUE}, |
244 | | {1, 1, 1, 1, 1, NOT_USED_VALUE}, |
245 | | {5, 5, 1, 1, 1, NOT_USED_VALUE}, |
246 | | {5, 5, 5, 1, 1, NOT_USED_VALUE}, |
247 | | {5, 5, 5, 5, 1, NOT_USED_VALUE}, |
248 | | {5, 5, 5, 5, 1, NOT_USED_VALUE}, |
249 | | {13, 13, 13, 5, 1, NOT_USED_VALUE}, |
250 | | {25, 25, 25, 5, 1, NOT_USED_VALUE}, |
251 | | {17, 25, 25, 25, 5, 1}, |
252 | | {5, 13, 13, 13, 5, NOT_USED_VALUE}}; |
253 | | |
254 | | static void md_scan_all_blks(GeomIndex geom, BlockGeom* blk_geom, uint32_t* idx_mds, uint32_t sq_size, uint32_t x, |
255 | 40.2k | uint32_t y, uint8_t min_nsq_bsize) { |
256 | | //the input block is the parent square block of size sq_size located at pos (x,y) |
257 | 40.2k | uint32_t part_it, nsq_it; |
258 | | |
259 | 40.2k | uint32_t halfsize = sq_size / 2; |
260 | 40.2k | uint32_t quartsize = sq_size / 4; |
261 | | |
262 | 40.2k | uint32_t max_part_updated = sq_size == 128 ? MIN(max_part, (uint32_t)(max_part < 9 && max_part > 3 ? 3 : 7)) |
263 | 40.2k | : sq_size == 8 ? MIN(max_part, 3) |
264 | 40.2k | : |
265 | | |
266 | 40.2k | sq_size == 4 ? 1 |
267 | 9.95k | : max_part; |
268 | 40.2k | if (sq_size <= min_nsq_bsize) { |
269 | 37.9k | max_part_updated = 1; |
270 | 37.9k | } |
271 | | |
272 | 80.5k | for (part_it = 0; part_it < max_part_updated; part_it++) { |
273 | 40.2k | uint32_t tot_num_ns_per_part = get_num_ns_per_part(part_it, sq_size); |
274 | | |
275 | 80.5k | for (nsq_it = 0; nsq_it < tot_num_ns_per_part; nsq_it++) { |
276 | 40.2k | uint8_t depth = sq_size == max_sb / 1 ? 0 |
277 | 40.2k | : sq_size == max_sb / 2 ? 1 |
278 | 39.8k | : sq_size == max_sb / 4 ? 2 |
279 | 37.9k | : sq_size == max_sb / 8 ? 3 |
280 | 30.3k | : sq_size == max_sb / 16 ? 4 |
281 | 0 | : 5; |
282 | | |
283 | 40.2k | blk_geom[*idx_mds].sq_size = sq_size; |
284 | | |
285 | | // part_it >= 3 for 128x128 blocks corresponds to HA/HB/VA/VB shapes since H4/V4 are not allowed |
286 | | // for 128x128 blocks. Therefore, need to offset part_it by 2 to not index H4/V4 shapes. |
287 | 40.2k | uint32_t part_it_idx = part_it >= 3 && sq_size == 128 ? part_it + 2 : part_it; |
288 | 40.2k | blk_geom[*idx_mds].d1_depth_offset = d1_depth_offset[geom][depth]; |
289 | 40.2k | blk_geom[*idx_mds].ns_depth_offset = ns_depth_offset[geom][depth]; |
290 | 40.2k | blk_geom[*idx_mds].bwidth = quartsize * ns_quarter_size_mult[part_it_idx][0][nsq_it]; |
291 | 40.2k | blk_geom[*idx_mds].bheight = quartsize * ns_quarter_size_mult[part_it_idx][1][nsq_it]; |
292 | 40.2k | blk_geom[*idx_mds].bsize = |
293 | 40.2k | hvsize_to_bsize[svt_log2f(blk_geom[*idx_mds].bwidth) - 2][svt_log2f(blk_geom[*idx_mds].bheight) - 2]; |
294 | 40.2k | blk_geom[*idx_mds].bwidth_uv = MAX(4, blk_geom[*idx_mds].bwidth >> 1); |
295 | 40.2k | blk_geom[*idx_mds].bheight_uv = MAX(4, blk_geom[*idx_mds].bheight >> 1); |
296 | | |
297 | 40.2k | blk_geom[*idx_mds].bsize_uv = get_plane_block_size(blk_geom[*idx_mds].bsize, 1, 1); |
298 | | #if _DEBUG |
299 | | blk_geom[*idx_mds].mds_idx = (*idx_mds); |
300 | | #endif |
301 | 40.2k | (*idx_mds) = (*idx_mds) + 1; |
302 | 40.2k | } |
303 | 40.2k | } |
304 | | |
305 | 40.2k | uint32_t min_size = max_sb >> (max_depth - 1); |
306 | 40.2k | if (halfsize >= min_size) { |
307 | 9.95k | md_scan_all_blks(geom, blk_geom, idx_mds, halfsize, x, y, min_nsq_bsize); |
308 | 9.95k | md_scan_all_blks(geom, blk_geom, idx_mds, halfsize, x + halfsize, y, min_nsq_bsize); |
309 | 9.95k | md_scan_all_blks(geom, blk_geom, idx_mds, halfsize, x, y + halfsize, min_nsq_bsize); |
310 | 9.95k | md_scan_all_blks(geom, blk_geom, idx_mds, halfsize, x + halfsize, y + halfsize, min_nsq_bsize); |
311 | 9.95k | } |
312 | 40.2k | } |
313 | | |
314 | 474 | static uint32_t count_total_num_of_active_blks(uint8_t min_nsq_bsize) { |
315 | 474 | uint32_t depth_it, sq_it_y, sq_it_x, part_it, nsq_it; |
316 | | |
317 | 474 | uint32_t depth_scan_idx = 0; |
318 | | |
319 | 2.37k | for (depth_it = 0; depth_it < max_depth; depth_it++) { |
320 | 1.89k | uint32_t tot_num_sq = 1 << depth_it; |
321 | 1.89k | uint32_t sq_size = depth_it == 0 ? max_sb |
322 | 1.89k | : depth_it == 1 ? max_sb / 2 |
323 | 1.42k | : depth_it == 2 ? max_sb / 4 |
324 | 948 | : depth_it == 3 ? max_sb / 8 |
325 | 474 | : depth_it == 4 ? max_sb / 16 |
326 | 0 | : max_sb / 32; |
327 | | |
328 | 1.89k | uint32_t max_part_updated = sq_size == 128 ? MIN(max_part, (uint32_t)(max_part < 9 && max_part > 3 ? 3 : 7)) |
329 | 1.89k | : sq_size == 8 ? MIN(max_part, 3) |
330 | 1.89k | : sq_size == 4 ? 1 |
331 | 1.42k | : max_part; |
332 | 1.89k | if (sq_size <= min_nsq_bsize) { |
333 | 948 | max_part_updated = 1; |
334 | 948 | } |
335 | 9.00k | for (sq_it_y = 0; sq_it_y < tot_num_sq; sq_it_y++) { |
336 | 47.4k | for (sq_it_x = 0; sq_it_x < tot_num_sq; sq_it_x++) { |
337 | 80.5k | for (part_it = 0; part_it < max_part_updated; part_it++) { |
338 | 40.2k | uint32_t tot_num_ns_per_part = get_num_ns_per_part(part_it, sq_size); |
339 | | |
340 | 80.5k | for (nsq_it = 0; nsq_it < tot_num_ns_per_part; nsq_it++) { |
341 | 40.2k | depth_scan_idx++; |
342 | 40.2k | } |
343 | 40.2k | } |
344 | 40.2k | } |
345 | 7.11k | } |
346 | 1.89k | } |
347 | | |
348 | 474 | return depth_scan_idx; |
349 | 474 | } |
350 | | |
351 | | /* |
352 | | Build Block Geometry |
353 | | */ |
354 | 474 | void svt_aom_build_blk_geom(GeomIndex geom, BlockGeom* blk_geom) { |
355 | 474 | uint32_t max_block_count; |
356 | 474 | uint32_t min_nsq_bsize; |
357 | 474 | if (geom == GEOM_0) { |
358 | 0 | max_sb = 64; |
359 | 0 | max_depth = 3; |
360 | 0 | max_part = 1; |
361 | 0 | max_block_count = 21; |
362 | 0 | min_nsq_bsize = 16; |
363 | 474 | } else if (geom == GEOM_1) { |
364 | 0 | max_sb = 64; |
365 | 0 | max_depth = 3; |
366 | 0 | max_part = 3; |
367 | 0 | max_block_count = 41; |
368 | 0 | min_nsq_bsize = 16; |
369 | 474 | } else if (geom == GEOM_2) { |
370 | 474 | max_sb = 64; |
371 | 474 | max_depth = 4; |
372 | 474 | max_part = 1; |
373 | 474 | max_block_count = 85; |
374 | 474 | min_nsq_bsize = 16; |
375 | 474 | } else if (geom == GEOM_3) { |
376 | 0 | max_sb = 64; |
377 | 0 | max_depth = 4; |
378 | 0 | max_part = 3; |
379 | 0 | max_block_count = 105; |
380 | 0 | min_nsq_bsize = 16; |
381 | 0 | } else if (geom == GEOM_4) { |
382 | 0 | max_sb = 64; |
383 | 0 | max_depth = 4; |
384 | 0 | max_part = 3; |
385 | 0 | max_block_count = 169; |
386 | 0 | min_nsq_bsize = 8; |
387 | 0 | } else if (geom == GEOM_5) { |
388 | 0 | max_sb = 64; |
389 | 0 | max_depth = 4; |
390 | 0 | max_part = 3; |
391 | 0 | max_block_count = 425; |
392 | 0 | min_nsq_bsize = 0; |
393 | 0 | } else if (geom == GEOM_6) { |
394 | 0 | max_sb = 64; |
395 | 0 | max_depth = 5; |
396 | 0 | max_part = 3; |
397 | 0 | max_block_count = 681; |
398 | 0 | min_nsq_bsize = 0; |
399 | 0 | } else if (geom == GEOM_7) { |
400 | 0 | max_sb = 64; |
401 | 0 | max_depth = 5; |
402 | 0 | max_part = 5; |
403 | 0 | max_block_count = 849; |
404 | 0 | min_nsq_bsize = 0; |
405 | 0 | } else if (geom == GEOM_8) { |
406 | 0 | max_sb = 64; |
407 | 0 | max_depth = 5; |
408 | 0 | max_part = 9; |
409 | 0 | max_block_count = 1101; |
410 | 0 | min_nsq_bsize = 0; |
411 | 0 | } else if (geom == GEOM_9) { |
412 | 0 | max_sb = 128; |
413 | 0 | max_depth = 6; |
414 | 0 | max_part = 9; |
415 | 0 | max_block_count = 4421; |
416 | 0 | min_nsq_bsize = 0; |
417 | 0 | } else { |
418 | 0 | max_sb = 128; |
419 | 0 | max_depth = 5; |
420 | 0 | max_part = 5; |
421 | 0 | max_block_count = 2377; |
422 | 0 | min_nsq_bsize = 0; |
423 | 0 | } |
424 | | //(0)compute total number of blocks using the information provided |
425 | 474 | max_num_active_blocks = count_total_num_of_active_blks(min_nsq_bsize); |
426 | 474 | if (max_num_active_blocks != max_block_count) { |
427 | 0 | SVT_LOG(" \n\n Error %i blocks\n\n ", max_num_active_blocks); |
428 | 0 | } |
429 | | //(2) Construct md scan blk_geom_mds: use info from dps |
430 | 474 | uint32_t idx_mds = 0; |
431 | 474 | md_scan_all_blks(geom, blk_geom, &idx_mds, max_sb, 0, 0, min_nsq_bsize); |
432 | 474 | } |
433 | | |
434 | | #if FIXED_POINT_ASSERT_TEST |
435 | | void svt_fixed_point_test_breakpoint(char* file, unsigned line) { |
436 | | printf("ERROR: Fixed Point Test Assert: %s:%u", file, line); |
437 | | } |
438 | | #endif |