当前位置: 首页>>代码示例>>C++>>正文


C++ silk_SMULBB函数代码示例

本文整理汇总了C++中silk_SMULBB函数的典型用法代码示例。如果您正苦于以下问题:C++ silk_SMULBB函数的具体用法?C++ silk_SMULBB怎么用?C++ silk_SMULBB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了silk_SMULBB函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: silk_sigm_Q15

opus_int silk_sigm_Q15(
    opus_int                    in_Q5               /* I                                                                */
)
{
    opus_int ind;

    if( in_Q5 < 0 ) {
        /* Negative input */
        in_Q5 = -in_Q5;
        if( in_Q5 >= 6 * 32 ) {
            return 0;        /* Clip */
        } else {
            /* Linear interpolation of look up table */
            ind = silk_RSHIFT( in_Q5, 5 );
            return( sigm_LUT_neg_Q15[ ind ] - silk_SMULBB( sigm_LUT_slope_Q10[ ind ], in_Q5 & 0x1F ) );
        }
    } else {
        /* Positive input */
        if( in_Q5 >= 6 * 32 ) {
            return 32767;        /* clip */
        } else {
            /* Linear interpolation of look up table */
            ind = silk_RSHIFT( in_Q5, 5 );
            return( sigm_LUT_pos_Q15[ ind ] + silk_SMULBB( sigm_LUT_slope_Q10[ ind ], in_Q5 & 0x1F ) );
        }
    }
}
开发者ID:62gs8ha,项目名称:batphone,代码行数:27,代码来源:sigm_Q15.c

示例2: silk_int16_array_maxabs

/* Function that returns the maximum absolut value of the input vector */
opus_int16 silk_int16_array_maxabs(                 /* O   Maximum absolute value, max: 2^15-1                          */
    const opus_int16            *vec,               /* I   Input vector  [len]                                          */
    const opus_int32            len                 /* I   Length of input vector                                       */
)
{
    opus_int32 max = 0, i, lvl = 0, ind;
    if( len == 0 ) return 0;

    ind = len - 1;
    max = silk_SMULBB( vec[ ind ], vec[ ind ] );
    for( i = len - 2; i >= 0; i-- ) {
        lvl = silk_SMULBB( vec[ i ], vec[ i ] );
        if( lvl > max ) {
            max = lvl;
            ind = i;
        }
    }

    /* Do not return 32768, as it will not fit in an int16 so may lead to problems later on */
    if( max >= 1073676289 ) {           /* (2^15-1)^2 = 1073676289 */
        return( silk_int16_MAX );
    } else {
        if( vec[ ind ] < 0 ) {
            return( -vec[ ind ] );
        } else {
            return(  vec[ ind ] );
        }
    }
}
开发者ID:oneman,项目名称:opus-oneman,代码行数:30,代码来源:vector_ops_FIX.c

示例3: silk_NLSF_unpack

/* Unpack predictor values and indices for entropy coding tables */
void silk_NLSF_unpack(int16_t ec_ix[],	/* O    Indices to entropy tables [ LPC_ORDER ]     */
		      uint8_t pred_Q8[],	/* O    LSF predictor [ LPC_ORDER ]                 */
		      const silk_NLSF_CB_struct * psNLSF_CB,	/* I    Codebook object                             */
		      const int CB1_index	/* I    Index of vector in first LSF codebook       */
    )
{
	int i;
	uint8_t entry;
	const uint8_t *ec_sel_ptr;

	ec_sel_ptr = &psNLSF_CB->ec_sel[CB1_index * psNLSF_CB->order / 2];
	for (i = 0; i < psNLSF_CB->order; i += 2) {
		entry = *ec_sel_ptr++;
		ec_ix[i] =
		    silk_SMULBB(silk_RSHIFT(entry, 1) & 7,
				2 * NLSF_QUANT_MAX_AMPLITUDE + 1);
		pred_Q8[i] =
		    psNLSF_CB->pred_Q8[i +
				       (entry & 1) * (psNLSF_CB->order - 1)];
		ec_ix[i + 1] =
		    silk_SMULBB(silk_RSHIFT(entry, 5) & 7,
				2 * NLSF_QUANT_MAX_AMPLITUDE + 1);
		pred_Q8[i + 1] =
		    psNLSF_CB->pred_Q8[i +
				       (silk_RSHIFT(entry, 4) & 1) *
				       (psNLSF_CB->order - 1) + 1];
	}
}
开发者ID:CEPBEP,项目名称:onion-phone,代码行数:29,代码来源:NLSF_unpack.c

