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 #include <string.h>
21 #include <stdlib.h>
22 #include "impd_type_def.h"
23 #include "impd_error_standards.h"
24 #include "impd_apicmd_standards.h"
25 #include "impd_memory_standards.h"
26
27 #include "impd_drc_bitbuffer.h"
28 #include "impd_drc_extr_delta_coded_info.h"
29 #include "impd_drc_common.h"
30 #include "impd_drc_struct.h"
31 #include "impd_drc_interface.h"
32 #include "impd_parametric_drc_dec.h"
33 #include "impd_drc_gain_dec.h"
34 #include "impd_drc_filter_bank.h"
35 #include "impd_drc_multi_band.h"
36 #include "impd_drc_process_audio.h"
37 #include "impd_drc_eq.h"
38 #include "impd_drc_gain_decoder.h"
39 #include "impd_drc_config_params.h"
40 #include "impd_drc_api_defs.h"
41 #include "impd_drc_definitions.h"
42 #include "impd_drc_hashdefines.h"
43 #include "impd_drc_peak_limiter.h"
44
45 #include "impd_drc_selection_process.h"
46 #include "impd_drc_api_struct_def.h"
47 #include "impd_drc_error_codes.h"
48
49 WORD32 impd_init_process_audio_main_qmf(ia_drc_api_struct *p_obj_drc);
50 WORD32 impd_init_process_audio_main_stft(ia_drc_api_struct *p_obj_drc);
51 WORD32 impd_init_process_audio_main_td_qmf(ia_drc_api_struct *p_obj_drc);
52
53 IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc, WORD32 i_cmd,
54 WORD32 i_idx, pVOID pv_value);
55
56 IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc);
57
58 IA_ERRORCODE impd_drc_process_frame(ia_drc_api_struct *p_obj_drc);
59 IA_ERRORCODE impd_drc_init(ia_drc_api_struct *p_obj_drc);
60 IA_ERRORCODE impd_drc_set_default_config(ia_drc_api_struct *p_obj_drc);
61 IA_ERRORCODE impd_drc_set_struct_pointer(ia_drc_api_struct *p_obj_drc);
62 IA_ERRORCODE impd_process_time_domain(ia_drc_api_struct *p_obj_drc);
63
64 #define SUBBAND_BUF_SIZE \
65 NUM_ELE_IN_CPLX_NUM *MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + \
66 (MAX_SUBBAND_DELAY + MAX_DRC_FRAME_SIZE) * MAX_CHANNEL_COUNT * \
67 sizeof(FLOAT32) * NUM_ELE_IN_CPLX_NUM
68
69 #define NUM_DRC_TABLES 4
70 #define SCRATCH_MEM_SIZE \
71 (AUDIO_CODEC_FRAME_SIZE_MAX * MAX_CHANNEL_COUNT * sizeof(FLOAT32) * \
72 NUM_ELE_IN_CPLX_NUM)
73
74 #define PERSIST_MEM_SIZE \
75 (sizeof(ia_drc_state_struct) + sizeof(ia_drc_bits_dec_struct) + \
76 sizeof(ia_drc_gain_dec_struct) * 2 + \
77 sizeof(ia_drc_loudness_info_set_struct) + sizeof(ia_drc_gain_struct) + \
78 sizeof(ia_drc_interface_struct) + sizeof(ia_drc_config) + \
79 sizeof(ia_drc_sel_pro_struct) + sizeof(ia_drc_sel_proc_params_struct) + \
80 sizeof(ia_drc_sel_proc_output_struct) + \
81 sizeof(ia_drc_peak_limiter_struct) + sizeof(ia_drc_peak_limiter_struct) + \
82 sizeof(ia_drc_qmf_filt_struct) + ANALY_BUF_SIZE + SYNTH_BUF_SIZE + \
83 PEAK_LIM_BUF_SIZE + MAX_DRC_BS_BUF_SIZE + \
84 MAX_DRC_CONFG_BUF_SIZE + /*DRC Config Bitstream*/ \
85 MAX_LOUD_INFO_BUF_SIZE + /*DRC loudness info Bitstream*/ \
86 MAX_INTERFACE_BUF_SIZE + /*DRC interface Bitstream*/ \
87 NUM_GAIN_DEC_INSTANCES * \
88 (SEL_DRC_COUNT * sizeof(ia_interp_buf_struct) * MAX_GAIN_ELE_COUNT + \
89 sizeof(ia_eq_set_struct) + /*non_interleaved_audio*/ \
90 MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + \
91 MAX_DRC_FRAME_SIZE * sizeof(FLOAT32) * \
92 MAX_CHANNEL_COUNT + /*audio_in_out_buf ptr*/ \
93 MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + /*audio_io_buffer_delayed*/ \
94 MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + \
95 MAX_DRC_FRAME_SIZE * sizeof(FLOAT32) * \
96 MAX_CHANNEL_COUNT + /*subband band buffer ptr*/ \
97 NUM_ELE_IN_CPLX_NUM * MAX_CHANNEL_COUNT * sizeof(FLOAT32 *) + \
98 SUBBAND_BUF_SIZE + (PARAM_DRC_MAX_BUF_SZ * MAX_CHANNEL_COUNT)))
99
ia_drc_dec_api(pVOID p_ia_drc_dec_obj,WORD32 i_cmd,WORD32 i_idx,pVOID pv_value)100 IA_ERRORCODE ia_drc_dec_api(pVOID p_ia_drc_dec_obj, WORD32 i_cmd, WORD32 i_idx,
101 pVOID pv_value) {
102 ia_drc_api_struct *p_obj_drc = p_ia_drc_dec_obj;
103 IA_ERRORCODE error_code = IA_NO_ERROR;
104 LOOPIDX i;
105
106 pUWORD32 pui_value = pv_value;
107 pUWORD32 pus_value = pv_value;
108 pWORD8 pb_value = pv_value;
109 SIZE_T *ps_value = pv_value;
110 pWORD32 pi_value = pv_value;
111 float *pf_value = pv_value;
112
113 switch (i_cmd) {
114 case IA_API_CMD_GET_MEM_INFO_SIZE:
115 case IA_API_CMD_GET_MEM_INFO_ALIGNMENT:
116 case IA_API_CMD_GET_MEM_INFO_TYPE:
117 case IA_API_CMD_GET_MEM_INFO_PLACEMENT:
118 case IA_API_CMD_GET_MEM_INFO_PRIORITY:
119 case IA_API_CMD_SET_MEM_PTR:
120 case IA_API_CMD_SET_MEM_PLACEMENT: {
121 return impd_drc_mem_api(p_ia_drc_dec_obj, i_cmd, i_idx, pv_value);
122 }
123 };
124
125 switch (i_cmd) {
126 case IA_API_CMD_GET_LIB_ID_STRINGS: {
127 switch (i_idx) {
128 case IA_CMD_TYPE_LIB_NAME: {
129 WORD8 lib_name[] = LIBNAME;
130 for (i = 0; i < IA_API_STR_LEN && lib_name[i - 1] != 0; i++) {
131 pb_value[i] = lib_name[i];
132 }
133 break;
134 }
135 case IA_CMD_TYPE_LIB_VERSION: {
136 break;
137 }
138
139 case IA_CMD_TYPE_API_VERSION: {
140 }
141 default: { return -1; }
142 };
143 break;
144 }
145 case IA_API_CMD_GET_API_SIZE: {
146 *pui_value = sizeof(ia_drc_api_struct);
147
148 break;
149 }
150 case IA_API_CMD_INIT: {
151 switch (i_idx) {
152 case IA_CMD_TYPE_INIT_SET_BUFF_PTR: {
153 p_obj_drc->p_state->persistent_ptr =
154 (UWORD8 *)p_obj_drc->pp_mem[IA_DRC_PERSIST_IDX] +
155 sizeof(ia_drc_state_struct);
156 error_code = impd_drc_set_struct_pointer(p_obj_drc);
157 if (error_code) return error_code;
158
159 break;
160 }
161 case IA_CMD_TYPE_INIT_API_PRE_CONFIG_PARAMS: {
162 error_code = impd_drc_set_default_config(p_obj_drc);
163 if (error_code) return error_code;
164 break;
165 }
166 case IA_CMD_TYPE_INIT_API_POST_CONFIG_PARAMS: {
167 error_code = impd_drc_fill_mem_tables(p_obj_drc);
168 if (error_code) return error_code;
169 break;
170 }
171 case IA_CMD_TYPE_INIT_PROCESS: {
172 IA_ERRORCODE Error = 0;
173
174 if (p_obj_drc->pp_mem[IA_DRC_PERSIST_IDX] == 0) {
175 return (-1);
176 }
177
178 Error = impd_drc_init(p_obj_drc);
179 if (Error) return Error;
180 p_obj_drc->p_state->ui_init_done = 1;
181 return Error;
182 break;
183 }
184 case IA_CMD_TYPE_INIT_DONE_QUERY: {
185 if (p_obj_drc->p_state->ui_init_done == 1) {
186 *pui_value = 1;
187 } else {
188 *pui_value = 0;
189 }
190 break;
191 }
192
193 case IA_CMD_TYPE_INIT_CPY_BSF_BUFF_OVER_QUERY: {
194 *pui_value = p_obj_drc->str_bit_handler.cpy_over;
195 break;
196 }
197 case IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF_OVER_QUERY: {
198 *pui_value = p_obj_drc->str_bit_handler.cpy_over_ic;
199 break;
200 }
201
202 case IA_CMD_TYPE_INIT_CPY_IL_BSF_BUFF_OVER_QUERY: {
203 *pui_value = p_obj_drc->str_bit_handler.cpy_over_il;
204 break;
205 }
206 case IA_CMD_TYPE_INIT_CPY_IN_BSF_BUFF_OVER_QUERY: {
207 *pui_value = p_obj_drc->str_bit_handler.cpy_over_in;
208 break;
209 }
210 case IA_CMD_TYPE_INIT_CPY_BSF_BUFF: {
211 memcpy(p_obj_drc->str_bit_handler.it_bit_buf +
212 p_obj_drc->str_bit_handler.num_bytes_offset_bs,
213 p_obj_drc->pp_mem[2], p_obj_drc->str_bit_handler.num_byts_cur);
214 p_obj_drc->str_bit_handler.num_bytes_bs =
215 p_obj_drc->str_bit_handler.num_bytes_bs +
216 p_obj_drc->str_bit_handler.num_byts_cur;
217 p_obj_drc->str_bit_handler.num_bytes_offset_bs =
218 p_obj_drc->str_bit_handler.num_bytes_bs;
219 p_obj_drc->str_bit_handler.num_total_bytes =
220 p_obj_drc->str_bit_handler.num_bytes_bs;
221
222 break;
223 }
224 case IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF: {
225 memcpy(p_obj_drc->str_bit_handler.bitstream_drc_config,
226 p_obj_drc->pp_mem[2],
227 p_obj_drc->str_bit_handler.num_byts_cur_ic);
228 p_obj_drc->str_bit_handler.num_bytes_bs_drc_config =
229 p_obj_drc->str_bit_handler.num_byts_cur_ic;
230 break;
231 }
232 case IA_CMD_TYPE_INIT_CPY_IL_BSF_BUFF: {
233 memcpy(p_obj_drc->str_bit_handler.bitstream_loudness_info,
234 p_obj_drc->pp_mem[2],
235 p_obj_drc->str_bit_handler.num_byts_cur_il);
236 p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info =
237 p_obj_drc->str_bit_handler.num_byts_cur_il;
238 break;
239 }
240 case IA_CMD_TYPE_INIT_CPY_IN_BSF_BUFF: {
241 memcpy(p_obj_drc->str_bit_handler.bitstream_unidrc_interface,
242 p_obj_drc->pp_mem[2],
243 p_obj_drc->str_bit_handler.num_byts_cur_in);
244 p_obj_drc->str_bit_handler.num_bytes_bs_unidrc_interface =
245 p_obj_drc->str_bit_handler.num_byts_cur_in;
246 break;
247 }
248 default: { return -1; }
249 };
250 break;
251 }
252 case IA_API_CMD_GET_CONFIG_PARAM: {
253 switch (i_idx) {
254 case IA_DRC_DEC_CONFIG_PARAM_SAMP_FREQ: {
255 *pus_value = p_obj_drc->str_config.sampling_rate;
256 break;
257 }
258
259 case IA_DRC_DEC_CONFIG_PARAM_NUM_CHANNELS: {
260 *pus_value = p_obj_drc->str_config.num_ch_out;
261 break;
262 }
263 case IA_DRC_DEC_CONFIG_PROC_OUT_PTR: {
264 *ps_value = (SIZE_T)p_obj_drc->str_payload.pstr_drc_sel_proc_output;
265 break;
266 }
267 case IA_DRC_DEC_CONFIG_DRC_TARGET_LOUDNESS: {
268 *pi_value = (WORD32)p_obj_drc->str_payload.pstr_loudness_info->loudness_info
269 ->loudness_measure->method_val;
270 if (*pi_value < -1)
271 *pi_value = *pi_value * -4;
272 else
273 *pi_value = -1;
274 break;
275 }
276 }
277 break;
278 }
279 case IA_API_CMD_SET_CONFIG_PARAM: {
280 switch (i_idx) {
281 case IA_DRC_DEC_CONFIG_PARAM_SAMP_FREQ: {
282 if (*pus_value < 8000 || *pus_value > 96000) {
283 return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_SAMP_FREQ;
284 }
285 p_obj_drc->str_config.sampling_rate = *pus_value;
286 break;
287 }
288 case IA_DRC_DEC_CONFIG_PARAM_APPLY_CROSSFADE: {
289 p_obj_drc->str_config.apply_crossfade = *pus_value;
290 break;
291 }
292 case IA_DRC_DEC_CONFIG_PARAM_CONFIG_CHANGED: {
293 p_obj_drc->str_config.is_config_changed = *pus_value;
294 break;
295 }
296 case IA_DRC_DEC_CONFIG_PARAM_NUM_CHANNELS: {
297 p_obj_drc->str_config.num_ch_in = *pus_value;
298 if (*pus_value < 1 || *pus_value > MAX_CHANNEL_COUNT) {
299 return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_NUM_OF_CHANNELS;
300 }
301 break;
302 }
303
304 case IA_DRC_DEC_CONFIG_PARAM_PCM_WDSZ: {
305 switch (*pus_value) {
306 case 16:
307 case 24:
308 case 32:
309 break;
310 default:
311 return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_PCM_SIZE;
312 }
313
314 p_obj_drc->str_config.pcm_size = *pus_value;
315
316 break;
317 }
318
319 case IA_DRC_DEC_CONFIG_PARAM_BITS_FORMAT: {
320 break;
321 }
322 case IA_DRC_DEC_CONFIG_PARAM_INT_PRESENT: {
323 break;
324 }
325 case IA_DRC_DEC_CONFIG_PARAM_FRAME_SIZE: {
326 if (*pus_value < 1 || *pus_value > 4096) {
327 return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_FRAME_SIZE;
328 }
329
330 p_obj_drc->str_config.frame_size = *pus_value;
331
332 break;
333 }
334 case IA_DRC_DEC_CONFIG_GAIN_STREAM_FLAG: {
335 break;
336 }
337
338 case IA_DRC_DEC_CONFIG_DRC_EFFECT_TYPE: {
339 p_obj_drc->str_config.effect_type = *pus_value;
340 break;
341 }
342 case IA_DRC_DEC_CONFIG_DRC_TARGET_LOUDNESS: {
343 p_obj_drc->str_config.target_loudness = *pus_value;
344 break;
345 }
346 case IA_DRC_DEC_CONFIG_DRC_LOUD_NORM: {
347 p_obj_drc->str_config.loud_norm_flag = *pus_value;
348 break;
349 }
350 case IA_DRC_DEC_CONFIG_DRC_ALBUM_MODE: {
351 p_obj_drc->str_config.album_mode = *pus_value;
352 break;
353 }
354 case IA_DRC_DEC_CONFIG_DRC_BOOST: {
355 p_obj_drc->str_config.boost = (*pf_value);
356 p_obj_drc->str_config.boost_set = 1;
357 break;
358 }
359 case IA_DRC_DEC_CONFIG_DRC_COMPRESS: {
360 p_obj_drc->str_config.compress = (*pf_value);
361 p_obj_drc->str_config.compress_set = 1;
362 break;
363 }
364 default: { return -1; }
365 }
366 break;
367 }
368 case IA_API_CMD_GET_MEMTABS_SIZE: {
369 *pui_value =
370 (sizeof(ia_mem_info_struct) + sizeof(pVOID *)) * (NUM_DRC_TABLES);
371 break;
372 }
373 case IA_API_CMD_SET_MEMTABS_PTR: {
374 if (ps_value == NULL) return IA_DRC_DEC_API_FATAL_MEM_ALLOC;
375 memset(ps_value, 0,
376 (sizeof(ia_mem_info_struct) + sizeof(pVOID *)) * (NUM_DRC_TABLES));
377 p_obj_drc->p_mem_info = (ia_mem_info_struct *)(ps_value);
378 p_obj_drc->pp_mem =
379 (pVOID)((SIZE_T)p_obj_drc->p_mem_info +
380 (NUM_DRC_TABLES * sizeof(*(p_obj_drc->p_mem_info))));
381 break;
382 }
383 case IA_API_CMD_GET_N_MEMTABS: {
384 *pui_value = NUM_DRC_TABLES;
385 break;
386 }
387 case IA_API_CMD_GET_N_TABLES: {
388 break;
389 }
390
391 case IA_API_CMD_EXECUTE: {
392 switch (i_idx) {
393 case IA_CMD_TYPE_DO_EXECUTE: {
394 if (!p_obj_drc->p_state->ui_init_done) {
395 error_code = IA_FATAL_ERROR;
396 } else if (p_obj_drc->str_config.dec_type == DEC_TYPE_TD) {
397 error_code = impd_process_time_domain(p_obj_drc);
398 } else if (p_obj_drc->str_config.dec_type == DEC_TYPE_QMF64) {
399 error_code = IA_FATAL_ERROR;
400 } else if (p_obj_drc->str_config.dec_type == DEC_TYPE_STFT256) {
401 error_code = IA_FATAL_ERROR;
402 } else if (p_obj_drc->str_config.dec_type == DEC_TYPE_TD_QMF64) {
403 error_code = IA_FATAL_ERROR;
404 }
405 p_obj_drc->str_bit_handler.byte_index_bs =
406 p_obj_drc->str_bit_handler.num_total_bytes -
407 p_obj_drc->str_bit_handler.num_bytes_bs;
408 p_obj_drc->str_bit_handler.num_bytes_offset_bs = 0;
409
410 break;
411 }
412 case IA_CMD_TYPE_DONE_QUERY: {
413 *pui_value = p_obj_drc->p_state->ui_exe_done;
414 break;
415 }
416 default: { return -1; }
417 };
418 break;
419 }
420 case IA_API_CMD_PUT_INPUT_QUERY: {
421 *pui_value = 1;
422 break;
423 }
424 case IA_API_CMD_GET_CURIDX_INPUT_BUF: {
425 UWORD32 ui_in_buf_size = p_obj_drc->p_mem_info[IA_DRC_INPUT_IDX].ui_size;
426 UWORD32 ui_in_bytes = p_obj_drc->p_state->ui_in_bytes;
427 *pui_value = ui_in_buf_size > ui_in_bytes ? ui_in_bytes : ui_in_buf_size;
428 break;
429 }
430 case IA_API_CMD_SET_INPUT_BYTES: {
431 p_obj_drc->p_state->ui_in_bytes = *pui_value;
432 break;
433 }
434
435 case IA_API_CMD_GET_OUTPUT_BYTES: {
436 *pui_value = p_obj_drc->p_state->ui_out_bytes;
437 break;
438 }
439 case IA_API_CMD_INPUT_OVER: {
440 p_obj_drc->p_state->ui_exe_done = 1;
441 break;
442 }
443 case IA_API_CMD_SET_INPUT_BYTES_BS: {
444 p_obj_drc->str_bit_handler.num_byts_cur = *pus_value;
445 break;
446 }
447 case IA_API_CMD_SET_INPUT_BYTES_IC_BS: {
448 p_obj_drc->str_bit_handler.num_byts_cur_ic = *pus_value;
449 break;
450 }
451 case IA_API_CMD_SET_INPUT_BYTES_IL_BS: {
452 p_obj_drc->str_bit_handler.num_byts_cur_il = *pus_value;
453 break;
454 }
455 case IA_API_CMD_SET_INPUT_BYTES_IN_BS: {
456 p_obj_drc->str_bit_handler.num_byts_cur_in = *pus_value;
457 break;
458 }
459 default: { return -1; }
460 };
461 return error_code;
462 }
463
impd_drc_mem_api(ia_drc_api_struct * p_obj_drc,WORD32 i_cmd,WORD32 i_idx,pVOID pv_value)464 IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc, WORD32 i_cmd,
465 WORD32 i_idx, pVOID pv_value) {
466 pUWORD32 pui_value = pv_value;
467
468 switch (i_cmd) {
469 case IA_API_CMD_GET_MEM_INFO_SIZE: {
470 *pui_value = p_obj_drc->p_mem_info[i_idx].ui_size;
471 break;
472 }
473 case IA_API_CMD_GET_MEM_INFO_ALIGNMENT: {
474 *pui_value = p_obj_drc->p_mem_info[i_idx].ui_alignment;
475 break;
476 }
477 case IA_API_CMD_GET_MEM_INFO_TYPE: {
478 *pui_value = p_obj_drc->p_mem_info[i_idx].ui_type;
479 break;
480 }
481 case IA_API_CMD_GET_MEM_INFO_PLACEMENT: {
482 *pui_value = p_obj_drc->p_mem_info[i_idx].ui_placement[0];
483 *(pui_value + 1) = p_obj_drc->p_mem_info[i_idx].ui_placement[1];
484 break;
485 }
486 case IA_API_CMD_GET_MEM_INFO_PRIORITY: {
487 *pui_value = p_obj_drc->p_mem_info[i_idx].ui_priority;
488 break;
489 }
490 case IA_API_CMD_SET_MEM_PTR: {
491 if (pv_value == 0) {
492 return (-1);
493 }
494 if (((SIZE_T)pv_value % p_obj_drc->p_mem_info[i_idx].ui_alignment) != 0) {
495 return (-1);
496 }
497 p_obj_drc->pp_mem[i_idx] = pv_value;
498 memset(p_obj_drc->pp_mem[i_idx], 0, p_obj_drc->p_mem_info[i_idx].ui_size);
499 if (IA_MEMTYPE_PERSIST == i_idx) {
500 p_obj_drc->p_state = pv_value;
501 }
502 break;
503 }
504 case IA_API_CMD_SET_MEM_PLACEMENT: {
505 }
506 };
507 return IA_NO_ERROR;
508 }
509
impd_drc_fill_mem_tables(ia_drc_api_struct * p_obj_drc)510 IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc) {
511 ia_mem_info_struct *p_mem_info;
512 {
513 p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_PERSIST_IDX];
514 memset(p_mem_info, 0, sizeof(*p_mem_info));
515 p_mem_info->ui_size = PERSIST_MEM_SIZE;
516 p_mem_info->ui_alignment = 8;
517 p_mem_info->ui_type = IA_MEMTYPE_PERSIST;
518 p_mem_info->ui_placement[0] = 0;
519 p_mem_info->ui_placement[1] = 0;
520 p_mem_info->ui_priority = IA_MEMPRIORITY_ANYWHERE;
521 p_mem_info->ui_placed[0] = 0;
522 p_mem_info->ui_placed[1] = 0;
523 }
524 {
525 p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_INPUT_IDX];
526 memset(p_mem_info, 0, sizeof(*p_mem_info));
527 p_mem_info->ui_size = p_obj_drc->str_config.frame_size *
528 (p_obj_drc->str_config.pcm_size >> 3) *
529 p_obj_drc->str_config.num_ch_in;
530 p_mem_info->ui_alignment = 4;
531 p_mem_info->ui_type = IA_MEMTYPE_INPUT;
532 p_mem_info->ui_placement[0] = 0;
533 p_mem_info->ui_placement[1] = 0;
534 p_mem_info->ui_priority = IA_MEMPRIORITY_ANYWHERE;
535 p_mem_info->ui_placed[0] = 0;
536 p_mem_info->ui_placed[1] = 0;
537 }
538 {
539 p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_OUTPUT_IDX];
540 memset(p_mem_info, 0, sizeof(*p_mem_info));
541 p_mem_info->ui_size = p_obj_drc->str_config.frame_size *
542 (p_obj_drc->str_config.pcm_size >> 3) *
543 p_obj_drc->str_config.num_ch_in;
544 p_mem_info->ui_alignment = 4;
545 p_mem_info->ui_type = IA_MEMTYPE_OUTPUT;
546 p_mem_info->ui_placement[0] = 0;
547 p_mem_info->ui_placement[1] = 0;
548 p_mem_info->ui_priority = IA_MEMPRIORITY_ANYWHERE;
549 p_mem_info->ui_placed[0] = 0;
550 p_mem_info->ui_placed[1] = 0;
551 }
552 {
553 p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_SCRATCH_IDX];
554 memset(p_mem_info, 0, sizeof(*p_mem_info));
555 p_mem_info->ui_size = SCRATCH_MEM_SIZE;
556 p_mem_info->ui_alignment = 8;
557 p_mem_info->ui_type = IA_MEMTYPE_SCRATCH;
558 p_mem_info->ui_placement[0] = 0;
559 p_mem_info->ui_placement[1] = 0;
560 p_mem_info->ui_priority = IA_MEMPRIORITY_ANYWHERE;
561 p_mem_info->ui_placed[0] = 0;
562 p_mem_info->ui_placed[1] = 0;
563 }
564 return IA_NO_ERROR;
565 }
566