Commit 8e7e4123 authored by Nishant S Kulgod's avatar Nishant S Kulgod
Browse files

commit 1

parent f96a652f
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -61,7 +61,9 @@ static void cldfb_init_proto_and_twiddles( HANDLE_CLDFB_FILTER_BANK hs );

static void cldfb_init_proto_and_twiddles_enc( HANDLE_CLDFB_FILTER_BANK hs );

#ifndef IVAS_FLOAT_FIXED
static float GetEnergyCldfb_ivas( float *energyValuesSum, float *energyLookahead, float **realValues, float **imagValues, const int16_t numberBands, int16_t numberCols, TEC_ENC_HANDLE hTecEnc );
#endif

/*-------------------------------------------------------------------*
 * cplxMult()
@@ -1917,6 +1919,7 @@ void resampleCldfb_ivas_fx(
}
#endif

#ifndef IVAS_FLOAT_FIXED
/*-------------------------------------------------------------------*
 * analysisCLDFBEncoder()
 *
@@ -1947,6 +1950,7 @@ void analysisCldfbEncoder_ivas(

    return;
}
#endif

void analysisCldfbEncoder_ivas_fx(
    Encoder_State *st, /* i/o: encoder state structure   */
@@ -2005,6 +2009,8 @@ void analysisCldfbEncoder_ivas_fx(

    return;
}

#ifndef IVAS_FLOAT_FIXED
/*-------------------------------------------------------------------*
 * GetEnergyCldfb_ivas()
 *
@@ -2078,6 +2084,7 @@ static float GetEnergyCldfb_ivas(

    return 65535.0f;
}
#endif


/*-------------------------------------------------------------------*
+28 −22
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@
#ifndef IVAS_FLOAT_FIXED
static void ivas_iir_2_filter( ivas_filters_process_state_t *filter_state, float *pIn_Out, const int16_t length, const int16_t stage );
#else
static void ivas_iir_2_filter_fx( ivas_filters_process_state_t *filter_state, Word32 *pIn_Out_fx, const Word16 length, const Word16 stage, Word16 q_fcator );
static void ivas_iir_2_filter_fx( ivas_filters_process_state_t *filter_state, Word32 *pIn_Out_fx, const Word16 length, const Word16 stage, Word16 *pIn_Out_e );
#endif
/*-----------------------------------------------------------------------------------------*
 * Function ivas_filters_init()
@@ -237,17 +237,33 @@ void ivas_filter_process_fx(
    const Word16 length,                        /* i  : filter order                    */
    Word16 q_factor )
{
    Word16 pIn_Out_e[L_FRAME_MAX];
    Word16 i;
    SWITCH( filter_state->order )
    {
        case IVAS_FILTER_ORDER_1:
        case IVAS_FILTER_ORDER_2:
            ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_0, q_factor );
            set_val_Word16( pIn_Out_e, sub( Q31, q_factor ), length );
            ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_0, pIn_Out_e );
            /* Scale pIn_Out_fx back to input Q */
            FOR( i = 0; i < length; i++ )
            {
                pIn_Out_fx[i] = L_shr_r_sat( pIn_Out_fx[i], sub( sub( 31, q_factor ), pIn_Out_e[i] ) );
                move32();
            }
            BREAK;
        case IVAS_FILTER_ORDER_4:
            set_val_Word16( pIn_Out_e, sub( Q31, q_factor ), length );
            /* biquad-1 */
            ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_0, q_factor );
            ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_0, pIn_Out_e );
            /* biquad-2 */
            ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_1, q_factor );
            ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_1, pIn_Out_e );
            /* Scale pIn_Out_fx back to input Q */
            FOR( i = 0; i < length; i++ )
            {
                pIn_Out_fx[i] = L_shr_r_sat( pIn_Out_fx[i], sub( sub( 31, q_factor ), pIn_Out_e[i] ) );
                move32();
            }
            BREAK;
        default:
            BREAK;
