Commit 652163f6 authored by Marek Szczerba's avatar Marek Szczerba
Browse files

Merge branch 'philips/contribution-38-control-metadata-reverb' into...

Merge branch 'philips/contribution-38-control-metadata-reverb' into philips/contribution-38-control-metadata-reverb-acoustic-environment-payload
parents 81183cb7 0447a7cf
Loading
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -266,6 +266,7 @@ build-codec-instrumented-linux:
  extends:
    - .build-job-linux
    - .rules-basis
  timeout: "6 minutes"
  script:
    - *print-common-info
    - bash ci/build_codec_instrumented_linux.sh
@@ -658,6 +659,32 @@ clang-format-check:
    name: "$ARTIFACT_BASE_NAME"
    expose_as: 'formatting patch'

# check for crashes if first received frame on decoder side is an SID
.check-first-frame-is-sid:
  extends:
    - .test-job-linux-needs-testv-dir
    - .rules-merge-request
  tags:
    - ivas-linux
  stage: test
  needs: ["build-codec-linux-cmake"]
  script:
    - *print-common-info
    - *update-ltv-repo
    - cmake .
    - make -j

    # TODO: for some MASA modes, we currently do not have testvectors that actually trigger DTX
    - modes=$(scripts/runIvasCodec.py -l | grep dtx | grep -v MASA)
    - echo $modes
    - scripts/runIvasCodec.py -p scripts/config/ci_linux_sidstart_test.json -m $modes -s --bs_length 500
  artifacts:
    paths:
      - out/logs
    when: on_failure
    name: "$CI_JOB_NAME--$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--sidstart"
    expose_as: "logs-sidstart"

# ---------------------------------------------------------------
# Test jobs for main branch
# ---------------------------------------------------------------
+33 −1
Original line number Diff line number Diff line
@@ -98,6 +98,9 @@ typedef struct
    char *outputBitstreamFilename;
    int32_t inputFs;
    IVAS_ENC_INPUT_FORMAT inputFormat;
#ifdef BINAURAL_AUDIO_CMDLINE
    bool is_binaural;
#endif
    EncInputFormatConfig inputFormatConfig;
    bool max_bwidth_user;
    IVAS_ENC_BANDWIDTH maxBandwidth;
