Commit 23db55ab authored by vaclav's avatar vaclav
Browse files

Merge branch '351-hrtf-command-option' into 'main'

Resolve ""-hrtf" command option"

See merge request !456
parents 6e313005 fe091769
Loading
Loading
Loading
Loading
Loading
+41 −3
Original line number Diff line number Diff line
@@ -222,8 +222,21 @@ int main(

    if ( arg.hrtfReaderEnabled )
    {
#ifdef FIX_351_HRTF_COMMAND
        /* sanity check */
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
        {
            arg.hrtfReaderEnabled = false;
            fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" );
            goto cleanup;
        }
#endif

        if ( ( error = hrtfFileReader_open( arg.hrtfFileName, &hrtfReader ) ) != IVAS_ERR_OK )
        {
#ifdef FIX_351_HRTF_COMMAND
            arg.hrtfReaderEnabled = false;
#endif
            fprintf( stderr, "\nError: Can't open HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
        }
@@ -235,6 +248,15 @@ int main(

    if ( arg.enableHeadRotation )
    {
#ifdef FIX_351_HRTF_COMMAND
        /* sanity check */
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
        {
            fprintf( stderr, "\nError: Head-rotation file file cannot be used in this output configuration.\n\n" );
            goto cleanup;
        }
#endif

        if ( ( error = HeadRotationFileReader_open( arg.headrotTrajFileName, &headRotReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError: Can't open head-rotation file %s \n\n", arg.headrotTrajFileName );
@@ -261,6 +283,15 @@ int main(

    if ( arg.renderConfigEnabled )
    {
#ifdef FIX_351_HRTF_COMMAND
        /* sanity check */
        if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL && arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
        {
            fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" );
            goto cleanup;
        }
#endif

        if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError: Can't open Renderer configuration file %s \n\n", arg.renderConfigFilename );
@@ -273,13 +304,21 @@ int main(
     *------------------------------------------------------------------------------------------*/

#ifdef REMOVE_FORCE_SUBFRAME_BIN
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation ) ) != IVAS_ERR_OK )
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled ) ) != IVAS_ERR_OK )
#else
#ifdef DEBUGGING
#ifdef FIX_351_HRTF_COMMAND
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.forceSubframeBinauralization ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.forceSubframeBinauralization ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef FIX_351_HRTF_COMMAND
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation ) ) != IVAS_ERR_OK )
#endif
#endif
#endif
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -456,9 +495,7 @@ int main(
        if ( ( error = create_SetOfHRTF_from_binary( hSetOfHRTF, hrtfReader, arg.output_Fs ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s for CRend \n\n", arg.hrtfCRendFileName );
#ifndef FIX_FOR_TEST
            goto cleanup;
#endif
        }
        IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv;
        IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv );
@@ -535,6 +572,7 @@ cleanup:
#ifdef DEBUG_SBA_AUDIO_DUMP
    IVAS_DEC_GetSbaDebugParams( hIvasDec, &numOutChannels, &numTransportChannels, &pca_ingest_channels );
#endif

    if ( arg.hrtfReaderEnabled )
    {
        IVAS_DEC_HRTF_HANDLE hHrtfTD;
+1 −0
Original line number Diff line number Diff line
@@ -161,6 +161,7 @@
#endif

#define BINAURALIZATION_DELAY_REPORT                    /* VA: Issue 255 - Changes the way the decoder delay is reported */
#define FIX_351_HRTF_COMMAND                            /* VA: Issue 354 - improve "-hrtf" command-line option */

#define FIX_94_VERIFY_WAV_NUM_CHANNELS                  /* FhG: Issue 94 - Check if number of channels in input wav file matches encoder/renderer configuration */

+4 −1
Original line number Diff line number Diff line
@@ -1127,6 +1127,9 @@ typedef struct decoder_config_structure
    int16_t Opt_LsCustom;          /* indicates whether loudspeaker custom setup is used */
    int16_t Opt_HRTF_binary;       /* indicates whether HRTF binary file is used */
    int16_t Opt_Headrotation;      /* indicates whether head-rotation is used */
#ifdef FIX_351_HRTF_COMMAND
    int16_t Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */
#endif
    int16_t orientation_tracking; /* indicates orientation tracking type */
    float no_diegetic_pan;
    int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */
+22 −0
Original line number Diff line number Diff line
@@ -223,6 +223,9 @@ static void init_decoder_config(
    hDecoderConfig->Opt_LsCustom = 0;
    hDecoderConfig->Opt_HRTF_binary = 0;
    hDecoderConfig->Opt_Headrotation = 0;
#ifdef FIX_351_HRTF_COMMAND
    hDecoderConfig->Opt_RendConfigCustom = 0;
#endif
#ifndef REMOVE_FORCE_SUBFRAME_BIN
#ifdef DEBUGGING
    hDecoderConfig->forceSubframeBinauralization = 0;
@@ -392,6 +395,10 @@ ivas_error IVAS_DEC_Configure(
    const int16_t customLsOutputEnabled,      /* i  : enable custom loudspeaker setup handle     */
    const int16_t hrtfReaderEnabled,          /* i  : enable HRTF binary file input              */
    const int16_t enableHeadRotation          /* i  : enable head rotation for binaural output   */
#ifdef FIX_351_HRTF_COMMAND
    ,
    const int16_t renderConfigEnabled /* i  : enable Renderer config. file for binaural output */
#endif
#ifndef REMOVE_FORCE_SUBFRAME_BIN
#ifdef DEBUGGING
    ,
@@ -451,6 +458,9 @@ ivas_error IVAS_DEC_Configure(
    hDecoderConfig->Opt_LsCustom = customLsOutputEnabled;
    hDecoderConfig->Opt_Headrotation = enableHeadRotation;
    hDecoderConfig->Opt_HRTF_binary = hrtfReaderEnabled;
#ifdef FIX_351_HRTF_COMMAND
    hDecoderConfig->Opt_RendConfigCustom = renderConfigEnabled;
#endif

    /* Set decoder parameters to initial values */
    if ( ( error = ivas_init_decoder_front( st_ivas ) ) != IVAS_ERR_OK )
@@ -1923,6 +1933,18 @@ static ivas_error printConfigInfo_dec(
        get_channel_config( st_ivas->hDecoderConfig->output_config, &config_str[0] );
        fprintf( stdout, "Output configuration:   %s\n", config_str );

#ifdef FIX_351_HRTF_COMMAND
        if ( st_ivas->hDecoderConfig->Opt_HRTF_binary )
        {
            fprintf( stdout, "HRIR/BRIR file:         ON\n" );
        }

        if ( st_ivas->hDecoderConfig->Opt_RendConfigCustom )
        {
            fprintf( stdout, "Renderer config. file:  ON\n" );
        }
#endif

        if ( st_ivas->hDecoderConfig->Opt_Headrotation )
        {
            fprintf( stdout, "Head rotation:          ON\n" );
+4 −0
Original line number Diff line number Diff line
@@ -130,6 +130,10 @@ ivas_error IVAS_DEC_Configure(
    const int16_t customLsOutputEnabled,        /* i  : enable custom loudspeaker setup handle                                  */
    const int16_t hrtfReaderEnabled,            /* i  : enable HRTF binary file input                                           */
    const int16_t enableHeadRotation            /* i  : enable head rotation for binaural output                                */
#ifdef FIX_351_HRTF_COMMAND
   ,const int16_t renderConfigEnabled           /* i  : enable Renderer config. file for binaural output                        */
#endif

#ifndef REMOVE_FORCE_SUBFRAME_BIN
#ifdef DEBUGGING
    ,