LCOV - code coverage report
Current view: top level - lib_rend - ivas_crend.c (source / functions) Hit Total Coverage
Test: Coverage on main -- short test vectors @ 0409e964e5c70ba6bb7edff5f83b8587504703cd Lines: 743 849 87.5 %
Date: 2026-01-19 08:02:43 Functions: 17 17 100.0 %

          Line data    Source code
       1             : /******************************************************************************************************
       2             : 
       3             :    (C) 2022-2026 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.h"
      36             : #include "ivas_prot.h"
      37             : #include "ivas_prot_rend.h"
      38             : #include "ivas_cnst.h"
      39             : #include "ivas_rom_rend.h"
      40             : #include <math.h>
      41             : #include "ivas_rom_binaural_crend_head.h"
      42             : #include "ivas_stat_rend.h"
      43             : #include "lib_rend.h"
      44             : #ifdef DEBUGGING
      45             : #include "debug.h"
      46             : #endif
      47             : #include "wmc_auto.h"
      48             : 
      49             : 
      50             : /*-------------------------------------------------------------------------
      51             :  * ivas_Crend_hrtf_init()
      52             :  *
      53             :  * Initialize hHrtf handle
      54             :  *------------------------------------------------------------------------*/
      55             : 
      56        7694 : ivas_error ivas_Crend_hrtf_init(
      57             :     HRTFS_CREND_DATA *hHrtf /* i/o: HRTF handle     */
      58             : )
      59             : {
      60             :     int16_t i, j;
      61             : 
      62        7694 :     if ( hHrtf == NULL )
      63             :     {
      64           0 :         return IVAS_ERR_WRONG_PARAMS;
      65             :     }
      66             : 
      67        7694 :     hHrtf->latency_s = 0;
      68        7694 :     hHrtf->gain_lfe = 0;
      69        7694 :     hHrtf->max_num_ir = 0;
      70        7694 :     hHrtf->max_num_iterations = 0;
      71        7694 :     hHrtf->index_frequency_max_diffuse = 0;
      72        7694 :     hHrtf->same_inv_diffuse_weight = 1;
      73             : 
      74      130798 :     for ( i = 0; i < MAX_INTERN_CHANNELS; i++ )
      75             :     {
      76      369312 :         for ( j = 0; j < BINAURAL_CHANNELS; j++ )
      77             :         {
      78      246208 :             hHrtf->inv_diffuse_weight[j][i] = 0;
      79      246208 :             hHrtf->num_iterations[i][j] = 0;
      80      246208 :             hHrtf->pIndex_frequency_max[i][j] = NULL;
      81      246208 :             hHrtf->pOut_to_bin_re[i][j] = NULL;
      82      246208 :             hHrtf->pOut_to_bin_im[i][j] = NULL;
      83      246208 :             hHrtf->pOut_to_bin_re_dyn[i][j] = NULL;
      84      246208 :             hHrtf->pOut_to_bin_im_dyn[i][j] = NULL;
      85      246208 :             hHrtf->pIndex_frequency_max_dyn[i][j] = NULL;
      86             :         }
      87             :     }
      88             : 
      89       23082 :     for ( j = 0; j < BINAURAL_CHANNELS; j++ )
      90             :     {
      91       15388 :         hHrtf->num_iterations_diffuse[j] = 0;
      92       15388 :         hHrtf->pIndex_frequency_max_diffuse[j] = NULL;
      93       15388 :         hHrtf->pOut_to_bin_diffuse_re[j] = NULL;
      94       15388 :         hHrtf->pOut_to_bin_diffuse_im[j] = NULL;
      95       15388 :         hHrtf->pIndex_frequency_max_diffuse_dyn[j] = NULL;
      96       15388 :         hHrtf->pOut_to_bin_diffuse_re_dyn[j] = NULL;
      97       15388 :         hHrtf->pOut_to_bin_diffuse_im_dyn[j] = NULL;
      98             :     }
      99             : 
     100        7694 :     hHrtf->init_from_rom = 1;
     101             : 
     102        7694 :     return IVAS_ERR_OK;
     103             : }
     104             : 
     105             : 
     106             : /*-------------------------------------------------------------------------
     107             :  * ivas_hrtf_open()
     108             :  *
     109             :  * Open hHrtf handle for Crend renderer
     110             :  *------------------------------------------------------------------------*/
     111             : 
     112        6841 : static ivas_error ivas_hrtf_open(
     113             :     HRTFS_CREND_HANDLE *hHrtf_out /* o  : HRTF handle     */
     114             : )
     115             : {
     116             :     HRTFS_CREND_HANDLE hHrtf;
     117             :     ivas_error error;
     118             : 
     119        6841 :     if ( *hHrtf_out == NULL )
     120             :     {
     121        6841 :         if ( ( hHrtf = (HRTFS_CREND_HANDLE) malloc( sizeof( HRTFS_CREND_DATA ) ) ) == NULL )
     122             :         {
     123           0 :             return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend HRTFS Handle\n" );
     124             :         }
     125             : 
     126        6841 :         if ( ( error = ivas_Crend_hrtf_init( hHrtf ) ) != IVAS_ERR_OK )
     127             :         {
     128           0 :             return error;
     129             :         }
     130             : 
     131        6841 :         *hHrtf_out = hHrtf;
     132             :     }
     133             :     else
     134             :     {
     135           0 :         return IVAS_ERR_INTERNAL;
     136             :     }
     137             : 
     138        6841 :     return IVAS_ERR_OK;
     139             : }
     140             : 
     141             : /*-------------------------------------------------------------------------
     142             :  * ivas_hrtf_close()
     143             :  *
     144             :  * Close hHrtf handle
     145             :  *------------------------------------------------------------------------*/
     146             : 
     147        6841 : static void ivas_hrtf_close(
     148             :     HRTFS_CREND_HANDLE *hHrtf /* i/o: Crend HRTF handle         */
     149             : )
     150             : {
     151        6841 :     if ( hHrtf == NULL || *hHrtf == NULL )
     152             :     {
     153           0 :         return;
     154             :     }
     155             : 
     156        6841 :     free( *hHrtf );
     157        6841 :     *hHrtf = NULL;
     158             : 
     159        6841 :     return;
     160             : }
     161             : 
     162             : 
     163             : /*-------------------------------------------------------------------------
     164             :  * ivas_rend_initCrend()
     165             :  *
     166             :  * Allocate and initialize crend renderer handle
     167             :  *------------------------------------------------------------------------*/
     168             : 
     169        7694 : static ivas_error ivas_rend_initCrend(
     170             :     CREND_WRAPPER *pCrend,
     171             :     const AUDIO_CONFIG inConfig,
     172             :     const AUDIO_CONFIG outConfig,
     173             :     HRTFS_CREND_HANDLE hHrtfCrend,
     174             :     const int16_t ext_rend_flag,
     175             :     const int32_t output_Fs )
     176             : {
     177             :     int16_t i, j, tmp, tmp2;
     178             :     int16_t nchan_in;
     179             :     IVAS_REND_AudioConfigType inConfigType;
     180             :     HRTFS_CREND_HANDLE hHrtf;
     181             :     ivas_error error;
     182             : 
     183        7694 :     inConfigType = getAudioConfigType( inConfig );
     184        7694 :     hHrtf = pCrend->hHrtfCrend;
     185             : 
     186             :     /* Do all error checks up front so that the nested if later is easier */
     187        7694 :     if ( inConfigType != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED && inConfigType != IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS )
     188             :     {
     189           0 :         return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Encountered unsupported input config in Crend" );
     190             :     }
     191             : 
     192        7694 :     if ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
     193             :     {
     194           0 :         return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Encountered unsupported output type in Crend" );
     195             :     }
     196             : 
     197        7694 :     if ( hHrtf == NULL )
     198             :     {
     199        7694 :         if ( hHrtfCrend != NULL && ext_rend_flag == 0 )
     200             :         {
     201             :             /* HRTF set loaded from binary file */
     202         853 :             hHrtf = hHrtfCrend;
     203         853 :             hHrtf->init_from_rom = 0;
     204             :         }
     205             :         else
     206             :         {
     207             :             /* create new handle when HRTF is loaded from ROM, or external renderer is used */
     208        6841 :             if ( ( error = ivas_hrtf_open( &hHrtf ) ) != IVAS_ERR_OK )
     209             :             {
     210           0 :                 return error;
     211             :             }
     212             : 
     213        6841 :             hHrtf->init_from_rom = 1;
     214        6841 :             if ( hHrtfCrend != NULL )
     215             :             {
     216           0 :                 hHrtf->init_from_rom = 0;
     217             :             }
     218             :         }
     219             :     }
     220             : 
     221        7694 :     if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK )
     222             :     {
     223           0 :         return error;
     224             :     }
     225        7694 :     hHrtf->max_num_ir = nchan_in;
     226             : 
     227        7694 :     if ( hHrtf->max_num_ir <= 0 )
     228             :     {
     229           0 :         return IVAS_ERR_INTERNAL_FATAL;
     230             :     }
     231             : 
     232        7694 :     if ( hHrtf->init_from_rom )
     233             :     {
     234        6841 :         if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED )
     235             :         {
     236        5240 :             hHrtf->max_num_ir -= 1; /* subtract LFE */
     237        5240 :             hHrtf->gain_lfe = GAIN_LFE;
     238             : 
     239        5240 :             if ( output_Fs == 48000 )
     240             :             {
     241        2144 :                 if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     242             :                 {
     243        1528 :                     hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s;
     244        1528 :                     hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_48kHz;
     245        1528 :                     hHrtf->index_frequency_max_diffuse = CRendBin_Combined_BRIR_index_frequency_max_diffuse_48kHz;
     246             :                 }
     247             :                 else
     248             :                 {
     249         616 :                     hHrtf->latency_s = CRendBin_Combined_HRIR_latency_s;
     250         616 :                     hHrtf->max_num_iterations = CRendBin_Combined_HRIR_max_num_iterations_48kHz;
     251         616 :                     hHrtf->index_frequency_max_diffuse = CRendBin_Combined_HRIR_index_frequency_max_diffuse_48kHz;
     252             :                 }
     253             : 
     254        6432 :                 for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     255             :                 {
     256        4288 :                     if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     257             :                     {
     258        3056 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_48kHz[j];
     259        3056 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_48kHz[j];
     260        3056 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_48kHz[j];
     261        3056 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_48kHz[j];
     262             :                     }
     263             :                     else
     264             :                     {
     265        1232 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_48kHz[j];
     266        1232 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_48kHz[j];
     267        1232 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_48kHz[j];
     268        1232 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_48kHz[j];
     269             :                     }
     270             :                 }
     271             :             }
     272        3096 :             else if ( output_Fs == 32000 )
     273             :             {
     274        1563 :                 if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     275             :                 {
     276        1283 :                     hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s;
     277        1283 :                     hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_32kHz;
     278        1283 :                     hHrtf->index_frequency_max_diffuse = CRendBin_Combined_BRIR_index_frequency_max_diffuse_32kHz;
     279             :                 }
     280             :                 else
     281             :                 {
     282         280 :                     hHrtf->latency_s = CRendBin_Combined_HRIR_latency_s;
     283         280 :                     hHrtf->max_num_iterations = CRendBin_Combined_HRIR_max_num_iterations_32kHz;
     284         280 :                     hHrtf->index_frequency_max_diffuse = CRendBin_Combined_HRIR_index_frequency_max_diffuse_32kHz;
     285             :                 }
     286             : 
     287        4689 :                 for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     288             :                 {
     289        3126 :                     if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     290             :                     {
     291        2566 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_32kHz[j];
     292        2566 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_32kHz[j];
     293        2566 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_32kHz[j];
     294        2566 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_32kHz[j];
     295             :                     }
     296             :                     else
     297             :                     {
     298         560 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_32kHz[j];
     299         560 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_32kHz[j];
     300         560 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_32kHz[j];
     301         560 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_32kHz[j];
     302             :                     }
     303             :                 }
     304             :             }
     305        1533 :             else if ( output_Fs == 16000 )
     306             :             {
     307        1533 :                 if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     308             :                 {
     309        1070 :                     hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s;
     310             : 
     311        1070 :                     hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_16kHz;
     312        1070 :                     hHrtf->index_frequency_max_diffuse = CRendBin_Combined_BRIR_index_frequency_max_diffuse_16kHz;
     313             :                 }
     314             :                 else
     315             :                 {
     316         463 :                     hHrtf->latency_s = CRendBin_Combined_HRIR_latency_s;
     317         463 :                     hHrtf->max_num_iterations = CRendBin_Combined_HRIR_max_num_iterations_16kHz;
     318         463 :                     hHrtf->index_frequency_max_diffuse = CRendBin_Combined_HRIR_index_frequency_max_diffuse_16kHz;
     319             :                 }
     320             : 
     321        4599 :                 for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     322             :                 {
     323        3066 :                     if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     324             :                     {
     325        2140 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_16kHz[j];
     326        2140 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_16kHz[j];
     327        2140 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_16kHz[j];
     328        2140 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_16kHz[j];
     329             :                     }
     330             :                     else
     331             :                     {
     332         926 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_16kHz[j];
     333         926 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_16kHz[j];
     334         926 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_16kHz[j];
     335         926 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz[j];
     336             :                     }
     337             :                 }
     338             :             }
     339             :             else
     340             :             {
     341           0 :                 return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" );
     342             :             }
     343             : 
     344       55316 :             for ( i = 0; i < hHrtf->max_num_ir; i++ )
     345             :             {
     346       50076 :                 if ( inConfig == IVAS_AUDIO_CONFIG_5_1 )
     347             :                 {
     348        4360 :                     tmp = channelIndex_CICP6[i];
     349             :                 }
     350       45716 :                 else if ( inConfig == IVAS_AUDIO_CONFIG_7_1 )
     351             :                 {
     352        1505 :                     tmp = channelIndex_CICP12[i];
     353             :                 }
     354       44211 :                 else if ( inConfig == IVAS_AUDIO_CONFIG_5_1_2 )
     355             :                 {
     356        1778 :                     tmp = channelIndex_CICP14[i];
     357             :                 }
     358       42433 :                 else if ( inConfig == IVAS_AUDIO_CONFIG_5_1_4 )
     359             :                 {
     360        2052 :                     tmp = channelIndex_CICP16[i];
     361             :                 }
     362       40381 :                 else if ( inConfig == IVAS_AUDIO_CONFIG_7_1_4 )
     363             :                 {
     364       40381 :                     tmp = channelIndex_CICP19[i];
     365             :                 }
     366             :                 else
     367             :                 {
     368           0 :                     return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Channel configuration not specified!\n\n" );
     369             :                 }
     370             : 
     371       50076 :                 if ( output_Fs == 48000 )
     372             :                 {
     373       58650 :                     for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     374             :                     {
     375       39100 :                         if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     376             :                         {
     377       30492 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz[j][tmp];
     378       30492 :                             hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_48kHz[tmp][j];
     379       30492 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[tmp][j];
     380       30492 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_48kHz[tmp][j];
     381       30492 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_48kHz[tmp][j];
     382             :                         }
     383             :                         else
     384             :                         {
     385        8608 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz[j][tmp];
     386        8608 :                             hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_48kHz[tmp][j];
     387        8608 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[tmp][j];
     388        8608 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_48kHz[tmp][j];
     389        8608 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_48kHz[tmp][j];
     390             :                         }
     391             :                     }
     392             :                 }
     393       30526 :                 else if ( output_Fs == 32000 )
     394             :                 {
     395       48003 :                     for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     396             :                     {
     397       32002 :                         if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     398             :                         {
     399       27506 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz[j][tmp];
     400       27506 :                             hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_32kHz[tmp][j];
     401       27506 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[tmp][j];
     402       27506 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_32kHz[tmp][j];
     403       27506 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_32kHz[tmp][j];
     404             :                         }
     405             :                         else
     406             :                         {
     407        4496 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_Combined_HRIR_inv_diffuse_weight_32kHz[j][tmp];
     408        4496 :                             hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_32kHz[tmp][j];
     409        4496 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[tmp][j];
     410        4496 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_32kHz[tmp][j];
     411        4496 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_32kHz[tmp][j];
     412             :                         }
     413             :                     }
     414             :                 }
     415       14525 :                 else if ( output_Fs == 16000 )
     416             :                 {
     417       43575 :                     for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     418             :                     {
     419       29050 :                         if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     420             :                         {
     421       22724 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz[j][tmp];
     422       22724 :                             hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_16kHz[tmp][j];
     423       22724 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[tmp][j];
     424       22724 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_16kHz[tmp][j];
     425       22724 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_16kHz[tmp][j];
     426             :                         }
     427             :                         else
     428             :                         {
     429        6326 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz[j][tmp];
     430        6326 :                             hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_16kHz[tmp][j];
     431        6326 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[tmp][j];
     432        6326 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_16kHz[tmp][j];
     433        6326 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_16kHz[tmp][j];
     434             :                         }
     435             :                     }
     436             :                 }
     437             :                 else
     438             :                 {
     439           0 :                     return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" );
     440             :                 }
     441             :             }
     442             :         }
     443        1601 :         else if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS )
     444             :         {
     445        1601 :             if ( inConfig == IVAS_AUDIO_CONFIG_HOA3 )
     446             :             {
     447         635 :                 if ( output_Fs == 48000 )
     448             :                 {
     449         355 :                     hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s;
     450         355 :                     hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_48kHz;
     451         355 :                     hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz;
     452             : 
     453        6035 :                     for ( i = 0; i < hHrtf->max_num_ir; i++ )
     454             :                     {
     455       17040 :                         for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     456             :                         {
     457       11360 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz[j][i];
     458       11360 :                             hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_48kHz[i][j];
     459       11360 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[i][j];
     460       11360 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_48kHz[i][j];
     461       11360 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_48kHz[i][j];
     462             :                         }
     463             :                     }
     464        1065 :                     for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     465             :                     {
     466         710 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[j];
     467         710 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[j];
     468         710 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz[j];
     469         710 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz[j];
     470             :                     }
     471             :                 }
     472         280 :                 else if ( output_Fs == 32000 )
     473             :                 {
     474         140 :                     hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s;
     475         140 :                     hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_32kHz;
     476         140 :                     hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_32kHz;
     477             : 
     478        2380 :                     for ( i = 0; i < hHrtf->max_num_ir; i++ )
     479             :                     {
     480        6720 :                         for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     481             :                         {
     482        4480 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz[j][i];
     483        4480 :                             hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_32kHz[i][j];
     484        4480 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[i][j];
     485        4480 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_32kHz[i][j];
     486        4480 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_32kHz[i][j];
     487             :                         }
     488             :                     }
     489             : 
     490         420 :                     for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     491             :                     {
     492         280 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[j];
     493         280 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[j];
     494         280 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz[j];
     495         280 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz[j];
     496             :                     }
     497             :                 }
     498         140 :                 else if ( output_Fs == 16000 )
     499             :                 {
     500         140 :                     hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s;
     501         140 :                     hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_16kHz;
     502         140 :                     hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_16kHz;
     503             : 
     504        2380 :                     for ( i = 0; i < hHrtf->max_num_ir; i++ )
     505             :                     {
     506        6720 :                         for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     507             :                         {
     508        4480 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz[j][i];
     509        4480 :                             hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_16kHz[i][j];
     510        4480 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[i][j];
     511        4480 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_16kHz[i][j];
     512        4480 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_16kHz[i][j];
     513             :                         }
     514             :                     }
     515             : 
     516         420 :                     for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     517             :                     {
     518         280 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[j];
     519         280 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[j];
     520         280 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz[j];
     521         280 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz[j];
     522             :                     }
     523             :                 }
     524             :                 else
     525             :                 {
     526           0 :                     return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" );
     527             :                 }
     528             :             }
     529         966 :             else if ( inConfig == IVAS_AUDIO_CONFIG_HOA2 )
     530             :             {
     531         448 :                 if ( output_Fs == 48000 )
     532             :                 {
     533         168 :                     hHrtf->latency_s = CRendBin_HOA2_HRIR_latency_s;
     534         168 :                     hHrtf->max_num_iterations = CRendBin_HOA2_HRIR_max_num_iterations_48kHz;
     535         168 :                     hHrtf->index_frequency_max_diffuse = CRendBin_HOA2_HRIR_index_frequency_max_diffuse_48kHz;
     536             : 
     537        1680 :                     for ( i = 0; i < hHrtf->max_num_ir; i++ )
     538             :                     {
     539        4536 :                         for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     540             :                         {
     541        3024 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_48kHz[j][i];
     542        3024 :                             hHrtf->num_iterations[i][j] = CRendBin_HOA2_HRIR_num_iterations_48kHz[i][j];
     543        3024 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_48kHz[i][j];
     544        3024 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA2_HRIR_coeff_re_48kHz[i][j];
     545        3024 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA2_HRIR_coeff_im_48kHz[i][j];
     546             :                         }
     547             :                     }
     548         504 :                     for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     549             :                     {
     550         336 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_HOA2_HRIR_num_iterations_diffuse_48kHz[j];
     551         336 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_48kHz[j];
     552         336 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_48kHz[j];
     553         336 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_48kHz[j];
     554             :                     }
     555             :                 }
     556         280 :                 else if ( output_Fs == 32000 )
     557             :                 {
     558         140 :                     hHrtf->latency_s = CRendBin_HOA2_HRIR_latency_s;
     559         140 :                     hHrtf->max_num_iterations = CRendBin_HOA2_HRIR_max_num_iterations_32kHz;
     560         140 :                     hHrtf->index_frequency_max_diffuse = CRendBin_HOA2_HRIR_index_frequency_max_diffuse_32kHz;
     561             : 
     562        1400 :                     for ( i = 0; i < hHrtf->max_num_ir; i++ )
     563             :                     {
     564        3780 :                         for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     565             :                         {
     566        2520 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_32kHz[j][i];
     567        2520 :                             hHrtf->num_iterations[i][j] = CRendBin_HOA2_HRIR_num_iterations_32kHz[i][j];
     568        2520 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_32kHz[i][j];
     569        2520 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA2_HRIR_coeff_re_32kHz[i][j];
     570        2520 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA2_HRIR_coeff_im_32kHz[i][j];
     571             :                         }
     572             :                     }
     573             : 
     574         420 :                     for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     575             :                     {
     576         280 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_HOA2_HRIR_num_iterations_diffuse_32kHz[j];
     577         280 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_32kHz[j];
     578         280 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_32kHz[j];
     579         280 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_32kHz[j];
     580             :                     }
     581             :                 }
     582         140 :                 else if ( output_Fs == 16000 )
     583             :                 {
     584         140 :                     hHrtf->latency_s = CRendBin_HOA2_HRIR_latency_s;
     585         140 :                     hHrtf->max_num_iterations = CRendBin_HOA2_HRIR_max_num_iterations_16kHz;
     586         140 :                     hHrtf->index_frequency_max_diffuse = CRendBin_HOA2_HRIR_index_frequency_max_diffuse_16kHz;
     587             : 
     588        1400 :                     for ( i = 0; i < hHrtf->max_num_ir; i++ )
     589             :                     {
     590        3780 :                         for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     591             :                         {
     592        2520 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_16kHz[j][i];
     593        2520 :                             hHrtf->num_iterations[i][j] = CRendBin_HOA2_HRIR_num_iterations_16kHz[i][j];
     594        2520 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_16kHz[i][j];
     595        2520 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA2_HRIR_coeff_re_16kHz[i][j];
     596        2520 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA2_HRIR_coeff_im_16kHz[i][j];
     597             :                         }
     598             :                     }
     599             : 
     600         420 :                     for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     601             :                     {
     602         280 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_HOA2_HRIR_num_iterations_diffuse_16kHz[j];
     603         280 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_16kHz[j];
     604         280 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_16kHz[j];
     605         280 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_16kHz[j];
     606             :                     }
     607             :                 }
     608             :                 else
     609             :                 {
     610           0 :                     return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" );
     611             :                 }
     612             :             }
     613         518 :             else if ( inConfig == IVAS_AUDIO_CONFIG_FOA )
     614             :             {
     615         518 :                 if ( output_Fs == 48000 )
     616             :                 {
     617         238 :                     hHrtf->latency_s = CRendBin_FOA_HRIR_latency_s;
     618         238 :                     hHrtf->max_num_iterations = CRendBin_FOA_HRIR_max_num_iterations_48kHz;
     619         238 :                     hHrtf->index_frequency_max_diffuse = CRendBin_FOA_HRIR_index_frequency_max_diffuse_48kHz;
     620             : 
     621        1190 :                     for ( i = 0; i < hHrtf->max_num_ir; i++ )
     622             :                     {
     623        2856 :                         for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     624             :                         {
     625        1904 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_FOA_HRIR_inv_diffuse_weight_48kHz[j][i];
     626        1904 :                             hHrtf->num_iterations[i][j] = CRendBin_FOA_HRIR_num_iterations_48kHz[i][j];
     627        1904 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_FOA_HRIR_pIndex_frequency_max_48kHz[i][j];
     628        1904 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_FOA_HRIR_coeff_re_48kHz[i][j];
     629        1904 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_FOA_HRIR_coeff_im_48kHz[i][j];
     630             :                         }
     631             :                     }
     632         714 :                     for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     633             :                     {
     634         476 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_FOA_HRIR_num_iterations_diffuse_48kHz[j];
     635         476 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_48kHz[j];
     636         476 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_48kHz[j];
     637         476 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_48kHz[j];
     638             :                     }
     639             :                 }
     640         280 :                 else if ( output_Fs == 32000 )
     641             :                 {
     642         140 :                     hHrtf->latency_s = CRendBin_FOA_HRIR_latency_s;
     643         140 :                     hHrtf->max_num_iterations = CRendBin_FOA_HRIR_max_num_iterations_32kHz;
     644         140 :                     hHrtf->index_frequency_max_diffuse = CRendBin_FOA_HRIR_index_frequency_max_diffuse_32kHz;
     645             : 
     646         700 :                     for ( i = 0; i < hHrtf->max_num_ir; i++ )
     647             :                     {
     648        1680 :                         for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     649             :                         {
     650        1120 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_FOA_HRIR_inv_diffuse_weight_32kHz[j][i];
     651        1120 :                             hHrtf->num_iterations[i][j] = CRendBin_FOA_HRIR_num_iterations_32kHz[i][j];
     652        1120 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_FOA_HRIR_pIndex_frequency_max_32kHz[i][j];
     653        1120 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_FOA_HRIR_coeff_re_32kHz[i][j];
     654        1120 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_FOA_HRIR_coeff_im_32kHz[i][j];
     655             :                         }
     656             :                     }
     657             : 
     658         420 :                     for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     659             :                     {
     660         280 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_FOA_HRIR_num_iterations_diffuse_32kHz[j];
     661         280 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_32kHz[j];
     662         280 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_32kHz[j];
     663         280 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_32kHz[j];
     664             :                     }
     665             :                 }
     666         140 :                 else if ( output_Fs == 16000 )
     667             :                 {
     668         140 :                     hHrtf->latency_s = CRendBin_FOA_HRIR_latency_s;
     669         140 :                     hHrtf->max_num_iterations = CRendBin_FOA_HRIR_max_num_iterations_16kHz;
     670         140 :                     hHrtf->index_frequency_max_diffuse = CRendBin_FOA_HRIR_index_frequency_max_diffuse_16kHz;
     671             : 
     672         700 :                     for ( i = 0; i < hHrtf->max_num_ir; i++ )
     673             :                     {
     674        1680 :                         for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     675             :                         {
     676        1120 :                             hHrtf->inv_diffuse_weight[j][i] = CRendBin_FOA_HRIR_inv_diffuse_weight_16kHz[j][i];
     677        1120 :                             hHrtf->num_iterations[i][j] = CRendBin_FOA_HRIR_num_iterations_16kHz[i][j];
     678        1120 :                             hHrtf->pIndex_frequency_max[i][j] = CRendBin_FOA_HRIR_pIndex_frequency_max_16kHz[i][j];
     679        1120 :                             hHrtf->pOut_to_bin_re[i][j] = CRendBin_FOA_HRIR_coeff_re_16kHz[i][j];
     680        1120 :                             hHrtf->pOut_to_bin_im[i][j] = CRendBin_FOA_HRIR_coeff_im_16kHz[i][j];
     681             :                         }
     682             :                     }
     683             : 
     684         420 :                     for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     685             :                     {
     686         280 :                         hHrtf->num_iterations_diffuse[j] = CRendBin_FOA_HRIR_num_iterations_diffuse_16kHz[j];
     687         280 :                         hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_16kHz[j];
     688         280 :                         hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_16kHz[j];
     689         280 :                         hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_16kHz[j];
     690             :                     }
     691             :                 }
     692             :                 else
     693             :                 {
     694           0 :                     return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" );
     695             :                 }
     696             :             }
     697             :             else
     698             :             {
     699           0 :                 return IVAS_ERROR( IVAS_ERR_INVALID_INPUT_FORMAT, "Encountered unsupported input config in Crend" );
     700             :             }
     701             :         }
     702             :         else
     703             :         {
     704           0 :             return IVAS_ERROR( IVAS_ERR_INTERNAL, "Unsupported renderer type in Crend" );
     705             :         }
     706             :     }
     707             :     else
     708             :     {
     709         853 :         if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED )
     710             :         {
     711         853 :             hHrtf->max_num_ir -= 1; /* subtract LFE */
     712         853 :             hHrtf->gain_lfe = GAIN_LFE;
     713             :         }
     714             : 
     715         853 :         if ( ext_rend_flag == 1 )
     716             :         {
     717           0 :             if ( hHrtfCrend == NULL )
     718             :             {
     719           0 :                 return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Invalid function parameters " );
     720             :             }
     721           0 :             hHrtf->latency_s = hHrtfCrend->latency_s;
     722           0 :             hHrtf->max_num_iterations = hHrtfCrend->max_num_iterations;
     723           0 :             hHrtf->index_frequency_max_diffuse = hHrtfCrend->index_frequency_max_diffuse;
     724             : 
     725           0 :             for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     726             :             {
     727           0 :                 hHrtf->num_iterations_diffuse[j] = hHrtfCrend->num_iterations_diffuse[j];
     728           0 :                 hHrtf->pIndex_frequency_max_diffuse[j] = hHrtfCrend->pIndex_frequency_max_diffuse[j];
     729           0 :                 hHrtf->pOut_to_bin_diffuse_re[j] = hHrtfCrend->pOut_to_bin_diffuse_re[j];
     730           0 :                 hHrtf->pOut_to_bin_diffuse_im[j] = hHrtfCrend->pOut_to_bin_diffuse_im[j];
     731             :             }
     732             :         }
     733             : 
     734         853 :         if ( inConfig == IVAS_AUDIO_CONFIG_7_1 && ext_rend_flag == 0 )
     735             :         {
     736             :             /* hack to enable pointers swapping - needed when indexes of 'channelIndex_CICPx[]' are not in increasing order */
     737         189 :             for ( i = 5; i < hHrtf->max_num_ir; i++ )
     738             :             {
     739         126 :                 tmp = channelIndex_CICP12[i];
     740         126 :                 tmp2 = channelIndex_CICP14[i];
     741             : 
     742         378 :                 for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     743             :                 {
     744         252 :                     hHrtf->inv_diffuse_weight[j][tmp2] = hHrtfCrend->inv_diffuse_weight[j][tmp];
     745         252 :                     hHrtf->num_iterations[tmp2][j] = hHrtfCrend->num_iterations[tmp][j];
     746         252 :                     hHrtf->pIndex_frequency_max[tmp2][j] = hHrtfCrend->pIndex_frequency_max[tmp][j];
     747         252 :                     hHrtf->pOut_to_bin_re[tmp2][j] = hHrtfCrend->pOut_to_bin_re[tmp][j];
     748         252 :                     hHrtf->pOut_to_bin_im[tmp2][j] = hHrtfCrend->pOut_to_bin_im[tmp][j];
     749             :                 }
     750             :             }
     751             :         }
     752             : 
     753        9180 :         for ( i = 0; i < hHrtf->max_num_ir; i++ )
     754             :         {
     755        8327 :             if ( inConfig == IVAS_AUDIO_CONFIG_5_1 )
     756             :             {
     757         360 :                 tmp = channelIndex_CICP6[i];
     758             :             }
     759        7967 :             else if ( inConfig == IVAS_AUDIO_CONFIG_7_1 )
     760             :             {
     761         441 :                 if ( ext_rend_flag == 0 )
     762             :                 {
     763         441 :                     tmp = channelIndex_CICP14[i];
     764             :                 }
     765             :                 else
     766             :                 {
     767           0 :                     tmp = channelIndex_CICP12[i];
     768             :                 }
     769             :             }
     770        7526 :             else if ( inConfig == IVAS_AUDIO_CONFIG_5_1_2 )
     771             :             {
     772         441 :                 tmp = channelIndex_CICP14[i];
     773             :             }
     774        7085 :             else if ( inConfig == IVAS_AUDIO_CONFIG_5_1_4 )
     775             :             {
     776         540 :                 tmp = channelIndex_CICP16[i];
     777             :             }
     778        6545 :             else if ( inConfig == IVAS_AUDIO_CONFIG_7_1_4 )
     779             :             {
     780        6545 :                 tmp = channelIndex_CICP19[i];
     781             :             }
     782           0 :             else if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS )
     783             :             {
     784           0 :                 tmp = i;
     785             :             }
     786             :             else
     787             :             {
     788           0 :                 return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Channel configuration not specified!\n\n" );
     789             :             }
     790             : 
     791       24981 :             for ( j = 0; j < BINAURAL_CHANNELS; j++ )
     792             :             {
     793       16654 :                 hHrtf->inv_diffuse_weight[j][i] = hHrtfCrend->inv_diffuse_weight[j][tmp];
     794       16654 :                 hHrtf->num_iterations[i][j] = hHrtfCrend->num_iterations[tmp][j];
     795             : 
     796       16654 :                 if ( ext_rend_flag == 0 )
     797             :                 {
     798             :                     /* in case of HRTF handle reuse, swap the pointers for correct deallocation at the exit */
     799             : #define WMC_TOOL_SKIP
     800       16654 :                     swap( hHrtf->pIndex_frequency_max[i][j], hHrtf->pIndex_frequency_max[tmp][j], const uint16_t * );
     801             :                     MOVE( 3 );
     802       16654 :                     swap( hHrtf->pOut_to_bin_re[i][j], hHrtf->pOut_to_bin_re[tmp][j], const float * );
     803             :                     MOVE( 3 );
     804       16654 :                     swap( hHrtf->pOut_to_bin_im[i][j], hHrtf->pOut_to_bin_im[tmp][j], const float * );
     805             :                     MOVE( 3 );
     806             : #undef WMC_TOOL_SKIP
     807             :                 }
     808             :                 else
     809             :                 {
     810           0 :                     hHrtf->pIndex_frequency_max[i][j] = hHrtfCrend->pIndex_frequency_max[tmp][j];
     811           0 :                     hHrtf->pOut_to_bin_re[i][j] = hHrtfCrend->pOut_to_bin_re[tmp][j];
     812           0 :                     hHrtf->pOut_to_bin_im[i][j] = hHrtfCrend->pOut_to_bin_im[tmp][j];
     813             :                 }
     814             :             }
     815             :         }
     816             :     }
     817             : 
     818        7694 :     hHrtf->same_inv_diffuse_weight = 1;
     819       82361 :     for ( i = 0; i < hHrtf->max_num_ir; i++ )
     820             :     {
     821       74667 :         if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
     822             :         {
     823       46948 :             if ( hHrtf->inv_diffuse_weight[0][i] != hHrtf->inv_diffuse_weight[1][i] )
     824             :             {
     825           0 :                 hHrtf->same_inv_diffuse_weight = 0;
     826           0 :                 break;
     827             :             }
     828             :         }
     829             :     }
     830             : 
     831        7694 :     pCrend->hHrtfCrend = hHrtf;
     832             : 
     833        7694 :     return IVAS_ERR_OK;
     834             : }
     835             : 
     836             : 
     837             : /*-------------------------------------------------------------------------
     838             :  * ivas_shoebox_data_init()
     839             :  *
     840             :  * Initialize shoebox_data_t handle
     841             :  *------------------------------------------------------------------------*/
     842             : 
     843         816 : static ivas_error ivas_shoebox_data_init(
     844             :     shoebox_data_t *hShoeboxData /* i/o: shoebox_data_t handle     */
     845             : )
     846             : {
     847             :     int16_t i;
     848             : 
     849         816 :     if ( hShoeboxData == NULL )
     850             :     {
     851           0 :         return IVAS_ERR_WRONG_PARAMS;
     852             :     }
     853             : 
     854      123216 :     for ( i = 0; i < 150; i++ )
     855             :     {
     856      122400 :         hShoeboxData->data[i] = 0.0f;
     857             :     }
     858        1632 :     for ( i = 0; i < 1; i++ )
     859             :     {
     860         816 :         hShoeboxData->size[i] = 0;
     861             :     }
     862             : 
     863         816 :     return IVAS_ERR_OK;
     864             : }
     865             : 
     866             : 
     867             : /*-------------------------------------------------------------------------
     868             :  * ivas_shoebox_output_init()
     869             :  *
     870             :  * Initialize shoebox_output_t handle
     871             :  *------------------------------------------------------------------------*/
     872             : 
     873         204 : static ivas_error ivas_shoebox_output_init(
     874             :     shoebox_output_t *hShoeboxOutput /* i/o: shoebox_output_t handle     */
     875             : )
     876             : {
     877             :     ivas_error error;
     878             : 
     879         204 :     if ( hShoeboxOutput == NULL )
     880             :     {
     881           0 :         return IVAS_ERR_WRONG_PARAMS;
     882             :     }
     883             : 
     884         204 :     hShoeboxOutput->n_sources = 0;
     885         204 :     hShoeboxOutput->n_ref = 0;
     886             : 
     887         204 :     if ( ( error = ivas_shoebox_data_init( &hShoeboxOutput->times ) ) != IVAS_ERR_OK )
     888             :     {
     889           0 :         return error;
     890             :     }
     891             : 
     892         204 :     if ( ( error = ivas_shoebox_data_init( &hShoeboxOutput->gains ) ) != IVAS_ERR_OK )
     893             :     {
     894           0 :         return error;
     895             :     }
     896             : 
     897         204 :     if ( ( error = ivas_shoebox_data_init( &hShoeboxOutput->az_angle ) ) != IVAS_ERR_OK )
     898             :     {
     899           0 :         return error;
     900             :     }
     901             : 
     902         204 :     if ( ( error = ivas_shoebox_data_init( &hShoeboxOutput->el_angle ) ) != IVAS_ERR_OK )
     903             :     {
     904           0 :         return error;
     905             :     }
     906             : 
     907         204 :     return IVAS_ERR_OK;
     908             : }
     909             : 
     910             : 
     911             : /*-------------------------------------------------------------------------
     912             :  * ivas_shoebox_config_init()
     913             :  *
     914             :  * Initialize shoebox_config_t handle
     915             :  *------------------------------------------------------------------------*/
     916             : 
     917         204 : static ivas_error ivas_shoebox_config_init_params(
     918             :     shoebox_config_t *hShoeboxConfig /* i/o: shoebox_config_t handle     */
     919             : )
     920             : {
     921             :     int16_t i;
     922             : 
     923         204 :     if ( hShoeboxConfig == NULL )
     924             :     {
     925           0 :         return IVAS_ERR_WRONG_PARAMS;
     926             :     }
     927             : 
     928         204 :     hShoeboxConfig->room_L = 0.0f;
     929         204 :     hShoeboxConfig->room_W = 0.0f;
     930         204 :     hShoeboxConfig->room_H = 0.0f;
     931             : 
     932        1428 :     for ( i = 0; i < IVAS_ROOM_ABS_COEFF; i++ )
     933             :     {
     934        1224 :         hShoeboxConfig->abs_coeff[i] = 0.0f;
     935             :     }
     936         816 :     for ( i = 0; i < 3; i++ )
     937             :     {
     938         612 :         hShoeboxConfig->list_orig[i] = 0.0f;
     939             :     }
     940             : 
     941         204 :     return IVAS_ERR_OK;
     942             : }
     943             : 
     944             : 
     945             : /*-------------------------------------------------------------------------
     946             :  * ivas_shoebox_obj_init()
     947             :  *
     948             :  * Initialize shoebox_obj_t handle
     949             :  *------------------------------------------------------------------------*/
     950             : 
     951         204 : static ivas_error ivas_shoebox_obj_init(
     952             :     shoebox_obj_t *hShoeboxObj /* i/o: shoebox_obj_t handle     */
     953             : )
     954             : {
     955             :     int16_t i;
     956             :     ivas_error error;
     957             : 
     958         204 :     if ( hShoeboxObj == NULL )
     959             :     {
     960           0 :         return IVAS_ERR_WRONG_PARAMS;
     961             :     }
     962             : 
     963         204 :     hShoeboxObj->isCartesian = 0;
     964         204 :     hShoeboxObj->isRelative = 0;
     965         204 :     hShoeboxObj->isZHeight = 0;
     966         204 :     hShoeboxObj->isRadians = 0;
     967         204 :     hShoeboxObj->MAX_SOURCES = 0;
     968         204 :     hShoeboxObj->max_bands = 0;
     969         204 :     hShoeboxObj->REF_ORDER = 0;
     970             : 
     971       15504 :     for ( i = 0; i < 75; i++ )
     972             :     {
     973       15300 :         hShoeboxObj->src_pos[i] = 0.0f;
     974             :     }
     975        5304 :     for ( i = 0; i < 25; i++ )
     976             :     {
     977        5100 :         hShoeboxObj->src_dist[i] = 0.0f;
     978             :     }
     979         816 :     for ( i = 0; i < 3; i++ )
     980             :     {
     981         612 :         hShoeboxObj->list_pos[i] = 0.0f;
     982             :     }
     983             : 
     984         204 :     hShoeboxObj->nSrc = 0;
     985         204 :     hShoeboxObj->radius = 0.0f;
     986         204 :     hShoeboxObj->min_wall_dist = 0.0f;
     987         204 :     hShoeboxObj->soundspeed = 0.0f;
     988         204 :     hShoeboxObj->air_coeff = 0.0f;
     989             : 
     990         204 :     if ( ( error = ivas_shoebox_config_init_params( &hShoeboxObj->cal ) ) != IVAS_ERR_OK )
     991             :     {
     992           0 :         return error;
     993             :     }
     994             : 
     995         204 :     return IVAS_ERR_OK;
     996             : }
     997             : 
     998             : 
     999             : /*-------------------------------------------------------------------------
    1000             :  * ivas_er_init_handle()
    1001             :  *
    1002             :  * Initialize early reflections handle
    1003             :  *------------------------------------------------------------------------*/
    1004             : 
    1005         204 : static ivas_error ivas_er_init_handle(
    1006             :     er_struct_t *reflections /* i/o: early reflections handle     */
    1007             : )
    1008             : {
    1009             :     int16_t i;
    1010             :     ivas_error error;
    1011             : 
    1012         204 :     if ( reflections == NULL )
    1013             :     {
    1014           0 :         return IVAS_ERR_WRONG_PARAMS;
    1015             :     }
    1016             : 
    1017         204 :     reflections->audio_config = IVAS_AUDIO_CONFIG_INVALID;
    1018         204 :     reflections->use_er = 0;
    1019         204 :     reflections->is_ready = 0;
    1020         204 :     reflections->circ_len = 0;
    1021         204 :     reflections->circ_insert = 0;
    1022         204 :     reflections->n_total_reflections = 0;
    1023         204 :     reflections->is_cartesian = 0;
    1024         204 :     reflections->is_relative = 0;
    1025         204 :     reflections->max_frame_size = 0;
    1026         204 :     reflections->output_Fs = 0.0f;
    1027             : 
    1028       15504 :     for ( i = 0; i < 75; i++ )
    1029             :     {
    1030       15300 :         reflections->source_positions[i] = 0.0f;
    1031             :     }
    1032         816 :     for ( i = 0; i < 3; i++ )
    1033             :     {
    1034         612 :         reflections->user_origin[i] = 0.0f;
    1035         612 :         if ( i == 2 )
    1036             :         {
    1037         204 :             reflections->user_origin[i] = ER_LIST_HEIGHT;
    1038             :         }
    1039             :     }
    1040             : 
    1041         204 :     reflections->circ_buffers = NULL;
    1042         204 :     reflections->closest_ch_idx = NULL;
    1043             : 
    1044         204 :     if ( ( error = ivas_shoebox_output_init( &reflections->shoebox_data ) ) != IVAS_ERR_OK )
    1045             :     {
    1046           0 :         return error;
    1047             :     }
    1048             : 
    1049         204 :     if ( ( error = ivas_shoebox_obj_init( &reflections->shoebox_lib ) ) != IVAS_ERR_OK )
    1050             :     {
    1051           0 :         return error;
    1052             :     }
    1053             : 
    1054         204 :     return IVAS_ERR_OK;
    1055             : }
    1056             : 
    1057             : 
    1058             : /*-------------------------------------------------------------------------
    1059             :  * ivas_rend_initCrendWrapper()
    1060             :  *
    1061             :  * Allocate and initialize crend renderer handle
    1062             :  *------------------------------------------------------------------------*/
    1063             : 
    1064        7694 : ivas_error ivas_rend_initCrendWrapper(
    1065             :     CREND_WRAPPER_HANDLE *pCrend,
    1066             :     const int16_t num_poses )
    1067             : {
    1068             :     int16_t i;
    1069             :     CREND_HANDLE hCrend;
    1070             :     int16_t pos_idx;
    1071             : 
    1072        7694 :     if ( pCrend == NULL )
    1073             :     {
    1074           0 :         return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer handle" );
    1075             :     }
    1076             : 
    1077        7694 :     if ( ( *pCrend = (CREND_WRAPPER_HANDLE) malloc( sizeof( CREND_WRAPPER ) ) ) == NULL )
    1078             :     {
    1079           0 :         return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" );
    1080             :     }
    1081             : 
    1082        7694 :     ( *pCrend )->binaural_latency_ns = 0;
    1083        7694 :     ( *pCrend )->hHrtfCrend = NULL;
    1084             : 
    1085       69246 :     for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ )
    1086             :     {
    1087       61552 :         ( *pCrend )->hCrend[pos_idx] = NULL;
    1088             :     }
    1089             : 
    1090       16312 :     for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
    1091             :     {
    1092        8618 :         hCrend = NULL;
    1093        8618 :         if ( ( hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL )
    1094             :         {
    1095           0 :             return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer handle" );
    1096             :         }
    1097             : 
    1098        8618 :         hCrend->lfe_delay_line = NULL;
    1099             : 
    1100      146506 :         for ( i = 0; i < MAX_INTERN_CHANNELS; i++ )
    1101             :         {
    1102      137888 :             hCrend->freq_buffer_re[i] = NULL;
    1103      137888 :             hCrend->freq_buffer_im[i] = NULL;
    1104             :         }
    1105             : 
    1106       25854 :         for ( i = 0; i < BINAURAL_CHANNELS; i++ )
    1107             :         {
    1108       17236 :             hCrend->prev_out_buffer[i] = NULL;
    1109             :         }
    1110             : 
    1111        8618 :         hCrend->freq_buffer_re_diffuse[0] = NULL;
    1112        8618 :         hCrend->freq_buffer_re_diffuse[1] = NULL;
    1113        8618 :         hCrend->freq_buffer_im_diffuse[0] = NULL;
    1114        8618 :         hCrend->freq_buffer_im_diffuse[1] = NULL;
    1115        8618 :         hCrend->hReverb = NULL;
    1116        8618 :         hCrend->reflections = NULL;
    1117        8618 :         hCrend->delay_line_rw_index = 0;
    1118        8618 :         hCrend->diffuse_delay_line_rw_index = 0;
    1119        8618 :         hCrend->hTrack = NULL;
    1120        8618 :         hCrend->m_fYaw = 0;
    1121        8618 :         hCrend->m_fPitch = 0;
    1122        8618 :         hCrend->m_fRoll = 0;
    1123             : 
    1124        8618 :         ( *pCrend )->hCrend[pos_idx] = hCrend;
    1125             :     }
    1126             : 
    1127        7694 :     return IVAS_ERR_OK;
    1128             : }
    1129             : 
    1130             : 
    1131             : /*-------------------------------------------------------------------------
    1132             :  * ivas_rend_openMultiBinCrend()
    1133             :  *
    1134             :  * Allocate and initialize crend renderer handle
    1135             :  *------------------------------------------------------------------------*/
    1136             : 
    1137         170 : ivas_error ivas_rend_openMultiBinCrend(
    1138             :     CREND_WRAPPER_HANDLE *pCrend,
    1139             :     const AUDIO_CONFIG inConfig,
    1140             :     const AUDIO_CONFIG outConfig,
    1141             :     const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
    1142             :     const int32_t output_Fs )
    1143             : {
    1144         170 :     return ivas_rend_openCrend( pCrend, inConfig, outConfig, NULL /*hRendCfg*/, NULL, NULL /* hHrtfStatistics */, output_Fs, 0, pMultiBinPoseData->num_poses );
    1145             : }
    1146             : 
    1147             : 
    1148             : /*-------------------------------------------------------------------------
    1149             :  * ivas_rend_openCrend()
    1150             :  *
    1151             :  * Allocate and initialize crend renderer handle
    1152             :  *------------------------------------------------------------------------*/
    1153             : 
    1154        7694 : ivas_error ivas_rend_openCrend(
    1155             :     CREND_WRAPPER_HANDLE *pCrend,
    1156             :     const AUDIO_CONFIG inConfig,
    1157             :     const AUDIO_CONFIG outConfig,
    1158             :     RENDER_CONFIG_DATA *hRendCfg,
    1159             :     HRTFS_CREND_HANDLE hHrtfCrend,
    1160             :     HRTFS_STATISTICS_HANDLE hHrtfStatistics,
    1161             :     const int32_t output_Fs,
    1162             :     const int16_t ext_rend_flag,
    1163             :     const int16_t num_poses )
    1164             : {
    1165             :     int16_t i, subframe_length;
    1166             :     int32_t max_total_ir_len;
    1167             :     HRTFS_CREND_HANDLE hHrtf;
    1168             :     CREND_HANDLE hCrend;
    1169             :     ivas_error error;
    1170             :     int16_t pos_idx;
    1171             : 
    1172        7694 :     if ( ( error = ivas_rend_initCrendWrapper( pCrend, num_poses ) ) != IVAS_ERR_OK )
    1173             :     {
    1174           0 :         return error;
    1175             :     }
    1176             : 
    1177        7694 :     subframe_length = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES;
    1178             : 
    1179        7694 :     if ( ( *pCrend )->hHrtfCrend == NULL )
    1180             :     {
    1181        7694 :         if ( ( error = ivas_rend_initCrend( *pCrend, inConfig, outConfig, hHrtfCrend, ext_rend_flag, output_Fs ) ) != IVAS_ERR_OK )
    1182             :         {
    1183           0 :             return error;
    1184             :         }
    1185             :     }
    1186             : 
    1187       16312 :     for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
    1188             :     {
    1189        8618 :         hCrend = ( *pCrend )->hCrend[pos_idx];
    1190        8618 :         hHrtf = ( *pCrend )->hHrtfCrend;
    1191             : 
    1192        8618 :         if ( hHrtf != NULL )
    1193             :         {
    1194        8618 :             max_total_ir_len = hHrtf->max_num_iterations * subframe_length;
    1195             : 
    1196       94909 :             for ( i = 0; i < hHrtf->max_num_ir; i++ )
    1197             :             {
    1198       86291 :                 if ( ( hCrend->freq_buffer_re[i] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
    1199             :                 {
    1200           0 :                     return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
    1201             :                 }
    1202       86291 :                 set_zero_l( hCrend->freq_buffer_re[i], max_total_ir_len );
    1203             : 
    1204       86291 :                 if ( ( hCrend->freq_buffer_im[i] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
    1205             :                 {
    1206           0 :                     return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
    1207             :                 }
    1208       86291 :                 set_zero_l( hCrend->freq_buffer_im[i], max_total_ir_len );
    1209             :             }
    1210             : 
    1211       25854 :             for ( i = 0; i < BINAURAL_CHANNELS; i++ )
    1212             :             {
    1213       17236 :                 if ( ( hCrend->prev_out_buffer[i] = (float *) malloc( sizeof( float ) * subframe_length ) ) == NULL )
    1214             :                 {
    1215           0 :                     return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
    1216             :                 }
    1217       17236 :                 set_zero_l( hCrend->prev_out_buffer[i], subframe_length );
    1218             :             }
    1219             : 
    1220        8618 :             max_total_ir_len = hHrtf->num_iterations_diffuse[0] * subframe_length;
    1221             : 
    1222        8618 :             if ( max_total_ir_len > 0 )
    1223             :             {
    1224        4512 :                 if ( ( hCrend->freq_buffer_re_diffuse[0] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
    1225             :                 {
    1226           0 :                     return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
    1227             :                 }
    1228        4512 :                 if ( hHrtf->same_inv_diffuse_weight == 0 )
    1229             :                 {
    1230           0 :                     if ( ( hCrend->freq_buffer_re_diffuse[1] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
    1231             :                     {
    1232           0 :                         return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
    1233             :                     }
    1234             :                 }
    1235             :                 else
    1236             :                 {
    1237        4512 :                     hCrend->freq_buffer_re_diffuse[1] = NULL;
    1238             :                 }
    1239        4512 :                 set_zero_l( hCrend->freq_buffer_re_diffuse[0], max_total_ir_len );
    1240        4512 :                 if ( hCrend->freq_buffer_re_diffuse[1] != NULL )
    1241             :                 {
    1242           0 :                     set_zero_l( hCrend->freq_buffer_re_diffuse[1], max_total_ir_len );
    1243             :                 }
    1244             : 
    1245        4512 :                 if ( ( hCrend->freq_buffer_im_diffuse[0] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
    1246             :                 {
    1247           0 :                     return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
    1248             :                 }
    1249        4512 :                 if ( hHrtf->same_inv_diffuse_weight == 0 )
    1250             :                 {
    1251           0 :                     if ( ( hCrend->freq_buffer_im_diffuse[1] = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
    1252             :                     {
    1253           0 :                         return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
    1254             :                     }
    1255             :                 }
    1256             :                 else
    1257             :                 {
    1258        4512 :                     hCrend->freq_buffer_im_diffuse[1] = NULL;
    1259             :                 }
    1260        4512 :                 set_zero_l( hCrend->freq_buffer_im_diffuse[0], max_total_ir_len );
    1261        4512 :                 if ( hCrend->freq_buffer_im_diffuse[1] != NULL )
    1262             :                 {
    1263           0 :                     set_zero_l( hCrend->freq_buffer_im_diffuse[1], max_total_ir_len );
    1264             :                 }
    1265             :             }
    1266             :             else
    1267             :             {
    1268        4106 :                 hCrend->freq_buffer_re_diffuse[0] = NULL;
    1269        4106 :                 hCrend->freq_buffer_im_diffuse[0] = NULL;
    1270        4106 :                 hCrend->freq_buffer_re_diffuse[1] = NULL;
    1271        4106 :                 hCrend->freq_buffer_im_diffuse[1] = NULL;
    1272             :             }
    1273        8618 :             max_total_ir_len = (int32_t) ( hHrtf->latency_s * output_Fs + 0.5f ) + subframe_length;
    1274        8618 :             if ( max_total_ir_len > 0 )
    1275             :             {
    1276        8618 :                 if ( ( hCrend->lfe_delay_line = (float *) malloc( sizeof( float ) * max_total_ir_len ) ) == NULL )
    1277             :                 {
    1278           0 :                     return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend" );
    1279             :                 }
    1280        8618 :                 set_zero_l( hCrend->lfe_delay_line, max_total_ir_len );
    1281             :             }
    1282             :             else
    1283             :             {
    1284           0 :                 hCrend->lfe_delay_line = NULL;
    1285             :             }
    1286             : 
    1287        8618 :             if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
    1288             :             {
    1289        1808 :                 if ( ( error = ivas_reverb_open( &( hCrend->hReverb ), hHrtfStatistics, hRendCfg, output_Fs ) ) != IVAS_ERR_OK )
    1290             :                 {
    1291           0 :                     return error;
    1292             :                 }
    1293             : 
    1294        1808 :                 if ( hRendCfg->roomAcoustics.use_er == 1 )
    1295             :                 {
    1296             : 
    1297             :                     /* Allocate memory for reflections */
    1298         204 :                     hCrend->reflections = (er_struct_t *) malloc( sizeof( er_struct_t ) );
    1299         204 :                     if ( !hCrend->reflections )
    1300             :                     {
    1301           0 :                         return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Early Reflections" );
    1302             :                     }
    1303         204 :                     if ( ( error = ivas_er_init_handle( hCrend->reflections ) ) != IVAS_ERR_OK )
    1304             :                     {
    1305           0 :                         return error;
    1306             :                     }
    1307             : 
    1308         204 :                     hCrend->reflections->use_er = hRendCfg->roomAcoustics.use_er;
    1309         204 :                     hCrend->reflections->lowComplexity = hRendCfg->roomAcoustics.lowComplexity;
    1310             : 
    1311             :                     /* Set sample rate and frame size */
    1312         204 :                     hCrend->reflections->output_Fs = (float) output_Fs;
    1313         204 :                     hCrend->reflections->max_frame_size = (int16_t) ( output_Fs / FRAMES_PER_SEC );
    1314             : 
    1315             :                     /* Init Shoebox */
    1316         204 :                     ivas_shoebox_config_init( &hCrend->reflections->shoebox_lib.cal, hRendCfg );
    1317             : 
    1318             :                     /* Init and compute Reflections */
    1319         204 :                     if ( ( error = ivas_er_init( hCrend->reflections, inConfig ) ) != IVAS_ERR_OK )
    1320             :                     {
    1321           0 :                         return error;
    1322             :                     }
    1323             :                 }
    1324             :                 else
    1325             :                 {
    1326        1604 :                     hCrend->reflections = NULL;
    1327             :                 }
    1328             :             }
    1329             :             else
    1330             :             {
    1331        6810 :                 hCrend->hReverb = NULL;
    1332             :             }
    1333             : 
    1334        8618 :             ( *pCrend )->binaural_latency_ns = (int32_t) ( ( *pCrend )->hHrtfCrend->latency_s * 1000000000.f );
    1335             :         }
    1336             : 
    1337        8618 :         ( *pCrend )->hCrend[pos_idx] = hCrend;
    1338             :     }
    1339             : 
    1340        7694 :     return IVAS_ERR_OK;
    1341             : }
    1342             : 
    1343             : 
    1344             : /*-------------------------------------------------------------------------
    1345             :  * ivas_rend_closeCrend()
    1346             :  *
    1347             :  * Deallocate Crend renderer handle
    1348             :  *------------------------------------------------------------------------*/
    1349             : 
    1350      328195 : void ivas_rend_closeCrend(
    1351             :     CREND_WRAPPER_HANDLE *pCrend )
    1352             : {
    1353             :     int16_t i;
    1354             :     int16_t pos_idx;
    1355             :     CREND_HANDLE hCrend;
    1356             : 
    1357      328195 :     if ( pCrend == NULL || *pCrend == NULL )
    1358             :     {
    1359      320501 :         return;
    1360             :     }
    1361             : 
    1362        7694 :     if ( ( *pCrend )->hHrtfCrend != NULL && ( *pCrend )->hHrtfCrend->init_from_rom )
    1363             :     {
    1364        6841 :         ivas_hrtf_close( &( *pCrend )->hHrtfCrend );
    1365             :     }
    1366             : 
    1367       69246 :     for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ )
    1368             :     {
    1369       61552 :         hCrend = ( *pCrend )->hCrend[pos_idx];
    1370       61552 :         if ( hCrend != NULL )
    1371             :         {
    1372      146506 :             for ( i = 0; i < MAX_INTERN_CHANNELS; i++ )
    1373             :             {
    1374      137888 :                 if ( hCrend->freq_buffer_re[i] != NULL )
    1375             :                 {
    1376       86291 :                     free( hCrend->freq_buffer_re[i] );
    1377       86291 :                     hCrend->freq_buffer_re[i] = NULL;
    1378             :                 }
    1379      137888 :                 if ( hCrend->freq_buffer_im[i] != NULL )
    1380             :                 {
    1381       86291 :                     free( hCrend->freq_buffer_im[i] );
    1382       86291 :                     hCrend->freq_buffer_im[i] = NULL;
    1383             :                 }
    1384             :             }
    1385             : 
    1386       25854 :             for ( i = 0; i < BINAURAL_CHANNELS; i++ )
    1387             :             {
    1388       17236 :                 if ( hCrend->prev_out_buffer[i] != NULL )
    1389             :                 {
    1390       17236 :                     free( hCrend->prev_out_buffer[i] );
    1391       17236 :                     hCrend->prev_out_buffer[i] = NULL;
    1392             :                 }
    1393             :             }
    1394             : 
    1395        8618 :             if ( hCrend->lfe_delay_line != NULL )
    1396             :             {
    1397        8618 :                 free( hCrend->lfe_delay_line );
    1398        8618 :                 hCrend->lfe_delay_line = NULL;
    1399             :             }
    1400        8618 :             if ( hCrend->freq_buffer_re_diffuse[0] != NULL )
    1401             :             {
    1402        4512 :                 free( hCrend->freq_buffer_re_diffuse[0] );
    1403        4512 :                 hCrend->freq_buffer_re_diffuse[0] = NULL;
    1404             :             }
    1405             : 
    1406        8618 :             if ( hCrend->freq_buffer_im_diffuse[0] != NULL )
    1407             :             {
    1408        4512 :                 free( hCrend->freq_buffer_im_diffuse[0] );
    1409        4512 :                 hCrend->freq_buffer_im_diffuse[0] = NULL;
    1410             :             }
    1411             : 
    1412        8618 :             if ( hCrend->freq_buffer_re_diffuse[1] != NULL )
    1413             :             {
    1414           0 :                 free( hCrend->freq_buffer_re_diffuse[1] );
    1415           0 :                 hCrend->freq_buffer_re_diffuse[1] = NULL;
    1416             :             }
    1417             : 
    1418        8618 :             if ( hCrend->freq_buffer_im_diffuse[1] != NULL )
    1419             :             {
    1420           0 :                 free( hCrend->freq_buffer_im_diffuse[1] );
    1421           0 :                 hCrend->freq_buffer_im_diffuse[1] = NULL;
    1422             :             }
    1423             : 
    1424        8618 :             if ( hCrend->hTrack != NULL )
    1425             :             {
    1426           0 :                 free( hCrend->hTrack );
    1427           0 :                 hCrend->hTrack = NULL;
    1428             :             }
    1429             : 
    1430        8618 :             ivas_reverb_close( &hCrend->hReverb );
    1431             : 
    1432        8618 :             if ( hCrend->reflections != NULL )
    1433             :             {
    1434         204 :                 if ( hCrend->reflections->closest_ch_idx != NULL )
    1435             :                 {
    1436         204 :                     free( hCrend->reflections->closest_ch_idx );
    1437         204 :                     hCrend->reflections->closest_ch_idx = NULL;
    1438             :                 }
    1439             : 
    1440         204 :                 if ( hCrend->reflections->circ_buffers != NULL )
    1441             :                 {
    1442         204 :                     free( hCrend->reflections->circ_buffers );
    1443         204 :                     hCrend->reflections->circ_buffers = NULL;
    1444             :                 }
    1445             : 
    1446         204 :                 free( hCrend->reflections );
    1447         204 :                 hCrend->reflections = NULL;
    1448             :             }
    1449             : 
    1450        8618 :             free( hCrend );
    1451        8618 :             hCrend = NULL;
    1452        8618 :             ( *pCrend )->hCrend[pos_idx] = hCrend;
    1453             :         }
    1454             :     }
    1455             : 
    1456        7694 :     free( *pCrend );
    1457        7694 :     *pCrend = NULL;
    1458             : 
    1459        7694 :     return;
    1460             : }
    1461             : 
    1462             : 
    1463             : /*-------------------------------------------------------------------------
    1464             :  * ivas_rend_closeCldfbRend()
    1465             :  *
    1466             :  * Close CLDFB based fastconv binaural renderer memories
    1467             :  *------------------------------------------------------------------------*/
    1468             : 
    1469           8 : void ivas_rend_closeCldfbRend(
    1470             :     CLDFB_REND_WRAPPER *pCldfbRend )
    1471             : {
    1472           8 :     if ( pCldfbRend->hCldfbRend->hInputSetup != NULL )
    1473             :     {
    1474           8 :         free( pCldfbRend->hCldfbRend->hInputSetup );
    1475           8 :         pCldfbRend->hCldfbRend->hInputSetup = NULL;
    1476             :     }
    1477             : 
    1478           8 :     ivas_binRenderer_close( &pCldfbRend->hCldfbRend );
    1479             : 
    1480           8 :     ivas_HRTF_fastconv_binary_close( &pCldfbRend->hHrtfFastConv );
    1481             : 
    1482           8 :     return;
    1483             : }
    1484             : 
    1485             : 
    1486             : /*-----------------------------------------------------------------------------------------*
    1487             :  * Function ivas_rend_crendConvolver()
    1488             :  *
    1489             :  * Convolver block
    1490             :  *-----------------------------------------------------------------------------------------*/
    1491             : 
    1492     7932254 : static ivas_error ivas_rend_crendConvolver(
    1493             :     const CREND_WRAPPER *pCrend,
    1494             :     AUDIO_CONFIG inConfig,
    1495             :     AUDIO_CONFIG outConfig,
    1496             :     float *pcm_in[],
    1497             :     float *pcm_out[],
    1498             :     const int32_t output_Fs,
    1499             :     const int16_t i_ts,
    1500             :     const int16_t pos_idx )
    1501             : {
    1502             :     int16_t i, j, k, m;
    1503             :     int16_t subframe_length, idx_in;
    1504             :     int16_t lfe_idx_in;
    1505             :     int32_t offset, offset_in, offset_diffuse;
    1506             :     int16_t nchan_in, nchan_out;
    1507             :     const float *pIn;
    1508             :     const float *pFreq_filt_re, *pFreq_filt_im;
    1509     7932254 :     float *pFreq_buf_re = NULL, *pFreq_buf_im = NULL;
    1510     7932254 :     float *pFreq_buf2_re = NULL, *pFreq_buf2_im = NULL;
    1511             :     float pOut[2 /*Re,Im*/ * L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES];
    1512             :     float tmp_out_re[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES], tmp_out_im[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES];
    1513             :     CREND_HANDLE hCrend;
    1514             :     ivas_error error;
    1515             : 
    1516     7932254 :     hCrend = pCrend->hCrend[pos_idx];
    1517             : 
    1518     7932254 :     if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK )
    1519             :     {
    1520           0 :         return error;
    1521             :     }
    1522             : 
    1523     7932254 :     if ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK )
    1524             :     {
    1525           0 :         return error;
    1526             :     }
    1527             : 
    1528     7932254 :     subframe_length = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES;
    1529             : 
    1530     7932254 :     lfe_idx_in = -1;
    1531     7932254 :     if ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED )
    1532             :     {
    1533     4631339 :         if ( inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM )
    1534             :         {
    1535     4631339 :             lfe_idx_in = LFE_CHANNEL;
    1536             :         }
    1537             :         else
    1538             :         {
    1539           0 :             assert( 0 && "Custom LS not supported in CRend" );
    1540             :         }
    1541             :     }
    1542             : 
    1543     7932254 :     offset = hCrend->delay_line_rw_index * subframe_length;                 /* subframe_length * ( pCrend->hHrtfCrend->max_num_iterations - 1 ); */
    1544     7932254 :     offset_diffuse = hCrend->diffuse_delay_line_rw_index * subframe_length; /* subframe_length *( pCrend->hHrtfCrend->num_iterations_diffuse[0] - 1 ); */
    1545             : 
    1546     7932254 :     if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 )
    1547             :     {
    1548     4031915 :         set_zero( &hCrend->freq_buffer_re_diffuse[0][offset_diffuse], subframe_length );
    1549     4031915 :         set_zero( &hCrend->freq_buffer_im_diffuse[0][offset_diffuse], subframe_length );
    1550     4031915 :         if ( pCrend->hHrtfCrend->same_inv_diffuse_weight == 0 )
    1551             :         {
    1552           0 :             set_zero( &hCrend->freq_buffer_re_diffuse[1][offset_diffuse], subframe_length );
    1553           0 :             set_zero( &hCrend->freq_buffer_im_diffuse[1][offset_diffuse], subframe_length );
    1554             :         }
    1555             :     }
    1556             : 
    1557     7932254 :     if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 )
    1558             :     {
    1559     4031915 :         if ( pCrend->hHrtfCrend->same_inv_diffuse_weight )
    1560             :         {
    1561     4031915 :             pFreq_buf_re = &hCrend->freq_buffer_re_diffuse[0][offset_diffuse];
    1562     4031915 :             pFreq_buf_im = &hCrend->freq_buffer_im_diffuse[0][offset_diffuse];
    1563             :         }
    1564             :         else
    1565             :         {
    1566           0 :             pFreq_buf_re = &hCrend->freq_buffer_re_diffuse[0][offset_diffuse];
    1567           0 :             pFreq_buf_im = &hCrend->freq_buffer_im_diffuse[0][offset_diffuse];
    1568           0 :             pFreq_buf2_re = &hCrend->freq_buffer_re_diffuse[1][offset_diffuse];
    1569           0 :             pFreq_buf2_im = &hCrend->freq_buffer_im_diffuse[1][offset_diffuse];
    1570             :         }
    1571             :     }
    1572             : 
    1573     7932254 :     i = 0;
    1574    94103561 :     for ( idx_in = 0; idx_in < nchan_in; idx_in++ )
    1575             :     {
    1576    86171307 :         pIn = &pcm_in[idx_in][i_ts * subframe_length];
    1577    86171307 :         if ( idx_in != lfe_idx_in )
    1578             :         {
    1579    81539968 :             if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 )
    1580             :             {
    1581    43340441 :                 if ( pCrend->hHrtfCrend->same_inv_diffuse_weight )
    1582             :                 {
    1583    43340441 :                     pFreq_filt_re = &hCrend->freq_buffer_re[i][offset];
    1584    43340441 :                     pFreq_filt_im = &hCrend->freq_buffer_im[i][offset];
    1585             : 
    1586  3985905274 :                     for ( k = 0; k < pCrend->hHrtfCrend->index_frequency_max_diffuse; k++ )
    1587             :                     {
    1588  3942564833 :                         pFreq_buf_re[k] += pFreq_filt_re[k] * pCrend->hHrtfCrend->inv_diffuse_weight[0][i];
    1589  3942564833 :                         pFreq_buf_im[k] += pFreq_filt_im[k] * pCrend->hHrtfCrend->inv_diffuse_weight[0][i];
    1590             :                     }
    1591             :                 }
    1592             :                 else
    1593             :                 {
    1594           0 :                     pFreq_filt_re = &hCrend->freq_buffer_re[i][offset];
    1595           0 :                     pFreq_filt_im = &hCrend->freq_buffer_im[i][offset];
    1596             : 
    1597           0 :                     for ( k = 0; k < pCrend->hHrtfCrend->index_frequency_max_diffuse; k++ )
    1598             :                     {
    1599           0 :                         pFreq_buf_re[k] += pFreq_filt_re[k] * pCrend->hHrtfCrend->inv_diffuse_weight[0][i];
    1600           0 :                         pFreq_buf_im[k] += pFreq_filt_im[k] * pCrend->hHrtfCrend->inv_diffuse_weight[0][i];
    1601           0 :                         pFreq_buf2_re[k] += pFreq_filt_re[k] * pCrend->hHrtfCrend->inv_diffuse_weight[1][i];
    1602           0 :                         pFreq_buf2_im[k] += pFreq_filt_im[k] * pCrend->hHrtfCrend->inv_diffuse_weight[1][i];
    1603             :                     }
    1604             :                 }
    1605             :             }
    1606             : 
    1607    81539968 :             ivas_mdft( pIn, &hCrend->freq_buffer_re[i][offset], &hCrend->freq_buffer_im[i][offset], subframe_length, subframe_length );
    1608    81539968 :             i++;
    1609             :         }
    1610             :     }
    1611             : 
    1612    23796762 :     for ( j = 0; j < nchan_out; j++ )
    1613             :     {
    1614    15864508 :         set_zero( tmp_out_re, subframe_length );
    1615    15864508 :         set_zero( tmp_out_im, subframe_length );
    1616             : 
    1617    15864508 :         i = 0;
    1618   188207122 :         for ( idx_in = 0; idx_in < nchan_in; idx_in++ )
    1619             :         {
    1620   172342614 :             if ( idx_in != lfe_idx_in )
    1621             :             {
    1622   163079936 :                 offset = 0;
    1623  2174160194 :                 for ( m = 0; m < pCrend->hHrtfCrend->num_iterations[i][j]; m++ )
    1624             :                 {
    1625  2011080258 :                     offset_in = ( hCrend->delay_line_rw_index + pCrend->hHrtfCrend->max_num_iterations - pCrend->hHrtfCrend->num_iterations[i][j] + m + 1 );
    1626  2011080258 :                     offset_in = offset_in % ( pCrend->hHrtfCrend->max_num_iterations );
    1627  2011080258 :                     offset_in = offset_in * subframe_length;
    1628  2011080258 :                     pFreq_buf_re = &hCrend->freq_buffer_re[i][offset_in];
    1629  2011080258 :                     pFreq_buf_im = &hCrend->freq_buffer_im[i][offset_in];
    1630  2011080258 :                     pFreq_filt_re = &pCrend->hHrtfCrend->pOut_to_bin_re[i][j][offset];
    1631  2011080258 :                     pFreq_filt_im = &pCrend->hHrtfCrend->pOut_to_bin_im[i][j][offset];
    1632             : 
    1633 >23180*10^7 :                     for ( k = 0; k < pCrend->hHrtfCrend->pIndex_frequency_max[i][j][m]; k++ )
    1634             :                     {
    1635 >22979*10^7 :                         tmp_out_re[k] += pFreq_buf_re[k] * pFreq_filt_re[k] - pFreq_buf_im[k] * pFreq_filt_im[k];
    1636 >22979*10^7 :                         tmp_out_im[k] += pFreq_buf_re[k] * pFreq_filt_im[k] + pFreq_buf_im[k] * pFreq_filt_re[k];
    1637             :                     }
    1638  2011080258 :                     offset = offset + k;
    1639             :                 }
    1640   163079936 :                 i++;
    1641             :             }
    1642             :         }
    1643             : 
    1644    15864508 :         offset = 0;
    1645   338417708 :         for ( m = 0; m < pCrend->hHrtfCrend->num_iterations_diffuse[j]; m++ )
    1646             :         {
    1647   322553200 :             offset_diffuse = ( hCrend->diffuse_delay_line_rw_index + m + 1 );
    1648   322553200 :             offset_diffuse = offset_diffuse % pCrend->hHrtfCrend->num_iterations_diffuse[0];
    1649   322553200 :             offset_diffuse = offset_diffuse * subframe_length;
    1650   322553200 :             if ( pCrend->hHrtfCrend->same_inv_diffuse_weight )
    1651             :             {
    1652   322553200 :                 pFreq_buf_re = &hCrend->freq_buffer_re_diffuse[0][offset_diffuse];
    1653   322553200 :                 pFreq_buf_im = &hCrend->freq_buffer_im_diffuse[0][offset_diffuse];
    1654             :             }
    1655             :             else
    1656             :             {
    1657           0 :                 pFreq_buf_re = &hCrend->freq_buffer_re_diffuse[j][offset_diffuse];
    1658           0 :                 pFreq_buf_im = &hCrend->freq_buffer_im_diffuse[j][offset_diffuse];
    1659             :             }
    1660   322553200 :             pFreq_filt_re = &pCrend->hHrtfCrend->pOut_to_bin_diffuse_re[j][offset];
    1661   322553200 :             pFreq_filt_im = &pCrend->hHrtfCrend->pOut_to_bin_diffuse_im[j][offset];
    1662             : 
    1663 22492474216 :             for ( k = 0; k < pCrend->hHrtfCrend->pIndex_frequency_max_diffuse[j][m]; k++ )
    1664             :             {
    1665 22169921016 :                 tmp_out_re[k] += pFreq_buf_re[k] * pFreq_filt_re[k] - pFreq_buf_im[k] * pFreq_filt_im[k];
    1666 22169921016 :                 tmp_out_im[k] += pFreq_buf_re[k] * pFreq_filt_im[k] + pFreq_buf_im[k] * pFreq_filt_re[k];
    1667             :             }
    1668   322553200 :             offset = offset + k;
    1669             :         }
    1670             : 
    1671    15864508 :         ivas_imdft( tmp_out_re, tmp_out_im, pOut, subframe_length );
    1672             : 
    1673    15864508 :         pFreq_buf_re = &pcm_out[j][i_ts * subframe_length];
    1674  2704159228 :         for ( k = 0; k < subframe_length; k++ )
    1675             :         {
    1676  2688294720 :             pFreq_buf_re[k] = pOut[k] + hCrend->prev_out_buffer[j][k];
    1677  2688294720 :             hCrend->prev_out_buffer[j][k] = pOut[k + subframe_length];
    1678             :         }
    1679             :     }
    1680             : 
    1681     7932254 :     hCrend->delay_line_rw_index++;
    1682     7932254 :     hCrend->delay_line_rw_index = hCrend->delay_line_rw_index % ( pCrend->hHrtfCrend->max_num_iterations );
    1683     7932254 :     if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 )
    1684             :     {
    1685     4031915 :         hCrend->diffuse_delay_line_rw_index++;
    1686     4031915 :         hCrend->diffuse_delay_line_rw_index = hCrend->diffuse_delay_line_rw_index % ( pCrend->hHrtfCrend->num_iterations_diffuse[0] );
    1687             :     }
    1688             : 
    1689     7932254 :     return IVAS_ERR_OK;
    1690             : }
    1691             : 
    1692             : 
    1693             : /*-----------------------------------------------------------------------------------------*
    1694             :  * Function ivas_rend_crendProcessSubframe()
    1695             :  *
    1696             :  *
    1697             :  *-----------------------------------------------------------------------------------------*/
    1698             : 
    1699     4545084 : ivas_error ivas_rend_crendProcessSubframe(
    1700             :     const CREND_WRAPPER *pCrend,                                /* i/o: Crend wrapper handle                    */
    1701             :     const AUDIO_CONFIG inConfig,                                /* i  : input audio configuration               */
    1702             :     const AUDIO_CONFIG outConfig,                               /* i  : output audio configuration              */
    1703             :     const DECODER_CONFIG_HANDLE hDecoderConfig,                 /* i  : decoder config. structure               */
    1704             :     const COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i  : combined orientation handle             */
    1705             :     const IVAS_OUTPUT_SETUP_HANDLE hIntSetup,                   /* i  : internal setup handle                   */
    1706             :     const EFAP_HANDLE hEFAPdata,                                /* i  : EFAP handle                             */
    1707             :     DECODER_TC_BUFFER_HANDLE hTcBuffer,                         /* i/o: TC handle                               */
    1708             :     float *input_f[],                                           /* i  : transport channels                      */
    1709             :     float *output[],                                            /* i/o: input/output audio channels             */
    1710             :     const int16_t n_samples_to_render,                          /* i  : output frame length per channel         */
    1711             :     const int32_t output_Fs,                                    /* i  : output sampling rate                    */
    1712             :     const int16_t pos_idx                                       /* i  : pose index                              */
    1713             : )
    1714             : {
    1715             :     int16_t subframe_idx, subframe_len;
    1716             :     int16_t nchan_out, nchan_in, ch, first_sf, last_sf, slot_size, slots_to_render;
    1717             :     float *tc_local[MAX_OUTPUT_CHANNELS];
    1718             :     float *p_output[BINAURAL_CHANNELS];
    1719             :     float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES];
    1720             :     float *p_pcm_tmp[BINAURAL_CHANNELS];
    1721             :     IVAS_REND_AudioConfigType inConfigType;
    1722             :     ivas_error error;
    1723             :     int8_t combinedOrientationEnabled;
    1724             :     CREND_HANDLE hCrend;
    1725             : 
    1726     4545084 :     hCrend = pCrend->hCrend[pos_idx];
    1727             : 
    1728     4545084 :     combinedOrientationEnabled = 0;
    1729     4545084 :     if ( hCombinedOrientationData != NULL )
    1730             :     {
    1731       63148 :         if ( hCombinedOrientationData->enableCombinedOrientation[0] != 0 )
    1732             :         {
    1733       63148 :             combinedOrientationEnabled = 1;
    1734             :         }
    1735             :     }
    1736             : 
    1737     4545084 :     push_wmops( "ivas_rend_crendProcessSubframe" );
    1738     4545084 :     inConfigType = getAudioConfigType( inConfig );
    1739             : 
    1740     4545084 :     if ( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK )
    1741             :     {
    1742           0 :         return error;
    1743             :     }
    1744             : 
    1745     4545084 :     if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK )
    1746             :     {
    1747           0 :         return error;
    1748             :     }
    1749             : 
    1750    53607090 :     for ( ch = 0; ch < nchan_in; ch++ )
    1751             :     {
    1752    49062006 :         tc_local[ch] = input_f[ch];
    1753             :     }
    1754             : 
    1755    13635252 :     for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
    1756             :     {
    1757     9090168 :         p_pcm_tmp[ch] = pcm_tmp[ch];
    1758     9090168 :         p_output[ch] = output[ch];
    1759             :     }
    1760             : 
    1761     4545084 :     if ( hTcBuffer != NULL )
    1762             :     {
    1763      320130 :         slot_size = hTcBuffer->n_samples_granularity;
    1764             : 
    1765             :         /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */
    1766      320130 :         slots_to_render = min( hTcBuffer->num_slots - hTcBuffer->slots_rendered, n_samples_to_render / slot_size );
    1767      320130 :         first_sf = hTcBuffer->subframes_rendered;
    1768      320130 :         last_sf = first_sf;
    1769             : 
    1770     1193447 :         while ( slots_to_render > 0 )
    1771             :         {
    1772      873317 :             slots_to_render -= hTcBuffer->subframe_nbslots[last_sf];
    1773      873317 :             last_sf++;
    1774             :         }
    1775      320130 :         subframe_len = -1; /* will be set later */
    1776             :     }
    1777             :     else
    1778             :     {
    1779     4224954 :         subframe_len = (int16_t) ( output_Fs / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) );
    1780     4224954 :         first_sf = 0;
    1781     4224954 :         last_sf = n_samples_to_render / subframe_len;
    1782             :     }
    1783             : 
    1784    12477338 :     for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ )
    1785             :     {
    1786     7932254 :         if ( hTcBuffer != NULL )
    1787             :         {
    1788      873317 :             subframe_len = hTcBuffer->subframe_nbslots[subframe_idx] * hTcBuffer->n_samples_granularity;
    1789             :         }
    1790             : 
    1791             :         /* Early Reflections */
    1792     7932254 :         if ( hCrend->reflections != NULL )
    1793             :         {
    1794      261810 :             if ( hCrend->reflections->use_er == 1 && hCrend->reflections->is_ready == 1 )
    1795             :             {
    1796      108900 :                 if ( ( error = ivas_er_process( hCrend->reflections, subframe_len, 0, tc_local, inConfig ) ) != IVAS_ERR_OK )
    1797             :                 {
    1798           0 :                     return error;
    1799             :                 }
    1800             :             }
    1801             :         }
    1802             : 
    1803     7932254 :         if ( hDecoderConfig && combinedOrientationEnabled )
    1804             :         {
    1805             :             /* Rotation in SHD for:
    1806             :                 MC with elevation (5_1_2 / 5_1_4 / 7_1_4) -> BINAURAL
    1807             :                 SBA SPAR -> BINAURAL or BINAURAL_ROOM
    1808             :             */
    1809      179754 :             if ( inConfig == IVAS_AUDIO_CONFIG_FOA || inConfig == IVAS_AUDIO_CONFIG_HOA2 || inConfig == IVAS_AUDIO_CONFIG_HOA3 )
    1810             :             {
    1811      131754 :                 rotateFrame_shd( hCombinedOrientationData, tc_local, subframe_len, *hIntSetup, 0 );
    1812             :             }
    1813             :             /* Rotation in SD for MC -> BINAURAL_ROOM */
    1814       48000 :             else if ( ( hIntSetup != NULL ) && hIntSetup->is_loudspeaker_setup )
    1815             :             {
    1816       48000 :                 rotateFrame_sd( hCombinedOrientationData, tc_local, subframe_len, *hIntSetup, hEFAPdata, 0 );
    1817             :             }
    1818             :         }
    1819             : 
    1820     7932254 :         if ( ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) )
    1821             :         {
    1822     7932254 :             if ( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, tc_local, p_pcm_tmp, output_Fs, 0, pos_idx ) ) != IVAS_ERR_OK )
    1823             :             {
    1824           0 :                 return error;
    1825             :             }
    1826             : 
    1827     7932254 :             if ( pCrend->hCrend[0]->hReverb != NULL )
    1828             :             {
    1829     2305047 :                 if ( ( error = ivas_reverb_process( pCrend->hCrend[pos_idx]->hReverb, inConfig, 1, tc_local, p_pcm_tmp, 0 ) ) != IVAS_ERR_OK )
    1830             :                 {
    1831           0 :                     return error;
    1832             :                 }
    1833             :             }
    1834             : 
    1835    94103561 :             for ( ch = 0; ch < nchan_in; ch++ )
    1836             :             {
    1837    86171307 :                 tc_local[ch] += subframe_len;
    1838             :             }
    1839             : 
    1840     7932254 :             if ( hTcBuffer != NULL )
    1841             :             {
    1842      873317 :                 hTcBuffer->slots_rendered += hTcBuffer->subframe_nbslots[subframe_idx];
    1843             :             }
    1844             :         }
    1845             :         else
    1846             :         {
    1847           0 :             return IVAS_ERR_INVALID_INPUT_FORMAT;
    1848             :         }
    1849             : 
    1850    23796762 :         for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
    1851             :         {
    1852             :             /* move to output */
    1853    15864508 :             mvr2r( pcm_tmp[ch], p_output[ch], subframe_len );
    1854             : 
    1855    15864508 :             p_output[ch] += subframe_len;
    1856             :         }
    1857             : 
    1858             :         /* update combined orientation access index */
    1859     7932254 :         ivas_combined_orientation_update_index( hCombinedOrientationData, subframe_len );
    1860             :     }
    1861             : 
    1862     4545084 :     if ( hTcBuffer != NULL )
    1863             :     {
    1864      320130 :         hTcBuffer->subframes_rendered = last_sf;
    1865             :     }
    1866             : 
    1867     4545084 :     pop_wmops();
    1868             : 
    1869     4545084 :     return IVAS_ERR_OK;
    1870             : }
    1871             : 
    1872             : 
    1873             : /*-----------------------------------------------------------------------------------------*
    1874             :  * Function ivas_rend_crend_ProcessSubframesSplitBin()
    1875             :  *
    1876             :  * Process call for IVAS Crend renderer
    1877             :  *-----------------------------------------------------------------------------------------*/
    1878             : 
    1879        7973 : ivas_error ivas_rend_crendProcessSubframesSplitBin(
    1880             :     const CREND_WRAPPER *pCrend,                                /* i/o: Crend wrapper handle                    */
    1881             :     const AUDIO_CONFIG inConfig,                                /* i  : input audio configuration               */
    1882             :     const AUDIO_CONFIG outConfig,                               /* i  : output audio configuration              */
    1883             :     const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,          /* i/o: pose correction data handle             */
    1884             :     const DECODER_CONFIG_HANDLE hDecoderConfig,                 /* i  : decoder config. structure               */
    1885             :     const COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i  : combined orientation handle             */
    1886             :     const IVAS_OUTPUT_SETUP_HANDLE hIntSetup,                   /* i  : internal setup handle                   */
    1887             :     const EFAP_HANDLE hEFAPdata,                                /* i  : EFAP handle                             */
    1888             :     DECODER_TC_BUFFER_HANDLE hTcBuffer,                         /* i/o: TC handle                               */
    1889             :     float *input_f[],                                           /* i  : transport channels                      */
    1890             :     float *output[],                                            /* i/o: input/output audio channels             */
    1891             :     const int16_t n_samples_to_render,                          /* i  : output frame length per channel         */
    1892             :     const int32_t output_Fs                                     /* i  : output sampling rate                    */
    1893             : )
    1894             : {
    1895             :     int16_t i, j;
    1896             :     int16_t sf;
    1897             :     int16_t pos_idx;
    1898             :     ivas_error error;
    1899             :     float gain_lfe;
    1900             :     float tmpLfeBuffer[L_FRAME48k];
    1901             :     int16_t original_subframes_rendered, original_slots_rendered;
    1902             :     float tmpInputBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k];
    1903             :     float *p_tmpInputBuffer[MAX_OUTPUT_CHANNELS];
    1904             :     float tmpSplitBinBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k];
    1905             :     COMBINED_ORIENTATION_DATA combinedOrientationDataLocal;
    1906             :     COMBINED_ORIENTATION_HANDLE pCombinedOrientationDataLocal;
    1907             : 
    1908             :     /* save current head positions */
    1909        7973 :     pCombinedOrientationDataLocal = hCombinedOrientationData;
    1910        7973 :     combinedOrientationDataLocal = *pCombinedOrientationDataLocal;
    1911        7973 :     original_subframes_rendered = hTcBuffer->subframes_rendered;
    1912        7973 :     original_slots_rendered = hTcBuffer->slots_rendered;
    1913             : 
    1914             :     /* copy input */
    1915      135541 :     for ( i = 0; i < hIntSetup->nchan_out_woLFE; ++i )
    1916             :     {
    1917      127568 :         mvr2r( input_f[i], tmpInputBuffer[i], n_samples_to_render );
    1918             :     }
    1919             : 
    1920      135541 :     for ( i = 0; i < MAX_OUTPUT_CHANNELS; ++i )
    1921             :     {
    1922      127568 :         p_tmpInputBuffer[i] = tmpInputBuffer[i];
    1923             :     }
    1924             : 
    1925             :     /* save current head positions */
    1926        7973 :     pCombinedOrientationDataLocal = hCombinedOrientationData;
    1927        7973 :     combinedOrientationDataLocal = *pCombinedOrientationDataLocal;
    1928        7973 :     if ( pMultiBinPoseData->poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
    1929             :     {
    1930       23032 :         for ( sf = 1; sf < hCombinedOrientationData->num_subframes; ++sf )
    1931             :         {
    1932       17274 :             combinedOrientationDataLocal.Quaternions[sf] = combinedOrientationDataLocal.Quaternions[0];
    1933       69096 :             for ( i = 0; i < 3; i++ )
    1934             :             {
    1935      207288 :                 for ( j = 0; j < 3; j++ )
    1936             :                 {
    1937      155466 :                     combinedOrientationDataLocal.Rmat[sf][i][j] = combinedOrientationDataLocal.Rmat[0][i][j];
    1938             :                 }
    1939             :             }
    1940             :         }
    1941             :     }
    1942             : 
    1943             :     /* copy LFE to tmpLfeBuffer and apply gain only once */
    1944        7973 :     if ( hIntSetup->num_lfe > 0 && hIntSetup->index_lfe[0] != -1 )
    1945             :     {
    1946           0 :         mvr2r( output[hIntSetup->index_lfe[0]], tmpLfeBuffer, n_samples_to_render );
    1947           0 :         gain_lfe = ( ( pCrend != NULL ) && ( pCrend->hHrtfCrend != NULL ) ) ? pCrend->hHrtfCrend->gain_lfe : GAIN_LFE;
    1948           0 :         v_multc( tmpLfeBuffer, gain_lfe, tmpLfeBuffer, n_samples_to_render );
    1949             :     }
    1950             :     else
    1951             :     {
    1952        7973 :         set_zero( tmpLfeBuffer, n_samples_to_render );
    1953             :     }
    1954             : 
    1955       41634 :     for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; ++pos_idx )
    1956             :     {
    1957             :         /* Update head positions */
    1958             :         IVAS_QUATERNION Quaternions_orig[MAX_PARAM_SPATIAL_SUBFRAMES], Quaternions_abs;
    1959      168305 :         for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ )
    1960             :         {
    1961      134644 :             Quaternions_orig[i] = combinedOrientationDataLocal.Quaternions[i];
    1962      134644 :             Quaternions_abs.w = -3.0f;
    1963      134644 :             Quat2EulerDegree( combinedOrientationDataLocal.Quaternions[i], &Quaternions_abs.z, &Quaternions_abs.y, &Quaternions_abs.x ); /*order in Quat2Euler seems to be reversed ?*/
    1964             : 
    1965      134644 :             Quaternions_abs.x += pMultiBinPoseData->relative_head_poses[pos_idx][0];
    1966      134644 :             Quaternions_abs.y += pMultiBinPoseData->relative_head_poses[pos_idx][1];
    1967      134644 :             Quaternions_abs.z += pMultiBinPoseData->relative_head_poses[pos_idx][2];
    1968      134644 :             combinedOrientationDataLocal.Quaternions[i] = Quaternions_abs;
    1969      134644 :             QuatToRotMat( combinedOrientationDataLocal.Quaternions[i], combinedOrientationDataLocal.Rmat[i] );
    1970             :         }
    1971             : 
    1972       33661 :         pCombinedOrientationDataLocal = &combinedOrientationDataLocal;
    1973             : 
    1974       33661 :         hTcBuffer->subframes_rendered = original_subframes_rendered;
    1975       33661 :         hTcBuffer->slots_rendered = original_slots_rendered;
    1976             : 
    1977             :         /* update combined orientation access index */
    1978       33661 :         ivas_combined_orientation_set_to_start_index( pCombinedOrientationDataLocal );
    1979             : 
    1980      134644 :         for ( i = 0; i < 3; i++ )
    1981             :         {
    1982      100983 :             mvr2r( hCombinedOrientationData->Rmat_prev[pos_idx][i], pCombinedOrientationDataLocal->Rmat_prev[0][i], 3 );
    1983             :         }
    1984             : 
    1985       33661 :         if ( ( error = ivas_rend_crendProcessSubframe( pCrend, inConfig, outConfig, hDecoderConfig, pCombinedOrientationDataLocal,
    1986             :                                                        hIntSetup, hEFAPdata, hTcBuffer, p_tmpInputBuffer, p_tmpInputBuffer, n_samples_to_render, output_Fs, pos_idx ) ) != IVAS_ERR_OK )
    1987             :         {
    1988           0 :             return error;
    1989             :         }
    1990             : 
    1991      134644 :         for ( i = 0; i < 3; i++ )
    1992             :         {
    1993      100983 :             mvr2r( pCombinedOrientationDataLocal->Rmat_prev[0][i], hCombinedOrientationData->Rmat_prev[pos_idx][i], 3 );
    1994             :         }
    1995             : 
    1996      100983 :         for ( i = 0; i < BINAURAL_CHANNELS; ++i )
    1997             :         {
    1998             :             /* accumulate LFE to output */
    1999       67322 :             v_add( tmpInputBuffer[i], tmpLfeBuffer, tmpInputBuffer[i], n_samples_to_render );
    2000             : 
    2001             :             /* move to split bin output buffer */
    2002       67322 :             mvr2r( tmpInputBuffer[i], tmpSplitBinBuffer[pos_idx * BINAURAL_CHANNELS + i], n_samples_to_render );
    2003             :         }
    2004             : 
    2005             :         /* overwrite rendered channels with input again for next iteration */
    2006      572237 :         for ( i = 0; i < hIntSetup->nchan_out_woLFE; ++i )
    2007             :         {
    2008      538576 :             mvr2r( input_f[i], tmpInputBuffer[i], n_samples_to_render );
    2009             :         }
    2010             : 
    2011             :         /* restore original headrotation data */
    2012      168305 :         for ( i = 0; i < hCombinedOrientationData->num_subframes; i++ )
    2013             :         {
    2014      134644 :             combinedOrientationDataLocal.Quaternions[i] = Quaternions_orig[i];
    2015             :         }
    2016             :     }
    2017             : 
    2018             :     /* copy split binaural rendered signals to final output */
    2019       75295 :     for ( i = 0; i < BINAURAL_CHANNELS * pMultiBinPoseData->num_poses; ++i )
    2020             :     {
    2021       67322 :         mvr2r( tmpSplitBinBuffer[i], output[i], n_samples_to_render );
    2022             :     }
    2023             : 
    2024             :     /* update main combined orientation access index */
    2025        7973 :     ivas_combined_orientation_update_index( hCombinedOrientationData, n_samples_to_render );
    2026             : 
    2027        7973 :     return IVAS_ERR_OK;
    2028             : }

Generated by: LCOV version 1.14