Commit 16cde909 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

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

Merge remote-tracking branch 'origin/main' into float-1493-improve-stability-of-decisions-in-masa-metadata-reduction-in-encoder
parents 585729e5 efe53129
Loading
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -259,37 +259,19 @@ uint32_t ivas_syn_output(
    int16_t *synth_out                                          /* o  : integer 16 bits synthesis signal        */
);

#ifdef FIX_BASOP_2396_CONSTANT_STRIDE_IN_TC_BUFFER
void ivas_buffer_interleaved_to_deinterleaved(
    float *audio_in,                                            /* i  : interleaved audio buffer                                 */
    float *audio_out[],                                         /* o  : pointers to each channel of deinterleaved audio buffer   */
    const int16_t n_channels,                                   /* i  : number of channels                                       */
    const int16_t frame_length                                  /* i  : frame length (one channel)                               */
);
#else
void ivas_buffer_interleaved_to_deinterleaved(
    float *audio,                                               /* i/o: audio buffer                            */
    const int16_t n_channels,                                   /* i  : number of channels                      */
    const int16_t frame_length,                                 /* i  : frame length (one channel)              */
    const int16_t n_samp_full                                   /* i  : full frame length (one channel)         */
);
#endif

#ifdef FIX_BASOP_2396_CONSTANT_STRIDE_IN_TC_BUFFER
void ivas_buffer_deinterleaved_to_interleaved(
    float *audio_in[],                                          /* i  : pointers to each channel of deinterleaved audio buffer  */
    float *audio_out,                                           /* o  : interleaved audio buffer                                */
    const int16_t n_channels,                                   /* i  : number of channels                                      */
    const int16_t frame_length                                  /* i  : frame length (one channel)                              */
);
#else
void ivas_buffer_deinterleaved_to_interleaved(
    float *audio[],                                             /* i  : deinterleaved audio buffer              */
    const int16_t n_channels,                                   /* i  : number of channels                      */
    const int16_t frame_length,                                 /* i  : frame length (one channel)              */
    float *audio_out                                            /* o  : interleaved audio buffer                */
);
#endif

