Commit 27c67d12 authored by norvell's avatar norvell
Browse files

Merge branch 'main' into ivas-conformance-windows

parents 65dedc33 3a0ecd3b
Loading
Loading
Loading
Loading
Loading
+94 −0
Original line number Diff line number Diff line
@@ -3425,7 +3425,14 @@ static ivas_error decodeVoIP(
        }
        vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
        frame++;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
        if ( vec_pos_update == 0 )
        {
            systemTime_ms += vec_pos_len * systemTimeInc_ms;
        }
#else
        systemTime_ms += systemTimeInc_ms;
#endif

#ifdef WMOPS
        update_mem();
@@ -3433,6 +3440,93 @@ static ivas_error decodeVoIP(
#endif
    }


#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    int16_t nSamplesFlushed = 0;

    /* decode and get samples */
#ifdef SPLIT_REND_WITH_HEAD_ROT
    if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, IVAS_DEC_PCM_INT16, (void *) pcmBuf, &nSamplesFlushed ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, pcmBuf, &nSamplesFlushed ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nError in IVAS_DEC_VoIP_Flush: %s\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }

    if ( nSamplesFlushed )
    {
        /* Write current frame */
        if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, nSamplesFlushed * nOutChannels ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nOutput audio file writer error\n" );
            goto cleanup;
        }

        /* Write ISm metadata to external file(s) */
        if ( decodedGoodFrame && arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL )
        {
            if ( bsFormat == IVAS_DEC_BS_OBJ || bsFormat == IVAS_DEC_BS_MASA_ISM || bsFormat == IVAS_DEC_BS_SBA_ISM )
            {
                if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetNumObjects: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }

                for ( i = 0; i < numObj; ++i )
                {
                    IVAS_ISM_METADATA IsmMetadata;

                    if ( ( error = IVAS_DEC_GetObjectMetadata( hIvasDec, &IsmMetadata, 0, i ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError in IVAS_DEC_GetObjectMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                        goto cleanup;
                    }

                    if ( ( IsmFileWriter_writeFrame( IsmMetadata, ismWriters[i] ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError writing ISM metadata to file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) );
                        goto cleanup;
                    }
                }
            }

            if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
            {
                IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
                int16_t fullDelayNumSamples[3];
                float delayMs;

                /* delayNumSamples is zeroed, and delayNumSamples_orig is updated only on first good frame, so need to re-fetch delay info */
                if ( ( error = IVAS_DEC_GetDelay( hIvasDec, fullDelayNumSamples, &delayTimeScale ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
                }
#endif
                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }

#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
                delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale );
                if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK )
#else
                if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
                    goto cleanup;
                }
            }
        }
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Add zeros at the end to have equal length of synthesized signals
     *------------------------------------------------------------------------------------------*/
+16 −31
Original line number Diff line number Diff line
@@ -14,39 +14,20 @@ def main(args):
        collect_for_sanitizer_test(file)


def find_failed_files_for_sanitizer_test(
    console_log: list, subfolder: str, which="LOGS"
) -> dict():
def find_failed_files_for_sanitizer_test(console_log: list) -> dict():

    assert which in ["LOGS", "FILE_BASENAMES"]

    pattern_line = "(Encoding|Decoding) failed .*for \/.*(CLANG.|VALGRIND)\/(.*)"
    pattern_file = "(.*_b[0-9]*_.*_rs|.*_b[0-9]*_.*_cbr).*"
    pattern_line = r"(CLANG.) reports . error\(s\) for (.*)"

    files_found = dict()
    for line in console_log:
        m_line = re.match(pattern_line, line)

        if m_line is not None:
            _, test, filename = m_line.groups()
            filename = pathlib.Path(filename).name
            m_file = re.match(pattern_file, filename)
            if m_file is None:
                print(f"Unexpected: no match on {filename} with {pattern_file} - skip")
                continue
            filename_start = m_file.groups()[0]

            if which == "LOGS":
                folder = pathlib.Path(f"{test}/{subfolder}/")
                files = [
                    f for f in folder.iterdir() if f.name.startswith(filename_start)
                ]
            elif which == "FILE_BASENAMES":
                files = [filename_start]
            test, filename = m_line.groups()
            if test in files_found:
                files_found[test].extend(files)
                files_found[test].append(filename)
            else:
                files_found[test] = files
                files_found[test] = [filename]

    return files_found

