LCOV - code coverage report
Current view: top level - lib_rend - ivas_render_config_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main -- dec/rend @ 633e3f2e309758d10805ef21e0436356fe719b7a Lines: 61 63 96.8 %
Date: 2025-08-23 01:22:27 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /******************************************************************************************************
       2             : 
       3             :    (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
       4             :    Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
       5             :    Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
       6             :    Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
       7             :    contributors to this repository. All Rights Reserved.
       8             : 
       9             :    This software is protected by copyright law and by international treaties.
      10             :    The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
      11             :    Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
      12             :    Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
      13             :    Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
      14             :    contributors to this repository retain full ownership rights in their respective contributions in
      15             :    the software. This notice grants no license of any kind, including but not limited to patent
      16             :    license, nor is any license granted by implication, estoppel or otherwise.
      17             : 
      18             :    Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
      19             :    contributions.
      20             : 
      21             :    This software is provided "AS IS", without any express or implied warranties. The software is in the
      22             :    development stage. It is intended exclusively for experts who have experience with such software and
      23             :    solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
      24             :    and fitness for a particular purpose are hereby disclaimed and excluded.
      25             : 
      26             :    Any dispute, controversy or claim arising under or in relation to providing this software shall be
      27             :    submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
      28             :    accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
      29             :    the United Nations Convention on Contracts on the International Sales of Goods.
      30             : 
      31             : *******************************************************************************************************/
      32             : 
      33             : #include <stdint.h>
      34             : #include "options.h"
      35             : #include "prot_fx.h"
      36             : #include "ivas_prot_rend_fx.h"
      37             : #include "ivas_rom_rend.h"
      38             : #include "ivas_rom_TdBinauralRenderer.h"
      39             : #include "wmc_auto.h"
      40             : 
      41             : /*-----------------------------------------------------------------------*
      42             :  * Local constants
      43             :  *-----------------------------------------------------------------------*/
      44             : 
      45             : #define IVAS_REVERB_DEFAULT_PRE_DELAY      0.016f
      46             : #define IVAS_REVERB_DEFAULT_PRE_DELAY_FX   2147484
      47             : #define IVAS_REVERB_DEFAULT_INPUT_DELAY    0.1f
      48             : #define IVAS_REVERB_DEFAULT_INPUT_DELAY_FX 13421773
      49             : 
      50             : #define IVAS_REVERB_DEFAULT_USE_ER 0
      51             : 
      52             : 
      53             : /*-----------------------------------------------------------------------*
      54             :  * ivas_render_config_open()
      55             :  *
      56             :  * Allocates the renderer configuration structure
      57             :  *-----------------------------------------------------------------------*/
      58             : 
      59         391 : ivas_error ivas_render_config_open(
      60             :     RENDER_CONFIG_HANDLE *hRenderConfig /* i/o: Renderer config handle    */
      61             : )
      62             : {
      63             :     /* Allocate HR filter set for headphones configuration */
      64         391 :     IF( ( *hRenderConfig = (RENDER_CONFIG_HANDLE) malloc( sizeof( RENDER_CONFIG_DATA ) ) ) == NULL )
      65             :     {
      66           0 :         return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer configuration!" );
      67             :     }
      68             : 
      69         391 :     return IVAS_ERR_OK;
      70             : }
      71             : 
      72             : 
      73             : /*-------------------------------------------------------------------*
      74             :  * ivas_render_config_close()
      75             :  *
      76             :  * Deallocates the renderer configuration structure
      77             :  *-------------------------------------------------------------------*/
      78             : 
      79        1279 : void ivas_render_config_close(
      80             :     RENDER_CONFIG_HANDLE *hRenderConfig /* i/o: Renderer config handle */
      81             : )
      82             : {
      83        1279 :     test();
      84        1279 :     IF( hRenderConfig == NULL || *hRenderConfig == NULL )
      85             :     {
      86         888 :         return;
      87             :     }
      88             : 
      89         391 :     free( *hRenderConfig );
      90         391 :     *hRenderConfig = NULL;
      91             : 
      92         391 :     return;
      93             : }
      94             : 
      95             : 
      96             : /*-------------------------------------------------------------------*
      97             :  * ivas_render_config_init_from_rom()
      98             :  *
      99             :  * Initializes the renderer configuration structure from ROM
     100             :  *-------------------------------------------------------------------*/
     101             : 
     102         391 : ivas_error ivas_render_config_init_from_rom_fx(
     103             :     RENDER_CONFIG_HANDLE *hRenderConfig /* i/o: Renderer config handle     */
     104             : )
     105             : {
     106             :     Word16 i;
     107         391 :     test();
     108         391 :     IF( hRenderConfig == NULL || *hRenderConfig == NULL )
     109             :     {
     110           0 :         return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "Unexpected null pointer while attempting to fill renderer configuration from ROM" );
     111             :     }
     112             : #ifndef FIX_587_DEFAULT_REVERB
     113             :     ( *hRenderConfig )->roomAcoustics.override = FALSE;
     114             :     move16();
     115             : #endif
     116         391 :     ( *hRenderConfig )->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_N_BANDS;
     117         391 :     move16();
     118         391 :     ( *hRenderConfig )->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_PRE_DELAY_FX;
     119         391 :     move32();
     120         391 :     ( *hRenderConfig )->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_INPUT_DELAY_FX;
     121         391 :     move32();
     122         391 :     ( *hRenderConfig )->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER;
     123         391 :     move16();
     124         391 :     set32_fx( &( *hRenderConfig )->roomAcoustics.pFc_input_fx[0], 0, CLDFB_NO_CHANNELS_MAX );
     125         391 :     set32_fx( &( *hRenderConfig )->roomAcoustics.pAcoustic_rt60_fx[0], 0, CLDFB_NO_CHANNELS_MAX );
     126         391 :     set32_fx( &( *hRenderConfig )->roomAcoustics.pAcoustic_dsr_fx[0], 0, CLDFB_NO_CHANNELS_MAX );
     127             : 
     128         391 :     Copy32( ivas_reverb_default_fc_fx, ( *hRenderConfig )->roomAcoustics.pFc_input_fx, IVAS_REVERB_DEFAULT_N_BANDS );
     129         391 :     Copy32( ivas_reverb_default_RT60_fx, ( *hRenderConfig )->roomAcoustics.pAcoustic_rt60_fx, IVAS_REVERB_DEFAULT_N_BANDS );
     130         391 :     Copy32( ivas_reverb_default_DSR_fx, ( *hRenderConfig )->roomAcoustics.pAcoustic_dsr_fx, IVAS_REVERB_DEFAULT_N_BANDS );
     131             : 
     132        1955 :     FOR( i = 0; i < MAX_NUM_OBJECTS; i++ )
     133             :     {
     134        1564 :         ( *hRenderConfig )->directivity_fx[i_mult( i, 3 )] = 23040; /* Front cone */ /*Q6*/
     135        1564 :         move16();
     136        1564 :         ( *hRenderConfig )->directivity_fx[add( i_mult( i, 3 ), 1 )] = 23040; /* Back cone */ /*Q6*/
     137        1564 :         move16();
     138        1564 :         ( *hRenderConfig )->directivity_fx[add( i_mult( i, 3 ), 2 )] = 32767 /*1.0f in Q15*/; /* Back attenuation */
     139        1564 :         move16();
     140             :     }
     141             : #ifdef CONF_DISTATT
     142         391 :     ( *hRenderConfig )->distAtt_fx[0] = 2113929216; /* Maximum radius (2^ISM_RADIUS_NBITS-1)*0.25 */ /*15.75 in Q27*/ /* Default max dist */
     143         391 :     move32();
     144         391 :     ( *hRenderConfig )->distAtt_fx[1] = ONE_IN_Q30; // Q30   /* Default ref dist */
     145         391 :     move32();
     146         391 :     ( *hRenderConfig )->distAtt_fx[2] = ONE_IN_Q30; // Q30   /* Default rolloff factor */
     147         391 :     move32();
     148             : #endif
     149         391 :     ( *hRenderConfig )->split_rend_config.splitRendBitRate = ISAR_MAX_SPLIT_REND_BITRATE;
     150         391 :     move32();
     151         391 :     ( *hRenderConfig )->split_rend_config.dof = 3;
     152         391 :     move16();
     153         391 :     ( *hRenderConfig )->split_rend_config.hq_mode = 0;
     154         391 :     move16();
     155         391 :     ( *hRenderConfig )->split_rend_config.codec_delay_ms = 0;
     156         391 :     move16();
     157         391 :     ( *hRenderConfig )->split_rend_config.isar_frame_size_ms = 20;
     158         391 :     move16();
     159         391 :     ( *hRenderConfig )->split_rend_config.codec_frame_size_ms = 0; /* 0 means "use default for selected codec" */
     160         391 :     move16();
     161         391 :     ( *hRenderConfig )->split_rend_config.codec = ISAR_SPLIT_REND_CODEC_DEFAULT;
     162         391 :     move32();
     163         391 :     ( *hRenderConfig )->split_rend_config.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB;
     164         391 :     move32();
     165         391 :     ( *hRenderConfig )->split_rend_config.rendererSelection = ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT;
     166         391 :     move32();
     167         391 :     ( *hRenderConfig )->split_rend_config.lc3plus_highres = 0;
     168         391 :     move16();
     169             : 
     170         391 :     return IVAS_ERR_OK;
     171             : }

Generated by: LCOV version 1.14