@@ -295,54 +311,44 @@ static void ivas_iir_2_filter_fx(
    Word32 *pIn_Out_fx,
    const Word16 length,
    const Word16 stage,
    Word16 q_factor )
    Word16 *pIn_Out_e )
{
    Word16 i, j;

    Word32 *pIn_fx = pIn_Out_fx;
    Word32 *pOut_fx = pIn_Out_fx;
    Word16 pOut_e;
    Word32 tmp_pIn_buf_i_fx;
    Word16 tmp_pIn_buf_i_e;

    Word32 L_tmp_prod, L_tmp;
    Word16 L_prod_e, L_tmp_e;

    move16();
    move16();

    FOR( i = 0; i < length; i++ )
    {
        tmp_pIn_buf_i_fx = pIn_fx[i];
        move32();
        tmp_pIn_buf_i_e = pIn_Out_e[i];
        move16();

        L_tmp_prod = Mpy_32_32( filter_state->num_fx[stage][0], pIn_fx[i] );
        L_prod_e = sub( 31, sub( q_factor, filter_state->num_e[stage][0] ) ); // 31 - ( ( q_factor + ( 31 - filter_state->num_e[stage][0] ) ) - 31 )
        L_prod_e = add( pIn_Out_e[i], filter_state->num_e[stage][0] );

        pOut_fx[i] = BASOP_Util_Add_Mant32Exp( filter_state->state_fx[stage][0], filter_state->state_e[stage][0], L_tmp_prod, L_prod_e, &pOut_e );
        pOut_fx[i] = BASOP_Util_Add_Mant32Exp( filter_state->state_fx[stage][0], filter_state->state_e[stage][0], L_tmp_prod, L_prod_e, &pIn_Out_e[i] );
        move32();

        FOR( j = 1; j < filter_state->filt_len; j++ )
        {
            L_tmp_prod = Mpy_32_32( filter_state->num_fx[stage][j], tmp_pIn_buf_i_fx );
            L_prod_e = sub( 31, sub( q_factor, filter_state->num_e[stage][j] ) ); // 31 - ( ( q_factor + ( 31 - filter_state->num_e[stage][j] ) ) - 31 )
            L_prod_e = add( filter_state->num_e[stage][j], tmp_pIn_buf_i_e );

            L_tmp = BASOP_Util_Add_Mant32Exp( filter_state->state_fx[stage][j], filter_state->state_e[stage][j], L_tmp_prod, L_prod_e, &L_tmp_e );

            L_tmp_prod = Mpy_32_32( filter_state->den_fx[stage][j], pOut_fx[i] );
            L_prod_e = add( pOut_e, filter_state->den_e[stage][j] ); // 31 - ( ( ( 31 - pOut_e ) + ( 31 - filter_state->den_e[stage][j] ) ) - 31 );
            L_prod_e = add( pIn_Out_e[i], filter_state->den_e[stage][j] );

            filter_state->state_fx[stage][j - 1] = BASOP_Util_Add_Mant32Exp( L_tmp, L_tmp_e, L_negate( L_tmp_prod ), L_prod_e, &filter_state->state_e[stage][j - 1] );
            move32();
        }

        /* Scaling pOut_fx to Q11 */
        pOut_fx[i] = L_shr_sat( pOut_fx[i], sub( sub( 31, q_factor ), pOut_e ) );
        move32();
        IF( pOut_fx[i] < 0 )
        {
            pOut_fx[i] = L_add( pOut_fx[i], 1 );
            move32();
        }
    }
}
#endif
+12 −0
Original line number Diff line number Diff line
@@ -4399,12 +4399,14 @@ void reset_metadata_spatial(
);

/*! r: number of bits written */
#ifndef IVAS_FLOAT_FIXED
void ivas_qmetadata_enc_sid_encode(
    BSTR_ENC_HANDLE hMetaData,                                  /* i/o: metadata bitstream handle               */
    IVAS_QMETADATA *q_metadata,                                 /* i/o: metadata handle                         */
    const int16_t masa_sid_descriptor,                          /* i  : description of MASA SID coding structure*/
    const int16_t ivas_format                                   /* i  : ivas format                             */
);
#endif