@@ -56,16 +37,20 @@ def collect_for_sanitizer_test(file):
    with open(file) as f:
        console_log = f.readlines()

    files_to_archive_noPLC = find_failed_files_for_sanitizer_test(
        console_log, "logs_noPLC"
    )
    files_to_archive = find_failed_files_for_sanitizer_test(console_log, "logs")
    start_indicators = ["Adding config" in l for l in console_log]
    idx_first_run = start_indicators.index(True)
    idx_second_run = start_indicators[idx_first_run + 1:].index(True) + idx_first_run + 1
    no_plc_part = console_log[idx_first_run:idx_second_run]
    plc_part = console_log[idx_second_run:]

    files_to_archive_noPLC = find_failed_files_for_sanitizer_test(no_plc_part)
    files_to_archive_PLC = find_failed_files_for_sanitizer_test(plc_part)

    log_folder = pathlib.Path("./LOGS_PLC")
    log_folder.mkdir()
    for test in files_to_archive.keys():
    for test in files_to_archive_PLC.keys():
        log_folder.joinpath(test).mkdir()
    for test, files in files_to_archive.items():
    for test, files in files_to_archive_PLC.items():
        folder = log_folder.joinpath(test)
        for p in files:
            source = pathlib.Path(p)
@@ -79,7 +64,7 @@ def collect_for_sanitizer_test(file):
    for test, files in files_to_archive_noPLC.items():
        folder = log_folder_noPLC.joinpath(test)
        for p in files:
            source = pathlib.Path(p)
            source = pathlib.Path(p.replace("/logs/", "/logs_noPLC/"))
            target = folder.joinpath(source.name)
            source.rename(target)

