Commit 69119a99 authored by PLAINSI's avatar PLAINSI
Browse files

Merge branch 'main' into 489-draft-non-be-fix-paramupmix-covariance-smoothing

parents f2a33b5c f221482e
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -552,7 +552,11 @@ int main(

    if ( arg.hrtfReaderEnabled )
    {
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL;
#else
        IVAS_DEC_HRTF_HANDLE hHrtfTD;
#endif

        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );

@@ -563,7 +567,11 @@ int main(
        }


#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
#else
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF;
#endif
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );

        if ( ( error = create_SetOfHRTF_from_binary( hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK )
@@ -571,14 +579,22 @@ int main(
            fprintf( stderr, "\nError in loading HRTF binary file %s for CRend \n\n", arg.hrtfCRendFileName );
            goto cleanup;
        }
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv = NULL;
#else
        IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv;
#endif
        IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv );

        if ( ( error = load_fastconv_HRTF_from_binary( hHrtfFastConv, hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s for FastConv \n\n", arg.hrtfCRendFileName );
        }
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin = NULL;
#else
        IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin;
#endif
        IVAS_DEC_GetHrtfParamBinHandle( hIvasDec, &hHrtfParambin );

        if ( ( error = load_parambin_HRTF_from_binary( hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK )
@@ -667,10 +683,18 @@ cleanup:

    if ( arg.hrtfReaderEnabled )
    {
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_HANDLE hHrtfTD = NULL;
#else
        IVAS_DEC_HRTF_HANDLE hHrtfTD;
#endif
        IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );
        dealloc_HRTF_binary( hHrtfTD );
#ifdef UPDATE_SBA_FILTER
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF = NULL;
#else
        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF;
#endif
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );
        destroy_SetOfHRTF( hSetOfHRTF );
    }
@@ -1743,7 +1767,6 @@ static ivas_error decodeG192(
            }
        }


        /* Write current frame */
        if ( decodedGoodFrame )
        {
@@ -1829,6 +1852,7 @@ static ivas_error decodeG192(
     *------------------------------------------------------------------------------------------*/

    memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) );

    if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) );
+14 −1
Original line number Diff line number Diff line
@@ -69,10 +69,17 @@ int32_t get_delay(
        {
            delay = IVAS_ENC_DELAY_NS;

#ifdef FIX_356_ISM_METADATA_SYNC
            if ( ivas_format == ISM_FORMAT || ivas_format == MASA_FORMAT )
            {
                delay = 0; /* All delay is compensated in the decoder with MASA/ISM */
            }
#else
            if ( ivas_format == MASA_FORMAT )
            {
                delay = 0; /* All delay is compensated in the decoder with MASA */
            }
#endif
        }

        if ( ivas_format == SBA_FORMAT )
@@ -104,11 +111,17 @@ int32_t get_delay(
                delay += IVAS_FB_DEC_DELAY_NS;
            }


#ifdef FIX_356_ISM_METADATA_SYNC
            if ( ivas_format == ISM_FORMAT || ivas_format == MASA_FORMAT )
            {
                delay += IVAS_ENC_DELAY_NS; /* Compensate also the encoder delay in the decoder with ISM/MASA */
            }
#else
            if ( ivas_format == MASA_FORMAT )
            {
                delay += IVAS_ENC_DELAY_NS; /* Compensate also the encoder delay in the decoder with MASA */
            }
#endif
        }
    }

+10 −0
Original line number Diff line number Diff line
@@ -1512,7 +1512,11 @@ typedef enum

#define BINAURAL_MAXBANDS                       60                          /* Max number of bands */
#define BINAURAL_CONVBANDS                      50                          /* Bands upto which convolution is performed */
#ifdef UPDATE_SBA_FILTER
#define BINAURAL_NTAPS                           5
#else
#define BINAURAL_NTAPS                           7
#endif
#define BINAURAL_NTAPS_MAX                      96