示例4: silk_stereo_MS_to_LR

/* Convert adaptive Mid/Side representation to Left/Right stereo signal */
void silk_stereo_MS_to_LR(
    stereo_dec_state            *state,                         /* I/O  State                                       */
    opus_int16                  x1[],                           /* I/O  Left input signal, becomes mid signal       */
    opus_int16                  x2[],                           /* I/O  Right input signal, becomes side signal     */
    const opus_int32            pred_Q13[],                     /* I    Predictors                                  */
    opus_int                    fs_kHz,                         /* I    Samples rate (kHz)                          */
    opus_int                    frame_length                    /* I    Number of samples                           */
)
{
    opus_int   n, denom_Q16, delta0_Q13, delta1_Q13;
    opus_int32 sum, diff, pred0_Q13, pred1_Q13;

    /* Buffering */
    silk_memcpy( x1, state->sMid,  2 * sizeof( opus_int16 ) );
    silk_memcpy( x2, state->sSide, 2 * sizeof( opus_int16 ) );
    silk_memcpy( state->sMid,  &x1[ frame_length ], 2 * sizeof( opus_int16 ) );
    silk_memcpy( state->sSide, &x2[ frame_length ], 2 * sizeof( opus_int16 ) );

    /* Interpolate predictors and add prediction to side channel */
    pred0_Q13  = state->pred_prev_Q13[ 0 ];
    pred1_Q13  = state->pred_prev_Q13[ 1 ];
    denom_Q16  = silk_DIV32_16( (opus_int32)1 << 16, STEREO_INTERP_LEN_MS * fs_kHz );
    delta0_Q13 = silk_RSHIFT_ROUND( silk_SMULBB( pred_Q13[ 0 ] - state->pred_prev_Q13[ 0 ], denom_Q16 ), 16 );
    delta1_Q13 = silk_RSHIFT_ROUND( silk_SMULBB( pred_Q13[ 1 ] - state->pred_prev_Q13[ 1 ], denom_Q16 ), 16 );
    for( n = 0; n < STEREO_INTERP_LEN_MS * fs_kHz; n++ ) {
        pred0_Q13 += delta0_Q13;
        pred1_Q13 += delta1_Q13;
        sum = silk_LSHIFT( silk_ADD_LSHIFT( x1[ n ] + x1[ n + 2 ], x1[ n + 1 ], 1 ), 9 );       /* Q11 */
        sum = silk_SMLAWB( silk_LSHIFT( (opus_int32)x2[ n + 1 ], 8 ), sum, pred0_Q13 );         /* Q8  */
        sum = silk_SMLAWB( sum, silk_LSHIFT( (opus_int32)x1[ n + 1 ], 11 ), pred1_Q13 );        /* Q8  */
        x2[ n + 1 ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( sum, 8 ) );
    }
    pred0_Q13 = pred_Q13[ 0 ];
    pred1_Q13 = pred_Q13[ 1 ];
    for( n = STEREO_INTERP_LEN_MS * fs_kHz; n < frame_length; n++ ) {
        sum = silk_LSHIFT( silk_ADD_LSHIFT( x1[ n ] + x1[ n + 2 ], x1[ n + 1 ], 1 ), 9 );       /* Q11 */
        sum = silk_SMLAWB( silk_LSHIFT( (opus_int32)x2[ n + 1 ], 8 ), sum, pred0_Q13 );         /* Q8  */
        sum = silk_SMLAWB( sum, silk_LSHIFT( (opus_int32)x1[ n + 1 ], 11 ), pred1_Q13 );        /* Q8  */
        x2[ n + 1 ] = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( sum, 8 ) );
    }
    state->pred_prev_Q13[ 0 ] = pred_Q13[ 0 ];
    state->pred_prev_Q13[ 1 ] = pred_Q13[ 1 ];

    /* Convert to left/right signals */
    for( n = 0; n < frame_length; n++ ) {
        sum  = x1[ n + 1 ] + (opus_int32)x2[ n + 1 ];
        diff = x1[ n + 1 ] - (opus_int32)x2[ n + 1 ];
        x1[ n + 1 ] = (opus_int16)silk_SAT16( sum );
        x2[ n + 1 ] = (opus_int16)silk_SAT16( diff );
    }
}
开发者ID:261117370,项目名称:godot,代码行数:52,代码来源:stereo_MS_to_LR.c

