LCOV - code coverage report
Current view: top level - lib_rend - ivas_output_init.c (source / functions) Hit Total Coverage
Test: Coverage on main -- short test vectors @ a21f94bc6bac334fe001a5bad2f7b32b79038097 Lines: 246 255 96.5 %
Date: 2025-11-02 05:54:52 Functions: 6 6 100.0 %

          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 "prot.h"
      37             : #include "ivas_prot_rend.h"
      38             : #include "ivas_rom_com.h"
      39             : #include "ivas_prot.h"
      40             : #include <string.h>
      41             : #ifdef DEBUGGING
      42             : #include "debug.h"
      43             : #include <assert.h>
      44             : #endif
      45             : #include "wmc_auto.h"
      46             : 
      47             : /*-------------------------------------------------------------------------*
      48             :  * audioCfg2channels()
      49             :  *
      50             :  * Map Audio configuration to number of channels
      51             :  *-------------------------------------------------------------------------*/
      52             : 
      53             : /*! r: number of audio channels */
      54     7310797 : int16_t audioCfg2channels(
      55             :     AUDIO_CONFIG output_config /* i  : output audio configuration  */
      56             : )
      57             : {
      58             :     int16_t nchan_out;
      59             : 
      60     7310797 :     switch ( output_config )
      61             :     {
      62       21784 :         case IVAS_AUDIO_CONFIG_MONO:
      63       21784 :             nchan_out = 1;
      64       21784 :             break;
      65       21294 :         case IVAS_AUDIO_CONFIG_STEREO:
      66       21294 :             nchan_out = 2;
      67       21294 :             break;
      68      154204 :         case IVAS_AUDIO_CONFIG_5_1:
      69      154204 :             nchan_out = 6;
      70      154204 :             break;
      71       50995 :         case IVAS_AUDIO_CONFIG_7_1:
      72       50995 :             nchan_out = 8;
      73       50995 :             break;
      74       50959 :         case IVAS_AUDIO_CONFIG_5_1_2:
      75       50959 :             nchan_out = 8;
      76       50959 :             break;
      77       49293 :         case IVAS_AUDIO_CONFIG_5_1_4:
      78       49293 :             nchan_out = 10;
      79       49293 :             break;
      80     1389620 :         case IVAS_AUDIO_CONFIG_7_1_4:
      81     1389620 :             nchan_out = 12;
      82     1389620 :             break;
      83       68911 :         case IVAS_AUDIO_CONFIG_FOA:
      84       68911 :             nchan_out = 4;
      85       68911 :             break;
      86       25826 :         case IVAS_AUDIO_CONFIG_HOA2:
      87       25826 :             nchan_out = 9;
      88       25826 :             break;
      89     2514309 :         case IVAS_AUDIO_CONFIG_HOA3:
      90     2514309 :             nchan_out = 16;
      91     2514309 :             break;
      92           0 :         case IVAS_AUDIO_CONFIG_OBA:
      93           0 :             nchan_out = 8;
      94           0 :             break;
      95       85986 :         case IVAS_AUDIO_CONFIG_BINAURAL:
      96             :         case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED:
      97             :         case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM:
      98             :         case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR:
      99             :         case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB:
     100       85986 :             nchan_out = 2;
     101       85986 :             break;
     102     2622120 :         case IVAS_AUDIO_CONFIG_ISM1:
     103     2622120 :             nchan_out = 1;
     104     2622120 :             break;
     105       81550 :         case IVAS_AUDIO_CONFIG_ISM2:
     106       81550 :             nchan_out = 2;
     107       81550 :             break;
     108       70997 :         case IVAS_AUDIO_CONFIG_ISM3:
     109       70997 :             nchan_out = 3;
     110       70997 :             break;
     111      102670 :         case IVAS_AUDIO_CONFIG_ISM4:
     112      102670 :             nchan_out = 4;
     113      102670 :             break;
     114         279 :         default:
     115         279 :             IVAS_ERROR( IVAS_ERR_INTERNAL, "Error: illegal output configuration\n" );
     116         279 :             nchan_out = -1;
     117         279 :             break;
     118             :     }
     119             : 
     120     7310797 :     return ( nchan_out );
     121             : }
     122             : 
     123             : 
     124             : /*-------------------------------------------------------------------------*
     125             :  * ivas_output_init()
     126             :  *
     127             :  * Initialize and configure IVAS output parameters
     128             :  *-------------------------------------------------------------------------*/
     129             : 
     130      273832 : void ivas_output_init(
     131             :     IVAS_OUTPUT_SETUP *hOutSetup,    /* o  : IVAS output setup structure */
     132             :     const AUDIO_CONFIG output_config /* i  : output audio configuration  */
     133             : )
     134             : {
     135             :     int16_t nchan_out;
     136             : 
     137             :     /* set general default values */
     138      273832 :     hOutSetup->output_config = output_config;
     139      273832 :     hOutSetup->is_loudspeaker_setup = 0;
     140      273832 :     hOutSetup->is_binaural_setup = 0;
     141      273832 :     hOutSetup->ambisonics_order = -1;
     142      273832 :     hOutSetup->separateChannelEnabled = 0;
     143      273832 :     hOutSetup->separateChannelIndex = 0;
     144             : 
     145      273832 :     if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM )
     146             :     {
     147         195 :         hOutSetup->is_loudspeaker_setup = 1;
     148             :         /* set in ivas_init_decoder: */
     149             :         /* hOutSetup->ls_azimuth */
     150             :         /* hOutSetup->ls_elevation    */
     151             :         /* hOutSetup->num_lfe         */
     152             :         /* hOutSetup->index_lfe[0]    */
     153             :         /* hOutSetup->is_planar_setup */
     154             :     }
     155             :     else
     156             :     {
     157             :         /* Set default values for all other than custom LS setup */
     158      273637 :         hOutSetup->ls_azimuth = NULL;
     159      273637 :         hOutSetup->ls_elevation = NULL;
     160      273637 :         hOutSetup->num_lfe = 0;
     161      273637 :         hOutSetup->index_lfe[0] = -1;
     162      273637 :         hOutSetup->is_planar_setup = 0;
     163             : 
     164             :         /* set output setup specific values */
     165      273637 :         switch ( output_config )
     166             :         {
     167       12143 :             case IVAS_AUDIO_CONFIG_MONO:
     168       12143 :                 hOutSetup->is_loudspeaker_setup = 1;
     169       12143 :                 break;
     170       11370 :             case IVAS_AUDIO_CONFIG_STEREO:
     171       11370 :                 hOutSetup->is_loudspeaker_setup = 1;
     172       11370 :                 hOutSetup->ls_azimuth = ls_azimuth_CICP2;
     173       11370 :                 hOutSetup->ls_elevation = ls_elevation_CICP2;
     174       11370 :                 break;
     175       59697 :             case IVAS_AUDIO_CONFIG_FOA:
     176       59697 :                 hOutSetup->ambisonics_order = SBA_FOA_ORDER;
     177       59697 :                 break;
     178       17121 :             case IVAS_AUDIO_CONFIG_HOA2:
     179       17121 :                 hOutSetup->ambisonics_order = SBA_HOA2_ORDER;
     180       17121 :                 break;
     181       23618 :             case IVAS_AUDIO_CONFIG_HOA3:
     182       23618 :                 hOutSetup->ambisonics_order = SBA_HOA3_ORDER;
     183       23618 :                 break;
     184       17611 :             case IVAS_AUDIO_CONFIG_5_1:
     185       17611 :                 hOutSetup->num_lfe = 1;
     186       17611 :                 hOutSetup->index_lfe[0] = 3;
     187       17611 :                 hOutSetup->is_loudspeaker_setup = 1;
     188       17611 :                 hOutSetup->ls_azimuth = ls_azimuth_CICP6;
     189       17611 :                 hOutSetup->ls_elevation = ls_elevation_CICP6;
     190       17611 :                 hOutSetup->is_planar_setup = 1;
     191       17611 :                 break;
     192       13800 :             case IVAS_AUDIO_CONFIG_7_1:
     193       13800 :                 hOutSetup->num_lfe = 1;
     194       13800 :                 hOutSetup->index_lfe[0] = 3;
     195       13800 :                 hOutSetup->is_loudspeaker_setup = 1;
     196       13800 :                 hOutSetup->ls_azimuth = ls_azimuth_CICP12;
     197       13800 :                 hOutSetup->ls_elevation = ls_elevation_CICP12;
     198       13800 :                 hOutSetup->is_planar_setup = 1;
     199       13800 :                 break;
     200       13991 :             case IVAS_AUDIO_CONFIG_5_1_2:
     201       13991 :                 hOutSetup->num_lfe = 1;
     202       13991 :                 hOutSetup->index_lfe[0] = 3;
     203       13991 :                 hOutSetup->is_loudspeaker_setup = 1;
     204       13991 :                 hOutSetup->ls_azimuth = ls_azimuth_CICP14;
     205       13991 :                 hOutSetup->ls_elevation = ls_elevation_CICP14;
     206       13991 :                 hOutSetup->is_planar_setup = 0;
     207       13991 :                 break;
     208       13550 :             case IVAS_AUDIO_CONFIG_5_1_4:
     209       13550 :                 hOutSetup->num_lfe = 1;
     210       13550 :                 hOutSetup->index_lfe[0] = 3;
     211       13550 :                 hOutSetup->is_loudspeaker_setup = 1;
     212       13550 :                 hOutSetup->ls_azimuth = ls_azimuth_CICP16;
     213       13550 :                 hOutSetup->ls_elevation = ls_elevation_CICP16;
     214       13550 :                 hOutSetup->is_planar_setup = 0;
     215       13550 :                 break;
     216       20710 :             case IVAS_AUDIO_CONFIG_7_1_4:
     217       20710 :                 hOutSetup->num_lfe = 1;
     218       20710 :                 hOutSetup->index_lfe[0] = 3;
     219       20710 :                 hOutSetup->is_loudspeaker_setup = 1;
     220       20710 :                 hOutSetup->ls_azimuth = ls_azimuth_CICP19;
     221       20710 :                 hOutSetup->ls_elevation = ls_elevation_CICP19;
     222       20710 :                 hOutSetup->is_planar_setup = 0;
     223       20710 :                 break;
     224       63852 :             case IVAS_AUDIO_CONFIG_BINAURAL:
     225             :             case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED:
     226             :             case IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM:
     227             :             case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR:
     228             :             case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB:
     229             :             case IVAS_AUDIO_CONFIG_ISM1:
     230             :             case IVAS_AUDIO_CONFIG_ISM2:
     231             :             case IVAS_AUDIO_CONFIG_ISM3:
     232             :             case IVAS_AUDIO_CONFIG_ISM4:
     233       63852 :                 hOutSetup->is_binaural_setup = 1;
     234       70026 :             case IVAS_AUDIO_CONFIG_EXTERNAL:
     235             :                 /* Default values are used */
     236       70026 :                 break;
     237           0 :             default:
     238             : #ifdef DEBUGGING
     239             :                 /* error */
     240             :                 assert( !"Error: Unknown output setup!\n" );
     241             : #endif
     242           0 :                 return;
     243             :         }
     244             :     }
     245             : 
     246      273832 :     if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL && output_config != IVAS_AUDIO_CONFIG_LS_CUSTOM )
     247             :     {
     248      267463 :         nchan_out = audioCfg2channels( output_config );
     249      267463 :         hOutSetup->nchan_out_woLFE = nchan_out - hOutSetup->num_lfe;
     250             :     }
     251             : 
     252      273832 :     return;
     253             : }
     254             : 
     255             : 
     256             : /*-----------------------------------------------------------------*
     257             :  * ivas_get_nchan_buffers_dec()
     258             :  *
     259             :  * Return number of decoder audio buffers
     260             :  *-----------------------------------------------------------------*/
     261             : 
     262             : /*! r: number of decoder buffers */
     263     6044194 : int16_t ivas_get_nchan_buffers_dec(
     264             :     Decoder_Struct *st_ivas,          /* i/o: IVAS decoder structure                */
     265             :     const int16_t sba_analysis_order, /* i  : SBA order evaluated in SBA decoder    */
     266             :     const int32_t ivas_total_brate    /* i  : total IVAS bitrate                    */
     267             : )
     268             : {
     269             :     int16_t nchan_out_buff;
     270             :     AUDIO_CONFIG output_config;
     271             : 
     272     6044194 :     output_config = st_ivas->hDecoderConfig->output_config;
     273             : 
     274     6044194 :     nchan_out_buff = st_ivas->nchan_transport;
     275             : 
     276     6044194 :     if ( st_ivas->ivas_format == MONO_FORMAT )
     277             :     {
     278         495 :         nchan_out_buff = st_ivas->hDecoderConfig->nchan_out;
     279             :     }
     280     6043699 :     else if ( st_ivas->ivas_format == STEREO_FORMAT )
     281             :     {
     282        1559 :         nchan_out_buff = max( st_ivas->hDecoderConfig->nchan_out, CPE_CHANNELS );
     283             :     }
     284     6042140 :     else if ( st_ivas->ivas_format == ISM_FORMAT )
     285             :     {
     286       26448 :         nchan_out_buff = max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_ism );
     287             : 
     288       26448 :         if ( st_ivas->ism_mode == ISM_MODE_PARAM || output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     289             :         {
     290        6740 :             nchan_out_buff = max( nchan_out_buff, audioCfg2channels( st_ivas->intern_config ) );
     291             :         }
     292             :     }
     293     6015692 :     else if ( st_ivas->ivas_format == SBA_FORMAT )
     294             :     {
     295             :         int16_t nchan_internal;
     296     2087909 :         nchan_internal = ivas_sba_get_nchan_metadata( sba_analysis_order, ivas_total_brate );
     297             : 
     298     2087909 :         nchan_out_buff = max( nchan_internal, st_ivas->hDecoderConfig->nchan_out );
     299             :     }
     300     3927783 :     else if ( st_ivas->ivas_format == MASA_FORMAT )
     301             :     {
     302       14793 :         nchan_out_buff = max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport );
     303             : 
     304       14793 :         if ( st_ivas->hDiracDecBin[0] != NULL && st_ivas->hDiracDecBin[0]->useTdDecorr )
     305             :         {
     306        2858 :             nchan_out_buff = 2 * BINAURAL_CHANNELS;
     307             :         }
     308             :     }
     309     3912990 :     else if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
     310             :     {
     311       12614 :         nchan_out_buff = max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport + st_ivas->nchan_ism );
     312             :     }
     313     3900376 :     else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
     314             :     {
     315             :         int16_t nchan_internal;
     316             : 
     317     2108243 :         nchan_internal = ivas_sba_get_nchan_metadata( sba_analysis_order, ivas_total_brate );
     318             : 
     319     2108243 :         if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC )
     320             :         {
     321      995357 :             nchan_internal += st_ivas->nchan_ism;
     322             :         }
     323             : 
     324     2108243 :         if ( st_ivas->hMCT != NULL )
     325             :         {
     326     1148563 :             nchan_internal = ( ( nchan_internal + 1 ) >> 1 ) << 1; /* ensure odd number of channels in MCT */
     327             :         }
     328             : 
     329     2108243 :         nchan_out_buff = max( nchan_internal, st_ivas->hDecoderConfig->nchan_out );
     330             : 
     331     2108243 :         if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     332             :         {
     333      110652 :             nchan_out_buff = max( nchan_out_buff, audioCfg2channels( st_ivas->intern_config ) );
     334             :         }
     335             :     }
     336     1792133 :     else if ( st_ivas->ivas_format == MC_FORMAT )
     337             :     {
     338     1792133 :         nchan_out_buff = max( st_ivas->hDecoderConfig->nchan_out, st_ivas->nchan_transport );
     339             : 
     340     1792133 :         if ( st_ivas->hOutSetup.separateChannelEnabled )
     341             :         {
     342        5994 :             nchan_out_buff = max( nchan_out_buff, st_ivas->nchan_transport + 1 );
     343             :         }
     344             : 
     345     1792133 :         if ( st_ivas->hDiracDecBin[0] != NULL && st_ivas->hDiracDecBin[0]->useTdDecorr )
     346             :         {
     347        1196 :             nchan_out_buff = 2 * BINAURAL_CHANNELS;
     348             :         }
     349             :         else
     350             :         {
     351     1790937 :             nchan_out_buff = max( nchan_out_buff, audioCfg2channels( st_ivas->intern_config ) );
     352             :         }
     353             :     }
     354             : 
     355     6044194 :     if ( output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
     356             :     {
     357     1228694 :         nchan_out_buff = max( nchan_out_buff, st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses * BINAURAL_CHANNELS );
     358             :     }
     359             : 
     360     6044194 :     return nchan_out_buff;
     361             : }
     362             : 
     363             : 
     364             : /*-------------------------------------------------------------------*
     365             :  * ivas_output_buff_dec()
     366             :  *
     367             :  * Allocate/reallocate output audio buffers
     368             :  *-------------------------------------------------------------------*/
     369             : 
     370      123827 : ivas_error ivas_output_buff_dec(
     371             :     float *p_output_f[],               /* i/o: output audio buffers                       */
     372             :     const int16_t nchan_out_buff,      /* i  : number of output channels                  */
     373             :     const int16_t Opt_tsm,             /* i  : TSM option flag                            */
     374             :     DECODER_TC_BUFFER_HANDLE hTcBuffer /* i  : TSM buffer handle                          */
     375             : )
     376             : {
     377             :     int16_t ch, nchan_tc_jbm, nsamp_to_allocate, n_samp_full, offset;
     378             : 
     379     2600367 :     for ( ch = 0; ch < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; ch++ )
     380             :     {
     381     2476540 :         p_output_f[ch] = NULL;
     382             :     }
     383             : 
     384      123827 :     if ( hTcBuffer->tc_buffer2 != NULL )
     385             :     {
     386       11410 :         free( hTcBuffer->tc_buffer2 );
     387       11410 :         hTcBuffer->tc_buffer2 = NULL;
     388             :     }
     389             : 
     390      123827 :     nchan_tc_jbm = 0;
     391      123827 :     if ( Opt_tsm )
     392             :     {
     393             :         /* JBM decoding: output audio buffers are shared with audio buffers from 'hTcBuffer->tc[]' */
     394       52100 :         nchan_tc_jbm = max( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full );
     395             :     }
     396             : 
     397      123827 :     if ( nchan_out_buff <= nchan_tc_jbm && !Opt_tsm )
     398             :     {
     399           0 :         for ( ch = 0; ch < nchan_out_buff; ch++ )
     400             :         {
     401           0 :             p_output_f[ch] = hTcBuffer->tc[ch];
     402             :         }
     403             :     }
     404             :     else
     405             :     {
     406      330183 :         for ( ch = 0; ch < nchan_tc_jbm; ch++ )
     407             :         {
     408      206356 :             p_output_f[ch] = hTcBuffer->tc[ch];
     409             :         }
     410             : 
     411             :         /* non-JBM decoding: allocate output audio buffers */
     412             :         /* JBM decoding: when not enough audio buffers 'hTcBuffer->tc[]', allocate additional buffers */
     413      123827 :         n_samp_full = ( 48000 / FRAMES_PER_SEC );
     414      123827 :         nsamp_to_allocate = ( nchan_out_buff - nchan_tc_jbm ) * n_samp_full;
     415             : 
     416      123827 :         if ( nsamp_to_allocate > 0 )
     417             :         {
     418             :             /* note: these are intra-frame heap memories */
     419      105868 :             if ( ( hTcBuffer->tc_buffer2 = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL )
     420             :             {
     421           0 :                 return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) );
     422             :             }
     423             : 
     424      105868 :             set_zero( hTcBuffer->tc_buffer2, nsamp_to_allocate );
     425             :         }
     426             : 
     427      123827 :         offset = 0;
     428      846454 :         for ( ; ch < nchan_out_buff; ch++ )
     429             :         {
     430      722627 :             p_output_f[ch] = &hTcBuffer->tc_buffer2[offset];
     431      722627 :             offset += n_samp_full;
     432             :         }
     433             :     }
     434             : 
     435      123827 :     return IVAS_ERR_OK;
     436             : }
     437             : 
     438             : 
     439             : /*---------------------------------------------------------------------*
     440             :  * is_split_rendering_enabled()
     441             :  *
     442             :  *
     443             :  *---------------------------------------------------------------------*/
     444             : 
     445             : /*! r: flag to indicate if split rendering is enabled */
     446     7774779 : int16_t is_split_rendering_enabled(
     447             :     const DECODER_CONFIG_HANDLE hDecoderConfig,   /* i  : configuration structure         */
     448             :     const IVAS_RENDER_CONFIG_HANDLE hRenderConfig /* i  : Render config data structure    */
     449             : )
     450             : {
     451     7774779 :     if ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ||
     452     7273316 :          ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO && hDecoderConfig->Opt_non_diegetic_pan && hRenderConfig->split_rend_config.dof == 0 ) )
     453             :     {
     454      501463 :         return 1;
     455             :     }
     456             :     else
     457             :     {
     458     7273316 :         return 0;
     459             :     }
     460             : }
     461             : 
     462             : 
     463             : /*---------------------------------------------------------------------*
     464             :  * get_channel_config()
     465             :  *
     466             :  * Gets a str related to input config
     467             :  *---------------------------------------------------------------------*/
     468             : 
     469      108572 : ivas_error get_channel_config(
     470             :     const AUDIO_CONFIG config,
     471             :     char *str )
     472             : {
     473      108572 :     if ( config == IVAS_AUDIO_CONFIG_MONO )
     474             :     {
     475        6122 :         strcpy( str, "Mono" );
     476             :     }
     477      102450 :     else if ( config == IVAS_AUDIO_CONFIG_STEREO )
     478             :     {
     479        6380 :         strcpy( str, "Stereo" );
     480             :     }
     481       96070 :     else if ( config == IVAS_AUDIO_CONFIG_ISM1 )
     482             :     {
     483        1390 :         strcpy( str, "Object-based audio (1 object)" );
     484             :     }
     485       94680 :     else if ( config == IVAS_AUDIO_CONFIG_ISM2 )
     486             :     {
     487        1530 :         strcpy( str, "Object-based audio (2 objects)" );
     488             :     }
     489       93150 :     else if ( config == IVAS_AUDIO_CONFIG_ISM3 )
     490             :     {
     491        1290 :         strcpy( str, "Object-based audio (3 objects)" );
     492             :     }
     493       91860 :     else if ( config == IVAS_AUDIO_CONFIG_ISM4 )
     494             :     {
     495        1404 :         strcpy( str, "Object-based audio (4 objects)" );
     496             :     }
     497       90456 :     else if ( config == IVAS_AUDIO_CONFIG_5_1 )
     498             :     {
     499        6194 :         strcpy( str, "Multichannel 5.1 (CICP6)" );
     500             :     }
     501       84262 :     else if ( config == IVAS_AUDIO_CONFIG_7_1 )
     502             :     {
     503        6060 :         strcpy( str, "Multichannel 7.1 (CICP12)" );
     504             :     }
     505       78202 :     else if ( config == IVAS_AUDIO_CONFIG_5_1_2 )
     506             :     {
     507        6054 :         strcpy( str, "Multichannel 5.1+2 (CICP14)" );
     508             :     }
     509       72148 :     else if ( config == IVAS_AUDIO_CONFIG_5_1_4 )
     510             :     {
     511        6172 :         strcpy( str, "Multichannel 5.1+4 (CICP16)" );
     512             :     }
     513       65976 :     else if ( config == IVAS_AUDIO_CONFIG_7_1_4 )
     514             :     {
     515        6136 :         strcpy( str, "Multichannel 7.1+4 (CICP19)" );
     516             :     }
     517       59840 :     else if ( config == IVAS_AUDIO_CONFIG_LS_CUSTOM )
     518             :     {
     519        1341 :         strcpy( str, "Multichannel (custom loudspeaker layout)" );
     520             :     }
     521       58499 :     else if ( config == IVAS_AUDIO_CONFIG_MASA1 )
     522             :     {
     523        1220 :         strcpy( str, "Metadata-Assisted Spatial Audio mono (MASA1)" );
     524             :     }
     525       57279 :     else if ( config == IVAS_AUDIO_CONFIG_MASA2 )
     526             :     {
     527        1232 :         strcpy( str, "Metadata-Assisted Spatial Audio stereo (MASA2)" );
     528             :     }
     529       56047 :     else if ( config == IVAS_AUDIO_CONFIG_FOA )
     530             :     {
     531        7462 :         strcpy( str, "Ambisonics: First Order (FOA)" );
     532             :     }
     533       48585 :     else if ( config == IVAS_AUDIO_CONFIG_HOA2 )
     534             :     {
     535        6775 :         strcpy( str, "Ambisonics: Second Order (HOA2)" );
     536             :     }
     537       41810 :     else if ( config == IVAS_AUDIO_CONFIG_HOA3 )
     538             :     {
     539        6921 :         strcpy( str, "Ambisonics: Third Order (HOA3)" );
     540             :     }
     541       34889 :     else if ( config == IVAS_AUDIO_CONFIG_BINAURAL )
     542             :     {
     543        9020 :         strcpy( str, "Binaural: no room" );
     544             :     }
     545       25869 :     else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     546             :     {
     547        8855 :         strcpy( str, "Binaural: room with impulse responses" );
     548             :     }
     549       17014 :     else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
     550             :     {
     551        8839 :         strcpy( str, "Binaural: room with reverb" );
     552             :     }
     553        8175 :     else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
     554             :     {
     555        2518 :         strcpy( str, "BINAURAL_SPLIT_CODED" );
     556             :     }
     557        5657 :     else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
     558             :     {
     559          42 :         strcpy( str, "Binaural_Split_PCM" );
     560             :     }
     561        5615 :     else if ( config == IVAS_AUDIO_CONFIG_EXTERNAL )
     562             :     {
     563        5615 :         strcpy( str, "External renderer" );
     564             :     }
     565             :     else
     566             :     {
     567           0 :         return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Error: Incorrect Input/Output Configuration" );
     568             :     }
     569             : 
     570      108572 :     return IVAS_ERR_OK;
     571             : }

Generated by: LCOV version 1.14