#define HRTF_SH_ORDER                           3
@@ -1530,7 +1534,13 @@ typedef enum
{
    BINAURAL_INPUT_AUDIO_CONFIG_INVALID,
    BINAURAL_INPUT_AUDIO_CONFIG_COMBINED,       /* 5_1, 5_1_2, 5_1_4, 7_1, 7_1_4 */
#ifdef UPDATE_SBA_FILTER    
    BINAURAL_INPUT_AUDIO_CONFIG_HOA3,            /*  HOA3 */
    BINAURAL_INPUT_AUDIO_CONFIG_HOA2,            /* HOA2 */
    BINAURAL_INPUT_AUDIO_CONFIG_FOA,            /* FOA */
#else    
    BINAURAL_INPUT_AUDIO_CONFIG_HOA,            /* FOA, HOA2, HOA3 */
#endif    
    BINAURAL_INPUT_AUDIO_CONFIG_UNDEFINED       /* Not used */

} BINAURAL_INPUT_AUDIO_CONFIG;
+26 −8
Original line number Diff line number Diff line
@@ -947,9 +947,11 @@ void deindex_spherical_component(
 *-----------------------------------------------------------------*/

void calculate_hodirac_sector_parameters(
#ifdef FIX_485_STATIC_BUFFERS
    DIRAC_ENC_HANDLE hDirAC, /* i  : DirAC handle                               */
#endif
    float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i  : signal vector (L+1)^2 x N_bins, real part  */
    float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i  : signal vector, imaginary part              */
    const int16_t N_bins,                                         /* i  : number of bins                             */
    const float beta,                                             /* i  : forgetting factor for average filtering    */
    const int16_t *band_grouping,                                 /* i  : indices of band groups                     */
    const int16_t N_bands,                                        /* i  : number of bands (groups)                   */
@@ -961,13 +963,12 @@ void calculate_hodirac_sector_parameters(
)
{
    int16_t i_sec, i_bin, i_band;

    float p_real, p_imag, normI, energy, tmp_diff;

    float sec_I_vec_x[NUM_ANA_SECTORS];
    float sec_I_vec_y[NUM_ANA_SECTORS];
    float sec_I_vec_z[NUM_ANA_SECTORS];

#ifndef FIX_485_STATIC_BUFFERS
    static int16_t firstrun_sector_params = 1;

    static float sec_I_vec_smth_x[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS];
@@ -977,9 +978,6 @@ void calculate_hodirac_sector_parameters(
    static float energy_smth[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS];
    static float azi_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS];
    static float ele_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS];

#ifdef DEBUGGING
    assert( N_bins <= DIRAC_NO_FB_BANDS_MAX );
#endif

    for ( i_sec = 0; i_sec < NUM_ANA_SECTORS; i_sec++ )
@@ -1016,6 +1014,15 @@ void calculate_hodirac_sector_parameters(
            float *p_ene = &ene[i_sec * N_bands + i_band];

            float *p_diff = &diff[i_sec * N_bands + i_band];
#ifdef FIX_485_STATIC_BUFFERS
            float *p_azi_prev = &hDirAC->azi_prev[i_sec * N_bands + i_band];
            float *p_ele_prev = &hDirAC->ele_prev[i_sec * N_bands + i_band];

            float *p_energy_smth = &hDirAC->energy_smth[i_sec][i_band];
            float *p_sec_I_vec_smth_x = &hDirAC->sec_I_vec_smth_x[i_sec][i_band];
            float *p_sec_I_vec_smth_y = &hDirAC->sec_I_vec_smth_y[i_sec][i_band];
            float *p_sec_I_vec_smth_z = &hDirAC->sec_I_vec_smth_z[i_sec][i_band];
#else
            float *p_azi_prev = &azi_prev[i_sec * N_bands + i_band];
            float *p_ele_prev = &ele_prev[i_sec * N_bands + i_band];

@@ -1023,7 +1030,7 @@ void calculate_hodirac_sector_parameters(
            float *p_sec_I_vec_smth_x = &sec_I_vec_smth_x[i_sec][i_band];
            float *p_sec_I_vec_smth_y = &sec_I_vec_smth_y[i_sec][i_band];
            float *p_sec_I_vec_smth_z = &sec_I_vec_smth_z[i_sec][i_band];

#endif
            *p_sec_I_vec_x = 0.f;
            *p_sec_I_vec_y = 0.f;
            *p_sec_I_vec_z = 0.f;
@@ -1089,8 +1096,11 @@ void calculate_hodirac_sector_parameters(
                                       sec_z_real * sec_z_real + sec_z_imag * sec_z_imag );
                }
            }

#ifdef FIX_485_STATIC_BUFFERS
            if ( hDirAC->firstrun_sector_params )
#else
            if ( firstrun_sector_params )
#endif
            {
                *p_sec_I_vec_smth_x = *p_sec_I_vec_x;
                *p_sec_I_vec_smth_y = *p_sec_I_vec_y;
@@ -1132,7 +1142,11 @@ void calculate_hodirac_sector_parameters(
            }
            if ( tmp_diff > 0.5f )
            {
#ifdef FIX_485_STATIC_BUFFERS
                if ( hDirAC->firstrun_sector_params )
#else
                if ( firstrun_sector_params )
#endif
                {
                    *p_azi = 0.f;
                    *p_ele = 0.f;
@@ -1151,7 +1165,11 @@ void calculate_hodirac_sector_parameters(
        }
    }

#ifdef FIX_485_STATIC_BUFFERS
    hDirAC->firstrun_sector_params = 0;
#else
    firstrun_sector_params = 0;
#endif

    return;
}
+61 −5
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ typedef enum
    IVAS_ERR_INVALID_SAMPLING_RATE,
    IVAS_ERR_NOT_CONFIGURED,
    IVAS_ERR_INVALID_STEREO_MODE,
    IVAS_ERR_INVALID_CICP_INDEX,
    IVAS_ERR_INVALID_CICP_INDEX, /* ToDo: rename, CICP not used in IVAS anymore */
    IVAS_ERR_INVALID_BITRATE,
    IVAS_ERR_INVALID_MASA_CONFIG,
    IVAS_ERR_TOO_MANY_INPUTS,
@@ -72,17 +72,15 @@ typedef enum
    IVAS_ERR_INVALID_SPAR_CONFIG,
    IVAS_ERR_WRONG_PARAMS,
    IVAS_ERR_INIT_ERROR,
    IVAS_ERR_DECODER_ERROR,
    IVAS_ERR_WRONG_MODE,
    IVAS_ERR_INVALID_OUTPUT_FORMAT,
    IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED,
    IVAS_ERR_INVALID_HRTF,
    IVAS_ERR_INVALID_INPUT_FORMAT,
    IVAS_ERR_INVALID_INDEX,
    IVAS_ERR_INVALID_INDEX, /* ToDo: should be merged with IVAS_ERR_INDEX_OUT_OF_BOUNDS */
    IVAS_ERR_NOT_SUPPORTED_OPTION,
    IVAS_ERR_NOT_IMPLEMENTED,
    IVAS_ERR_WAITING_FOR_BITSTREAM,
    IVAS_ERR_FILE_READER_TIMESTAMP_MISMATCH,
    IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT,
    IVAS_ERR_ISM_INVALID_METADATA_VALUE,
    IVAS_ERR_INVALID_MASA_FORMAT_METADATA_FILE,
@@ -131,7 +129,7 @@ typedef enum
     *    renderer (lib_rend only)            *
     *----------------------------------------*/

    IVAS_ERR_NUM_CHANNELS_UNKNOWN,
    IVAS_ERR_NUM_CHANNELS_UNKNOWN = 0x6000,
    IVAS_ERR_INVALID_CUSTOM_LS_LAYOUT,
    IVAS_ERR_INVALID_INPUT_ID,
    IVAS_ERR_WRONG_NUM_CHANNELS,
@@ -182,6 +180,64 @@ static inline const char *ivas_error_to_string( ivas_error error_code )
            return "Parse error";
        case IVAS_ERR_END_OF_FILE:
            return "End of file";
        case IVAS_ERR_WRONG_PARAMS:
            return "Wrong function parameters";
        case IVAS_ERR_INVALID_BANDWIDTH:
            return "Invalid bandwidth";
        case IVAS_ERR_INVALID_DTX_UPDATE_RATE:
            return "Invalid DTX update rate";
        case IVAS_ERR_NOT_CONFIGURED:
            return "Handle has not been configured";
        case IVAS_ERR_INVALID_STEREO_MODE:
            return "Invalid stereo mode";
        case IVAS_ERR_INVALID_CICP_INDEX:
            return "Invalid speaker layout";
        case IVAS_ERR_INVALID_BITRATE:
            return "Invalid bitrate";
        case IVAS_ERR_INVALID_MASA_CONFIG:
            return "Invalid MASA config";
        case IVAS_ERR_TOO_MANY_INPUTS:
            return "Too many object inputs provided";
        case IVAS_ERR_INDEX_OUT_OF_BOUNDS:
            return "Index out of bounds";
        case IVAS_ERR_RECONFIGURE_NOT_SUPPORTED:
            return "Reconfigure not supported";
        case IVAS_ERR_INVALID_FEC_OFFSET:
            return "Invalid FEC offset";
        case IVAS_ERR_INVALID_INPUT_BUFFER_SIZE:
            return "Invalid input buffer size";
        case IVAS_ERR_DTX_NOT_SUPPORTED:
            return "DTX is not supported in this IVAS format and element mode";
        case IVAS_ERR_UNEXPECTED_NULL_POINTER:
            return "Unexpected NULL pointer";
        case IVAS_ERR_METADATA_NOT_EXPECTED:
            return "Metadata input not expected for current configuration";
#ifdef DEBUGGING
        case IVAS_ERR_INVALID_FORCE_MODE:
            return "Invalid force mode";
#endif
        case IVAS_ERR_NOT_IMPLEMENTED:
            return "Not implemented";
        case IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT:
            return "Invalid metadata file format";
        case IVAS_ERR_ISM_INVALID_METADATA_VALUE:
            return "Invalid metadata value provided";
        case IVAS_ERR_NOT_SUPPORTED_OPTION:
            return "Option not supported in this set-up";
        case IVAS_ERR_INIT_ERROR:
            return "Initialization error";
        case IVAS_ERR_INVALID_BITSTREAM:
            return "Invalid bitstream";
        case IVAS_ERR_WRONG_MODE:
            return "Wrong mode";
        case IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED:
            return "Head rotation not supported";
        case IVAS_ERR_INVALID_HRTF:
            return "Unsupported HRTF filter set";
        case IVAS_ERR_INVALID_INPUT_FORMAT:
            return "Invalid format of input bitstream";
        case IVAS_ERR_INVALID_INDEX:
            return "Invalid index";
        default:
            break;
    }
Loading