示例5: silk_sum_sqr_shift

/* of int16s to make it fit in an int32                                 */
void silk_sum_sqr_shift(int32_t * energy,	/* O   Energy of x, after shifting to the right                     */
			int * shift,	/* O   Number of bits right shift applied to energy                 */
			const int16_t * x,	/* I   Input vector                                                 */
			int len	/* I   Length of input vector                                       */
    )
{
	int i, shft;
	int32_t nrg_tmp, nrg;

	nrg = 0;
	shft = 0;
	len--;
	for (i = 0; i < len; i += 2) {
		nrg = silk_SMLABB_ovflw(nrg, x[i], x[i]);
		nrg = silk_SMLABB_ovflw(nrg, x[i + 1], x[i + 1]);
		if (nrg < 0) {
			/* Scale down */
			nrg =
			    (int32_t) silk_RSHIFT_uint((uint32_t) nrg, 2);
			shft = 2;
			break;
		}
	}
	for (; i < len; i += 2) {
		nrg_tmp = silk_SMULBB(x[i], x[i]);
		nrg_tmp = silk_SMLABB_ovflw(nrg_tmp, x[i + 1], x[i + 1]);
		nrg =
		    (int32_t) silk_ADD_RSHIFT_uint(nrg,
						      (uint32_t) nrg_tmp,
						      shft);
		if (nrg < 0) {
			/* Scale down */
			nrg =
			    (int32_t) silk_RSHIFT_uint((uint32_t) nrg, 2);
			shft += 2;
		}
	}
	if (i == len) {
		/* One sample left to process */
		nrg_tmp = silk_SMULBB(x[i], x[i]);
		nrg = (int32_t) silk_ADD_RSHIFT_uint(nrg, nrg_tmp, shft);
	}

	/* Make sure to have at least one extra leading zero (two leading zeros in total) */
	if (nrg & 0xC0000000) {
		nrg = silk_RSHIFT_uint((uint32_t) nrg, 2);
		shft += 2;
	}

	/* Output arguments */
	*shift = shft;
	*energy = nrg;
}
开发者ID:CEPBEP,项目名称:onion-phone,代码行数:54,代码来源:sum_sqr_shift.c

示例6: silk_QueryEncoder

static opus_int silk_QueryEncoder(                      /* O    Returns error code                              */
    const void                      *encState,          /* I    State                                           */
    silk_EncControlStruct           *encStatus          /* O    Encoder Status                                  */
)
{
    opus_int ret = SILK_NO_ERROR;
    silk_encoder_state_Fxx *state_Fxx;
    silk_encoder *psEnc = (silk_encoder *)encState;

    state_Fxx = psEnc->state_Fxx;

    encStatus->nChannelsAPI              = psEnc->nChannelsAPI;
    encStatus->nChannelsInternal         = psEnc->nChannelsInternal;
    encStatus->API_sampleRate            = state_Fxx[ 0 ].sCmn.API_fs_Hz;
    encStatus->maxInternalSampleRate     = state_Fxx[ 0 ].sCmn.maxInternal_fs_Hz;
    encStatus->minInternalSampleRate     = state_Fxx[ 0 ].sCmn.minInternal_fs_Hz;
    encStatus->desiredInternalSampleRate = state_Fxx[ 0 ].sCmn.desiredInternal_fs_Hz;
    encStatus->payloadSize_ms            = state_Fxx[ 0 ].sCmn.PacketSize_ms;
    encStatus->bitRate                   = state_Fxx[ 0 ].sCmn.TargetRate_bps;
    encStatus->packetLossPercentage      = state_Fxx[ 0 ].sCmn.PacketLoss_perc;
    encStatus->complexity                = state_Fxx[ 0 ].sCmn.Complexity;
    encStatus->useInBandFEC              = state_Fxx[ 0 ].sCmn.useInBandFEC;
    encStatus->useDTX                    = state_Fxx[ 0 ].sCmn.useDTX;
    encStatus->useCBR                    = state_Fxx[ 0 ].sCmn.useCBR;
    encStatus->internalSampleRate        = silk_SMULBB( state_Fxx[ 0 ].sCmn.fs_kHz, 1000 );
    encStatus->allowBandwidthSwitch      = state_Fxx[ 0 ].sCmn.allow_bandwidth_switch;
    encStatus->inWBmodeWithoutVariableLP = state_Fxx[ 0 ].sCmn.fs_kHz == 16 && state_Fxx[ 0 ].sCmn.sLP.mode == 0;

    return ret;
}
开发者ID:kode54,项目名称:Cog,代码行数:30,代码来源:enc_API.c

