Commit dfc2d371 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch 'orange/fixpoint_crend_hrtf_file_format_clean_up' into 'main'

[non-be][split-non-be][ref-using-main][non-IO] Orange/fixpoint hrtf file format-clean-up

See merge request !1690
parents ed0e1362 8df4563a
Loading
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -5130,8 +5130,11 @@ ivas_error ivas_allocate_binaural_hrtf(
    HRTFS_FASTCONV *HrtfFastConv,                               /* i/o: FASTCONV HRTF structure */
    const AUDIO_CONFIG input_config,                            /* i  : input audio configuration                       */
    const BINAURAL_INPUT_AUDIO_CONFIG bin_input_config,         /* i  : binaural input audio config                     */
    const RENDERER_TYPE renderer_type,                          /* i  : renderer type                                   */
    const RENDERER_TYPE renderer_type                           /* i  : renderer type                                   */
#ifndef FIX_1123_FASTCONV_16BIT_ROM
    ,
    const int16_t allocate_init_flag                            /* i  : Memory allocation flag                          */
#endif
);

#ifdef DEBUGGING
+9 −3
Original line number Diff line number Diff line
@@ -159,13 +159,19 @@

/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */

//#define FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT          /* Orange issue 1031 : new fix point hrtf binary file format */
//#define FIX_CREND_SIMPLIFY_CODE                       /* Orange: simplify line code in Crend */
#define FLOAT_FIX_POINT_HRTF_FILE_FORMAT                /* allows reading floation or fix point hrtf binary file format */
#define FIX_CREND_SIMPLIFY_CODE                         /* Ora : simplify line code in crend */
#define FIX_1138_SBA_EXT_ERROR_PRINTOUT                 /* VA: issue 1138: Fix SBA EXT output call of audioCfg2channels() */
#define FIX_1117_ISAR_MALLOC                            /* VA: issue 1117: call ISAR malloc() only at the initialization. */
#define TMP_FIX_1119_SPLIT_RENDERING_VOIP               /* FhG: Add error check for unsupported config: split rendering with VoIP mode */

#define FIX_POINT_HRTF_FILE_FORMAT                     /* All: fix point hrtf binary file format */
#ifdef FIX_POINT_HRTF_FILE_FORMAT
#define FIX_1123_CREND_16BIT_ROM
#define FIX_1123_TDREN_16BIT_ROM
#define FIX_1123_FASTCONV_16BIT_ROM                     /* FhG: issue 1123: update FastConv ROM tables and scripts to generate 16 bit tables instead of float */
#define FIX_1123_PARAMBIN_16BIT_ROM                     /* FhG,Nok: issue 1123: update ParamBin ROM tables and scripts to generate 16 bit tables instead of float */
#endif

/* #################### End BE switches ################################## */

/* #################### Start NON-BE switches ############################ */
+318 −9

File changed.

Preview size limit exceeded, changes collapsed.

+405 −3

File changed.

Preview size limit exceeded, changes collapsed.

+28 −1
Original line number Diff line number Diff line
@@ -373,7 +373,11 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs(
    HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */
)
{
#ifdef FIX_1123_PARAMBIN_16BIT_ROM
    int16_t i, j, k;
#else
    int16_t i, j;
#endif
    if ( hHrtfParambin != NULL && *hHrtfParambin != NULL )
    {
        /* Tables already loaded from file */
@@ -383,7 +387,13 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs(
    {
        /* Initialise tables from ROM */
        HRTFS_PARAMBIN *hrtfParambin;

#ifdef FIX_1123_PARAMBIN_16BIT_ROM
        float shCoef_scale, rt_scale, rene_scale, early_scale;
        shCoef_scale = powf( 2.f, -1.f * (float) hrtfShCoeffs_factorQ );
        rt_scale = powf( 2.f, -1.f * (float) parametricReverberationTimes_factorQ );
        rene_scale = powf( 2.f, -1.f * (float) parametricReverberationEneCorrections_factorQ );
        early_scale = powf( 2.f, -1.f * (float) parametricEarlyPartEneCorrection_factorQ );
#endif
        if ( ( hrtfParambin = (HRTFS_PARAMBIN *) malloc( sizeof( HRTFS_PARAMBIN ) ) ) == NULL )
        {
            return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for parametric binauralizer HRTF tables" );
@@ -393,14 +403,31 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs(
        {
            for ( j = 0; j < HRTF_SH_CHANNELS; j++ )
            {
#ifdef FIX_1123_PARAMBIN_16BIT_ROM
                for ( k = 0; k < HRTF_NUM_BINS; k++ )
                {
                    hrtfParambin->hrtfShCoeffsRe[i][j][k] = (float) hrtfShCoeffsRe[i][j][k] * shCoef_scale;
                    hrtfParambin->hrtfShCoeffsIm[i][j][k] = (float) hrtfShCoeffsIm[i][j][k] * shCoef_scale;
                }
#else
                mvr2r( hrtfShCoeffsRe[i][j], hrtfParambin->hrtfShCoeffsRe[i][j], HRTF_NUM_BINS );
                mvr2r( hrtfShCoeffsIm[i][j], hrtfParambin->hrtfShCoeffsIm[i][j], HRTF_NUM_BINS );
#endif
            }
        }

#ifdef FIX_1123_PARAMBIN_16BIT_ROM
        for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ )
        {
            hrtfParambin->parametricReverberationTimes[i] = (float) parametricReverberationTimes[i] * rt_scale;
            hrtfParambin->parametricReverberationEneCorrections[i] = (float) parametricReverberationEneCorrections[i] * rene_scale;
            hrtfParambin->parametricEarlyPartEneCorrection[i] = (float) parametricEarlyPartEneCorrection[i] * early_scale;
        }
#else
        mvr2r( parametricReverberationTimes, hrtfParambin->parametricReverberationTimes, CLDFB_NO_CHANNELS_MAX );
        mvr2r( parametricReverberationEneCorrections, hrtfParambin->parametricReverberationEneCorrections, CLDFB_NO_CHANNELS_MAX );
        mvr2r( parametricEarlyPartEneCorrection, hrtfParambin->parametricEarlyPartEneCorrection, CLDFB_NO_CHANNELS_MAX );
#endif

        *hHrtfParambin = hrtfParambin;
    }
Loading