Commit 10d26293 authored by vaclav's avatar vaclav
Browse files

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

- Merge remote-tracking branch 'remotes/origin/main' into basop-2350-harmonization-of-the-0-bit-bwe-between-evs-and-ivas
parents fc9cc6b7 a807096e
Loading
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -448,12 +448,10 @@ int main(
            goto cleanup;
        }

#ifdef FIX_1449_RENDERER_FRAME_SIZE_UNCLEAR_IN_ISAR
        if ( !arg.renderConfigEnabled && ( arg.render_num_subframes != asked_num_subframes ) )
        {
            fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for non-0dof split rendering!\n" );
        }
#endif
    }

    /*------------------------------------------------------------------------------------------*
+0 −36
Original line number Diff line number Diff line
@@ -167,9 +167,6 @@ typedef struct
    int16_t numInMetadataFiles;
    char outMetadataFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char headRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
#ifndef FIX_1494_SET_SPLITBFI_UNUSED
    char splitRendBFIFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
#endif
    char referenceVectorFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char referenceRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
    char externalOrientationFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
@@ -220,9 +217,6 @@ typedef enum
    CmdLnOptionId_listFormats,
    CmdLnOptionId_inputGain,
    CmdLnOptionId_outputMetadata,
#ifndef FIX_1494_SET_SPLITBFI_UNUSED
    CmdLnOptionId_SplitRendBFIFile,
#endif
    CmdLnOptionId_referenceVectorFile,
    CmdLnOptionId_exteriorOrientationFile,
    CmdLnOptionId_framing,
@@ -281,14 +275,6 @@ static const CmdLnParser_Option cliOptions[] = {
        .matchShort = "om",
        .description = "coded metadata file for BINAURAL_SPLIT_PCM output mode",
    },
#ifndef FIX_1494_SET_SPLITBFI_UNUSED
    {
        .id = CmdLnOptionId_SplitRendBFIFile,
        .match = "post_rend_bfi_file",
        .matchShort = "prbfi",
        .description = "Split rendering option: bfi file",
    },
#endif
    {
        .id = CmdLnOptionId_refRotFile,
        .match = "reference_rotation_file",
@@ -764,9 +750,6 @@ int main(
    IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[RENDERER_MAX_INPUT_CHANNELS];
    IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[RENDERER_MAX_INPUT_CHANNELS];
    int16_t cldfb_in_flag, CLDFBframeSize_smpls;
#ifndef FIX_1494_SET_SPLITBFI_UNUSED
    SplitRendBFIFileReader *splitRendBFIReader = NULL;
#endif
    Vector3PairFileReader *referenceVectorReader = NULL;
    hrtfFileReader *hrtfFileReader = NULL;
    IVAS_DEC_HRTF_CREND_HANDLE *hHrtfCrend = NULL;
@@ -896,13 +879,6 @@ int main(
        }
    }

#ifndef FIX_1494_SET_SPLITBFI_UNUSED
    if ( !isEmptyString( args.splitRendBFIFilePath ) )
    {
        convert_backslash( args.splitRendBFIFilePath );
        SplitRendBFIFileReader_open( args.splitRendBFIFilePath, &splitRendBFIReader );
    }
#endif
    if ( !isEmptyString( args.externalOrientationFilePath ) )
    {
        if ( RotationFileReader_open( args.externalOrientationFilePath, &externalOrientationFileReader ) != IVAS_ERR_OK )
@@ -2184,9 +2160,6 @@ cleanup:
    }

    split_rend_reader_writer_close( &hSplitRendFileReadWrite );
#ifndef FIX_1494_SET_SPLITBFI_UNUSED
    SplitRendBFIFileReader_close( &splitRendBFIReader );
#endif

    for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i )
    {
@@ -2798,9 +2771,6 @@ static CmdlnArgs defaultArgs(

    clearString( args.headRotationFilePath );
    clearString( args.outMetadataFilePath );
#ifndef FIX_1494_SET_SPLITBFI_UNUSED
    clearString( args.splitRendBFIFilePath );
#endif
    clearString( args.referenceVectorFilePath );
    clearString( args.referenceRotationFilePath );
    clearString( args.customHrtfFilePath );
@@ -2907,12 +2877,6 @@ static void parseOption(
            assert( numOptionValues == 1 );
            strncpy( args->outMetadataFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 );
            break;
#ifndef FIX_1494_SET_SPLITBFI_UNUSED
        case CmdLnOptionId_SplitRendBFIFile:
            assert( numOptionValues == 1 );
            strncpy( args->splitRendBFIFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 );
            break;
#endif
        case CmdLnOptionId_referenceVectorFile:
            assert( numOptionValues == 1 );
            strncpy( args->referenceVectorFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 );
+0 −2
Original line number Diff line number Diff line
@@ -595,9 +595,7 @@ void cldfbAnalysis_ts_fx_var_q(
    IF( NE_16( h_cldfb->Q_cldfb_state, *q_cldfb ) )
    {
        Word16 norm_st = L_norm_arr( timeBuffer_fx, offset );
#ifdef FIX_2257_INCR_GUARD_BITS
        norm_st = sub( norm_st, find_guarded_bits_fx( shr( h_cldfb->no_channels, 2 ) ) );
#endif
        IF( GE_16( norm_st, sub( *q_cldfb, h_cldfb->Q_cldfb_state ) ) )
        {
            scale_sig32( timeBuffer_fx, offset, sub( *q_cldfb, h_cldfb->Q_cldfb_state ) );
+8 −718

File changed.

Preview size limit exceeded, changes collapsed.

+0 −166
Original line number Diff line number Diff line
@@ -208,172 +208,6 @@ void mdct_spectrum_denorm_fx(
    return;
}

#ifndef CLEANUP_HQ_CORE
void mdct_spectrum_denorm_ivas_fx(
    const Word32 inp_vector[],    /* i   : Q0  :                                       */
    Word32 L_y2[],                /* i/o : Qs  : decoded spectrum                      */
    const Word16 band_start[],    /* i   : Q0  : table of start freq for every subband */
    const Word16 band_end[],      /* i   : Q0  : table of end freq for every subband   */
    const Word16 band_width[],    /* i   : Q0  : table of bandwidth for every subband  */
    const Word32 L_band_energy[], /* i   : Qbe : band energy                           */
    const Word16 npulses[],       /* i   : Q0  : number of coded spectrum              */
    const Word16 bands,           /* i   : Q0  : number of subbands                    */
    const Word16 ld_slope_fx,     /* i   : Q15 :                                       */
    const Word16 pd_thresh_fx     /* i   : Q15 :                                       */
)
{
    Word16 i, k;
    Word32 L_Eyy;
    Word32 L_tmp, L_temp;
    Word16 temp_fx, temp_lo_fx, temp_hi_fx;
    Word32 L_inp_tmp[L_FRAME48k];
    Word16 exp_norm;
    Word16 exp_safe;
    Word16 exp_normn, exp_normd;

    Word16 pd_fx;
    Word16 Qpd;

    Word16 div_pd_fx;
    Word16 Qdivpd;
    Word32 L_div_pd;

    Word16 frac, exp;

    Word16 gain_tweak_fx;
    Word16 Qtweak;

    Word16 exp_shift;

    Word16 QEyy;
    Word16 pow_fx;
    Word16 Qpow;
    Word16 Qdiv;
    Word16 Qgamma;
    Word16 gamma_fx;

    Word16 cond_fx;

    exp_safe = 4; /* safe bit for overflow */
    move16();

    FOR( k = 0; k < bands; k++ )
    {
        L_tmp = L_deposit_l( 0 );
        FOR( i = band_start[k]; i <= band_end[k]; i++ )
        {
            L_inp_tmp[i] = L_mult( extract_l( inp_vector[i] ), extract_l( inp_vector[i] ) );
            move32(); /* Q0+Q0+1 */
            L_tmp = L_or( L_tmp, L_inp_tmp[i] );
        }
        exp_norm = norm_l( L_tmp );
        exp_norm = sub( exp_norm, exp_safe );

        L_Eyy = L_deposit_l( 0 );
        FOR( i = band_start[k]; i <= band_end[k]; i++ )
        {
            /*Eyy += (float) inp_vector[i] * inp_vector[i]; */
            L_Eyy = L_add( L_Eyy, L_shl( L_inp_tmp[i], exp_norm ) ); /* Q1+exp_norm */
        }
        QEyy = add( 1, exp_norm );

        IF( L_Eyy > 0x0L )
        {
            /* Set gamma to be pulse gain which results in perfect quantized subband energy */
            /*gamma = (float) sqrt (pow (2.0f, band_energy[k]) / Eyy); */

            /* Pow part  (pow(2.0f, band_energy) ) */
            L_temp = L_shr( L_band_energy[k], sub( SWB_BWE_LR_Qbe, 16 ) );
            temp_lo_fx = L_Extract_lc( L_temp, &temp_hi_fx );
            Qpow = sub( 14, temp_hi_fx );
            pow_fx = extract_l( Pow2( 14, temp_lo_fx ) ); /* Qpow */

            /* Div part  ( pow (2.0f, band_energy[i])/Eyy ) */
            exp_normn = norm_s( pow_fx );
            exp_normn = sub( exp_normn, 1 );
            exp_normd = norm_l( L_Eyy );
            temp_fx = div_s( shl( pow_fx, exp_normn ), extract_h( L_shl( L_Eyy, exp_normd ) ) ); /* ((Qpow + exp_norm) - (QEyy + exp_normd)) + 31 */
            Qdiv = add( sub( add( Qpow, exp_normn ), add( QEyy, exp_normd ) ), 31 );

            exp_norm = norm_s( temp_fx );
            temp_fx = shl( temp_fx, exp_norm ); /* Qdiv + exp_norm */
            Qdiv = add( Qdiv, exp_norm );

            /* Sqrt part sqrt(pow (2.0f, band_energy[i])/Eyy) */
            Qgamma = add( Qdiv, 16 );
            IF( s_and( Qdiv, 1 ) == 0 ) /* Qdiv % 2 == 0 */
            {
                L_temp = Sqrt_l( L_shr( L_deposit_h( temp_fx ), 1 ), &exp_norm );
                L_temp = L_shr( L_temp, exp_norm );
                Qgamma = sub( shr( Qgamma, 1 ), 1 );
                gamma_fx = round_fx( L_temp );
            }
            ELSE
            {
                L_temp = Sqrt_l( L_deposit_h( temp_fx ), &exp_norm );
                L_temp = L_shr( L_temp, exp_norm );
                Qgamma = shr( Qgamma, 1 );
                gamma_fx = round_fx( L_temp );
            }

            /* Adjust gamma based on pulse density (0 bit MSE gain estimator) */
            /*pd = (float) npulses[k] / band_width[k]; */
            exp_normn = norm_s( npulses[k] );
            exp_normn = sub( exp_normn, 1 );
            exp_normd = norm_s( band_width[k] );
            pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_normn + exp_normd) */
            Qpd = add( sub( exp_normn, exp_normd ), 15 );

            cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */
            move16();                                                                /* allow overflow happen. */
            IF( cond_fx < 0 )
            {
                /*gain_tweak = (float) pow (2.0f, (ld_slope * log2_f (pd / pd_thresh))); */
                /* Div part */
                exp_normn = norm_s( pd_fx );
                exp_normn = sub( exp_normn, 1 );
                exp_normd = norm_s( pd_thresh_fx );
                div_pd_fx = div_s( shl( pd_fx, exp_normn ), shl( pd_thresh_fx, exp_normd ) ); /* Qpd+exp_normn - (15 + exp_normd) + 15 */
                Qdivpd = add( sub( add( Qpd, exp_normn ), add( 15, exp_normd ) ), 15 );

                /* Log2 part */
                exp_norm = norm_s( div_pd_fx );
                L_div_pd = L_deposit_h( shl( div_pd_fx, exp_norm ) ); /* Qdivpd + exp_norm + 16 */
                Qdivpd = add( add( Qdivpd, exp_norm ), 16 );

                frac = Log2_norm_lc( L_div_pd );
                exp = sub( 30, Qdivpd );
                L_tmp = L_Comp( exp, frac ); /* Q16 */

                /* Mult part */
                L_tmp = Mpy_32_16_1( L_tmp, ld_slope_fx );

                /* Pow part */
                temp_lo_fx = L_Extract_lc( L_tmp, &temp_hi_fx );
                Qtweak = sub( 14, temp_hi_fx );
                gain_tweak_fx = extract_l( Pow2( 14, temp_lo_fx ) );

                /*gamma *= gain_tweak; */
                L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */
                exp_norm = norm_l( L_tmp );
                gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) );
                Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */
            }

            exp_shift = sub( SWB_BWE_LR_Qs - 1, Qgamma );
            FOR( i = band_start[k]; i <= band_end[k]; i++ )
            {
                /*y2[i] = gamma * inp_vector[i]; */
                L_tmp = L_mult( gamma_fx, extract_l( inp_vector[i] ) ); /* Qgamma+0+1=Qgamma+1 */
                L_y2[i] = L_shl( L_tmp, exp_shift );                    /* SWB_BWE_LR_Qs */
                move32();
            }
        }
    }

    return;
}
#endif

/*==========================================================================*/
/* FUNCTION      : void hq2_core_configure_fx()                             */
Loading