示例7: silk_NLSF_VQ

/* Compute quantization errors for an LPC_order element input vector for a VQ codebook */
void silk_NLSF_VQ(
    opus_int32                  err_Q26[],                      /* O    Quantization errors [K]                     */
    const opus_int16            in_Q15[],                       /* I    Input vectors to be quantized [LPC_order]   */
    const opus_uint8            pCB_Q8[],                       /* I    Codebook vectors [K*LPC_order]              */
    const opus_int              K,                              /* I    Number of codebook vectors                  */
    const opus_int              LPC_order                       /* I    Number of LPCs                              */
)
{
    opus_int        i, m;
    opus_int32      diff_Q15, sum_error_Q30, sum_error_Q26;

    silk_assert( LPC_order <= 16 );
    silk_assert( ( LPC_order & 1 ) == 0 );

    /* Loop over codebook */
    for( i = 0; i < K; i++ ) {
        sum_error_Q26 = 0;
        for( m = 0; m < LPC_order; m += 2 ) {
            /* Compute weighted squared quantization error for index m */
            diff_Q15 = silk_SUB_LSHIFT32( in_Q15[ m ], (opus_int32)*pCB_Q8++, 7 ); /* range: [ -32767 : 32767 ]*/
            sum_error_Q30 = silk_SMULBB( diff_Q15, diff_Q15 );

            /* Compute weighted squared quantization error for index m + 1 */
            diff_Q15 = silk_SUB_LSHIFT32( in_Q15[m + 1], (opus_int32)*pCB_Q8++, 7 ); /* range: [ -32767 : 32767 ]*/
            sum_error_Q30 = silk_SMLABB( sum_error_Q30, diff_Q15, diff_Q15 );

            sum_error_Q26 = silk_ADD_RSHIFT32( sum_error_Q26, sum_error_Q30, 4 );

            silk_assert( sum_error_Q26 >= 0 );
            silk_assert( sum_error_Q30 >= 0 );
        }
        err_Q26[ i ] = sum_error_Q26;
    }
}
开发者ID:wonktnodi,项目名称:webrtc_port,代码行数:35,代码来源:NLSF_VQ.c

示例8: silk_corrVector_FIX

/* Calculates correlation vector X'*t */
void silk_corrVector_FIX(
    const opus_int16                *x,                                     /* I    x vector [L + order - 1] used to form data matrix X                         */
    const opus_int16                *t,                                     /* I    Target vector [L]                                                           */
    const opus_int                  L,                                      /* I    Length of vectors                                                           */
    const opus_int                  order,                                  /* I    Max lag for correlation                                                     */
    opus_int32                      *Xt,                                    /* O    Pointer to X'*t correlation vector [order]                                  */
    const opus_int                  rshifts                                 /* I    Right shifts of correlations                                                */
)
{
    opus_int         lag, i;
    const opus_int16 *ptr1, *ptr2;
    opus_int32       inner_prod;

    ptr1 = &x[ order - 1 ]; /* Points to first sample of column 0 of X: X[:,0] */
    ptr2 = t;
    /* Calculate X'*t */
    if( rshifts > 0 ) {
        /* Right shifting used */
        for( lag = 0; lag < order; lag++ ) {
            inner_prod = 0;
            for( i = 0; i < L; i++ ) {
                inner_prod += silk_RSHIFT32( silk_SMULBB( ptr1[ i ], ptr2[i] ), rshifts );
            }
            Xt[ lag ] = inner_prod; /* X[:,lag]'*t */
            ptr1--; /* Go to next column of X */
        }
    } else {
        silk_assert( rshifts == 0 );
        for( lag = 0; lag < order; lag++ ) {
            Xt[ lag ] = silk_inner_prod_aligned( ptr1, ptr2, L ); /* X[:,lag]'*t */
            ptr1--; /* Go to next column of X */
        }
    }
}
开发者ID:edd83,项目名称:Skype-like,代码行数:35,代码来源:corrMatrix_FIX.c