+1 −3
Original line number Diff line number Diff line
@@ -180,9 +180,7 @@ def run_check(in_format: str, out_formats: list, tests: list, run_fec: bool = Tr
    # delete bitstream files for all failed modes to prevent follow-up errors in decoder-only run
    with open(CONSOLE_OUT_FILE) as f:
        console_log = f.readlines()
    failed_files = find_failed_files_for_sanitizer_test(
        console_log, "logs", "FILE_BASENAMES"
    )
    failed_files = find_failed_files_for_sanitizer_test(console_log)
    for t in failed_files.keys():
        bs_folder = pathlib.Path(f"{t}/enc")
        file_starts = failed_files[t]
+0 −2
Original line number Diff line number Diff line
@@ -1225,9 +1225,7 @@ enum
#define MASA_BIT_REDUCT_PARAM                   10
#define MASA_MAXIMUM_TWO_DIR_BANDS              24
#define NBITS_HR_COH                            4
#ifdef NONBE_FIX_982_OMASA_DELAY_COMP_5MS
#define OMASA_TDREND_MATCHING_GAIN              0.7943f
#endif

#define MASA_JBM_RINGBUFFER_FRAMES              3

lib_com/options.h

100755 → 100644
+11 −17
Original line number Diff line number Diff line
@@ -57,7 +57,6 @@
/*#define MEM_COUNT_DETAILS*/                   /* Output detailed memory analysis for the worst-case frame (writes to the file "mem_analysis.csv") */

#ifdef DEBUGGING

/*#define DEBUG_MODE_INFO*/                     /* output most important parameters to the subdirectory "res/" */
#ifdef DEBUG_MODE_INFO
/*#define DEBUG_MODE_ACELP*/                    /* output most important ACELP core parameters to the subdirectory "res/" */
@@ -72,6 +71,8 @@
/*#define DEBUG_MODE_INFO_PLC */                /* define to output PLC related parameters */
/*#define DEBUG_MODE_INFO_ALLRAD*/              /* define to output generated HOA decoding mtx */
/*#define DEBUG_MODE_LFE */                     /* define to output LFE relevant parameters */
/*#define DEBUG_MODE_ORIENTATION */             /* define to output combined orientation relevant parameters */               
/*#define DEBUG_MODE_JBM */                     /* define to output JBM relevant parameters */
#endif

#ifdef DEBUG_MODE_MDCT
@@ -128,6 +129,7 @@
/*#define DEBUG_AGC_ENCODER_CMD_OPTION*/        /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */
/*#define DEBUG_JBM_CMD_OPTION*/                /* ability for telling the decoder the frontend fetch size and to not delay compensate for bad frames at the beginning */
/*#define VARIABLE_SPEED_DECODING*/             /* variable speed decoding employing the JBM functioniality; move to DEBUGGING after build for disabled is fixed */
/*#define DISABLE_LIMITER*/                     /* disable the limiter */

/*Split Rendering Debug switches*/
/*#define DBG_WAV_WRITER*/                      /* add debugging function dbgwrite_wav() */
@@ -153,6 +155,7 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
/*#define SPLIT_REND_WITH_HEAD_ROT  */                  /* Dlb,FhG: Split Rendering contributions 21 and 35 */

#define FIX_777_COMBI_RENDER_CONFIG_FILE                      /* Philips: Fix for combined renderer config file support */
#define FIX_966_VAR_OVERFLOW_IN_HARM_MODEL_ARI          /* FhG: fix and undef behaviour bug in the harmonic TCX model arithmetic coder */
#define FIX_699_FILE_READER_JBM_TSM                     /* VA: issue 699: complement FileReader_getFilePath() logic for TSM and JBM */
#define FIX_997_REMOVE_SPAR_DEC_UPMIXER                 /* VA: issue 997: remove obsolete function ivas_spar_dec_upmixer() */
@@ -160,8 +163,7 @@
#define FIX_1003_PARAMISM_BINAURAL_RECONFIG_USAN        /* FhG: fix for #1003: fix USAN caused by ParamISM reconfig                    */
#define FIX_1001_ARI_HM_OVERFLOW                        /* FhG: fix for undef behaviour in in the harmonic TCX model arithmetic coder */
#define FIX_901_PARAMMC_DEAD_CODE                       /* FhG: issue 901: remove dead ParamMC code             */


#define FIX_1008_EXTORIENT_TARGET_INTERPOLATION          /* FhG: issue #1008, external orientation init was wrong for 5ms */


/* #################### End BE switches ################################## */
@@ -170,17 +172,7 @@
/* any switch which is non-be wrt selection floating point code */
/* all switches in this category should start with "NONBE_" */

#define BE_FIX_567_DOUBLE_STEREO_DMX                          /* NTT: Fix formal issues */   
#define NONBE_FIX_567_DOUBLE_STEREO_DMX                       /* Orange: Double-precision replaced by single-precision */   
#define NONBE_FIX_947_STEREO_DMX_EVS_POC                      /* Orange: Fix clicks on POC */
#ifdef NONBE_FIX_947_STEREO_DMX_EVS_POC
#define NONBE_FIX_947_STEREO_DMX_ROMOPT                       /* Orange: ROM optimisation for POC*/  
#endif
#define NONBE_FIX_947_STEREO_DMX_EVS_PHA                      /* Orange: Fix issues on PHA */
#ifdef NONBE_FIX_947_STEREO_DMX_EVS_PHA
#define NONBE_FIX_947_STEREO_DMX_FADOPT                       /* Orange: Fading optimisation */  
#endif                                                                                     
#define NONBE_FIX_982_OMASA_DELAY_COMP_5MS                    /* FhG : issue #982 : 5ms and 20ms output different for OMASA */
#define NONBE_FIX_978_MC_TDREND_REVERB                        /* Eri : activate reverb for TDREND with headtracking */

#ifdef SPLIT_REND_WITH_HEAD_ROT
#define SPLIT_REND_LCLD_5MS                                   /* Dlb: LCLD 5ms framing operation  */
@@ -189,7 +181,9 @@
#define NONBE_FIX_984_OMASA_EXT_OUTPUT                        /* Nokia: issue #984: complete the OMASA EXT output implementation */
#define NONBE_FIX_1000_G1_G2_SWB_TBE                          /* VA: issue 1000: avoid div by zero due to g1 + g2 being zero in SWB TBE */
#define NONBE_FIX_999_JBM_MCT_FLUSH                           /* FhG: issue #999: fix wrong flushing for MCT at a JBM rate switch */

#define NONBE_FIX_991_PARAMBIN_BINARY_HRTF                    /* Nokia: issue #991: fix using of binary file HRTF in ParamBin */
#define NONBE_FIX_1005_MC_RS_TCBUFFER_UPDATE                  /* FhG: issue #1005: fix TC Buffer update at a MC rate switch */
#define NONBE_FIX_864_JBM_RENDER_FRAMESIZE                    /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */
/* ##################### End NON-BE switches ########################### */

/* ################## End DEVELOPMENT switches ######################### */
Loading