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