示例9: silk_HP_variable_cutoff

/* High-pass filter with cutoff frequency adaptation based on pitch lag statistics */
void silk_HP_variable_cutoff(silk_encoder_state_Fxx state_Fxx[]	/* I/O  Encoder states                              */
    )
{
	int quality_Q15;
	int32_t pitch_freq_Hz_Q16, pitch_freq_log_Q7, delta_freq_Q7;
	silk_encoder_state *psEncC1 = &state_Fxx[0].sCmn;

	/* Adaptive cutoff frequency: estimate low end of pitch frequency range */
	if (psEncC1->prevSignalType == TYPE_VOICED) {
		/* difference, in log domain */
		pitch_freq_Hz_Q16 =
		    silk_DIV32_16(silk_LSHIFT
				  (silk_MUL(psEncC1->fs_kHz, 1000), 16),
				  psEncC1->prevLag);
		pitch_freq_log_Q7 = silk_lin2log(pitch_freq_Hz_Q16) - (16 << 7);

		/* adjustment based on quality */
		quality_Q15 = psEncC1->input_quality_bands_Q15[0];
		pitch_freq_log_Q7 =
		    silk_SMLAWB(pitch_freq_log_Q7,
				silk_SMULWB(silk_LSHIFT(-quality_Q15, 2),
					    quality_Q15),
				pitch_freq_log_Q7 -
				(silk_lin2log
				 (SILK_FIX_CONST(VARIABLE_HP_MIN_CUTOFF_HZ, 16))
				 - (16 << 7)));

		/* delta_freq = pitch_freq_log - psEnc->variable_HP_smth1; */
		delta_freq_Q7 =
		    pitch_freq_log_Q7 -
		    silk_RSHIFT(psEncC1->variable_HP_smth1_Q15, 8);
		if (delta_freq_Q7 < 0) {
			/* less smoothing for decreasing pitch frequency, to track something close to the minimum */
			delta_freq_Q7 = silk_MUL(delta_freq_Q7, 3);
		}

		/* limit delta, to reduce impact of outliers in pitch estimation */
		delta_freq_Q7 =
		    silk_LIMIT_32(delta_freq_Q7,
				  -SILK_FIX_CONST(VARIABLE_HP_MAX_DELTA_FREQ,
						  7),
				  SILK_FIX_CONST(VARIABLE_HP_MAX_DELTA_FREQ,
						 7));

		/* update smoother */
		psEncC1->variable_HP_smth1_Q15 =
		    silk_SMLAWB(psEncC1->variable_HP_smth1_Q15,
				silk_SMULBB(psEncC1->speech_activity_Q8,
					    delta_freq_Q7),
				SILK_FIX_CONST(VARIABLE_HP_SMTH_COEF1, 16));

		/* limit frequency range */
		psEncC1->variable_HP_smth1_Q15 =
		    silk_LIMIT_32(psEncC1->variable_HP_smth1_Q15,
				  silk_LSHIFT(silk_lin2log
					      (VARIABLE_HP_MIN_CUTOFF_HZ), 8),
				  silk_LSHIFT(silk_lin2log
					      (VARIABLE_HP_MAX_CUTOFF_HZ), 8));
	}
}
开发者ID:CEPBEP,项目名称:onion-phone,代码行数:61,代码来源:HP_variable_cutoff.c

示例10: silk_encode_signs

