Line data Source code
1 : /******************************************************************************************************
2 :
3 : (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
4 : Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
5 : Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
6 : Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
7 : contributors to this repository. All Rights Reserved.
8 :
9 : This software is protected by copyright law and by international treaties.
10 : The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
11 : Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
12 : Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
13 : Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
14 : contributors to this repository retain full ownership rights in their respective contributions in
15 : the software. This notice grants no license of any kind, including but not limited to patent
16 : license, nor is any license granted by implication, estoppel or otherwise.
17 :
18 : Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
19 : contributions.
20 :
21 : This software is provided "AS IS", without any express or implied warranties. The software is in the
22 : development stage. It is intended exclusively for experts who have experience with such software and
23 : solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
24 : and fitness for a particular purpose are hereby disclaimed and excluded.
25 :
26 : Any dispute, controversy or claim arising under or in relation to providing this software shall be
27 : submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
28 : accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
29 : the United Nations Convention on Contracts on the International Sales of Goods.
30 :
31 : *******************************************************************************************************/
32 :
33 : #include <stdint.h>
34 : #include "options.h"
35 : #include "math.h"
36 : #include "prot_fx.h"
37 : #include "ivas_rom_com.h"
38 : #include <assert.h>
39 : #include "wmc_auto.h"
40 : #include "ivas_rom_com_fx.h"
41 : #include "ivas_prot_fx.h"
42 :
43 :
44 : /*-----------------------------------------------------------------------------------------*
45 : * Function ivas_quantise_real_values()
46 : *
47 : * Quantize real values
48 : *-----------------------------------------------------------------------------------------*/
49 0 : void ivas_quantise_real_values_enc_fx_varq(
50 : const Word32 *values_fx,
51 : const Word16 q_levels,
52 : const Word32 min_value_fx,
53 : const Word32 max_value_fx,
54 : Word16 *index,
55 : Word32 *quant_fx,
56 : const Word16 dim,
57 : Word16 inp_q )
58 : {
59 : Word16 i;
60 : Word32 q_step_fx, one_by_q_step_fx;
61 0 : test();
62 0 : IF( EQ_16( q_levels, 1 ) )
63 : {
64 0 : FOR( i = 0; i < dim; i++ )
65 : {
66 0 : quant_fx[i] = 0;
67 0 : move32();
68 0 : index[i] = 0;
69 0 : move16();
70 : }
71 : }
72 0 : ELSE IF( q_levels && NE_32( max_value_fx, min_value_fx ) )
73 0 : {
74 0 : Word16 nor_q_level = norm_l( sub( q_levels, 1 ) );
75 0 : Word32 one_by_q_levels = divide3232( L_shl( 1, ( nor_q_level ) ), L_shl( sub( q_levels, 1 ), ( nor_q_level ) ) ); // Q15
76 0 : one_by_q_levels = L_shl( one_by_q_levels, 16 ); // Q31
77 0 : q_step_fx = Mpy_32_32( L_sub( max_value_fx, min_value_fx ), one_by_q_levels ); // Q28
78 : Word16 exp;
79 0 : Word16 one_by_max_min = BASOP_Util_Divide3232_Scale( ONE_IN_Q28, L_sub( max_value_fx, min_value_fx ), &exp ); // Q(15-exp)
80 0 : one_by_q_step_fx = L_mult0( sub( q_levels, 1 ), one_by_max_min ); // Q(15-exp)
81 : Word32 val_fx;
82 0 : IF( LT_16( inp_q, Q28 ) )
83 : {
84 0 : FOR( i = 0; i < dim; i++ )
85 : {
86 0 : val_fx = L_max( L_shr( min_value_fx, sub( Q28, inp_q ) ), L_min( values_fx[i], L_shr( max_value_fx, sub( Q28, inp_q ) ) ) ); // Q(inp_q)
87 0 : val_fx = L_shl( val_fx, sub( Q28, inp_q ) ); // Q28
88 0 : index[i] = round_fx( L_shl( Mpy_32_32( one_by_q_step_fx, val_fx ), add( Q4, exp ) ) ); // Q0
89 0 : move16();
90 0 : quant_fx[i] = imult3216( q_step_fx, index[i] ); // Q28
91 0 : move32();
92 : }
93 : }
94 : ELSE
95 : {
96 0 : FOR( i = 0; i < dim; i++ )
97 : {
98 0 : val_fx = L_max( min_value_fx, L_min( L_shr( values_fx[i], sub( inp_q, Q28 ) ), max_value_fx ) ); // Q28
99 0 : index[i] = round_fx( L_shl( Mpy_32_32( one_by_q_step_fx, val_fx ), add( Q4, exp ) ) ); // Q0
100 0 : move16();
101 0 : quant_fx[i] = imult3216( q_step_fx, index[i] ); // Q28
102 0 : move32();
103 : }
104 : }
105 : }
106 : ELSE
107 : {
108 0 : FOR( i = 0; i < dim; i++ )
109 : {
110 0 : quant_fx[i] = values_fx[i];
111 0 : move32();
112 : }
113 : }
114 0 : return;
115 : }
116 :
117 :
118 6684 : void ivas_quantise_real_values_fx(
119 : const Word32 *values_fx, /*q28*/
120 : const Word16 q_levels,
121 : const Word32 min_value_fx, /*q28*/
122 : const Word32 max_value_fx, /*q28*/
123 : Word16 *index,
124 : Word32 *quant_fx, /*q28*/
125 : const Word16 dim )
126 : {
127 : Word16 i;
128 : Word32 q_step_fx, one_by_q_step_fx;
129 6684 : test();
130 6684 : IF( EQ_16( q_levels, 1 ) )
131 : {
132 1272 : FOR( i = 0; i < dim; i++ )
133 : {
134 636 : quant_fx[i] = 0;
135 636 : move32();
136 636 : index[i] = 0;
137 636 : move16();
138 : }
139 : }
140 6048 : ELSE IF( q_levels && NE_32( max_value_fx, min_value_fx ) )
141 6048 : {
142 6048 : Word16 nor_q_level = norm_l( sub( q_levels, 1 ) );
143 6048 : Word32 one_by_q_levels = divide3232( L_shl( 1, ( nor_q_level ) ), L_shl( sub( q_levels, 1 ), ( nor_q_level ) ) ); // q15
144 6048 : one_by_q_levels = L_shl( one_by_q_levels, 16 ); // q31
145 6048 : q_step_fx = Mpy_32_32( L_sub( max_value_fx, min_value_fx ), one_by_q_levels ); // q28
146 6048 : Word16 one_by_max_min = divide3232( ONE_IN_Q28, L_sub( max_value_fx, min_value_fx ) ); // q15
147 6048 : one_by_q_step_fx = L_mult0( sub( q_levels, 1 ), one_by_max_min ); // q15
148 : Word32 val_fx;
149 12096 : FOR( i = 0; i < dim; i++ )
150 : {
151 6048 : val_fx = L_max( min_value_fx, L_min( values_fx[i], max_value_fx ) ); // q28
152 6048 : index[i] = extract_l( L_shr( Mpy_32_32( one_by_q_step_fx, val_fx ), 12 ) ); // q15+q28-q31-q12=>q0
153 6048 : move16();
154 6048 : quant_fx[i] = imult3216( q_step_fx, index[i] ); // q28
155 6048 : move16();
156 : }
157 : }
158 : ELSE
159 : {
160 0 : FOR( i = 0; i < dim; i++ )
161 : {
162 0 : quant_fx[i] = values_fx[i]; // q28
163 0 : move32();
164 : }
165 : }
166 6684 : return;
167 : }
168 :
169 0 : void ivas_quantise_real_values_enc_fx(
170 : const Word32 *values_fx, // Q28
171 : const Word16 q_levels,
172 : const Word32 min_value_fx, // Q28
173 : const Word32 max_value_fx, // Q28
174 : Word16 *index,
175 : Word32 *quant_fx, // Q28
176 : const Word16 dim )
177 : {
178 : Word16 i;
179 : Word32 q_step_fx, one_by_q_step_fx;
180 0 : test();
181 0 : IF( EQ_16( q_levels, 1 ) )
182 : {
183 0 : FOR( i = 0; i < dim; i++ )
184 : {
185 0 : quant_fx[i] = 0;
186 0 : move32();
187 0 : index[i] = 0;
188 0 : move16();
189 : }
190 : }
191 0 : ELSE IF( q_levels && NE_32( max_value_fx, min_value_fx ) )
192 0 : {
193 0 : Word16 nor_q_level = norm_l( sub( q_levels, 1 ) );
194 0 : Word32 one_by_q_levels = divide3232( L_shl( 1, ( nor_q_level ) ), L_shl( sub( q_levels, 1 ), ( nor_q_level ) ) ); // Q15
195 0 : one_by_q_levels = L_shl( one_by_q_levels, 16 ); // Q31
196 0 : q_step_fx = Mpy_32_32( L_sub( max_value_fx, min_value_fx ), one_by_q_levels ); // Q28
197 : Word16 exp;
198 0 : Word16 one_by_max_min = BASOP_Util_Divide3232_Scale( ONE_IN_Q28, L_sub( max_value_fx, min_value_fx ), &exp ); // Q(15-exp)
199 0 : one_by_q_step_fx = L_mult0( sub( q_levels, 1 ), one_by_max_min ); // Q(15-exp)
200 : Word32 val_fx;
201 0 : FOR( i = 0; i < dim; i++ )
202 : {
203 0 : val_fx = L_max( min_value_fx, L_min( values_fx[i], max_value_fx ) ); // Q28
204 0 : index[i] = round_fx( L_shl( Mpy_32_32( one_by_q_step_fx, val_fx ), add( Q4, exp ) ) ); //(Q(15-exp)+Q28-Q31)+Q4+Q(exp)=Q0
205 0 : move16();
206 0 : quant_fx[i] = imult3216( q_step_fx, index[i] ); // Q28
207 0 : move32();
208 : }
209 : }
210 : ELSE
211 : {
212 0 : FOR( i = 0; i < dim; i++ )
213 : {
214 0 : quant_fx[i] = values_fx[i]; // Q28
215 0 : move32();
216 : }
217 : }
218 0 : return;
219 : }
220 :
221 : /*-----------------------------------------------------------------------------------------*
222 : * Function ivas_spar_get_uniform_quant_strat()
223 : *
224 : * Sets the quant strat values
225 : *-----------------------------------------------------------------------------------------*/
226 : /*-----------------------------------------------------------------------------------------*
227 : * Function ivas_spar_get_uniform_quant_strat_fx()
228 : *
229 : * Sets the quant strat values
230 : *-----------------------------------------------------------------------------------------*/
231 1764 : void ivas_spar_get_uniform_quant_strat_fx(
232 : ivas_spar_md_com_cfg *pSpar_md_com_cfg,
233 : const Word16 table_idx )
234 : {
235 : Word16 i;
236 1764 : Word16 active_w = ivas_spar_br_table_consts[table_idx].active_w;
237 1764 : move16();
238 : Word16 PQ_q_lvl, C_q_lvl, Pr_q_lvl, Pc_q_lvl;
239 :
240 1764 : pSpar_md_com_cfg->num_quant_strats = MAX_QUANT_STRATS;
241 1764 : move16();
242 :
243 7056 : FOR( i = 0; i < pSpar_md_com_cfg->num_quant_strats; i++ )
244 : {
245 5292 : PQ_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][0];
246 5292 : move16();
247 5292 : C_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][1];
248 5292 : move16();
249 5292 : Pr_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][2];
250 5292 : move16();
251 5292 : Pc_q_lvl = ivas_spar_br_table_consts[table_idx].q_lvls[i][3];
252 5292 : move16();
253 :
254 5292 : IF( active_w )
255 : {
256 1929 : pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl;
257 1929 : move16();
258 1929 : pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl;
259 1929 : move16();
260 1929 : pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -322122547; // -1.2*Q28
261 1929 : move32();
262 1929 : pSpar_md_com_cfg->quant_strat[i].PR.max_fx = 322122547; // 1.2*Q28
263 1929 : move32();
264 :
265 1929 : pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl;
266 1929 : move16();
267 1929 : pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl;
268 1929 : move16();
269 1929 : pSpar_md_com_cfg->quant_strat[i].C.min_fx = -214748364; //-.8*Q28
270 1929 : move32();
271 1929 : pSpar_md_com_cfg->quant_strat[i].C.max_fx = 214748364; //.8*Q28
272 1929 : move32();
273 :
274 1929 : pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl;
275 1929 : move16();
276 1929 : pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl;
277 1929 : move16();
278 1929 : pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0;
279 1929 : move32();
280 1929 : pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = 214748364; //.8*Q28
281 1929 : move32();
282 :
283 1929 : pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl;
284 1929 : move16();
285 1929 : pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl;
286 1929 : move16();
287 1929 : pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -214748364; //-.8*Q28
288 1929 : move32();
289 1929 : pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = 214748364; //.8*Q28
290 1929 : move32();
291 : }
292 : ELSE
293 : {
294 3363 : pSpar_md_com_cfg->quant_strat[i].PR.q_levels[0] = PQ_q_lvl;
295 3363 : move16();
296 3363 : pSpar_md_com_cfg->quant_strat[i].PR.q_levels[1] = PQ_q_lvl;
297 3363 : move16();
298 3363 : pSpar_md_com_cfg->quant_strat[i].PR.max_fx = ONE_IN_Q28; // 1 Q28
299 3363 : move32();
300 3363 : pSpar_md_com_cfg->quant_strat[i].PR.min_fx = -ONE_IN_Q28; //-1 Q28
301 3363 : move32();
302 :
303 3363 : pSpar_md_com_cfg->quant_strat[i].C.q_levels[0] = C_q_lvl;
304 3363 : move16();
305 3363 : pSpar_md_com_cfg->quant_strat[i].C.q_levels[1] = C_q_lvl;
306 3363 : move16();
307 3363 : pSpar_md_com_cfg->quant_strat[i].C.max_fx = ONE_IN_Q29; // 2 Q28
308 3363 : move32();
309 3363 : pSpar_md_com_cfg->quant_strat[i].C.min_fx = -ONE_IN_Q29; //-2 Q28
310 3363 : move32();
311 :
312 3363 : pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[0] = Pr_q_lvl;
313 3363 : move16();
314 3363 : pSpar_md_com_cfg->quant_strat[i].P_r.q_levels[1] = Pr_q_lvl;
315 3363 : move16();
316 3363 : pSpar_md_com_cfg->quant_strat[i].P_r.max_fx = ONE_IN_Q28; // 1 Q28
317 3363 : move32();
318 3363 : pSpar_md_com_cfg->quant_strat[i].P_r.min_fx = 0; // Q28
319 3363 : move32();
320 :
321 3363 : pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[0] = Pc_q_lvl;
322 3363 : move16();
323 3363 : pSpar_md_com_cfg->quant_strat[i].P_c.q_levels[1] = Pc_q_lvl;
324 3363 : move16();
325 3363 : pSpar_md_com_cfg->quant_strat[i].P_c.max_fx = ONE_IN_Q27; // 0.5 Q28
326 3363 : move32();
327 3363 : pSpar_md_com_cfg->quant_strat[i].P_c.min_fx = -ONE_IN_Q27; //-0.5 Q28
328 3363 : move32();
329 : }
330 : }
331 :
332 1764 : return;
333 : }
334 :
335 :
336 : /*-----------------------------------------------------------------------------------------*
337 : * Function ivas_map_prior_coeffs_quant()
338 : *
339 : * Map prior coeffs
340 : *-----------------------------------------------------------------------------------------*/
341 74647 : void ivas_map_prior_coeffs_quant(
342 : ivas_spar_md_prev_t *pSpar_md_prior,
343 : ivas_spar_md_com_cfg *pSpar_md_cfg,
344 : const Word16 qsi,
345 : const Word16 nB )
346 : {
347 : Word16 i, j;
348 :
349 74647 : IF( NE_16( qsi, pSpar_md_cfg->prev_quant_idx ) )
350 : {
351 676 : ivas_quant_strat_t qs = pSpar_md_cfg->quant_strat[qsi];
352 676 : ivas_quant_strat_t prev_qs = pSpar_md_cfg->quant_strat[pSpar_md_cfg->prev_quant_idx];
353 676 : Word32 one_by_q_lvl_PR_fx = one_by_q_level[max( ( prev_qs.PR.q_levels[0] - 1 ), 1 )]; /*q31*/
354 676 : move32();
355 676 : Word32 one_by_q_lvl_C_fx = one_by_q_level[max( ( prev_qs.C.q_levels[0] - 1 ), 1 )]; /*q31*/
356 676 : move32();
357 676 : Word32 one_by_q_lvl_P_r_fx = one_by_q_level[max( ( prev_qs.P_r.q_levels[0] - 1 ), 1 )]; /*q31*/
358 676 : move32();
359 6084 : FOR( i = 0; i < nB; i++ )
360 : {
361 59488 : FOR( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ )
362 : {
363 54080 : Word32 trial1 = L_mult0( sub( qs.PR.q_levels[0], 1 ), pSpar_md_prior->band_coeffs_idx[i].pred_index_re[j] ); /*q0*/
364 54080 : trial1 = L_shl( trial1, 16 ); /*q16*/
365 54080 : trial1 = round_fx( Mpy_32_32( trial1, one_by_q_lvl_PR_fx ) ); /*q16+q31-31-16->0*/
366 54080 : pSpar_md_prior->band_coeffs_idx_mapped[i].pred_index_re[j] = extract_l( trial1 ); /*q0*/
367 54080 : move16();
368 54080 : Word32 trial2 = L_mult0( sub( qs.P_r.q_levels[0], 1 ), pSpar_md_prior->band_coeffs_idx[i].decd_index_re[j] ); /*q0*/
369 54080 : trial2 = L_shl( trial2, 16 ); /*q16*/
370 54080 : trial2 = round_fx( Mpy_32_32( trial2, one_by_q_lvl_P_r_fx ) ); /*q16+q31-31-16->0*/
371 54080 : pSpar_md_prior->band_coeffs_idx_mapped[i].decd_index_re[j] = extract_l( trial2 ); /*q0*/
372 54080 : move16();
373 : }
374 118976 : FOR( j = 0; j < IVAS_SPAR_MAX_C_COEFF; j++ )
375 : {
376 113568 : Word32 trial1 = L_mult0( sub( qs.C.q_levels[0], 1 ), pSpar_md_prior->band_coeffs_idx[i].drct_index_re[j] ); /*q0*/
377 113568 : trial1 = L_shl( trial1, 16 ); /*q16*/
378 113568 : trial1 = round_fx( Mpy_32_32( trial1, one_by_q_lvl_C_fx ) ); /*q16+q31-31-16->0*/
379 113568 : pSpar_md_prior->band_coeffs_idx_mapped[i].drct_index_re[j] = extract_l( trial1 ); /*q0*/
380 113568 : move16();
381 : }
382 : }
383 : }
384 : ELSE
385 : {
386 665739 : FOR( i = 0; i < nB; i++ )
387 : {
388 6509448 : FOR( j = 0; j < IVAS_SPAR_MAX_CH - 1; j++ )
389 : {
390 5917680 : pSpar_md_prior->band_coeffs_idx_mapped[i].pred_index_re[j] = pSpar_md_prior->band_coeffs_idx[i].pred_index_re[j];
391 5917680 : move16();
392 5917680 : pSpar_md_prior->band_coeffs_idx_mapped[i].decd_index_re[j] = pSpar_md_prior->band_coeffs_idx[i].decd_index_re[j];
393 5917680 : move16();
394 : }
395 13018896 : FOR( j = 0; j < IVAS_SPAR_MAX_C_COEFF; j++ )
396 : {
397 12427128 : pSpar_md_prior->band_coeffs_idx_mapped[i].drct_index_re[j] = pSpar_md_prior->band_coeffs_idx[i].drct_index_re[j];
398 12427128 : move16();
399 : }
400 : }
401 : }
402 :
403 74647 : return;
404 : }
405 :
406 : /*-----------------------------------------------------------------------------------------*
407 : * Function ivas_spar_quant_dtx_init()
408 : *
409 : * Init SPAR MD with minmax vals
410 : *-----------------------------------------------------------------------------------------*/
411 1764 : void ivas_spar_quant_dtx_init_fx(
412 : ivas_spar_md_t *spar_md,
413 : Word32 *min_max /*q28*/ )
414 : {
415 1764 : spar_md->min_max_fx[0] = min_max[0]; // q28
416 1764 : move32();
417 1764 : spar_md->min_max_fx[1] = min_max[1]; // q28
418 1764 : move32();
419 :
420 1764 : return;
421 : }
422 :
423 : /*-----------------------------------------------------------------------------------------*
424 : * Function ivas_copy_band_coeffs_idx_to_arr()
425 : *
426 : * Copy pred band coeffs to arr
427 : *-----------------------------------------------------------------------------------------*/
428 :
429 298616 : void ivas_copy_band_coeffs_idx_to_arr(
430 : ivas_band_coeffs_ind_t *pBands_idx,
431 : const Word16 nB,
432 : Word16 *pSymbol_re,
433 : ivas_cell_dim_t *pCell_dims,
434 : const ivas_coeffs_type_t coeff_type )
435 : {
436 : Word16 i, len;
437 298616 : Word16 *pPtr_idx = NULL;
438 :
439 2687544 : FOR( i = 0; i < nB; i++ )
440 : {
441 2388928 : SWITCH( coeff_type )
442 : {
443 597232 : case PRED_COEFF:
444 : {
445 597232 : pPtr_idx = pBands_idx[i].pred_index_re;
446 597232 : BREAK;
447 : }
448 597232 : case DRCT_COEFF:
449 : {
450 597232 : pPtr_idx = pBands_idx[i].drct_index_re;
451 597232 : BREAK;
452 : }
453 597232 : case DECD_COEFF:
454 : {
455 597232 : pPtr_idx = pBands_idx[i].decd_index_re;
456 597232 : BREAK;
457 : }
458 597232 : case DECX_COEFF:
459 : {
460 597232 : BREAK;
461 : }
462 : }
463 2388928 : len = imult1616( pCell_dims[i].dim1, pCell_dims[i].dim2 );
464 2388928 : IF( NE_16( coeff_type, DECX_COEFF ) )
465 : {
466 1791696 : Copy( pPtr_idx, pSymbol_re, len );
467 1791696 : pSymbol_re += len;
468 : }
469 : }
470 :
471 :
472 298616 : return;
473 : }
474 :
475 :
476 : /*-----------------------------------------------------------------------------------------*
477 : * Function ivas_clear_band_coeffs()
478 : *
479 : * clear band coeffs array in SPAR MD
480 : *-----------------------------------------------------------------------------------------*/
481 :
482 3528 : void ivas_clear_band_coeffs_fx(
483 : ivas_band_coeffs_t *pband_coeffs,
484 : const UWord16 num_bands )
485 : {
486 : UWord16 i;
487 :
488 45864 : FOR( i = 0; i < num_bands; i++ )
489 : {
490 42336 : set32_fx( (Word32 *) pband_coeffs[i].C_re_fx, 0, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) );
491 42336 : set32_fx( (Word32 *) pband_coeffs[i].P_re_fx, 0, ( IVAS_SPAR_MAX_CH - 1 ) );
492 42336 : set32_fx( (Word32 *) pband_coeffs[i].C_quant_re_fx, 0, ( IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS ) * ( IVAS_SPAR_MAX_DMX_CHS - 1 ) );
493 42336 : set32_fx( (Word32 *) pband_coeffs[i].P_quant_re_fx, 0, ( IVAS_SPAR_MAX_CH - 1 ) );
494 42336 : set32_fx( pband_coeffs[i].pred_re_fx, 0, ( IVAS_SPAR_MAX_CH - 1 ) );
495 42336 : set32_fx( pband_coeffs[i].pred_quant_re_fx, 0, ( IVAS_SPAR_MAX_CH - 1 ) );
496 : }
497 :
498 3528 : return;
499 : }
500 : /*-----------------------------------------------------------------------------------------*
501 : * Function ivas_clear_band_coeff_idx()
502 : *
503 : * clear band coeffs index array in SPAR MD
504 : *-----------------------------------------------------------------------------------------*/
505 :
506 5292 : void ivas_clear_band_coeff_idx(
507 : ivas_band_coeffs_ind_t *pband_coeff_idx,
508 : const UWord16 num_bands )
509 : {
510 : UWord16 i;
511 68796 : FOR( i = 0; i < num_bands; i++ )
512 : {
513 63504 : set16_fx( pband_coeff_idx[i].pred_index_re, 0, ( sub( IVAS_SPAR_MAX_CH, 1 ) ) );
514 63504 : set16_fx( pband_coeff_idx[i].drct_index_re, 0, IVAS_SPAR_MAX_C_COEFF );
515 63504 : set16_fx( pband_coeff_idx[i].decd_index_re, 0, sub( IVAS_SPAR_MAX_CH, 1 ) );
516 : }
517 :
518 5292 : return;
519 : }
|