Commit 6b1025dc authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch 'hrtf_binary' into 'main'

Enable reading binaural ROM tables from file ( HRTF_BINARY )

See merge request !390
parents 61a88e5d 531fdb8e
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -66,5 +66,8 @@ __pycache__/
#history
.history/

#externals
Externals/

# coan output files that are created when cleaning out switches
coan_out_*
+3 −1
Original line number Diff line number Diff line
@@ -278,7 +278,8 @@ codec-smoke-test:
    ### analyze for failures
    - if cat smoke_test_output.txt | grep -c "failed"; then echo "Smoke test without PLC failed"; exit 1; fi
    - if cat smoke_test_output_plc.txt | grep -c "failed"; then echo "Smoke test with PLC failed"; exit 1; fi
    - if cat smoke_test_output_jbm_noEXT.txt | grep -c "failed"; then echo "Smoke test with PLC failed"; exit 1; fi
    - if cat smoke_test_output_jbm_noEXT.txt | grep -c "failed"; then echo "Smoke test JBM part failed"; exit 1; fi
    - if cat smoke_test_output_hrtf.txt | grep -c "failed"; then echo "Smoke test with external hrtf files failed"; exit 1; fi
  artifacts:
    name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--stage-$CI_JOB_STAGE--results"
    paths:
@@ -286,6 +287,7 @@ codec-smoke-test:
      - smoke_test_output.txt
      - smoke_test_output_plc.txt
      - smoke_test_output_jbm_noEXT.txt
      - smoke_test_output_hrtf.txt
    expose_as: "Smoke test results"

# code selftest testvectors with memory-sanitizer binaries
+42 −1
Original line number Diff line number Diff line
@@ -93,6 +93,10 @@ typedef struct
    float FER;
    bool hrtfReaderEnabled;
    char *hrtfFileName;
#ifdef HRTF_BINARY_FILE
    bool hrtfCRendReaderEnabled;
    char *hrtfCRendFileName;
#endif
    IVAS_DEC_INPUT_FORMAT inputFormat;
    bool customLsOutputEnabled;
    char *customLsSetupFilename;
@@ -218,7 +222,7 @@ int main(

    if ( arg.hrtfReaderEnabled )
    {
        if ( ( ( error = hrtfFileReader_open( arg.hrtfFileName, &hrtfReader ) ) != IVAS_ERR_OK ) )
        if ( ( error = hrtfFileReader_open( arg.hrtfFileName, &hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError: Can't open HRTF binary file %s \n\n", arg.hrtfFileName );
            goto cleanup;
@@ -440,6 +444,34 @@ 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 );
#ifndef FIX_FOR_TEST
            goto cleanup;
#endif
        }
        IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv;
        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 );
        }
        IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin;
        IVAS_DEC_GetHrtfParamBinHandle( hIvasDec, &hHrtfParambin );

        if ( ( error = load_parambin_HRTF_from_binary( hHrtfParambin, hrtfReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in loading HRTF binary file %s for parametric binauralizer \n\n", arg.hrtfCRendFileName );
        }
#endif
    }

    /*-----------------------------------------------------------------*
@@ -662,6 +694,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;

@@ -1030,7 +1067,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" );
+19 −0
Original line number Diff line number Diff line
@@ -73,9 +73,28 @@ if [ $BUILD -eq 1 ];then

fi

# run all modes vanilla-fashion
./scripts/runIvasCodec.py -p $cfg -U 1 $WORKERS | tee smoke_test_output.txt
# run the decoding again, but with 15% frame loss
./scripts/runIvasCodec.py -p $cfg -U 1 $WORKERS -D="-fec 15" --decoder_only | tee smoke_test_output_plc.txt

# run JBM modes - EXT is excluded as not supported yet
modes_with_no_ext_out=$(./scripts/runIvasCodec.py -l | grep -v MASA | grep -v ISM)
./scripts/runIvasCodec.py -m $modes_with_no_ext_out -p $cfg -U 1 $WORKERS --decoder_only --jbm_file $dly_profile | tee smoke_test_output_jbm_noEXT.txt
./scripts/runIvasCodec.py -C MASA ISM1 ISM2 ISM3 ISM4 -p $cfg -U 1 $WORKERS --decoder_only --jbm_file $dly_profile --oc BINAURAL BINAURAL_ROOM mono stereo FOA HOA3 5_1 7_1_4 | tee -a smoke_test_output_jbm_noEXT.txt

# run all modes with binaural output using external files
modes_with_bin_out="SBA PlanarSBA MASA MC ISM1 ISM2 ISM3 ISM4"
bin_out_modes="BINAURAL BINAURAL_ROOM"

wb_modes=$(./scripts/runIvasCodec.py -l -C $modes_with_bin_out | grep _wb_)
hrtf_wb="../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin"
./scripts/runIvasCodec.py -p $cfg -m $wb_modes -U 1 $WORKERS -D="-hrtf ${hrtf_wb}" --decoder_only | tee -a smoke_test_output_hrtf.txt

swb_modes=$(./scripts/runIvasCodec.py -l -C $modes_with_bin_out | grep _swb_)
hrtf_swb="../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin"
./scripts/runIvasCodec.py -p $cfg -m $swb_modes -U 1 $WORKERS -D="-hrtf ${hrtf_swb}" --decoder_only | tee -a smoke_test_output_hrtf.txt

fb_modes=$(./scripts/runIvasCodec.py -l -C $modes_with_bin_out | grep _fb_)
hrtf_fb="../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin"
./scripts/runIvasCodec.py -p $cfg -m $fb_modes -U 1 $WORKERS -D="-hrtf ${hrtf_fb}" --decoder_only | tee -a smoke_test_output_hrtf.txt
+8 −0
Original line number Diff line number Diff line
@@ -87,6 +87,14 @@ 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 HRTF_BINARY_FILE
typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE;

typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE;
#endif

#ifdef DEBUGGING
typedef enum
Loading