/* Encodes signs of excitation */
void silk_encode_signs(
    ec_enc                      *psRangeEnc,                        /* I/O  Compressor data structure                   */
    const opus_int8             pulses[],                           /* I    pulse signal                                */
    opus_int                    length,                             /* I    length of input                             */
    const opus_int              signalType,                         /* I    Signal type                                 */
    const opus_int              quantOffsetType,                    /* I    Quantization offset type                    */
    const opus_int              sum_pulses[ MAX_NB_SHELL_BLOCKS ]   /* I    Sum of absolute pulses per block            */
)
{
    opus_int         i, j, p;
    opus_uint8       icdf[ 2 ];
    const opus_int8  *q_ptr;
    const opus_uint8 *icdf_ptr;

    icdf[ 1 ] = 0;
    q_ptr = pulses;
    i = silk_SMULBB( 7, silk_ADD_LSHIFT( quantOffsetType, signalType, 1 ) );
    icdf_ptr = &silk_sign_iCDF[ i ];
    length = silk_RSHIFT( length + SHELL_CODEC_FRAME_LENGTH/2, LOG2_SHELL_CODEC_FRAME_LENGTH );
    for( i = 0; i < length; i++ ) {
        p = sum_pulses[ i ];
        if( p > 0 ) {
            icdf[ 0 ] = icdf_ptr[ silk_min( p & 0x1F, 6 ) ];
            for( j = 0; j < SHELL_CODEC_FRAME_LENGTH; j++ ) {
                if( q_ptr[ j ] != 0 ) {
                    ec_enc_icdf( psRangeEnc, silk_enc_map( q_ptr[ j ]), icdf, 8 );
                }
            }
        }
        q_ptr += SHELL_CODEC_FRAME_LENGTH;
    }
}
开发者ID:4nykey,项目名称:rockbox,代码行数:33,代码来源:code_signs.c

示例11: silk_SMULWB

static OPUS_INLINE opus_int16 *silk_resampler_private_IIR_FIR_INTERPOL(
    opus_int16  *out,
    opus_int16  *buf,
    opus_int32  max_index_Q16,
    opus_int32  index_increment_Q16
)
{
    opus_int32 index_Q16, res_Q15;
    opus_int16 *buf_ptr;
    opus_int32 table_index;

    /* Interpolate upsampled signal and store in output array */
    for( index_Q16 = 0; index_Q16 < max_index_Q16; index_Q16 += index_increment_Q16 ) {
        table_index = silk_SMULWB( index_Q16 & 0xFFFF, 12 );
        buf_ptr = &buf[ index_Q16 >> 16 ];

        res_Q15 = silk_SMULBB(          buf_ptr[ 0 ], silk_resampler_frac_FIR_12[      table_index ][ 0 ] );
        res_Q15 = silk_SMLABB( res_Q15, buf_ptr[ 1 ], silk_resampler_frac_FIR_12[      table_index ][ 1 ] );
        res_Q15 = silk_SMLABB( res_Q15, buf_ptr[ 2 ], silk_resampler_frac_FIR_12[      table_index ][ 2 ] );
        res_Q15 = silk_SMLABB( res_Q15, buf_ptr[ 3 ], silk_resampler_frac_FIR_12[      table_index ][ 3 ] );
        res_Q15 = silk_SMLABB( res_Q15, buf_ptr[ 4 ], silk_resampler_frac_FIR_12[ 11 - table_index ][ 3 ] );
        res_Q15 = silk_SMLABB( res_Q15, buf_ptr[ 5 ], silk_resampler_frac_FIR_12[ 11 - table_index ][ 2 ] );
        res_Q15 = silk_SMLABB( res_Q15, buf_ptr[ 6 ], silk_resampler_frac_FIR_12[ 11 - table_index ][ 1 ] );
        res_Q15 = silk_SMLABB( res_Q15, buf_ptr[ 7 ], silk_resampler_frac_FIR_12[ 11 - table_index ][ 0 ] );
        *out++ = (opus_int16)silk_SAT16( silk_RSHIFT_ROUND( res_Q15, 15 ) );
    }
    return out;
}
开发者ID:a12n,项目名称:godot,代码行数:28,代码来源:resampler_private_IIR_FIR.c

示例12: silk_prefilt_FIX

