Commit a1e9d348 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 float-1591-cmakelists-txt-overrides-cmake_c_compiler-forcing-clang-18-when-ivas-is-included-as-a
parents de442483 6b289e01
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -321,7 +321,6 @@
    <ClInclude Include="..\lib_dec\jbm_jb4_inputbuffer.h" />
    <ClInclude Include="..\lib_dec\jbm_jb4_jmf.h" />
    <ClInclude Include="..\lib_dec\jbm_pcmdsp_apa.h" />
    <ClInclude Include="..\lib_dec\jbm_pcmdsp_fifo.h" />
    <ClInclude Include="..\lib_dec\jbm_pcmdsp_similarityestimation.h" />
    <ClInclude Include="..\lib_dec\jbm_pcmdsp_window.h" />
    <ClInclude Include="..\lib_dec\lib_dec.h" />
+0 −3
Original line number Diff line number Diff line
@@ -515,9 +515,6 @@
    <ClInclude Include="..\lib_dec\jbm_pcmdsp_apa.h">
      <Filter>decoder_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_dec\jbm_pcmdsp_fifo.h">
      <Filter>decoder_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_dec\jbm_pcmdsp_similarityestimation.h">
      <Filter>decoder_h</Filter>
    </ClInclude>
+14 −0
Original line number Diff line number Diff line
@@ -464,6 +464,7 @@ int main(
        }
    }

#ifndef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT
    /*-----------------------------------------------------------------*
     * Print config information
     *-----------------------------------------------------------------*/
@@ -473,6 +474,7 @@ int main(
        fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }
#endif

    /*-------------------------------------------------------------------*
     * Load renderer configuration from file
@@ -666,6 +668,18 @@ int main(
        hHrtfBinary.hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID;
    }

#ifdef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT
    /*-----------------------------------------------------------------*
     * Print config information
     *-----------------------------------------------------------------*/

    if ( ( error = IVAS_DEC_PrintConfig( hIvasDec, 1, arg.voipMode ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Allocate output data buffer
     *------------------------------------------------------------------------------------------*/
+26 −7
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@
#include "rom_com.h" /* Static table prototypes                */
#include "prot_fx.h" /* Function prototypes                    */
#include "assert.h"  /* Debug prototypes                       */
#include "stl.h"
#include "ivas_prot_fx.h"


@@ -375,9 +374,10 @@ void bands_and_bit_alloc_fx(
            nb_bands_max = s_min( nb_bands_max, MBANDS_GN_BITALLOC16k );

            /*------------------------------------------------------------------------
             * Ajustement of the maximum number of bands in function of the
             * Adjustement of the maximum number of bands in function of the
             * dynamics of the spectrum (more or less speech like)
             *-----------------------------------------------------------------------*/

            test();
            test();
            test();
@@ -444,6 +444,7 @@ void bands_and_bit_alloc_fx(
            /*------------------------------------------------------------------------
             * Find extra number of band to code according to bit rate availables
             *-----------------------------------------------------------------------*/

            test();
            WHILE( GE_16( bit_tmp, bit_new_bands ) && LE_16( nb_bands, sub( nb_bands_max, 1 ) ) )
            {
@@ -470,6 +471,7 @@ void bands_and_bit_alloc_fx(
            /*------------------------------------------------------------------------
             * Complete the bit allocation per frequency band
             *-----------------------------------------------------------------------*/

            imax = 5;
            move16();

@@ -587,6 +589,7 @@ void bands_and_bit_alloc_fx(
             * For the first x bands to be included in th final sorted vector
             * Sort the remaining bands in decrease energy order
             *--------------------------------------------------------------------------*/

            FOR( j = 0; j < nb_tot_bands; j++ )
            {
                max_ener_band[j] = -10;
@@ -669,6 +672,7 @@ void bands_and_bit_alloc_fx(
         * The maximum number of bits per band of length 16 is 112
         * Redistribute the overage bits if needed
         *--------------------------------------------------------------------------*/

        sum_bit = 0;
        move16();
        j = 0;
@@ -736,6 +740,7 @@ void bands_and_bit_alloc_fx(
        /*--------------------------------------------------------------------------
         * Recompute the real number/length of frequency bands to encode
         *--------------------------------------------------------------------------*/

        *nb_subbands = nb_bands;
        move16();
        *pvq_len = shl( *nb_subbands, 4 );
@@ -744,6 +749,7 @@ void bands_and_bit_alloc_fx(
        /*--------------------------------------------------------------------------
         * Concatenate bands (encoder only)
         *--------------------------------------------------------------------------*/

        IF( exc_diff != NULL )
        {
            FOR( j = 0; j < nb_bands; j++ )
@@ -834,6 +840,7 @@ static void reajust_bits_fx(
    return;
}


/*-------------------------------------------------------------------*
 * Find_bit_frac()
 *
@@ -886,6 +893,12 @@ static Word32 Find_bit_frac_fx(
}


/*-------------------------------------------------------------------*
 * Find_bit_alloc_IVAS()
 *
 *
 *-------------------------------------------------------------------*/

/* o  : Number of band to encode */
static Word16 Find_bit_alloc_IVAS_fx(
    const Word32 core_brate,      /* i  : core bit rate                                         */
@@ -907,12 +920,10 @@ static Word16 Find_bit_alloc_IVAS_fx(
    Word16 d_tmp, e_div, tmp16;
    Word32 Ltmp, etmp_32fx;

    SWB_bit_budgetQ18 = L_shl( *bit, 18 ); /* Q0 -> Q18 */
    SWB_bit_budgetQ5 = L_shl( *bit, 5 );   /* Q0 -> Q5 */
    SWB_bit_budgetQ18 = L_shl( *bit, Q18 ); /* Q0 -> Q18 */
    SWB_bit_budgetQ5 = L_shl( *bit, Q5 );   /* Q0 -> Q5 */
    st_band = 5;
    nb_bands_max = nb_tot_bands_in;

    move16();
    move16();
    move16();

@@ -1135,14 +1146,22 @@ static Word16 Find_bit_alloc_IVAS_fx(
            /* bits_per_bands[i] = 112; */
            bits_per_bands[i] = Q18_112;
            move32();
#ifndef FIX_2585_BIT_ALLOCATION_DIFF
            j = add( j, add( i, 1 ) );
#else
            j = add( i, 1 );
#endif
        }

        /* safety check for overage bit reallocation */
        /* else if (bits_per_bands[i] + sum_bit / 3 > 112) */
        ELSE IF( GT_32( L_add( bits_per_bands[i], Mpy_32_16_1( sum_bit, Q15_0_33 ) ), Q18_112 ) )
        {
#ifndef FIX_2585_BIT_ALLOCATION_DIFF
            j = add( j, add( i, 1 ) );
#else
            j = add( i, 1 );
#endif
        }
    }

+21 −1
Original line number Diff line number Diff line
@@ -204,13 +204,25 @@ void tdm_bit_alloc(
        }
        ELSE
        {
#ifdef FIX_2585_BIT_ALLOCATION_DIFF
            Word16 neg = 0;
            move16();
            if ( bit_rate_diff_fx < 0 )
            {
                neg = 1;
                move16();
            }
#endif
            IF( LT_16( ener_ratio_idx, LRTD_STEREO_MID_IS_PRIM ) )
            {

                bit_rate_diff_fx = imult3216( bit_rate_diff_fx, sub( LRTD_STEREO_MID_IS_PRIM, ener_ratio_idx ) ); /*Q0*/
                bit_rate_diff_fx = L_shr( bit_rate_diff_fx, 1 );                                                  /*Q0*/
                bit_rate_diff_fx = Mpy_32_16_1( L_abs( bit_rate_diff_fx ), 3277 /*0.1f in Q15*/ );                /*Q0*/
#ifdef FIX_2585_BIT_ALLOCATION_DIFF
                if ( neg != 0 )
#else
                if ( bit_rate_diff_fx < 0 )
#endif
                {
                    bit_rate_diff_fx = L_negate( bit_rate_diff_fx );
                }
@@ -220,7 +232,11 @@ void tdm_bit_alloc(
                bit_rate_diff_fx = imult3216( bit_rate_diff_fx, sub( ener_ratio_idx, LRTD_STEREO_MID_IS_PRIM ) ); /*Q0*/
                bit_rate_diff_fx = L_shr( bit_rate_diff_fx, 1 );                                                  /*Q0*/
                bit_rate_diff_fx = Mpy_32_16_1( L_abs( bit_rate_diff_fx ), 3277 /*0.1f in Q15*/ );                /*Q0*/
#ifdef FIX_2585_BIT_ALLOCATION_DIFF
                if ( neg != 0 )
#else
                if ( bit_rate_diff_fx < 0 )
#endif
                {
                    bit_rate_diff_fx = L_negate( bit_rate_diff_fx );
                }
@@ -322,7 +338,11 @@ void tdm_bit_alloc(
            *tdm_low_rate_mode = 0;
            move16();
        }
#ifndef FIX_2585_BIT_ALLOCATION_DIFF
        ELSE IF( ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, TDM_UC_NORMAL_MODE_MINBR_LP_R ) && EQ_16( coder_type, UNVOICED ) ) || ( tdm_lp_reuse_flag == 0 && LE_32( *total_brate_sec, L_deposit_l( add( tdm_bit_allc_tbl[idx][0], MID_LP_BRATE ) ) ) ) )
#else
        ELSE IF( ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, TDM_UC_NORMAL_MODE_MINBR_LP_R ) && EQ_16( coder_type, UNVOICED ) ) || ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, L_deposit_l( add( tdm_bit_allc_tbl[idx][0], MID_LP_BRATE ) ) ) ) )
#endif
        {
            *total_brate_sec = L_add( *total_brate_sec, MID_LP_BRATE ); /*Q0*/
            move32();
Loading