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 "prot_fx.h"
36 : #include "ivas_prot_fx.h"
37 : #include "ivas_prot_rend_fx.h"
38 : #include "wmc_auto.h"
39 : #include "ivas_prot_fx.h"
40 :
41 :
42 : /*-------------------------------------------------------------------------*
43 : * ivas_ism_bitrate_switching_dec()
44 : *
45 : *
46 : *-------------------------------------------------------------------------*/
47 :
48 1438 : static ivas_error ivas_ism_bitrate_switching_dec_fx(
49 : Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
50 : const Word16 nchan_transport_old, /* i : last number of transport channels */
51 : const ISM_MODE last_ism_mode /* i : last ISM mode */
52 : )
53 : {
54 : ivas_error error;
55 : Word32 element_brate_tmp[MAX_NUM_OBJECTS];
56 : Word16 nSCE_old, nCPE_old;
57 : Word16 numCldfbAnalyses_old, numCldfbSyntheses_old, ism_mode;
58 : TC_BUFFER_MODE tc_buffer_mode_new;
59 : Word16 tc_nchan_tc_new;
60 : Word16 tc_nchan_allocate_new;
61 : Word16 tc_granularity_new;
62 : Word16 nchan_out_buff;
63 :
64 1438 : nCPE_old = st_ivas->nCPE;
65 1438 : move16();
66 1438 : nSCE_old = st_ivas->nSCE;
67 1438 : move16();
68 :
69 : /* temporarily set the ism mode back to the old one, otherwise this can give wrong results*/
70 1438 : ism_mode = st_ivas->ism_mode;
71 1438 : move16();
72 1438 : st_ivas->ism_mode = last_ism_mode;
73 1438 : move16();
74 1438 : ivas_init_dec_get_num_cldfb_instances_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );
75 1438 : st_ivas->ism_mode = ism_mode;
76 1438 : move16();
77 :
78 1438 : IF( NE_32( ( error = ivas_ism_config_fx( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ), IVAS_ERR_OK ) )
79 : {
80 0 : return error;
81 : }
82 :
83 1438 : st_ivas->nSCE = st_ivas->nchan_transport;
84 1438 : move16();
85 :
86 : /*-----------------------------------------------------------------*
87 : * Allocate, initialize, and configure SCE/CPE/MCT handles
88 : *-----------------------------------------------------------------*/
89 :
90 : /* st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport */
91 : Word16 tmp, tmp_e;
92 : Word32 tmp_32;
93 1438 : tmp = BASOP_Util_Divide3216_Scale( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, &tmp_e );
94 1438 : tmp = shr( tmp, sub( 15, tmp_e ) );
95 1438 : tmp_32 = L_deposit_l( tmp );
96 1438 : IF( NE_32( ( error = ivas_corecoder_dec_reconfig_fx( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, 0, tmp_32, L_shl( tmp_32, 1 ) ) ), IVAS_ERR_OK ) )
97 : {
98 0 : return error;
99 : }
100 :
101 : /*-----------------------------------------------------------------*
102 : * HP20 memories
103 : *-----------------------------------------------------------------*/
104 :
105 1438 : IF( NE_32( ( error = ivas_hp20_dec_reconfig_fx( st_ivas, nchan_transport_old ) ), IVAS_ERR_OK ) )
106 : {
107 0 : return error;
108 : }
109 :
110 : /*-----------------------------------------------------------------*
111 : * Initialize the needed renderer struct and destroy the unnecessary renderer struct
112 : *-----------------------------------------------------------------*/
113 :
114 : /* select the renderer */
115 1438 : ivas_renderer_select( st_ivas );
116 :
117 1438 : ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config );
118 :
119 1438 : test();
120 1438 : IF( ( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) ) && ( EQ_32( st_ivas->ism_mode, ISM_MODE_DISC ) ) )
121 : {
122 78 : ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config );
123 : }
124 :
125 1438 : test();
126 1438 : test();
127 : /* transfer subframe info from DirAC or ParamMC to central tc buffer */
128 : /* only do this if we are not having done everything already in the TC decoding part and having only played out from the TC buffer */
129 1438 : IF( EQ_32( last_ism_mode, ISM_MODE_PARAM ) && st_ivas->hSpatParamRendCom != NULL && NE_32( st_ivas->hTcBuffer->tc_buffer_mode, TC_BUFFER_MODE_BUFFER ) )
130 : {
131 419 : st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes;
132 419 : move16();
133 419 : st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered;
134 419 : move16();
135 419 : st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots;
136 419 : move16();
137 419 : st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered;
138 419 : move16();
139 419 : Copy( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
140 : }
141 :
142 : /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv
143 : render what still fits in the new granularity */
144 1438 : tc_granularity_new = ivas_jbm_dec_get_render_granularity_fx( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs );
145 :
146 1438 : IF( LT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) )
147 : {
148 : /* flush already done in IVAS_DEC_ReadFormat() */
149 : }
150 : /* JBM: when granularity goes up set samples to discard at the beginning of the frame */
151 1170 : ELSE IF( GT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) )
152 : {
153 268 : IF( NE_32( ( error = ivas_jbm_dec_set_discard_samples_fx( st_ivas ) ), IVAS_ERR_OK ) )
154 : {
155 0 : return error;
156 : }
157 : }
158 :
159 1438 : IF( NE_16( st_ivas->ism_mode, last_ism_mode ) )
160 : {
161 : /* EFAP handle */
162 663 : efap_free_data_fx( &st_ivas->hEFAPdata );
163 : }
164 :
165 : /*-----------------------------------------------------------------*
166 : * Switching between ParamISM and DiscISM
167 : *-----------------------------------------------------------------*/
168 :
169 : /* switching from ParamISM to DiscISM */
170 1438 : test();
171 1438 : IF( EQ_32( st_ivas->ism_mode, ISM_MODE_DISC ) && EQ_32( last_ism_mode, ISM_MODE_PARAM ) )
172 : {
173 : /* Deallocate the ParamISM struct */
174 333 : ivas_param_ism_dec_close_fx( &( st_ivas->hParamIsmDec ), &( st_ivas->hSpatParamRendCom ), st_ivas->hDecoderConfig->output_config );
175 :
176 333 : test();
177 333 : IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
178 : {
179 : /* close the parametric binaural renderer */
180 101 : ivas_dirac_dec_close_binaural_data_fx( st_ivas->hDiracDecBin );
181 : /* Close omasa data struct (used for object editing) */
182 101 : ivas_omasa_data_close_fx( &st_ivas->hMasaIsmData );
183 :
184 : /* Open the TD Binaural renderer */
185 101 : test();
186 101 : IF( st_ivas->hHrtfTD == NULL || st_ivas->hBinRendererTd == NULL )
187 : {
188 : Word16 SrcInd[MAX_NUM_TDREND_CHANNELS];
189 : Word16 num_src;
190 101 : IF( NE_32( ( error = ivas_td_binaural_open_fx( st_ivas, SrcInd, &num_src ) ), IVAS_ERR_OK ) )
191 : {
192 0 : return error;
193 : }
194 101 : IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
195 : {
196 0 : IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) )
197 : {
198 0 : return error;
199 : }
200 : }
201 : }
202 : }
203 : ELSE
204 : {
205 : /* close the ISM renderer and reinitialize */
206 232 : ivas_ism_renderer_close( &st_ivas->hIsmRendererData );
207 232 : IF( NE_32( ( error = ivas_ism_renderer_open_fx( st_ivas ) ), IVAS_ERR_OK ) )
208 : {
209 0 : return error;
210 : }
211 : }
212 :
213 333 : IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) )
214 : {
215 : /* close the parametric binaural renderer */
216 167 : ivas_dirac_dec_close_binaural_data_fx( st_ivas->hDiracDecBin );
217 :
218 :
219 : /* Close omasa data struct (used for object editing) */
220 167 : ivas_omasa_data_close_fx( &st_ivas->hMasaIsmData );
221 :
222 : /* Open Crend Binaural renderer */
223 167 : IF( NE_32( ( error = ivas_rend_openCrend_fx( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) )
224 :
225 0 : st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns;
226 167 : move32();
227 : }
228 : }
229 :
230 : /* switching from Discrete ISM to ParamISM */
231 1438 : test();
232 1438 : IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) && EQ_32( last_ism_mode, ISM_MODE_DISC ) )
233 : {
234 : /* Allocate and initialize the ParamISM struct */
235 330 : IF( NE_32( ( error = ivas_param_ism_dec_open_fx( st_ivas ) ), IVAS_ERR_OK ) )
236 : {
237 0 : return error;
238 : }
239 :
240 330 : test();
241 330 : IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
242 : {
243 : /* open the parametric binaural renderer */
244 102 : IF( NE_32( ( error = ivas_dirac_dec_binaural_copy_hrtfs_fx( &st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) )
245 : {
246 0 : return error;
247 : }
248 :
249 102 : IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, &( st_ivas->hHrtfParambin ) ) ), IVAS_ERR_OK ) )
250 : {
251 0 : return error;
252 : }
253 : /* Open omasa data struct (used for object editing) */
254 102 : IF( ( error = ivas_omasa_data_open_fx( st_ivas ) ) != IVAS_ERR_OK )
255 : {
256 0 : return error;
257 : }
258 :
259 : /* Close the TD Binaural renderer */
260 102 : ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd );
261 :
262 102 : IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
263 : {
264 0 : ivas_reverb_close_fx( &st_ivas->hReverb );
265 : }
266 : }
267 : ELSE
268 : {
269 : /* Close the ISM renderer */
270 228 : ivas_ism_renderer_close( &st_ivas->hIsmRendererData );
271 : }
272 :
273 330 : IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) )
274 : {
275 : /* open the parametric binaural renderer */
276 166 : IF( NE_32( ( error = ivas_dirac_dec_binaural_copy_hrtfs_fx( &st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) )
277 : {
278 0 : return error;
279 : }
280 :
281 166 : IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, &( st_ivas->hHrtfParambin ) ) ), IVAS_ERR_OK ) )
282 : {
283 0 : return error;
284 : }
285 :
286 : /* Open omasa data struct (used for object editing) */
287 166 : IF( ( error = ivas_omasa_data_open_fx( st_ivas ) ) != IVAS_ERR_OK )
288 : {
289 0 : return error;
290 : }
291 : /* close the crend binaural renderer */
292 166 : ivas_rend_closeCrend_fx( &( st_ivas->hCrendWrapper ) );
293 : }
294 : }
295 :
296 : /*-----------------------------------------------------------------*
297 : * CLDFB instances
298 : *-----------------------------------------------------------------*/
299 :
300 1438 : IF( NE_32( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ), IVAS_ERR_OK ) )
301 : {
302 0 : return error;
303 : }
304 :
305 : /*-----------------------------------------------------------------*
306 : * JBM TC buffers
307 : *-----------------------------------------------------------------*/
308 :
309 : Word16 tc_nchan_full_new;
310 : DECODER_TC_BUFFER_HANDLE hTcBuffer;
311 :
312 1438 : hTcBuffer = st_ivas->hTcBuffer;
313 1438 : tc_buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode_fx( st_ivas );
314 1438 : tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas );
315 1438 : tc_nchan_allocate_new = tc_nchan_tc_new;
316 1438 : move16();
317 1438 : tc_nchan_full_new = tc_nchan_tc_new;
318 1438 : move16();
319 :
320 1438 : test();
321 1438 : test();
322 1438 : test();
323 1438 : test();
324 1438 : if ( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) && ( NE_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) && NE_32( st_ivas->renderer_type, RENDERER_DISABLE ) && NE_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && NE_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) )
325 : {
326 71 : tc_nchan_full_new = 0;
327 71 : move16();
328 : }
329 :
330 : /* reconfigure buffer */
331 1438 : test();
332 1438 : test();
333 1438 : test();
334 1438 : IF( NE_32( hTcBuffer->tc_buffer_mode, tc_buffer_mode_new ) || NE_16( hTcBuffer->nchan_transport_jbm, tc_nchan_tc_new ) ||
335 : NE_16( hTcBuffer->nchan_buffer_full, tc_nchan_full_new ) || NE_16( hTcBuffer->nchan_transport_internal, tc_nchan_allocate_new ) )
336 : {
337 663 : IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_reconfigure_fx( st_ivas, tc_buffer_mode_new, tc_nchan_tc_new, tc_nchan_allocate_new, tc_nchan_full_new, tc_granularity_new ) ), IVAS_ERR_OK ) )
338 : {
339 0 : return error;
340 : }
341 : }
342 :
343 : /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */
344 1438 : IF( st_ivas->hSpatParamRendCom != NULL )
345 : {
346 416 : st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes;
347 416 : move16();
348 416 : st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered;
349 416 : move16();
350 416 : st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots;
351 416 : move16();
352 416 : st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered;
353 416 : move16();
354 :
355 416 : Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
356 : }
357 :
358 : /*-----------------------------------------------------------------*
359 : * output audio buffers
360 : *-----------------------------------------------------------------*/
361 :
362 1438 : nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 );
363 1438 : IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff, st_ivas->hDecoderConfig->Opt_tsm, st_ivas->hTcBuffer ) ) != IVAS_ERR_OK )
364 : {
365 0 : return error;
366 : }
367 :
368 1438 : return IVAS_ERR_OK;
369 : }
370 :
371 :
372 : /*-------------------------------------------------------------------------
373 : * ivas_ism_dec_config()
374 : *
375 : * - select ISM format mode
376 : * - reconfigure the ISM format decoder
377 : *-------------------------------------------------------------------------*/
378 :
379 102266 : ivas_error ivas_ism_dec_config_fx(
380 : Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
381 : const ISM_MODE last_ism_mode /* i/o: last ISM mode */
382 : )
383 : {
384 : Word32 ivas_total_brate;
385 : ivas_error error;
386 : Word16 nchan_transport_old;
387 :
388 102266 : ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
389 102266 : move32();
390 : /* Assumes that num of input objects are constant */
391 102266 : nchan_transport_old = st_ivas->nchan_ism;
392 102266 : move16();
393 :
394 102266 : if ( EQ_32( last_ism_mode, ISM_MODE_PARAM ) )
395 : {
396 20358 : nchan_transport_old = MAX_PARAM_ISM_WAVE;
397 20358 : move16();
398 : }
399 :
400 102266 : test();
401 102266 : test();
402 102266 : test();
403 102266 : IF( !st_ivas->bfi && NE_32( ivas_total_brate, IVAS_SID_5k2 ) && ( ivas_total_brate != FRAME_NO_DATA ) )
404 : {
405 : /* select ISM format mode */
406 101737 : st_ivas->ism_mode = ivas_ism_mode_select( st_ivas->nchan_ism, ivas_total_brate );
407 101737 : move32();
408 101737 : st_ivas->nchan_transport = st_ivas->nchan_ism;
409 101737 : move16();
410 :
411 101737 : IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) )
412 : {
413 20279 : st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE;
414 20279 : move16();
415 20279 : if ( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
416 : {
417 513 : st_ivas->hDecoderConfig->nchan_out = st_ivas->nchan_ism;
418 513 : move16();
419 : }
420 : }
421 :
422 101737 : IF( st_ivas->ini_active_frame != 0 )
423 : {
424 : /* ISM bit-rate switching */
425 101662 : test();
426 101662 : IF( ( NE_16( st_ivas->ism_mode, last_ism_mode ) ) || ( NE_32( ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate ) ) )
427 : {
428 1432 : IF( NE_16( ( error = ivas_ism_bitrate_switching_dec_fx( st_ivas, nchan_transport_old, last_ism_mode ) ), IVAS_ERR_OK ) )
429 : {
430 0 : return error;
431 : }
432 : }
433 : }
434 : }
435 529 : ELSE IF( !st_ivas->bfi && EQ_32( ivas_total_brate, IVAS_SID_5k2 ) )
436 : {
437 529 : st_ivas->nchan_transport = st_ivas->nchan_ism;
438 529 : move16();
439 529 : IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) )
440 : {
441 94 : st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE;
442 94 : move16();
443 94 : if ( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
444 : {
445 7 : st_ivas->hDecoderConfig->nchan_out = st_ivas->nchan_ism;
446 7 : move16();
447 : }
448 : }
449 :
450 : /* ISM mode switching */
451 529 : IF( NE_32( st_ivas->ism_mode, last_ism_mode ) )
452 : {
453 6 : IF( NE_16( ( error = ivas_ism_bitrate_switching_dec_fx( st_ivas, nchan_transport_old, last_ism_mode ) ), IVAS_ERR_OK ) )
454 : {
455 0 : return error;
456 : }
457 : }
458 : }
459 :
460 102266 : SWITCH( st_ivas->nchan_ism )
461 : {
462 18801 : case 1:
463 18801 : st_ivas->transport_config = IVAS_AUDIO_CONFIG_ISM1;
464 18801 : move32();
465 18801 : BREAK;
466 16065 : case 2:
467 16065 : st_ivas->transport_config = IVAS_AUDIO_CONFIG_ISM2;
468 16065 : move32();
469 16065 : BREAK;
470 19017 : case 3:
471 19017 : st_ivas->transport_config = IVAS_AUDIO_CONFIG_ISM3;
472 19017 : move32();
473 19017 : BREAK;
474 48383 : case 4:
475 48383 : st_ivas->transport_config = IVAS_AUDIO_CONFIG_ISM4;
476 48383 : move32();
477 48383 : BREAK;
478 0 : default:
479 0 : st_ivas->transport_config = IVAS_AUDIO_CONFIG_INVALID;
480 0 : move32();
481 0 : BREAK;
482 : }
483 :
484 102266 : return IVAS_ERR_OK;
485 : }
|