/* Prefilter for finding Quantizer input signal */
static OPUS_INLINE void silk_prefilt_FIX(
        silk_prefilter_state_FIX *P,                         /* I/O  state                               */
        opus_int32 st_res_Q12[],               /* I    short term residual signal          */
        opus_int32 xw_Q3[],                    /* O    prefiltered signal                  */
        opus_int32 HarmShapeFIRPacked_Q12,     /* I    Harmonic shaping coeficients        */
        opus_int Tilt_Q14,                   /* I    Tilt shaping coeficient             */
        opus_int32 LF_shp_Q14,                 /* I    Low-frequancy shaping coeficients   */
        opus_int lag,                        /* I    Lag for harmonic shaping            */
        opus_int length                      /* I    Length of signals                   */
) {
    opus_int i, idx, LTP_shp_buf_idx;
    opus_int32 n_LTP_Q12, n_Tilt_Q10, n_LF_Q10;
    opus_int32 sLF_MA_shp_Q12, sLF_AR_shp_Q12;
    opus_int16 *LTP_shp_buf;

    /* To speed up use temp variables instead of using the struct */
    LTP_shp_buf = P->sLTP_shp;
    LTP_shp_buf_idx = P->sLTP_shp_buf_idx;
    sLF_AR_shp_Q12 = P->sLF_AR_shp_Q12;
    sLF_MA_shp_Q12 = P->sLF_MA_shp_Q12;

    for (i = 0; i < length; i++) {
        if (lag > 0) {
            /* unrolled loop */
            silk_assert(HARM_SHAPE_FIR_TAPS == 3);
            idx = lag + LTP_shp_buf_idx;
            n_LTP_Q12 = silk_SMULBB(LTP_shp_buf[(idx - HARM_SHAPE_FIR_TAPS / 2 - 1) & LTP_MASK],
                                    HarmShapeFIRPacked_Q12);
            n_LTP_Q12 = silk_SMLABT(n_LTP_Q12,
                                    LTP_shp_buf[(idx - HARM_SHAPE_FIR_TAPS / 2) & LTP_MASK],
                                    HarmShapeFIRPacked_Q12);
            n_LTP_Q12 = silk_SMLABB(n_LTP_Q12,
                                    LTP_shp_buf[(idx - HARM_SHAPE_FIR_TAPS / 2 + 1) & LTP_MASK],
                                    HarmShapeFIRPacked_Q12);
        } else {
            n_LTP_Q12 = 0;
        }

        n_Tilt_Q10 = silk_SMULWB(sLF_AR_shp_Q12, Tilt_Q14);
        n_LF_Q10 = silk_SMLAWB(silk_SMULWT(sLF_AR_shp_Q12, LF_shp_Q14), sLF_MA_shp_Q12, LF_shp_Q14);

        sLF_AR_shp_Q12 = silk_SUB32(st_res_Q12[i], silk_LSHIFT(n_Tilt_Q10, 2));
        sLF_MA_shp_Q12 = silk_SUB32(sLF_AR_shp_Q12, silk_LSHIFT(n_LF_Q10, 2));

        LTP_shp_buf_idx = (LTP_shp_buf_idx - 1) & LTP_MASK;
        LTP_shp_buf[LTP_shp_buf_idx] = (opus_int16) silk_SAT16(
                silk_RSHIFT_ROUND(sLF_MA_shp_Q12, 12));

        xw_Q3[i] = silk_RSHIFT_ROUND(silk_SUB32(sLF_MA_shp_Q12, n_LTP_Q12), 9);
    }

    /* Copy temp variable back to state */
    P->sLF_AR_shp_Q12 = sLF_AR_shp_Q12;
    P->sLF_MA_shp_Q12 = sLF_MA_shp_Q12;
    P->sLTP_shp_buf_idx = LTP_shp_buf_idx;
}
开发者ID:KeepYoung24,项目名称:Yahala-Messenger,代码行数:57,代码来源:prefilter_FIX.c

示例13: silk_log2lin

