• 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           error_code = impd_drc_set_struct_pointer(p_obj_drc);
156           if (error_code) return error_code;
157 
158           break;
159         }
160         case IA_CMD_TYPE_INIT_API_PRE_CONFIG_PARAMS: {
161           error_code = impd_drc_set_default_config(p_obj_drc);
162           if (error_code) return error_code;
163           break;
164         }
165         case IA_CMD_TYPE_INIT_API_POST_CONFIG_PARAMS: {
166           error_code = impd_drc_fill_mem_tables(p_obj_drc);
167           if (error_code) return error_code;
168           break;
169         }
170         case IA_CMD_TYPE_INIT_PROCESS: {
171           IA_ERRORCODE Error = 0;
172 
173           if (p_obj_drc->pp_mem[IA_DRC_PERSIST_IDX] == 0) {
174             return (-1);
175           }
176 
177           Error = impd_drc_init(p_obj_drc);
178           if (Error) return Error;
179           p_obj_drc->p_state->ui_init_done = 1;
180           return Error;
181           break;
182         }
183         case IA_CMD_TYPE_INIT_DONE_QUERY: {
184           if (p_obj_drc->p_state->ui_init_done == 1) {
185             *pui_value = 1;
186           } else {
187             *pui_value = 0;
188           }
189           break;
190         }
191 
192         case IA_CMD_TYPE_INIT_CPY_BSF_BUFF_OVER_QUERY: {
193           *pui_value = p_obj_drc->str_bit_handler.cpy_over;
194           break;
195         }
196         case IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF_OVER_QUERY: {
197           *pui_value = p_obj_drc->str_bit_handler.cpy_over_ic;
198           break;
199         }
200 
201         case IA_CMD_TYPE_INIT_CPY_IL_BSF_BUFF_OVER_QUERY: {
202           *pui_value = p_obj_drc->str_bit_handler.cpy_over_il;
203           break;
204         }
205         case IA_CMD_TYPE_INIT_CPY_IN_BSF_BUFF_OVER_QUERY: {
206           *pui_value = p_obj_drc->str_bit_handler.cpy_over_in;
207           break;
208         }
209         case IA_CMD_TYPE_INIT_CPY_BSF_BUFF: {
210           memcpy(p_obj_drc->str_bit_handler.it_bit_buf +
211                      p_obj_drc->str_bit_handler.num_bytes_offset_bs,
212                  p_obj_drc->pp_mem[2], p_obj_drc->str_bit_handler.num_byts_cur);
213           p_obj_drc->str_bit_handler.num_bytes_bs =
214               p_obj_drc->str_bit_handler.num_bytes_bs +
215               p_obj_drc->str_bit_handler.num_byts_cur;
216           p_obj_drc->str_bit_handler.num_bytes_offset_bs =
217               p_obj_drc->str_bit_handler.num_bytes_bs;
218           p_obj_drc->str_bit_handler.num_total_bytes =
219               p_obj_drc->str_bit_handler.num_bytes_bs;
220 
221           break;
222         }
223         case IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF: {
224           memcpy(p_obj_drc->str_bit_handler.bitstream_drc_config +
225                      p_obj_drc->str_bit_handler.num_bytes_bs_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_bytes_bs_drc_config +
230               p_obj_drc->str_bit_handler.num_byts_cur_ic;
231           break;
232         }
233         case IA_CMD_TYPE_INIT_CPY_IL_BSF_BUFF: {
234           memcpy(p_obj_drc->str_bit_handler.bitstream_loudness_info +
235                      p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info,
236                  p_obj_drc->pp_mem[2],
237                  p_obj_drc->str_bit_handler.num_byts_cur_il);
238           p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info =
239               p_obj_drc->str_bit_handler.num_bytes_bs_loudness_info +
240               p_obj_drc->str_bit_handler.num_byts_cur_il;
241           break;
242         }
243         case IA_CMD_TYPE_INIT_CPY_IN_BSF_BUFF: {
244           memcpy(p_obj_drc->str_bit_handler.bitstream_unidrc_interface +
245                      p_obj_drc->str_bit_handler.num_bytes_bs_unidrc_interface,
246                  p_obj_drc->pp_mem[2],
247                  p_obj_drc->str_bit_handler.num_byts_cur_in);
248           p_obj_drc->str_bit_handler.num_bytes_bs_unidrc_interface =
249               p_obj_drc->str_bit_handler.num_bytes_bs_unidrc_interface +
250               p_obj_drc->str_bit_handler.num_byts_cur_in;
251           break;
252         }
253         default: { return -1; }
254       };
255       break;
256     }
257     case IA_API_CMD_GET_CONFIG_PARAM: {
258       switch (i_idx) {
259         case IA_DRC_DEC_CONFIG_PARAM_SAMP_FREQ: {
260           *pus_value = p_obj_drc->str_config.sampling_rate;
261           break;
262         }
263 
264         case IA_DRC_DEC_CONFIG_PARAM_NUM_CHANNELS: {
265           *pus_value = p_obj_drc->str_config.num_ch_out;
266           break;
267         }
268         case IA_DRC_DEC_CONFIG_PROC_OUT_PTR: {
269           *ps_value = (SIZE_T)p_obj_drc->str_payload.pstr_drc_sel_proc_output;
270           break;
271         }
272       }
273       break;
274     }
275     case IA_API_CMD_SET_CONFIG_PARAM: {
276       switch (i_idx) {
277         case IA_DRC_DEC_CONFIG_PARAM_SAMP_FREQ: {
278           if (*pus_value < 8000 || *pus_value > 96000) {
279             return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_SAMP_FREQ;
280           }
281           p_obj_drc->str_config.sampling_rate = *pus_value;
282           break;
283         }
284         case IA_DRC_DEC_CONFIG_PARAM_NUM_CHANNELS: {
285           p_obj_drc->str_config.num_ch_in = *pus_value;
286           if (*pus_value < 1 || *pus_value > MAX_CHANNEL_COUNT) {
287             return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_NUM_OF_CHANNELS;
288           }
289           break;
290         }
291 
292         case IA_DRC_DEC_CONFIG_PARAM_PCM_WDSZ: {
293           switch (*pus_value) {
294             case 16:
295             case 24:
296             case 32:
297               break;
298             default:
299               return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_PCM_SIZE;
300           }
301 
302           p_obj_drc->str_config.pcm_size = *pus_value;
303 
304           break;
305         }
306 
307         case IA_DRC_DEC_CONFIG_PARAM_BITS_FORMAT: {
308           break;
309         }
310         case IA_DRC_DEC_CONFIG_PARAM_INT_PRESENT: {
311           break;
312         }
313         case IA_DRC_DEC_CONFIG_PARAM_FRAME_SIZE: {
314           if (*pus_value < 1 || *pus_value > 4096) {
315             return IA_DRC_DEC_CONFIG_NON_FATAL_INVALID_FRAME_SIZE;
316           }
317 
318           p_obj_drc->str_config.frame_size = *pus_value;
319 
320           break;
321         }
322         case IA_DRC_DEC_CONFIG_GAIN_STREAM_FLAG: {
323           break;
324         }
325 
326         case IA_DRC_DEC_CONFIG_DRC_EFFECT_TYPE: {
327           p_obj_drc->str_config.effect_type = *pus_value;
328           break;
329         }
330         case IA_DRC_DEC_CONFIG_DRC_TARGET_LOUDNESS: {
331           p_obj_drc->str_config.target_loudness = *pus_value;
332           break;
333         }
334         case IA_DRC_DEC_CONFIG_DRC_LOUD_NORM: {
335           p_obj_drc->str_config.loud_norm_flag = *pus_value;
336           break;
337         }
338 
339         default: { return -1; }
340       }
341       break;
342     }
343     case IA_API_CMD_GET_MEMTABS_SIZE: {
344       *pui_value =
345           (sizeof(ia_mem_info_struct) + sizeof(pVOID *)) * (NUM_DRC_TABLES);
346       break;
347     }
348     case IA_API_CMD_SET_MEMTABS_PTR: {
349       if (ps_value == NULL) return IA_DRC_DEC_API_FATAL_MEM_ALLOC;
350       memset(ps_value, 0,
351              (sizeof(ia_mem_info_struct) + sizeof(pVOID *)) * (NUM_DRC_TABLES));
352       p_obj_drc->p_mem_info = (ia_mem_info_struct *)(ps_value);
353       p_obj_drc->pp_mem =
354           (pVOID)((SIZE_T)p_obj_drc->p_mem_info +
355                   (NUM_DRC_TABLES * sizeof(*(p_obj_drc->p_mem_info))));
356       break;
357     }
358     case IA_API_CMD_GET_N_MEMTABS: {
359       *pui_value = NUM_DRC_TABLES;
360       break;
361     }
362     case IA_API_CMD_GET_N_TABLES: {
363       break;
364     }
365 
366     case IA_API_CMD_EXECUTE: {
367       switch (i_idx) {
368         case IA_CMD_TYPE_DO_EXECUTE: {
369           if (!p_obj_drc->p_state->ui_init_done) {
370             error_code = IA_FATAL_ERROR;
371           } else if (p_obj_drc->str_config.dec_type == DEC_TYPE_TD) {
372             error_code = impd_process_time_domain(p_obj_drc);
373           } else if (p_obj_drc->str_config.dec_type == DEC_TYPE_QMF64) {
374             error_code = IA_FATAL_ERROR;
375           } else if (p_obj_drc->str_config.dec_type == DEC_TYPE_STFT256) {
376             error_code = IA_FATAL_ERROR;
377           } else if (p_obj_drc->str_config.dec_type == DEC_TYPE_TD_QMF64) {
378             error_code = IA_FATAL_ERROR;
379           }
380           p_obj_drc->str_bit_handler.byte_index_bs =
381               p_obj_drc->str_bit_handler.num_total_bytes -
382               p_obj_drc->str_bit_handler.num_bytes_bs;
383           p_obj_drc->str_bit_handler.num_bytes_offset_bs = 0;
384 
385           break;
386         }
387         case IA_CMD_TYPE_DONE_QUERY: {
388           *pui_value = p_obj_drc->p_state->ui_exe_done;
389           break;
390         }
391         default: { return -1; }
392       };
393       break;
394     }
395     case IA_API_CMD_PUT_INPUT_QUERY: {
396       *pui_value = 1;
397       break;
398     }
399     case IA_API_CMD_GET_CURIDX_INPUT_BUF: {
400       UWORD32 ui_in_buf_size = p_obj_drc->p_mem_info[IA_DRC_INPUT_IDX].ui_size;
401       UWORD32 ui_in_bytes = p_obj_drc->p_state->ui_in_bytes;
402       *pui_value = ui_in_buf_size > ui_in_bytes ? ui_in_bytes : ui_in_buf_size;
403       break;
404     }
405     case IA_API_CMD_SET_INPUT_BYTES: {
406       p_obj_drc->p_state->ui_in_bytes = *pui_value;
407       break;
408     }
409 
410     case IA_API_CMD_GET_OUTPUT_BYTES: {
411       *pui_value = p_obj_drc->p_state->ui_out_bytes;
412       break;
413     }
414     case IA_API_CMD_INPUT_OVER: {
415       p_obj_drc->p_state->ui_exe_done = 1;
416       break;
417     }
418     case IA_API_CMD_SET_INPUT_BYTES_BS: {
419       p_obj_drc->str_bit_handler.num_byts_cur = *pus_value;
420       break;
421     }
422     case IA_API_CMD_SET_INPUT_BYTES_IC_BS: {
423       p_obj_drc->str_bit_handler.num_byts_cur_ic = *pus_value;
424       break;
425     }
426     case IA_API_CMD_SET_INPUT_BYTES_IL_BS: {
427       p_obj_drc->str_bit_handler.num_byts_cur_il = *pus_value;
428       break;
429     }
430     case IA_API_CMD_SET_INPUT_BYTES_IN_BS: {
431       p_obj_drc->str_bit_handler.num_byts_cur_in = *pus_value;
432       break;
433     }
434     default: { return -1; }
435   };
436   return error_code;
437 }
438 
impd_drc_mem_api(ia_drc_api_struct * p_obj_drc,WORD32 i_cmd,WORD32 i_idx,pVOID pv_value)439 IA_ERRORCODE impd_drc_mem_api(ia_drc_api_struct *p_obj_drc, WORD32 i_cmd,
440                               WORD32 i_idx, pVOID pv_value) {
441   pUWORD32 pui_value = pv_value;
442 
443   switch (i_cmd) {
444     case IA_API_CMD_GET_MEM_INFO_SIZE: {
445       *pui_value = p_obj_drc->p_mem_info[i_idx].ui_size;
446       break;
447     }
448     case IA_API_CMD_GET_MEM_INFO_ALIGNMENT: {
449       *pui_value = p_obj_drc->p_mem_info[i_idx].ui_alignment;
450       break;
451     }
452     case IA_API_CMD_GET_MEM_INFO_TYPE: {
453       *pui_value = p_obj_drc->p_mem_info[i_idx].ui_type;
454       break;
455     }
456     case IA_API_CMD_GET_MEM_INFO_PLACEMENT: {
457       *pui_value = p_obj_drc->p_mem_info[i_idx].ui_placement[0];
458       *(pui_value + 1) = p_obj_drc->p_mem_info[i_idx].ui_placement[1];
459       break;
460     }
461     case IA_API_CMD_GET_MEM_INFO_PRIORITY: {
462       *pui_value = p_obj_drc->p_mem_info[i_idx].ui_priority;
463       break;
464     }
465     case IA_API_CMD_SET_MEM_PTR: {
466       if (pv_value == 0) {
467         return (-1);
468       }
469       if (((SIZE_T)pv_value % p_obj_drc->p_mem_info[i_idx].ui_alignment) != 0) {
470         return (-1);
471       }
472       p_obj_drc->pp_mem[i_idx] = pv_value;
473       memset(p_obj_drc->pp_mem[i_idx], 0, p_obj_drc->p_mem_info[i_idx].ui_size);
474       if (IA_MEMTYPE_PERSIST == i_idx) {
475         p_obj_drc->p_state = pv_value;
476       }
477       break;
478     }
479     case IA_API_CMD_SET_MEM_PLACEMENT: {
480     }
481   };
482   return IA_NO_ERROR;
483 }
484 
impd_drc_fill_mem_tables(ia_drc_api_struct * p_obj_drc)485 IA_ERRORCODE impd_drc_fill_mem_tables(ia_drc_api_struct *p_obj_drc) {
486   ia_mem_info_struct *p_mem_info;
487   {
488     p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_PERSIST_IDX];
489     memset(p_mem_info, 0, sizeof(*p_mem_info));
490     p_mem_info->ui_size = PERSIST_MEM_SIZE;
491     p_mem_info->ui_alignment = 8;
492     p_mem_info->ui_type = IA_MEMTYPE_PERSIST;
493     p_mem_info->ui_placement[0] = 0;
494     p_mem_info->ui_placement[1] = 0;
495     p_mem_info->ui_priority = IA_MEMPRIORITY_ANYWHERE;
496     p_mem_info->ui_placed[0] = 0;
497     p_mem_info->ui_placed[1] = 0;
498   }
499   {
500     p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_INPUT_IDX];
501     memset(p_mem_info, 0, sizeof(*p_mem_info));
502     p_mem_info->ui_size = p_obj_drc->str_config.frame_size *
503                           (p_obj_drc->str_config.pcm_size >> 3) *
504                           p_obj_drc->str_config.num_ch_in;
505     p_mem_info->ui_alignment = 4;
506     p_mem_info->ui_type = IA_MEMTYPE_INPUT;
507     p_mem_info->ui_placement[0] = 0;
508     p_mem_info->ui_placement[1] = 0;
509     p_mem_info->ui_priority = IA_MEMPRIORITY_ANYWHERE;
510     p_mem_info->ui_placed[0] = 0;
511     p_mem_info->ui_placed[1] = 0;
512   }
513   {
514     p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_OUTPUT_IDX];
515     memset(p_mem_info, 0, sizeof(*p_mem_info));
516     p_mem_info->ui_size = p_obj_drc->str_config.frame_size *
517                           (p_obj_drc->str_config.pcm_size >> 3) *
518                           p_obj_drc->str_config.num_ch_in;
519     p_mem_info->ui_alignment = 4;
520     p_mem_info->ui_type = IA_MEMTYPE_OUTPUT;
521     p_mem_info->ui_placement[0] = 0;
522     p_mem_info->ui_placement[1] = 0;
523     p_mem_info->ui_priority = IA_MEMPRIORITY_ANYWHERE;
524     p_mem_info->ui_placed[0] = 0;
525     p_mem_info->ui_placed[1] = 0;
526   }
527   {
528     p_mem_info = &p_obj_drc->p_mem_info[IA_DRC_SCRATCH_IDX];
529     memset(p_mem_info, 0, sizeof(*p_mem_info));
530     p_mem_info->ui_size = SCRATCH_MEM_SIZE;
531     p_mem_info->ui_alignment = 8;
532     p_mem_info->ui_type = IA_MEMTYPE_SCRATCH;
533     p_mem_info->ui_placement[0] = 0;
534     p_mem_info->ui_placement[1] = 0;
535     p_mem_info->ui_priority = IA_MEMPRIORITY_ANYWHERE;
536     p_mem_info->ui_placed[0] = 0;
537     p_mem_info->ui_placed[1] = 0;
538   }
539   return IA_NO_ERROR;
540 }
541