Commit e58fe7b7 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch 'main' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into...

Merge branch 'main' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into extrend-osba-omasa-support-main
parents 15838fc7 c5a2b92f
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
variables:
  # note: GitLab cannot reference variables defined by users in the include ref:, we need to use a YAML anchor for this
  # see https://docs.gitlab.com/ci/yaml/includes/#use-variables-with-include for more information
  IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF 44cb5638949b874ce0f5c3bf4359f9db860d88bc
  IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF 41186736915f5c0a857ac92e8ab438c434e5247d

include:
  - local: .gitlab-ci/variables.yml
+95 −0
Original line number Diff line number Diff line
@@ -2462,7 +2462,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();
@@ -2470,6 +2477,94 @@ 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
     *------------------------------------------------------------------------------------------*/
+4 −0
Original line number Diff line number Diff line
@@ -1409,7 +1409,11 @@ Word32 BASOP_Util_Divide3232_Scale_newton( Word32 x, Word32 y, Word16 *s )
        *s = 0;
        return ( (Word32) 0 );
    }
#ifdef FIX_USAN_BASOP_UTIL_DIVIDE3232
    IF( EQ_32( y, (Word32) 0x80000000 ) )
#else
    IF( EQ_32( y, 0x80000000 ) )
#endif
    {
        /* Division by -1.0: same as negation of numerator */
        /* Return normalized negated numerator */
+18 −19
Original line number Diff line number Diff line
@@ -782,7 +782,6 @@ void computeDirectionVectors_fx(
 *
 *
 *------------------------------------------------------------------------*/

void computeDiffuseness_fixed(
    Word32 *buffer_intensity[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF], // i: Q(q_factor_intensity)
    const Word32 *buffer_energy,                                     // i: Q(q_factor_energy)
@@ -795,10 +794,10 @@ void computeDiffuseness_fixed(
{
    Word32 intensity_slow[DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX];
    Word32 intensity_slow_abs[CLDFB_NO_CHANNELS_MAX];
    Word64 tmp_intensity_slow_abs[CLDFB_NO_CHANNELS_MAX];
    Word16 intensity_slow_abs_exp[CLDFB_NO_CHANNELS_MAX];
    Word64 intensity_slow_abs_64[CLDFB_NO_CHANNELS_MAX];
    Word16 intensity_slow_abs_q[CLDFB_NO_CHANNELS_MAX];
    Word32 energy_slow[CLDFB_NO_CHANNELS_MAX];
    Word16 i, j, k, tmp16;
    Word16 i, j, k;
    Word32 tmp = 0;
    move32();
    Word32 *p_tmp;
@@ -808,10 +807,8 @@ void computeDiffuseness_fixed(

    /* Compute Intensity slow and energy slow buffer_intensity and buffer_energy */

    set_zero_fx( intensity_slow, DIRAC_NUM_DIMS * CLDFB_NO_CHANNELS_MAX );
    set_zero_fx( intensity_slow, i_mult( DIRAC_NUM_DIMS, CLDFB_NO_CHANNELS_MAX ) );
    set_zero_fx( intensity_slow_abs, CLDFB_NO_CHANNELS_MAX );
    set16_fx( intensity_slow_abs_exp, 0, CLDFB_NO_CHANNELS_MAX );
    set64_fx( tmp_intensity_slow_abs, 0, CLDFB_NO_CHANNELS_MAX );
    set_zero_fx( energy_slow, CLDFB_NO_CHANNELS_MAX );

    /* Calculate max possible shift for the buffer buffer_energy and buffer_intensity */
@@ -895,27 +892,31 @@ void computeDiffuseness_fixed(
        q_intensity = s_min( q_intensity, q_tmp );
    }

    scale_sig32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ), -2 );
    q_intensity = sub( q_intensity, 2 );
    min_q_shift1 = getScaleFactor32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ) );
    min_q_shift1 = sub( min_q_shift1, idiv1616( add( find_guarded_bits_fx( DIRAC_NUM_DIMS ), 1 ), 2 ) );
    scale_sig32( intensity_slow, i_mult( DIRAC_NUM_DIMS, num_freq_bands ), min_q_shift1 );
    q_intensity = add( q_intensity, min_q_shift1 );
    FOR( k = 0; k < num_freq_bands; k++ )
    {
        intensity_slow_abs_64[k] = 0;
        move64();
    }

    /* intensity_slow.^2 + intensity_slow_abs*/
    FOR( j = 0; j < DIRAC_NUM_DIMS; ++j )
    {
        p_tmp = intensity_slow + j * num_freq_bands;

        FOR( k = 0; k < num_freq_bands; k++ )
        {
            tmp_intensity_slow_abs[k] = W_mac_32_32( tmp_intensity_slow_abs[k], p_tmp[k], p_tmp[k] );
            move64();
            intensity_slow_abs_64[k] = W_add( intensity_slow_abs_64[k], W_mult_32_32( p_tmp[k], p_tmp[k] ) ); // 2*q_intensity+1
        }
    }

    FOR( k = 0; k < num_freq_bands; k++ )
    {
        tmp16 = W_norm( tmp_intensity_slow_abs[k] );
        intensity_slow_abs[k] = W_extract_h( W_shl( tmp_intensity_slow_abs[k], tmp16 ) );
        Word16 shift = W_norm( intensity_slow_abs_64[k] );
        intensity_slow_abs[k] = W_extract_h( W_shl( intensity_slow_abs_64[k], shift ) );
        move32();
        intensity_slow_abs_exp[k] = sub( 31, sub( add( add( shl( q_intensity, 1 ), 1 ), tmp16 ), 32 ) );
        intensity_slow_abs_q[k] = sub( add( add( q_intensity, q_intensity ), shift ), 31 );
        move16();
    }

@@ -925,8 +926,7 @@ void computeDiffuseness_fixed(
    move16();
    FOR( i = 0; i < num_freq_bands; ++i )
    {
        exp1 = intensity_slow_abs_exp[i];
        move16();
        exp1 = sub( 31, intensity_slow_abs_q[i] );
        tmp = Sqrt32( p_tmp[i], &exp1 );

        tmp = BASOP_Util_Divide3232_Scale_newton( tmp, L_add( energy_slow[i], EPSILLON_FX ), &exp2 );
@@ -965,7 +965,6 @@ void computeDiffuseness_fixed(
    return;
}


Word32 deindex_azimuth_fx(                             /* o  : output Q22                              */
                           Word16 id_phi,              /* i  : index                                   */
                           const Word16 no_bits,       /* i  : number of bits for the spherical grid   */
+8 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@
/*#define DEBUG_FORCE_DIR*/                       /* Force modes/parameters by reading from external binary files */
/*#define DBG_WAV_WRITER*/                    /* Enable dbgwrite_wav() function for generating ".wav" files */
#define SUPPORT_FORCE_TCX10_TCX20             /* VA: Enable -force tcx10|tcx20 command-line option */
/*#define DEBUG_MODE_JBM */                     /* define to output JBM relevant parameters */
#endif

#define SUPPORT_JBM_TRACEFILE                   /* Support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */
@@ -75,6 +76,9 @@
#define FIX_1379_MASA_ANGLE_ROUND

/* Note: each compile switch (FIX_1101_...) is independent from the other ones */
#define OPT_SBA_REND_V1_BE
#define OPT_HEAD_ROT_REND_V1_BE
#define OPT_SBA_DEC_V2_BE
#define OPT_SBA_ENC_V1_BE
#define OPT_BIN_RENDERER_V1
#define OPT_BIN_RENDERER_V2
@@ -106,7 +110,11 @@
#define REMOVE_EVS_DUPLICATES                   /* remove core-coder duplicated functions, ACELP low-band decoder */

#define FIX_1713_EXP                            /* VA: proposed correction to exp in ic-BWE*/
#define FIX_USAN_BASOP_UTIL_DIVIDE3232          /* Eri: Fix USAN error in BASOP_Util_Divide3232_Scale_newton by adding explicit type cast for -1 in hex */

#define FIX_1733_CLDFB_BUG
#define FIX_1740_MISING_POP_WMOPS               /* VA: fix issue 1740: missing pop_wmops() */

#define NONBE_FIX_864_JBM_RENDER_FRAMESIZE                    /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */

#endif
Loading