/*! r: number of bits read */
int16_t ivas_qmetadata_dec_decode(
@@ -4535,6 +4537,16 @@ uint16_t quantize_direction(
    const MC_LS_SETUP mc_format                                 /* i  : channel format if in MC-mode            */
);

#ifdef IVAS_FLOAT_FIXED
Word16 quantize_direction2D_fx(
    Word32 phi,                 /* i  : input azimuth value            Q22 */
    const Word16 no_cw,         /* i  : number of bits                  */
    Word32 *phi_q,              /* o  : quantized azimuth value        Q22 */
    UWord16 *index_phi,         /* o  : quantized azimuth index         */
    const MC_LS_SETUP mc_format /* i  : channel format if in MC-mode    */
);
#endif

int16_t quantize_direction2D(
    float phi,                                                  /* i  : input azimuth value                     */
    const int16_t no_cw,                                        /* i  : number of bits                          */
+14 −0
Original line number Diff line number Diff line
@@ -3373,4 +3373,18 @@ void ivas_merge_masa_metadata_fx(
    MASA_ENCODER_HANDLE hMasa,           /* i/o: MASA enc handle. source for MASA metadata and combined metadata will be here */
    OMASA_SPATIAL_META_HANDLE hOMasaMeta /* i  : ISM-object metadata to be merged with the MASA metadata                      */
);

/*! r: number of bits written */
void ivas_qmetadata_enc_sid_encode_fx(
    BSTR_ENC_HANDLE hMetaData,        /* i/o: metadata bitstream handle               */
    IVAS_QMETADATA *q_metadata,       /* i/o: metadata handle                         */
    const Word16 masa_sid_descriptor, /* i  : description of MASA SID coding structure*/
    const Word16 ivas_format          /* i  : ivas format                             */
);
void ivas_param_mc_enc_fx(
    Encoder_Struct *st_ivas,   /* i/o: IVAS Encoder handle                                 */
    BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle                      */
    Word32 *data_f_fx[],           /* i/o: input/transport MC data                     Q11 */
    const Word16 input_frame  /* i  : input frame length                                   */
);
#endif
+22 −0
Original line number Diff line number Diff line
@@ -482,6 +482,8 @@ const Word32 dft_res_gains_q_fx[][2] = {
   { (Word32)( 0x7fff5800 ), (Word32)( 0x00cf398f ) },

};

// Q13
const Word16 McMASA_LFEGain_vectors_fx_q13[64] = {
    3112, 2703, 1556, 1638, -1310, -1802, -2867, -2785,
    4096, 4096, 4096, 4096, -6553, -3276, 8355, 819,
@@ -493,6 +495,26 @@ const Word16 McMASA_LFEGain_vectors_fx_q13[64] = {
    -6553, -12943, 6717, 11632, -17530, 2129, 6881, 8355
};

// Q25
const Word32 McMASA_LFEGain_vectors_fx_q25[64] = {
    12750684, 11072963, 6375342, 6710886, /* 1st bit */
    -5368709, -7381975, -11744051, -11408507,
    16777216, 16777216, 16777216, 16777216, /* 2nd bit*/
    -26843546, -13421773, 34225521, 3355443, 
    -16777216, -16777216, -16777216, -16777216, /* 3rd bit */
    -18790482, -4026532, -26172457, 45634028, 
    -34225521, 39594230, -19126026, 11072963,
    24159191, -37916508, 32547799, -20803748,
    -30534533, 31205622, 33554432, -36909875, /* 4th bit*/
    58049167, -7717519, -26172457, -28185723,
    31876710, -53687091, -11408507, 31205622, 
    29192356, 15770583, -63753421, 17448305, 
    22481469, 47647293, -32547799, -41607496,
    27850179, 19461571, 20468204, -68451041,
    -26843546, -53016003, 27514634, 47647293,
    -71806484, 8724152, 28185723, 34225521
};

/*
 This lookup table is calculated from, and therefore
 depends on the following macros:
Loading