@@ -362,17 +365,29 @@ int main(
    switch ( arg.inputFormat )
    {
        case IVAS_ENC_INPUT_MONO:
#ifdef BINAURAL_AUDIO_CMDLINE
            if ( ( error = IVAS_ENC_ConfigureForMono( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, caConfig, arg.inputFormatConfig.stereoToMonoDownmix, arg.is_binaural ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_ENC_ConfigureForMono( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, caConfig, arg.inputFormatConfig.stereoToMonoDownmix ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nIVAS_ENC_ConfigureForMono failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
                goto cleanup;
            }
            break;
        case IVAS_ENC_INPUT_STEREO:
#ifdef BINAURAL_AUDIO_CMDLINE
#ifdef DEBUGGING
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.is_binaural, arg.inputFormatConfig.stereoMode ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.is_binaural ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef DEBUGGING
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig, arg.inputFormatConfig.stereoMode ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_ENC_ConfigureForStereo( hIvasEnc, arg.inputFs, totalBitrate, arg.max_bwidth_user, bandwidth, arg.dtxConfig ) ) != IVAS_ERR_OK )
#endif
#endif
            {
                fprintf( stderr, "\nIVAS_ENC_ConfigureForStereo failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
@@ -865,6 +880,9 @@ static void initArgStruct( EncArguments *arg )
    arg->outputBitstreamFilename = NULL;
    arg->inputFs = 0;
    arg->inputFormat = IVAS_ENC_INPUT_MONO;
#ifdef BINAURAL_AUDIO_CMDLINE
    arg->is_binaural = false;
#endif
    arg->inputFormatConfig.stereoToMonoDownmix = false;
    arg->max_bwidth_user = false;
    arg->maxBandwidth = IVAS_ENC_BANDWIDTH_UNDEFINED;
@@ -1207,6 +1225,16 @@ static bool parseCmdlIVAS_enc(
         * IVAS Formats
         *-----------------------------------------------------------------*/

#ifdef BINAURAL_AUDIO_CMDLINE
        else if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 )
        {
            i++;
            if ( strcmp( argv_to_upper, "-BINAURAL" ) == 0 )
            {
                arg->is_binaural = true;
            }
        }
#endif
        else if ( strcmp( argv_to_upper, "-STEREO" ) == 0 )
        {
            i++;
@@ -1487,9 +1515,10 @@ static bool parseCmdlIVAS_enc(
        {
            arg->inputFormat = IVAS_ENC_INPUT_MONO;
            arg->inputFormatConfig.stereoToMonoDownmix = true;

            i++;
        }
        else if ( strcmp( argv_to_upper, "-BYPASS" ) == 0 ) // VE: should be renamed to "-pca"
        else if ( strcmp( argv_to_upper, "-BYPASS" ) == 0 ) // TODO: should be renamed to "-pca"
        {
            i++;
            if ( i < argc - 4 )
@@ -1674,6 +1703,9 @@ static void usage_enc( void )
    fprintf( stdout, "Options:\n" );
    fprintf( stdout, "--------\n" );
    fprintf( stdout, "EVS mono is default, for IVAS choose one of the following: -stereo, -ism, -sba, -masa, -mc\n" );
#ifdef BINAURAL_AUDIO_CMDLINE
    fprintf( stdout, "-binaural           : Optional indication that input is binaural audio (to be used with -stereo or -stereo_dmx_evs)\n" );
#endif
    fprintf( stdout, "-stereo             : Stereo format \n" );
    fprintf( stdout, "-ism (+)Ch Files    : ISM format \n" );
    fprintf( stdout, "                      where Ch specifies the number of ISMs (1-4)\n" );
+5 −1
Original line number Diff line number Diff line
@@ -262,7 +262,11 @@ static const CmdLnParser_Option cliOptions[] = {
        .id = CmdLnOptionId_nonDiegeticPan,
        .match = "non_diegetic_pan",
        .matchShort = "ndp",
#ifdef FIX_TODO_NON_DIEGETIC_PAN_NOT_IMPLELENTED_IN_RENDERER
        .description = "Panning mono non diegetic sound to stereo -90<= pan <= 90\nleft or l or 90->left, right or r or -90->right, center or c or 0 ->middle\n",
#else
        .description = "Panning mono non diegetic sound to stereo -90<= pan <= 90\nleft or l or 90->left, right or r or -90->right, center or c or 0 ->middle\n(todo: implementation)",
#endif
    },
    {
        .id = CmdLnOptionId_orientationTracking,
@@ -1054,7 +1058,7 @@ int main(
        else
        {
            error = IVAS_REND_SetHeadRotation( hIvasRend, NULL, NULL );
            if ( ( error != IVAS_ERR_OK ) && ( error != IVAS_ERR_INVALID_OUTPUT_FORMAT ) ) // VE: TBC
            if ( error != IVAS_ERR_OK && error != IVAS_ERR_INVALID_OUTPUT_FORMAT )
            {
                fprintf( stderr, "Error setting Head Rotation: %s\n", ivas_error_to_string( error ) );
                exit( -1 );
+2 −2
Original line number Diff line number Diff line
@@ -737,7 +737,7 @@ ivas_error config_acelp1(
                }
                else /* L_frame == L_FRAME16k */
                {
                    acelp_cfg->lsf_bits = 41; /* TBV: currently LSFQ @16kHz is not flexible (only 31/41 bits supported */
                    acelp_cfg->lsf_bits = 41;
                }
            }

@@ -1360,7 +1360,7 @@ ivas_error config_acelp1(
                    acelp_cfg->ubits = acelp_cfg->lsf_bits - 46;
                    acelp_cfg->lsf_bits = 46;
                }
                else if ( acelp_cfg->lsf_bits > 42 && L_frame == L_FRAME ) /* TBV: verify maximum supported LSF Q bitbudget (for some reason 43 bits LSFQ decreases segSNR by 0.7 dB) */
                else if ( acelp_cfg->lsf_bits > 42 && L_frame == L_FRAME )
                {
                    acelp_cfg->ubits = acelp_cfg->lsf_bits - 42;
                    acelp_cfg->lsf_bits = 42;
+83 −8
Original line number Diff line number Diff line
@@ -907,16 +907,22 @@ int16_t get_ivas_max_num_indices_metadata( /* o
 * Move indices inside the buffer or among two buffers
 *-------------------------------------------------------------------*/

#ifdef FIX_545_ASSERT
void move_indices(
#else
ivas_error move_indices(
#endif
    INDICE_HANDLE old_ind_list, /* i/o: old location of indices */
    INDICE_HANDLE new_ind_list, /* i/o: new location of indices */
    const int16_t nb_indices    /* i  : number of moved indices */
)
{
    int16_t i;
#ifndef FIX_545_ASSERT
    ivas_error error;

    error = IVAS_ERR_OK;
#endif

    if ( new_ind_list < old_ind_list )
    {
@@ -941,7 +947,11 @@ ivas_error move_indices(
        }
    }

#ifdef FIX_545_ASSERT
    return;
#else
    return error;
#endif
}

#endif
@@ -969,13 +979,24 @@ ivas_error check_ind_list_limits(
    if ( ( &hBstr->ind_list[hBstr->nb_ind_tot] - ivas_ind_list_zero ) >= *( hBstr->ivas_max_num_indices ) )
    {
#ifdef DEBUGGING
#ifdef FIX_545_ASSERT
        fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame );
#else
        /* TODO: replace with the warning message below before the finalization of the IVAS codec */
        /* fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame ); */
        assert( 0 && "The maximum number of indices has been exceeded! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata()." );
#endif
#endif

        /* reallocate the buffer of indices with increased limit */
#ifdef FIX_545_ASSERT
        if ( ( error = ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#else
        ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES );
#endif
    }

    /* check, if we will not overwrite an existing indice */
@@ -996,13 +1017,24 @@ ivas_error check_ind_list_limits(
            if ( hBstr->ind_list >= ivas_ind_list_last )
            {
#ifdef DEBUGGING
#ifdef FIX_545_ASSERT
                fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame );
#else
                /* TODO: replace with the warning message below before the finalization of the IVAS codec */
                /* fprintf( stderr, "Warning: The maximum number of indices %d has been exceeded in frame %d! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata().\n", *( hBstr->ivas_max_num_indices ), frame ); */
                assert( 0 && "The maximum number of indices has been exceeded! Increase the limits in get_ivas_max_num_indices() or get_max_num_indices_metadata()." );
#endif
#endif

                /* no available empty slot -> need to re-allocate the buffer */
#ifdef FIX_545_ASSERT
                if ( ( error = ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
#else
                ind_list_realloc( hBstr, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES );
#endif
            }
        }
        else
@@ -1080,8 +1112,15 @@ ivas_error push_indice(

#ifdef IND_LIST_DYN
    /* check the limits of the list of indices */
#ifdef FIX_545_ASSERT
    if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK )
    {
        return IVAS_ERROR( error, "Error occured in push_indice() while re-allocating the list of indices (frame %d) !\n", frame );
    }
#else
    error = check_ind_list_limits( hBstr );
#endif
#endif

#ifdef IND_LIST_DYN
    /* find the location in the list of indices based on ID */
@@ -1203,8 +1242,15 @@ ivas_error push_next_indice(

#ifdef IND_LIST_DYN
    /* check the limits of the list of indices */
#ifdef FIX_545_ASSERT
    if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#else
    error = check_ind_list_limits( hBstr );
#endif
#endif

#ifdef IND_LIST_DYN
    /* get the id of the previous indice -> it will be re-used */
@@ -1246,9 +1292,17 @@ ivas_error push_next_indice(
 *-------------------------------------------------------------------*/

#ifdef DEBUG_BS_READ_WRITE
#ifdef FIX_545_ASSERT
ivas_error push_next_bits_(
#else
void push_next_bits_(
#endif
#else
#ifdef FIX_545_ASSERT
ivas_error push_next_bits(
#else
void push_next_bits(
#endif
#endif
    BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle                     */
    const uint16_t bits[], /* i  : bit buffer to pack, sequence of single bits  */
@@ -1265,6 +1319,11 @@ void push_next_bits(
    Indice *ptr;
#ifdef IND_LIST_DYN
    int16_t prev_id;
#ifdef FIX_545_ASSERT
    ivas_error error;

    error = IVAS_ERR_OK;
#endif
#endif
#ifdef DEBUG_BS_READ_WRITE
    printf( "%s: %d: %d\n", func, line, nb_bits );
@@ -1293,7 +1352,14 @@ void push_next_bits(

#ifdef IND_LIST_DYN
        /* check the limits of the list of indices */
#ifdef FIX_545_ASSERT
        if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK )
        {
            return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices (frame %d) !\n", frame );
        }
#else
        check_ind_list_limits( hBstr );
#endif
        ptr = &hBstr->ind_list[hBstr->nb_ind_tot];
#endif

@@ -1313,7 +1379,14 @@ void push_next_bits(
    {
#ifdef IND_LIST_DYN
        /* check the limits of the list of indices */
#ifdef FIX_545_ASSERT
        if ( ( error = check_ind_list_limits( hBstr ) ) != IVAS_ERR_OK )
        {
            return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices (frame %d) !\n", frame );
        }
#else
        check_ind_list_limits( hBstr );
#endif
        ptr = &hBstr->ind_list[hBstr->nb_ind_tot];
#endif

@@ -1334,7 +1407,11 @@ void push_next_bits(
#endif
    hBstr->nb_bits_tot = hBstr->nb_bits_tot + nb_bits;

#ifdef FIX_545_ASSERT
    return error;
#else
    return;
#endif
}


@@ -1535,10 +1612,12 @@ uint16_t get_indice(
{
    uint16_t value;
    int16_t i;
    int32_t nbits_total;

    assert( nb_bits <= 16 );
    int32_t nbits_total;

    nbits_total = st->total_brate / FRAMES_PER_SEC;

    /* detect corrupted bitstream */
    if ( pos + nb_bits > nbits_total )
    {
@@ -2903,9 +2982,6 @@ ivas_error preview_indices(
                break;
            case SID_ISM:
                st_ivas->ivas_format = ISM_FORMAT;
                /* temporary hack to make mode signaling work with the current 1-object ISM DTX: read padding bits */
                /* Todo: how to apply this here? maybe pt_stream += ... would work? */
                /* st->bit_stream += ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; */
                break;
            case SID_MULTICHANNEL:
                st_ivas->ivas_format = MC_FORMAT;
@@ -3070,7 +3146,7 @@ ivas_error read_indices(
    file_read_FECpattern( &st_ivas->bfi );
    st_ivas->bfi |= bfi;

    if ( bfi == FRAMEMODE_MISSING ) /* TODO(mcjbm): This fixes channel-aware mode BE. Still requires review from a bitstream reading expert */
    if ( bfi == FRAMEMODE_MISSING )
    {
        for ( k = 0; k < num_bits; k++ )
        {
@@ -3236,7 +3312,7 @@ ivas_error read_indices(

    /* handle bad/lost speech frame(and CS bad SID frame) in the decoders CNG synthesis settings pair (total_brate, bfi) */
    if ( (
             bfi != FRAMEMODE_FUTURE &&                                            /* TODO(mcjbm): This fixes channel-aware mode BE. Still requires review from a bitstream reading expert */
             bfi != FRAMEMODE_FUTURE &&
             ( *CNG != 0 ) && ( ( speech_bad != 0 ) || ( speech_lost != 0 ) ) ) || /* SP_BAD or SPEECH_LOST)   --> stay in CNG */
         ( sid_upd_bad != 0 ) )                                                    /* SID_UPD_BAD              --> start CNG */
    {
@@ -3280,8 +3356,7 @@ ivas_error read_indices(
    }

    /* GOOD frame */
    if ( st_ivas->bfi == 0 || st_ivas->bfi == FRAMEMODE_FUTURE /* TODO(mcjbm): This fixes channel-aware mode BE. Still requires review from a bitstream reading expert */
    )
    if ( st_ivas->bfi == 0 || st_ivas->bfi == FRAMEMODE_FUTURE )
    {
        /* GOOD frame - convert ITU-T G.192 words to short values */
        st_ivas->hDecoderConfig->ivas_total_brate = total_brate;
Loading