/* Convert input to a linear scale    */
opus_int32 silk_log2lin( 
    const opus_int32            inLog_Q7            /* I  input on log scale                                            */
)
{
    opus_int32 out, frac_Q7;

    if( inLog_Q7 < 0 ) {
        return 0;
    }

    out = silk_LSHIFT( 1, silk_RSHIFT( inLog_Q7, 7 ) );
    frac_Q7 = inLog_Q7 & 0x7F;
    if( inLog_Q7 < 2048 ) {
        /* Piece-wise parabolic approximation */
        out = silk_ADD_RSHIFT32( out, silk_MUL( out, silk_SMLAWB( frac_Q7, silk_SMULBB( frac_Q7, 128 - frac_Q7 ), -174 ) ), 7 );
    } else {
        /* Piece-wise parabolic approximation */
        out = silk_MLA( out, silk_RSHIFT( out, 7 ), silk_SMLAWB( frac_Q7, silk_SMULBB( frac_Q7, 128 - frac_Q7 ), -174 ) );
    }
    return out;
}
开发者ID:AdaDoom3,项目名称:AdaDoom3Libraries,代码行数:22,代码来源:log2lin.c

示例14: silk_interpolate

/* Interpolate two vectors */
void silk_interpolate(
    opus_int16                  xi[ MAX_LPC_ORDER ],            /* O    interpolated vector                         */
    const opus_int16            x0[ MAX_LPC_ORDER ],            /* I    first vector                                */
    const opus_int16            x1[ MAX_LPC_ORDER ],            /* I    second vector                               */
    const opus_int              ifact_Q2,                       /* I    interp. factor, weight on 2nd vector        */
    const opus_int              d                               /* I    number of parameters                        */
)
{
    opus_int i;

    silk_assert( ifact_Q2 >= 0 );
    silk_assert( ifact_Q2 <= 4 );

    for( i = 0; i < d; i++ ) {
        xi[ i ] = (opus_int16)silk_ADD_RSHIFT( x0[ i ], silk_SMULBB( x1[ i ] - x0[ i ], ifact_Q2 ), 2 );
    }
}
开发者ID:03050903,项目名称:godot,代码行数:18,代码来源:interpolate.c

示例15: silk_LPC_analysis_filter

void silk_LPC_analysis_filter(
    opus_int16                  *out,               /* O    Output signal                                               */
    const opus_int16            *in,                /* I    Input signal                                                */
    const opus_int16            *B,                 /* I    MA prediction coefficients, Q12 [order]                     */
    const opus_int32            len,                /* I    Signal length                                               */
    const opus_int32            d                   /* I    Filter order                                                */
)
{
    opus_int         ix, j;
    opus_int32       out32_Q12, out32;
    const opus_int16 *in_ptr;

    silk_assert( d >= 6 );
    silk_assert( (d & 1) == 0 );
    silk_assert( d <= len );

    for( ix = d; ix < len; ix++ ) {
        in_ptr = &in[ ix - 1 ];

        out32_Q12 = silk_SMULBB( in_ptr[  0 ], B[ 0 ] );
        /* Allowing wrap around so that two wraps can cancel each other. The rare
           cases where the result wraps around can only be triggered by invalid streams*/
        out32_Q12 = silk_SMLABB_ovflw( out32_Q12, in_ptr[ -1 ], B[ 1 ] );
        out32_Q12 = silk_SMLABB_ovflw( out32_Q12, in_ptr[ -2 ], B[ 2 ] );
        out32_Q12 = silk_SMLABB_ovflw( out32_Q12, in_ptr[ -3 ], B[ 3 ] );
        out32_Q12 = silk_SMLABB_ovflw( out32_Q12, in_ptr[ -4 ], B[ 4 ] );
        out32_Q12 = silk_SMLABB_ovflw( out32_Q12, in_ptr[ -5 ], B[ 5 ] );
        for( j = 6; j < d; j += 2 ) {
            out32_Q12 = silk_SMLABB_ovflw( out32_Q12, in_ptr[ -j     ], B[ j     ] );
            out32_Q12 = silk_SMLABB_ovflw( out32_Q12, in_ptr[ -j - 1 ], B[ j + 1 ] );
        }

        /* Subtract prediction */
        out32_Q12 = silk_SUB32_ovflw( silk_LSHIFT( (opus_int32)in_ptr[ 1 ], 12 ), out32_Q12 );

        /* Scale to Q0 */
        out32 = silk_RSHIFT_ROUND( out32_Q12, 12 );

        /* Saturate output */
        out[ ix ] = (opus_int16)silk_SAT16( out32 );
    }

    /* Set first d output samples to zero */
    silk_memset( out, 0, d * sizeof( opus_int16 ) );
}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:45,代码来源:LPC_analysis_filter.c


注:本文中的silk_SMULBB函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。