Commit 79f4fc4a authored by vaclav's avatar vaclav
Browse files

- Merge remote-tracking branch 'remotes/origin/main' into...

- Merge remote-tracking branch 'remotes/origin/main' into 945-wrong-return-value-in-ivas_dec_getnumorientationsubframes
parents 5bf043dd 87e93d91
Loading
Loading
Loading
Loading
Loading
+242 −419

File changed.

Preview size limit exceeded, changes collapsed.

+30 −0
Original line number Diff line number Diff line
variables:
  EVS_BE_TEST_DIR: "/usr/local/be_2_evs_test"
  EVS_BE_WIN_TEST_DIR: "C:/Users/gitlab-runner/testvec"
  PROCESSING_SCRIPTS_BIN_DIR: "/test-bin"
  SANITIZER_TESTS: "CLANG1 CLANG2 CLANG3"
  OUT_FORMATS_CHANNEL_BASED: "stereo mono 5_1 5_1_2 5_1_4 7_1 7_1_4"
  OUT_FORMATS_SCENE_BASED: "FOA HOA2 HOA3"
  OUT_FORMATS_BINAURAL: "BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB"
  OUT_FORMATS_ALL: "$OUT_FORMATS_CHANNEL_BASED $OUT_FORMATS_SCENE_BASED $OUT_FORMATS_BINAURAL EXT"
  MANUAL_PIPELINE_TYPE:
    description: "Type for the manual pipeline run. Use 'test-be-release' to run BE test against release codec."
    value: 'default'
    options:
      - 'default'
      - 'test-be-release'
      - 'test-long-self-test'
      - 'ivas-conformance'
      - 'ivas-conformance-linux'
      - 'check-clipping'
      - 'test-branch-vs-input-passthrough'

  PYTEST_ARGS: ""
  LONG_TEST_SUITE: "tests/codec_be_on_mr_nonselection tests/renderer --param_file scripts/config/self_test_ltv.prm --use_ltv"
  LONG_TEST_SUITE_NO_RENDERER: "tests/codec_be_on_mr_nonselection --param_file scripts/config/self_test_ltv.prm --use_ltv"
  SHORT_TEST_SUITE: "tests/codec_be_on_mr_nonselection"
  SHORT_TEST_SUITE_ENCODER: "tests/codec_be_on_mr_nonselection/test_param_file.py --param_file scripts/config/self_test_basop_encoder.prm"
  LONG_TEST_SUITE_ENCODER: "tests/codec_be_on_mr_nonselection/test_param_file.py --param_file scripts/config/self_test_ltv_basop_encoder.prm"
  TEST_SUITE: ""
  # note: currently overwrites default value from ci repo
  TESTCASE_TIMEOUT_STV_SANITIZERS: 240
+2 −2
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
#        cmake --build . --config Release


cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.10)

set(CMAKE_C_STANDARD 99)

@@ -121,7 +121,7 @@ if(WMOPS)
  add_definitions("-DWMOPS=1")
endif()

project(stereo-evs)
project(stereo-evs LANGUAGES C)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) # make Visual Studio projects look nicer
include(CTest)

+66 −49
Original line number Diff line number Diff line
@@ -69,22 +69,10 @@ static
#endif
    int32_t frame = 0; /* Counter of frames */

#ifdef DEBUGGING
#define MIN_NUM_BITS_ACTIVE_FRAME 56
#define NUM_BITS_SID_IVAS_5K2     104
#define MAX_OUTPUT_PCM_BUFFER_SIZE ( ( IVAS_MAX_OUTPUT_CHANNELS + IVAS_MAX_NUM_OBJECTS ) * IVAS_MAX_FRAME_SIZE )

#define ORIENT_TRK_NONE        ( 0 )
#define ORIENT_TRK_REF         ( 1 )
#define ORIENT_TRK_AVG         ( 2 )
#define ORIENT_TRK_REF_VEC     ( 3 )
#define ORIENT_TRK_REF_VEC_LEV ( 4 )

#ifdef VARIABLE_SPEED_DECODING
#define VARIABLE_SPEED_FETCH_FRAMESIZE_MS 20
#endif
#define JBM_FRONTEND_FETCH_FRAMESIZE_MS 20
#define HEADROTATION_FETCH_FRAMESIZE_MS 5
#define DEFAULT_FETCH_FRAMESIZE_MS      20