void ivas_initialize_handles_enc(
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                  */
+0 −58
Original line number Diff line number Diff line
@@ -155,7 +155,6 @@ uint32_t ivas_syn_output(
 * Convert an interleaved buffer of audio channels to deinterleaved one
 *-------------------------------------------------------------------*/

#ifdef FIX_BASOP_2396_CONSTANT_STRIDE_IN_TC_BUFFER
void ivas_buffer_interleaved_to_deinterleaved(
    float *audio_in,           /* i  : interleaved audio buffer                                 */
    float *audio_out[],        /* o  : pointers to each channel of deinterleaved audio buffer   */
@@ -184,35 +183,6 @@ void ivas_buffer_interleaved_to_deinterleaved(

    return;
}
#else
void ivas_buffer_interleaved_to_deinterleaved(
    float *audio,               /* i/o: audio buffer                    */
    const int16_t n_channels,   /* i  : number of channels              */
    const int16_t frame_length, /* i  : frame length (one channel)      */
    const int16_t n_samp_full   /* i  : full frame length (one channel) */
)
{
    int16_t offset, ch, m;
    float buffer[MAX_TRANSPORT_CHANNELS][MAX_JBM_L_FRAME48k];

    for ( ch = 0; ch < n_channels; ch++ )
    {
        for ( m = 0; m < frame_length; m++ )
        {
            buffer[ch][m] = audio[m * n_channels + ch];
        }
    }

    offset = 0;
    for ( ch = 0; ch < n_channels; ch++ )
    {
        mvr2r( buffer[ch], audio + offset, frame_length );
        offset += n_samp_full;
    }

    return;
}
#endif

/*-------------------------------------------------------------------*
 * ivas_buffer_deinterleaved_to_interleaved()
@@ -220,7 +190,6 @@ void ivas_buffer_interleaved_to_deinterleaved(
 * Convert a deinterleaved buffer of audio channels to interleaved one
 *-------------------------------------------------------------------*/

#ifdef FIX_BASOP_2396_CONSTANT_STRIDE_IN_TC_BUFFER
void ivas_buffer_deinterleaved_to_interleaved(
    float *audio_in[],         /* i  : pointers to each channel of deinterleaved audio buffer  */
    float *audio_out,          /* o  : interleaved audio buffer                                */
@@ -249,33 +218,6 @@ void ivas_buffer_deinterleaved_to_interleaved(

    return;
}
#else
void ivas_buffer_deinterleaved_to_interleaved(
    float *audio[],             /* i/o: deinterleaved audio buffer      */
    const int16_t n_channels,   /* i  : number of channels              */
    const int16_t frame_length, /* i  : frame length (one channel)      */
    float *audio_out            /* o  : interleaved audio buffer        */
)
{
    int16_t ch, m;
    float buffer[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k]; /* temp buffer needed when "*audio[]" and "*audio_out[]" are the same */

    for ( ch = 0; ch < n_channels; ch++ )
    {
        mvr2r( audio[ch], buffer[ch], frame_length );
    }

    for ( ch = 0; ch < n_channels; ch++ )
    {
        for ( m = 0; m < frame_length; m++ )
        {
            audio_out[m * n_channels + ch] = buffer[ch][m];
        }
    }

    return;
}
#endif


/*-------------------------------------------------------------------*
+0 −3
Original line number Diff line number Diff line
@@ -161,15 +161,12 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define FIX_2392_MSAN_DESTROY_DEC                       /* VA: basop issue 2392: fix MSAN in ivas_destroy_dec_fx() */
#define FIX_FLOAT_1522_LTV_MSAN_QMETADATA_ENC_EC3       /* Nokia: float issue 1522: fix uninit MSAN in EC3 of qmetadata encoding */

/* #################### End BE switches ################################## */

/* #################### Start NON-BE switches ############################ */
/* any switch which is non-be wrt. TS 26.258 V3.0 */
#define FIX_1465_SWB_TBE_RANDOM_VECTOR_CREATION         /* Dolby: issue 1465: Fix constant in create_random_vector() to allow more reliable fixed point port */
#define FIX_BASOP_2396_CONSTANT_STRIDE_IN_TC_BUFFER     /* FhG/VA: basop issue 2396: keep TC channel pointers in one constant place during decoding and rendering */
#define FIX_FLOAT_1493_MASA_ENCODE_STABILITY_IMPROVE    /* Nokia: float issue 1493: Improves float decision stability in MASA encoding by adjusting reduction code */

/* ##################### End NON-BE switches ########################### */
+5 −7
Original line number Diff line number Diff line
@@ -2685,9 +2685,7 @@ void GenShapedWBExcitation(
    float *mem_genSHBexc_filt_down3, /* i/o: memory                                 */
    float *state_lpc_syn,            /* i/o: memory                                 */
    const int16_t coder_type,        /* i  : coding type                            */
#ifdef FIX_1465_SWB_TBE_RANDOM_VECTOR_CREATION
    const int16_t element_mode,      /* i  : element mode                           */
#endif
    const float *bwe_exc_extended,   /* i  : bandwidth extended exciatation         */
    int16_t bwe_seed[],              /* i/o: random number generator seed           */
    const float voice_factors[],     /* i  : voicing factor                         */
+5 −42
Original line number Diff line number Diff line
@@ -54,11 +54,7 @@
 * Local function prototypes
 *-----------------------------------------------------------------*/

#ifdef FIX_1465_SWB_TBE_RANDOM_VECTOR_CREATION
static void create_random_vector( float output[], const int16_t length, int16_t seed[], const int16_t element_mode );
#else
static void create_random_vector( float output[], const int16_t length, int16_t seed[] );
#endif
static void flip_spectrum( const float input[], float output[], const int16_t length );
static void Hilbert_transform( float tmp_R[], float tmp_I[], float *tmpi_R, float *tmpi_I, const int16_t length, const int16_t HB_stage_id );
static void Estimate_mix_factors( const float *shb_res, const float *exc16kWhtnd, const float *White_exc16k, const float pow1, const float pow22, float *vf_modified, int16_t *vf_ind );
@@ -370,9 +366,7 @@ void GenShapedWBExcitation(
    float *mem_genSHBexc_filt_down3, /* i/o: memory                                */
    float *state_lpc_syn,            /* i/o: memory                                */
    const int16_t coder_type,        /* i  : coding type                           */
#ifdef FIX_1465_SWB_TBE_RANDOM_VECTOR_CREATION
    const int16_t element_mode,      /* i  : element mode                          */
#endif
    const float *bwe_exc_extended,   /* i  : bandwidth extended exciatation        */
    int16_t bwe_seed[],              /* i/o: random number generator seed          */
    const float voice_factors[],     /* i  : voicing factor                        */
@@ -414,11 +408,7 @@ void GenShapedWBExcitation(
    if ( uv_flag )
    {
        /* unvoiced signal */
#ifdef FIX_1465_SWB_TBE_RANDOM_VECTOR_CREATION
        create_random_vector( exc4kWhtnd, L_FRAME16k / 4, bwe_seed, element_mode );
#else
        create_random_vector( exc4kWhtnd, L_FRAME16k / 4, bwe_seed );
#endif
    }
    else
    {
@@ -447,11 +437,7 @@ void GenShapedWBExcitation(
            *mem_csfilt = -csfilt_den2[1] * excNoisyEnv[i];
        }

#ifdef FIX_1465_SWB_TBE_RANDOM_VECTOR_CREATION
        create_random_vector( exc4k, L_FRAME16k / 4, bwe_seed, element_mode );
#else
        create_random_vector( exc4k, L_FRAME16k / 4, bwe_seed );
#endif

        /* Ensure pow22 is greater than zero when computing normalization */
        for ( i = 0, pow22 = 0.00001f; i < L_FRAME16k / 4; i++ )
@@ -905,13 +891,8 @@ void GenShapedSHBExcitation(
    }
    else
    {
#ifdef FIX_1465_SWB_TBE_RANDOM_VECTOR_CREATION
        create_random_vector( White_exc16k, L_FRAME, bwe_seed, element_mode );
        create_random_vector( White_exc16k + L_FRAME, L_FRAME16k - L_FRAME, bwe_seed, element_mode );
#else
        create_random_vector( White_exc16k, L_FRAME, bwe_seed );
        create_random_vector( White_exc16k + L_FRAME, L_FRAME16k - L_FRAME, bwe_seed );
#endif

        for ( k = 0, pow22 = 0.00001f; k < L_FRAME16k; k++ )
        {
@@ -1555,22 +1536,15 @@ void non_linearity(
 * -------------------------------------------------------------------*/

void create_random_vector(
#ifdef FIX_1465_SWB_TBE_RANDOM_VECTOR_CREATION
    float output[],            /* o  : output random vector      */
    const int16_t length,      /* i  : length of random vector   */
    int16_t seed[],            /* i/o: start seed                */
    const int16_t element_mode /* i  : element mode              */
#else
    float output[],       /* o  : output random vector      */
    const int16_t length, /* i  : length of random vector   */
    int16_t seed[]        /* i/o: start seed                */
#endif
)
{
    int16_t i, j, k;
    float scale1, scale2;

#ifdef FIX_1465_SWB_TBE_RANDOM_VECTOR_CREATION
    if ( element_mode != EVS_MONO )
    {
        j = (int16_t) ( own_random( &seed[0] ) * 0.0078125f );
@@ -1585,16 +1559,9 @@ void create_random_vector(
        k = (int16_t) ( own_random( &seed[1] ) * 0.0078f );
        k = abs( k ) & 0xff;
    }
#else
    j = (int16_t) ( own_random( &seed[0] ) * 0.0078f );
    j = abs( j ) & 0xff;
    k = (int16_t) ( own_random( &seed[1] ) * 0.0078f );
    k = abs( k ) & 0xff;
#endif

    while ( k == j )
    {
#ifdef FIX_1465_SWB_TBE_RANDOM_VECTOR_CREATION
        if ( element_mode != EVS_MONO )
        {
            k = (int16_t) ( own_random( &seed[1] ) * 0.0078125f );
@@ -1605,10 +1572,6 @@ void create_random_vector(
            k = (int16_t) ( own_random( &seed[1] ) * 0.0078f );
            k = abs( k ) & 0xff;
        }
#else
        k = (int16_t) ( own_random( &seed[1] ) * 0.0078f );
        k = abs( k ) & 0xff;
#endif
    }

    if ( own_random( &seed[0] ) < 0 )
Loading