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 "ivas_cnst.h" 36 : #include "ivas_prot.h" 37 : #include "ivas_rom_com.h" 38 : #include "ivas_stat_dec.h" 39 : #include "wmc_auto.h" 40 : #include "prot.h" 41 : 42 : 43 : /*-------------------------------------------------------------------* 44 : * deindex_elevation() 45 : * 46 : * Decode elevation index 47 : *----------------------------------------------------------------------*/ 48 : 49 : /*! r: decoded elevation value */ 50 5433966 : float deindex_elevation( 51 : uint16_t *id_th, /* i : input index */ 52 : const int16_t no_bits, /* i : number of bits for the spherical grid */ 53 : const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ 54 : ) 55 : { 56 : float theta_hat; 57 : 58 5433966 : if ( *id_th == MASA_NO_INDEX ) 59 : { 60 0 : theta_hat = 0; 61 : } 62 : else 63 : { 64 5433966 : if ( mc_format != MC_LS_SETUP_INVALID ) 65 : { 66 185349 : theta_hat = ( *id_th * delta_theta_masa[no_bits - 3] ); 67 185349 : if ( theta_hat > 90 ) 68 : { 69 231 : theta_hat = 90; 70 : } 71 : } 72 : else 73 : { 74 5248617 : if ( *id_th % 2 == 0 ) 75 : { 76 : /* theta is negative */ 77 4392456 : *id_th = *id_th / 2; 78 4392456 : theta_hat = -( *id_th * delta_theta_masa[no_bits - 3] ); 79 4392456 : if ( theta_hat < -90 ) 80 : { 81 777 : theta_hat = -90; 82 : } 83 : } 84 : else 85 : { 86 856161 : *id_th = ( *id_th + 1 ) / 2; 87 856161 : theta_hat = ( *id_th * delta_theta_masa[no_bits - 3] ); 88 856161 : if ( theta_hat > 90 ) 89 : { 90 270 : theta_hat = 90; 91 : } 92 : } 93 : } 94 : } 95 : 96 5433966 : return theta_hat; 97 : }