Commit 69d70a59 authored by Stephane Ragot's avatar Stephane Ragot
Browse files

initial support of external HR binary file in decoder/unit test with table format converter

parent 8efa516d
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -104,6 +104,10 @@ typedef struct
    float FER;
    bool hrtfReaderEnabled;
    char *hrtfFileName;
#ifdef HRTF_BINARY_FILE
    bool hrtfCRendReaderEnabled;
    char *hrtfCRendFileName;
#endif
    IVAS_DEC_INPUT_FORMAT inputFormat;
#ifdef DEBUGGING
    bool forceSubframeBinauralization;
@@ -487,6 +491,19 @@ int main(
            fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
        }

#ifdef HRTF_BINARY_FILE

        IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF;
        IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF );

        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 );
            goto cleanup;
        }

#endif
    }

    /*-----------------------------------------------------------------*
@@ -712,6 +729,11 @@ static bool parseCmdlIVAS_dec(
    arg->hrtfReaderEnabled = false;
    arg->hrtfFileName = NULL;

#ifdef HRTF_BINARY_FILE
    arg->hrtfCRendReaderEnabled = false;
    arg->hrtfCRendFileName = NULL;
#endif

    arg->customLsOutputEnabled = false;
    arg->customLsSetupFilename = NULL;

@@ -1087,7 +1109,11 @@ static void usage_dec( void )
    fprintf( stdout, "                      which of the two supported formats is in use.\n" );
    fprintf( stdout, "                      default bitstream file format is G.192\n" );
    fprintf( stdout, "-T File             : Head rotation specified by external trajectory File\n" );
#ifdef HRTF_BINARY_FILE
    fprintf( stdout, "-hrtf File          : HRTF filter File used in BINAURAL output configuration\n" );
#else
    fprintf( stdout, "-hrtf File          : HRTF filter File used in ISm format and BINAURAL output configuration\n" );
#endif
#ifdef DEBUGGING
    fprintf( stdout, "-force_subframe_bin : Forces parametric binauralizer code to use 5 ms time resolution even when\n" );
    fprintf( stdout, "                      output time resolution is larger.\n" );
+3 −0
Original line number Diff line number Diff line
@@ -86,6 +86,9 @@ typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE;
typedef struct ivas_masa_qmetadata_frame_struct *IVAS_MASA_QMETADATA_HANDLE;

typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE;
#ifdef HRTF_BINARY_FILE
typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE;
#endif

#ifdef DEBUGGING
typedef enum
+10 −0
Original line number Diff line number Diff line
@@ -1354,6 +1354,16 @@ typedef enum

#define BINAURAL_COHERENCE_DIFFERENCE_BINS      9                           /* Number of bins for direction-dependent diffuse-field binaural coherence */

#ifdef HRTF_BINARY_FILE
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
    BINAURAL_INPUT_AUDIO_CONFIG_HOA,      // FOA, HOA2, HOA3
    BINAURAL_INPUT_AUDIO_CONFIG_UNDEFINED // Not used

} BINAURAL_INPUT_AUDIO_CONFIG;
#endif

/*----------------------------------------------------------------------------------*
 * TD Binaural Object renderer
+23 −0
Original line number Diff line number Diff line
@@ -5178,6 +5178,29 @@ ivas_error ivas_crend_process(
    float output[][L_FRAME48k]                                  /* i/o: input/output audio channels             */
);

#ifdef HRTF_BINARY_FILE

ivas_error ivas_HRTF_CRend_binary_open(
	HRTFS_CREND **hSetOfHRTF                                    /* i/o: Set of HRTF handle                      */
);

void ivas_HRTF_CRend_binary_close(
	HRTFS_CREND **hSetOfHRTF                                    /* i/o: Set of HRTF handle                      */
);

ivas_error ivas_crend_init_from_setofhrtf(
	Decoder_Struct *st_ivas     /* i/o: IVAS decoder structure                                 */
);

ivas_error ivas_crend_init_from_hrtf_handle(
	Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
	HRTFS_HANDLE hrtf);

ivas_error destroy_SetOfHRTF(
	HRTFS_CREND_HANDLE hSetOfHRTF    /* i/o: Set of HRTF CRend handle              */
);

#endif

/*----------------------------------------------------------------------------------*
 * Renderer configuration
+2 −0
Original line number Diff line number Diff line
@@ -152,6 +152,8 @@
#define LFE_NO_ENTROPY_CODING                           /* issue 65: changes to add no entropy coding in LFE */
#define FIX_79_MASA2TC_BITRATE_SWITCHING                /* Nokia: Fix issue 79 on MASA 2TC bitrate switching crash in decoder. */

#define HRTF_BINARY_FILE                                /* HRTF filters' binary file used for binaural rendering. */

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
#endif
Loading