/*------------------------------------------------------------------------------------------*
@@ -129,7 +117,7 @@ typedef struct
    IVAS_DEC_INPUT_FORMAT inputFormat;
    bool customLsOutputEnabled;
    char *customLsSetupFilename;
    int16_t orientation_tracking;
    IVAS_HEAD_ORIENT_TRK_T orientation_tracking;
    bool non_diegetic_pan_enabled;
    float non_diegetic_pan_gain;
    bool renderConfigEnabled;
@@ -183,7 +171,7 @@ typedef struct
static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec );
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs );
#ifdef DEBUGGING
static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec );
@@ -359,7 +347,7 @@ int main(
        }

        /* sanity check */
        if ( arg.orientation_tracking != ORIENT_TRK_REF )
        if ( arg.orientation_tracking != IVAS_HEAD_ORIENT_TRK_REF )
        {
            fprintf( stderr, "\nError: Reference rotation file can be used in '-otr ref' mode only.\n\n" );
            goto cleanup;
@@ -386,7 +374,7 @@ int main(
        }

        /* sanity check */
        if ( arg.orientation_tracking != ORIENT_TRK_REF_VEC && arg.orientation_tracking != ORIENT_TRK_REF_VEC_LEV )
        if ( arg.orientation_tracking != IVAS_HEAD_ORIENT_TRK_REF_VEC && arg.orientation_tracking != IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV )
        {
            fprintf( stderr, "\nError: Reference trajectory file can be used in '-otr ref_vec' or '-otr ref_vec_lev' mode only.\n\n" );
            goto cleanup;
@@ -445,8 +433,9 @@ int main(
    asked_num_subframes = arg.render_num_subframes;
    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535;

    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.render_num_subframes, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain,
                                       arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.render_num_subframes, arg.customLsOutputEnabled, arg.hrtfReaderEnabled,
                                       arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled,
                                       arg.non_diegetic_pan_gain, arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -667,7 +656,8 @@ int main(

            if ( ( error = IVAS_DEC_SetRenderNumSubfr( hIvasDec, arg.render_num_subframes ) ) != IVAS_ERR_OK )
            {
                return error;
                fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }

            if ( arg.render_num_subframes != asked_num_subframes )
@@ -695,7 +685,7 @@ int main(

        /* ISAR frame size is set from command line, not renderer config file.
         * This will be ignored if output format is not split rendering. */
        renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) arg.render_num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS;
        renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) arg.render_num_subframes /* given in number of 5ms subframes */ * 5;

        if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK )
        {
@@ -751,6 +741,11 @@ int main(
    }

    pcmBuf = malloc( pcmBufSize * sizeof( int16_t ) );
    if ( pcmBuf == NULL )
    {
        fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" );
        goto cleanup;
    }

    /*-----------------------------------------------------------------*
     * Decoding
@@ -758,7 +753,7 @@ int main(

    if ( arg.voipMode )
    {
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec );
        error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, hIvasDec, pcmBuf );
    }
    else
    {
@@ -956,6 +951,10 @@ static bool parseCmdlIVAS_dec(
    int16_t i;
    char argv_to_upper[FILENAME_MAX];

    /*-----------------------------------------------------------------*
     * Set default values
     *-----------------------------------------------------------------*/

#ifdef DEBUGGING
    float ftmp;

@@ -964,7 +963,7 @@ static bool parseCmdlIVAS_dec(
    arg->agcBitstream = NULL;
#endif
#endif
    arg->output_Fs = 48000;
    arg->output_Fs = IVAS_MAX_SAMPLING_RATE;
    arg->outputConfig = IVAS_AUDIO_CONFIG_MONO;
    arg->decMode = IVAS_DEC_MODE_IVAS;
    arg->quietModeEnabled = false;
@@ -974,7 +973,7 @@ static bool parseCmdlIVAS_dec(

    arg->enableHeadRotation = false;
    arg->headrotTrajFileName = NULL;
    arg->orientation_tracking = ORIENT_TRK_NONE;
    arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_NONE;
    arg->enableReferenceRotation = false;
    arg->headrotTrajFileName = NULL;
    arg->enableReferenceVectorTracking = false;
@@ -1052,18 +1051,18 @@ static bool parseCmdlIVAS_dec(

        if ( strcmp( argv_to_upper, "-VOIP" ) == 0 )
        {
            arg->voipMode = 1;
            arg->voipMode = true;
            i++;
        }
        else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=0" ) == 0 )
        {
            arg->voipMode = 1;
            arg->voipMode = true;
            arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP;
            i++;
        }
        else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=1" ) == 0 )
        {
            arg->voipMode = 1;
            arg->voipMode = true;
            arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF;
            i++;
        }
@@ -1174,9 +1173,9 @@ static bool parseCmdlIVAS_dec(
                }
                arg->tsmScale = (uint16_t) tmp;

                if ( arg->tsmScale < 50 || arg->tsmScale > 150 )
                if ( arg->tsmScale < IVAS_TIME_SCALE_MIN || arg->tsmScale > IVAS_TIME_SCALE_MAX )
                {
                    fprintf( stderr, "Error: Scaling factor value must be 50 <= fac <= 150!\n\n" );
                    fprintf( stderr, "Error: Scaling factor value must be IVAS_TIME_SCALE_MIN <= fac <= IVAS_TIME_SCALE_MAX!\n\n" );
                    usage_dec();
                    return false;
                }
@@ -1213,6 +1212,8 @@ static bool parseCmdlIVAS_dec(
            {
                if ( !is_digits_only( argv[i] ) )
                {
                    fprintf( stderr, "Error: Render frame size is invalid or not specified!\n\n" );
                    usage_dec();
                    return false;
                }

@@ -1247,23 +1248,23 @@ static bool parseCmdlIVAS_dec(

            if ( strcmp( argv_to_upper, "NONE" ) == 0 )
            {
                arg->orientation_tracking = ORIENT_TRK_NONE;
                arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_NONE;
            }
            else if ( strcmp( argv_to_upper, "REF" ) == 0 )
            {
                arg->orientation_tracking = ORIENT_TRK_REF;
                arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_REF;
            }
            else if ( strcmp( argv_to_upper, "AVG" ) == 0 )
            {
                arg->orientation_tracking = ORIENT_TRK_AVG;
                arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_AVG;
            }
            else if ( strcmp( argv_to_upper, "REF_VEC" ) == 0 )
            {
                arg->orientation_tracking = ORIENT_TRK_REF_VEC;
                arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_REF_VEC;
            }
            else if ( strcmp( argv_to_upper, "REF_VEC_LEV" ) == 0 )
            {
                arg->orientation_tracking = ORIENT_TRK_REF_VEC_LEV;
                arg->orientation_tracking = IVAS_HEAD_ORIENT_TRK_REF_VEC_LEV;
            }
            else
            {
@@ -1658,7 +1659,7 @@ static void usage_dec( void )
#ifdef DEBUGGING
#ifdef VARIABLE_SPEED_DECODING
    fprintf( stdout, "-VS fac             : Variable Speed mode: change speed of playout fac as integer in percent.\n" );
    fprintf( stdout, "                      50 <= fac <= 150; fac<100 faster, fac>100 slower\n" );
    fprintf( stdout, "                      IVAS_TIME_SCALE_MIN <= fac <= IVAS_TIME_SCALE_MAX; fac<100 faster, fac>100 slower\n" );
#endif
#endif
    fprintf( stdout, "-fr L               : render frame size in ms L=(5,10,20), default is 20)\n" );
@@ -1794,14 +1795,6 @@ static ivas_error initOnFirstGoodFrame(
        return error;
    }

    int32_t pcmFrameSize;

    if ( ( error = IVAS_DEC_GetPcmFrameSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError in IVAS_DEC_GetPcmFrameSize, error code: %d\n", error );
        return error;
    }

    if ( isSplitRend )
    {
        /* Open split rendering metadata writer */
@@ -1859,7 +1852,19 @@ static ivas_error initOnFirstGoodFrame(
        }
    }

    int16_t pcmFrameSize;
    if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError in IVAS_DEC_GetOutputBufferSize, error code: %d\n", error );
        return error;
    }

    int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) );
    if ( zeroBuf == NULL )
    {
        fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" );
        return IVAS_ERR_FAILED_ALLOC;
    }
    memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) );

    for ( int16_t i = 0; i < numInitialBadFrames; ++i )
@@ -2073,6 +2078,17 @@ static ivas_error decodeG192(
    SplitFileReadWrite *splitRendWriter = NULL;
    int16_t isSplitRend, isSplitCoded;

#ifdef VARIABLE_SPEED_DECODING
    if ( arg.tsmEnabled )
    {
        if ( ( error = IVAS_DEC_EnableTsm( hIvasDec ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_DEC_EnableTsm, code: %d\n", error );
            return error;
        }
    }

#endif
    if ( ( error = IVAS_DEC_is_split_rendering_enabled( hIvasDec, &isSplitRend ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError in IVAS_DEC_is_split_rendering_enabled, code: %d\n", error );
@@ -2996,14 +3012,15 @@ static ivas_error decodeVoIP(
    RotFileReader *refRotReader,
    Vector3PairFileReader *referenceVectorReader,
    ObjectEditFileReader *objectEditFileReader,
    IVAS_DEC_HANDLE hIvasDec )
    IVAS_DEC_HANDLE hIvasDec,
    int16_t *pcmBuf )
{
    bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */
    ivas_error error = IVAS_ERR_OK;

    uint32_t nextPacketRcvTime_ms = 0;
    uint32_t systemTime_ms = 0;
    uint32_t systemTimeInc_ms = (uint32_t) JBM_FRONTEND_FETCH_FRAMESIZE_MS;
    uint32_t systemTimeInc_ms = (uint32_t) ( 1000 / IVAS_NUM_FRAMES_PER_SEC );
    int32_t nFramesFed = 0;

    uint8_t au[( IVAS_MAX_BITS_PER_FRAME + 7 ) >> 3];
@@ -3017,7 +3034,6 @@ static ivas_error decodeVoIP(
    MasaFileWriter *masaWriter = NULL;
    uint16_t numObj = 0;

    int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE];
    AudioFileWriter *afWriter = NULL;
#ifdef SUPPORT_JBM_TRACEFILE
    JbmTraceFileWriter *jbmTraceWriter = NULL;
@@ -3450,7 +3466,7 @@ static ivas_error decodeVoIP(
        {
            if ( ( error = IVAS_DEC_HasDecodedFirstGoodFrame( hIvasDec, &decodedGoodFrame ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "Error in IVAS_DEC_HasDecodedFirstGoodFrame, code: %d\n", error );
                fprintf( stderr, "Error in IVAS_DEC_HasDecodedFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }

@@ -3462,6 +3478,7 @@ static ivas_error decodeVoIP(
                if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, NULL, delayNumSamples_orig, &delayNumSamples, &delayTimeScale,
                                                     &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error in initOnFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }
            }
+22 −26
Original line number Diff line number Diff line
@@ -154,7 +154,6 @@ typedef struct
 * Local functions prototypes
 *------------------------------------------------------------------------------------------*/

static void initArgStruct( EncArguments *arg );
static bool parseCmdlIVAS_enc( int16_t argc, char *argv[], EncArguments *arg );
static void usage_enc( void );
static bool readBandwidth( FILE *file, IVAS_ENC_BANDWIDTH *bandwidth, int32_t *bandwidthFrameCounter );
@@ -207,8 +206,6 @@ int main(
    reset_mem( USE_BYTES );
#endif

    initArgStruct( &arg );

    /*------------------------------------------------------------------------------------------*
     * Parse command-line arguments
     *------------------------------------------------------------------------------------------*/
@@ -878,14 +875,29 @@ cleanup:
 * Local functions
 *-------------------------------------------------------------------*/

#define IVAS_DEFAULT_AGC ( 0 )
/*---------------------------------------------------------------------*
 * parseCmdlIVAS_enc()
 *
 * Encoder command-line parsing
 *---------------------------------------------------------------------*/

static void initArgStruct( EncArguments *arg )
static bool parseCmdlIVAS_enc(
    int16_t argc,
    char *argv[],
    EncArguments *arg )
{
    /* Set default values here */
    int16_t i, j;
    char argv_to_upper[FILENAME_MAX];
    char stmp[FILENAME_MAX];
    int32_t tmp;

    /*-----------------------------------------------------------------*
     * Set default values
     *-----------------------------------------------------------------*/

    arg->inputWavFilename = NULL;
    arg->outputBitstreamFilename = NULL;
    arg->inputFs = 0;
    arg->inputFs = IVAS_MAX_SAMPLING_RATE;
    arg->inputFormat = IVAS_ENC_INPUT_MONO;
    arg->is_binaural = false;
    arg->inputFormatConfig.stereoToMonoDownmix = false;
@@ -919,25 +931,9 @@ static void initArgStruct( EncArguments *arg )
#endif
    arg->pca = false;

    return;
}


/*---------------------------------------------------------------------*
 * parseCmdlIVAS_enc()
 *
 * Encoder command-line parsing
 *---------------------------------------------------------------------*/

static bool parseCmdlIVAS_enc(
    int16_t argc,
    char *argv[],
    EncArguments *arg )
{
    int16_t i, j;
    char argv_to_upper[FILENAME_MAX];
    char stmp[FILENAME_MAX];
    int32_t tmp;
    /*-----------------------------------------------------------------*
     * Initialization
     *-----------------------------------------------------------------*/

    if ( argc < 5 )
    {
Loading