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 "options.h" 34 : #include <stdint.h> 35 : #include "ivas_cnst.h" 36 : #include "ivas_prot.h" 37 : #include "ivas_prot_rend.h" 38 : #include "prot.h" 39 : #ifdef DEBUGGING 40 : #include "debug.h" 41 : #endif 42 : #include "wmc_auto.h" 43 : 44 : 45 : /*------------------------------------------------------------------------- 46 : * ivas_mcmasa_dec_reconfig() 47 : * 48 : * Reconfigure McMASA decoder 49 : *------------------------------------------------------------------------*/ 50 : 51 798 : ivas_error ivas_mcmasa_dec_reconfig( 52 : Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ 53 : ) 54 : { 55 : ivas_error error; 56 : int32_t ivas_total_brate; 57 : 58 798 : ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; 59 : 60 : /* close the old MASA instance */ 61 798 : ivas_masa_dec_close( &( st_ivas->hMasa ) ); 62 : 63 : /* get new McMASA settings */ 64 798 : ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); 65 798 : ivas_mcmasa_set_separate_channel_mode( &( st_ivas->hOutSetup.separateChannelEnabled ), &( st_ivas->hOutSetup.separateChannelIndex ), ivas_total_brate ); 66 : 67 : /* transport channel settings may affect renderer */ 68 798 : ivas_renderer_select( st_ivas ); 69 : 70 : /* renderer change may affect internal config */ 71 798 : ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); 72 798 : ivas_mcmasa_set_separate_channel_mode( &( st_ivas->hIntSetup.separateChannelEnabled ), &( st_ivas->hIntSetup.separateChannelIndex ), ivas_total_brate ); 73 : 74 798 : if ( ( error = ivas_masa_dec_open( st_ivas ) ) != IVAS_ERR_OK ) 75 : { 76 0 : return error; 77 : } 78 : 79 798 : st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); 80 : 81 798 : if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MCMASA_MONO_STEREO ) 82 : { 83 774 : if ( st_ivas->hDirAC == NULL ) 84 : { 85 648 : if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) 86 : { 87 0 : return error; 88 : } 89 : } 90 : else 91 : { 92 126 : if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) 93 : { 94 0 : return error; 95 : } 96 : } 97 : } 98 : 99 798 : return error; 100 : }