LCOV - code coverage report
Current view: top level - lib_rend - ivas_hrtf_fx.c (source / functions) Hit Total Coverage
Test: Coverage on main enc/dec/rend @ 3b2f07138c61dcf997bbf4165d0882f794b2995f Lines: 49 54 90.7 %
Date: 2025-05-03 01:55:50 Functions: 8 8 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_error.h"
      38             : #include "wmc_auto.h"
      39             : #include "ivas_prot_fx.h"
      40             : 
      41             : /*-----------------------------------------------------------------------*
      42             :  * ivas_HRTF_binary_open()
      43             :  *
      44             :  * Allocate HRTF binary handle
      45             :  *-----------------------------------------------------------------------*/
      46             : 
      47          23 : ivas_error ivas_HRTF_binary_open_fx(
      48             :     TDREND_HRFILT_FiltSet_t **hHrtfTD )
      49             : {
      50             :     /* Allocate HR filter set for headphones configuration */
      51          23 :     *hHrtfTD = (TDREND_HRFILT_FiltSet_t *) malloc( sizeof( TDREND_HRFILT_FiltSet_t ) );
      52          23 :     IF( *hHrtfTD == NULL )
      53             :     {
      54           0 :         return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF binary!" );
      55             :     }
      56             : 
      57          23 :     return IVAS_ERR_OK;
      58             : }
      59             : 
      60             : 
      61             : /*-------------------------------------------------------------------*
      62             :  * ivas_HRTF_binary_close()
      63             :  *
      64             :  * Close HRTF binary handle
      65             :  *-------------------------------------------------------------------*/
      66             : 
      67          14 : void ivas_HRTF_binary_close_fx(
      68             :     TDREND_HRFILT_FiltSet_t **hHrtfTD )
      69             : {
      70          14 :     test();
      71          14 :     IF( hHrtfTD == NULL || *hHrtfTD == NULL )
      72             :     {
      73           0 :         return;
      74             :     }
      75             : 
      76          14 :     free( *hHrtfTD );
      77          14 :     *hHrtfTD = NULL;
      78             : 
      79          14 :     return;
      80             : }
      81             : 
      82             : 
      83             : /*-----------------------------------------------------------------------*
      84             :  * ivas_HRTF_CRend_binary_open()
      85             :  *
      86             :  * Allocate HRTF binary handle
      87             :  *-----------------------------------------------------------------------*/
      88             : 
      89          23 : ivas_error ivas_HRTF_CRend_binary_open_fx(
      90             :     HRTFS_CREND **hSetOfHRTF )
      91             : {
      92             :     /* Allocate HR filter set for headphones configuration */
      93          23 :     *hSetOfHRTF = (HRTFS_CREND *) malloc( sizeof( HRTFS_CREND ) );
      94          23 :     IF( *hSetOfHRTF == NULL )
      95             :     {
      96           0 :         return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for set of HRTF binary!" );
      97             :     }
      98             : 
      99          23 :     ( *hSetOfHRTF )->hHRTF_hrir_combined = NULL;
     100          23 :     ( *hSetOfHRTF )->hHRTF_hrir_hoa3 = NULL;
     101          23 :     ( *hSetOfHRTF )->hHRTF_hrir_hoa2 = NULL;
     102          23 :     ( *hSetOfHRTF )->hHRTF_hrir_foa = NULL;
     103          23 :     ( *hSetOfHRTF )->hHRTF_brir_combined = NULL;
     104             : 
     105          23 :     return IVAS_ERR_OK;
     106             : }
     107             : 
     108             : 
     109             : /*-------------------------------------------------------------------*
     110             :  * ivas_HRTF_CRend_binary_close()
     111             :  *
     112             :  * Close HRTF CRend binary handle
     113             :  *-------------------------------------------------------------------*/
     114             : 
     115         604 : void ivas_HRTF_CRend_binary_close_fx(
     116             :     HRTFS_CREND **hSetOfHRTF )
     117             : {
     118         604 :     test();
     119         604 :     IF( hSetOfHRTF == NULL || *hSetOfHRTF == NULL )
     120             :     {
     121         581 :         return;
     122             :     }
     123             : 
     124          23 :     free( *hSetOfHRTF );
     125          23 :     *hSetOfHRTF = NULL;
     126             : 
     127          23 :     return;
     128             : }
     129             : 
     130             : 
     131             : /*-----------------------------------------------------------------------*
     132             :  * ivas_HRTF_fastconv_binary_open()
     133             :  *
     134             :  * Allocate HRTF binary handle for FASTCONV renderer
     135             :  *-----------------------------------------------------------------------*/
     136             : 
     137          23 : ivas_error ivas_HRTF_fastconv_binary_open_fx(
     138             :     HRTFS_FASTCONV **hHrtfFastConv )
     139             : {
     140          23 :     *hHrtfFastConv = (HRTFS_FASTCONV *) malloc( sizeof( HRTFS_FASTCONV ) );
     141          23 :     IF( *hHrtfFastConv == NULL )
     142             :     {
     143           0 :         return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FASTCONV HRTF tables!" );
     144             :     }
     145          23 :     ivas_init_binaural_hrtf_fx( *hHrtfFastConv );
     146          23 :     return IVAS_ERR_OK;
     147             : }
     148             : 
     149             : 
     150             : /*-----------------------------------------------------------------------*
     151             :  * ivas_HRTF_fastconv_binary_close()
     152             :  *
     153             :  * Close HRTF binary handle for FASTCONV renderer
     154             :  *-----------------------------------------------------------------------*/
     155             : 
     156         604 : void ivas_HRTF_fastconv_binary_close_fx(
     157             :     HRTFS_FASTCONV **hHrtfFastConv )
     158             : {
     159         604 :     test();
     160         604 :     IF( hHrtfFastConv == NULL || *hHrtfFastConv == NULL )
     161             :     {
     162         543 :         return;
     163             :     }
     164             : 
     165          61 :     free( *hHrtfFastConv );
     166          61 :     *hHrtfFastConv = NULL;
     167             : 
     168          61 :     return;
     169             : }
     170             : 
     171             : 
     172             : /*-----------------------------------------------------------------------*
     173             :  * ivas_HRTF_parambin_binary_open()
     174             :  *
     175             :  * Allocate HRTF binary handle for parametric binauralizer
     176             :  *-----------------------------------------------------------------------*/
     177             : 
     178          23 : ivas_error ivas_HRTF_parambin_binary_open_fx(
     179             :     HRTFS_PARAMBIN **hHrtfParambin )
     180             : {
     181          23 :     *hHrtfParambin = (HRTFS_PARAMBIN *) malloc( sizeof( HRTFS_PARAMBIN ) );
     182          23 :     IF( *hHrtfParambin == NULL )
     183             :     {
     184           0 :         return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for parametric binauralizer HRTF tables!" );
     185             :     }
     186             : 
     187          23 :     return IVAS_ERR_OK;
     188             : }
     189             : 
     190             : 
     191             : /*-----------------------------------------------------------------------*
     192             :  * ivas_HRTF_parambin_binary_close()
     193             :  *
     194             :  * Close HRTF binary handle for parametric binauralizer
     195             :  *-----------------------------------------------------------------------*/
     196             : 
     197         612 : void ivas_HRTF_parambin_binary_close_fx(
     198             :     HRTFS_PARAMBIN **hHrtfParambin )
     199             : {
     200         612 :     test();
     201         612 :     IF( hHrtfParambin == NULL || *hHrtfParambin == NULL )
     202             :     {
     203         487 :         return;
     204             :     }
     205             : 
     206         125 :     free( *hHrtfParambin );
     207         125 :     *hHrtfParambin = NULL;
     208             : 
     209         125 :     return;
     210             : }

Generated by: LCOV version 1.14