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


C++ SKP_SMULBB函数代码示例

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


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

示例1: SKP_Silk_int16_array_maxabs

SKP_int16 SKP_Silk_int16_array_maxabs(    /* O    Maximum absolute value, max: 2^15-1   */
    const SKP_int16        *vec,            /* I    Input vector  [len]                   */
    const SKP_int32        len              /* I    Length of input vector                */
)                    
{
    SKP_int32 max = 0, i, lvl = 0, ind;
	if( len == 0 ) return 0;

    ind = len - 1;
    max = SKP_SMULBB( vec[ ind ], vec[ ind ] );
    for( i = len - 2; i >= 0; i-- ) {
        lvl = SKP_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( SKP_int16_MAX );
    } else {
        if( vec[ ind ] < 0 ) {
            return( -vec[ ind ] );
        } else {
            return(  vec[ ind ] );
        }
    }
}
开发者ID:Archipov,项目名称:android-client,代码行数:29,代码来源:SKP_Silk_array_maxabs.c

示例2: SKP_Silk_int16_array_maxabs

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

	ind = len - 1;
	max = SKP_SMULBB(vec[ind], vec[ind]);
	for (i = len - 2; i >= 0; i--) {
		lvl = SKP_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 */
	lvl = SKP_abs(vec[ind]);
	if (lvl > int16_t_MAX) {
		return (int16_t_MAX);
	} else {
		return ((int16_t) lvl);
	}
}
开发者ID:CEPBEP,项目名称:onion-phone,代码行数:26,代码来源:SKP_Silk_array_maxabs.c

示例3: SKP_Silk_sigm_Q15

SKP_int SKP_Silk_sigm_Q15( SKP_int in_Q5 )
{
    SKP_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 = SKP_RSHIFT( in_Q5, 5 );
            return( sigm_LUT_neg_Q15[ ind ] - SKP_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 = SKP_RSHIFT( in_Q5, 5 );
            return( sigm_LUT_pos_Q15[ ind ] + SKP_SMULBB( sigm_LUT_slope_Q10[ ind ], in_Q5 & 0x1F ) );
        }
    }
}
开发者ID:CloudStyleStudio,项目名称:csip,代码行数:25,代码来源:SKP_Silk_sigm_Q15.c

示例4: SKP_Silk_resample_3_1

/* Resamples by a factor 3/1 */
void SKP_Silk_resample_3_1(
    SKP_int16           *out,       /* O:   Fs_high signal [inLen*3]        */
    SKP_int32           *S,         /* I/O: State vector   [7]              */
    const SKP_int16     *in,        /* I:   Fs_low signal  [inLen]          */
    const SKP_int32     inLen       /* I:   Input length                    */
)
{
    SKP_int     k, LSubFrameIn, LSubFrameOut;
    SKP_int32   out_tmp, idx, inLenTmp = inLen;
    SKP_int32   scratch00[    IN_SUBFR_LEN_RESAMPLE_3_1 ];
    SKP_int32   scratch0[ 3 * IN_SUBFR_LEN_RESAMPLE_3_1 ];
    SKP_int32   scratch1[ 3 * IN_SUBFR_LEN_RESAMPLE_3_1 ];
    
    /* Coefficients for 3-fold resampling */
    const SKP_int16 A30[ 2 ] = {  1773, 17818 };
    const SKP_int16 A31[ 2 ] = {  4942, 25677 };
    const SKP_int16 A32[ 2 ] = { 11786, 29304 };

    while( inLenTmp > 0 ) {
        LSubFrameIn  = SKP_min_int( IN_SUBFR_LEN_RESAMPLE_3_1, inLenTmp );
        LSubFrameOut = SKP_SMULBB( 3, LSubFrameIn );

        /* Convert Q15 -> Q25 */
        for( k = 0; k < LSubFrameIn; k++ ) {
            scratch00[k] = SKP_LSHIFT( (SKP_int32)in[ k ], 10 );
        }

        /* Allpass filtering */
        /* Scratch size: 2 * 3* LSubFrame * sizeof(SKP_int32) */
        SKP_Silk_allpass_int( scratch00, S + 1, A30[ 0 ], scratch1, LSubFrameIn );
        SKP_Silk_allpass_int( scratch1,  S + 2, A30[ 1 ], scratch0, LSubFrameIn );

        SKP_Silk_allpass_int( scratch00, S + 3, A31[ 0 ], scratch1, LSubFrameIn );
        SKP_Silk_allpass_int( scratch1,  S + 4, A31[ 1 ], scratch0 +     IN_SUBFR_LEN_RESAMPLE_3_1, LSubFrameIn );

        SKP_Silk_allpass_int( scratch00, S + 5, A32[ 0 ], scratch1, LSubFrameIn );
        SKP_Silk_allpass_int( scratch1,  S + 6, A32[ 1 ], scratch0 + 2 * IN_SUBFR_LEN_RESAMPLE_3_1, LSubFrameIn );

        /* Interleave three allpass outputs */
        for( k = 0; k < LSubFrameIn; k++ ) {
            idx = SKP_SMULBB( 3, k );
            scratch1[ idx     ] = scratch0[ k ];
            scratch1[ idx + 1 ] = scratch0[ k +     IN_SUBFR_LEN_RESAMPLE_3_1 ];
            scratch1[ idx + 2 ] = scratch0[ k + 2 * IN_SUBFR_LEN_RESAMPLE_3_1 ];
        }

        /* Low-pass filtering */
        SKP_Silk_lowpass_int( scratch1, S, scratch0, LSubFrameOut );

        /* Saturate and convert to SKP_int16 */
        for( k = 0; k < LSubFrameOut; k++ ) {
            out_tmp  = scratch0[ k ];
            out[ k ] = (SKP_int16) SKP_SAT16( SKP_RSHIFT_ROUND( out_tmp, 10 ) );
        }

        in       += LSubFrameIn;
        inLenTmp -= LSubFrameIn;
        out      += LSubFrameOut;
    }
}
开发者ID:371816210,项目名称:mysipdroid,代码行数:61,代码来源:SKP_Silk_resample_3_1.c

示例5: SKP_Silk_LPC_analysis_filter

/* Inverse filter of SKP_Silk_LPC_synthesis_filter */
void SKP_Silk_LPC_analysis_filter(
    const SKP_int16      *in,            /* I:   Input signal                                */
    const SKP_int16      *B,             /* I:   MA prediction coefficients, Q12 [order]     */
    SKP_int16            *S,             /* I/O: State vector [order]                        */
    SKP_int16            *out,           /* O:   Output signal                               */
    const SKP_int32      len,            /* I:   Signal length                               */
    const SKP_int32      Order           /* I:   Filter order                                */
)
{
    SKP_int   k, j, idx, Order_half = SKP_RSHIFT( Order, 1 );
    SKP_int32 Btmp, B_align_Q12[ SigProc_MAX_ORDER_LPC >> 1 ], out32_Q12, out32;
    SKP_int16 SA, SB;
    /* Order must be even */
    SKP_assert( 2 * Order_half == Order );

    /* Combine two A_Q12 values and ensure 32-bit alignment */
    for( k = 0; k < Order_half; k++ ) {
        idx = SKP_SMULBB( 2, k );
        B_align_Q12[ k ] = ( ( (SKP_int32)B[ idx ] ) & 0x0000ffff ) | SKP_LSHIFT( (SKP_int32)B[ idx + 1 ], 16 );
    }

    /* S[] values are in Q0 */
    for( k = 0; k < len; k++ ) {
        SA = S[ 0 ];
        out32_Q12 = 0;
        for( j = 0; j < ( Order_half - 1 ); j++ ) {
            idx = SKP_SMULBB( 2, j ) + 1;
            /* Multiply-add two prediction coefficients for each loop */
            Btmp = B_align_Q12[ j ];
            SB = S[ idx ];
            S[ idx ] = SA;
            out32_Q12 = SKP_SMLABB( out32_Q12, SA, Btmp );
            out32_Q12 = SKP_SMLABT( out32_Q12, SB, Btmp );
            SA = S[ idx + 1 ];
            S[ idx + 1 ] = SB;
        }

        /* Unrolled loop: epilog */
        Btmp = B_align_Q12[ Order_half - 1 ];
        SB = S[ Order - 1 ];
        S[ Order - 1 ] = SA;
        out32_Q12 = SKP_SMLABB( out32_Q12, SA, Btmp );
        out32_Q12 = SKP_SMLABT( out32_Q12, SB, Btmp );

        /* Subtract prediction */
        out32_Q12 = SKP_SUB_SAT32( SKP_LSHIFT( (SKP_int32)in[ k ], 12 ), out32_Q12 );

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

        /* Saturate output */
        out[ k ] = (SKP_int16)SKP_SAT16( out32 );

        /* Move input line */
        S[ 0 ] = in[ k ];
    }
}
开发者ID:371816210,项目名称:mysipdroid,代码行数:58,代码来源:SKP_Silk_MA.c

示例6: SKP_Silk_NLSF_VQ_sum_error_FIX

/* Compute weighted quantization errors for an LPC_order element input vector, over one codebook stage */
void SKP_Silk_NLSF_VQ_sum_error_FIX(int32_t * err_Q20,	/* O    Weighted quantization errors  [N*K]         */
				    const int *in_Q15,	/* I    Input vectors to be quantized [N*LPC_order] */
				    const int *w_Q6,	/* I    Weighting vectors             [N*LPC_order] */
				    const int16_t * pCB_Q15,	/* I    Codebook vectors              [K*LPC_order] */
				    const int N,	/* I    Number of input vectors                     */
				    const int K,	/* I    Number of codebook vectors                  */
				    const int LPC_order	/* I    Number of LPCs                              */
    )
{
	int i, n, m;
	int32_t diff_Q15, sum_error, Wtmp_Q6;
	int32_t Wcpy_Q6[MAX_LPC_ORDER / 2];
	const int16_t *cb_vec_Q15;

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

	memzero(Wcpy_Q6, (MAX_LPC_ORDER / 2) * sizeof(int32_t));

	/* Copy to local stack and pack two weights per int32 */
	for (m = 0; m < SKP_RSHIFT(LPC_order, 1); m++) {
		Wcpy_Q6[m] =
		    w_Q6[2 * m] | SKP_LSHIFT((int32_t) w_Q6[2 * m + 1], 16);
	}

	/* Loop over input vectors */
	for (n = 0; n < N; n++) {
		/* Loop over codebook */
		cb_vec_Q15 = pCB_Q15;
		for (i = 0; i < K; i++) {
			sum_error = 0;
			for (m = 0; m < LPC_order; m += 2) {
				/* Get two weights packed in an int32 */
				Wtmp_Q6 = Wcpy_Q6[SKP_RSHIFT(m, 1)];

				/* Compute weighted squared quantization error for index m */
				diff_Q15 = in_Q15[m] - *cb_vec_Q15++;	// range: [ -32767 : 32767 ]
				sum_error =
				    SKP_SMLAWB(sum_error,
					       SKP_SMULBB(diff_Q15, diff_Q15),
					       Wtmp_Q6);

				/* Compute weighted squared quantization error for index m + 1 */
				diff_Q15 = in_Q15[m + 1] - *cb_vec_Q15++;	// range: [ -32767 : 32767 ]
				sum_error =
				    SKP_SMLAWT(sum_error,
					       SKP_SMULBB(diff_Q15, diff_Q15),
					       Wtmp_Q6);
			}
			assert(sum_error >= 0);
			err_Q20[i] = sum_error;
		}
		err_Q20 += K;
		in_Q15 += LPC_order;
	}
}
开发者ID:CEPBEP,项目名称:onion-phone,代码行数:57,代码来源:SKP_Silk_NLSF_VQ_sum_error_FIX.c

示例7: SKP_Silk_decoder_set_fs

/* Set decoder sampling rate */
void SKP_Silk_decoder_set_fs(SKP_Silk_decoder_state * psDec,	/* I/O  Decoder state pointer                       */
			     int fs_kHz	/* I    Sampling frequency (kHz)                    */
    )
{
	if (psDec->fs_kHz != fs_kHz) {
		psDec->fs_kHz = fs_kHz;
		psDec->frame_length = SKP_SMULBB(FRAME_LENGTH_MS, fs_kHz);
		psDec->subfr_length =
		    SKP_SMULBB(FRAME_LENGTH_MS / NB_SUBFR, fs_kHz);
		if (psDec->fs_kHz == 8) {
			psDec->LPC_order = MIN_LPC_ORDER;
			psDec->psNLSF_CB[0] = &SKP_Silk_NLSF_CB0_10;
			psDec->psNLSF_CB[1] = &SKP_Silk_NLSF_CB1_10;
		} else {
			psDec->LPC_order = MAX_LPC_ORDER;
			psDec->psNLSF_CB[0] = &SKP_Silk_NLSF_CB0_16;
			psDec->psNLSF_CB[1] = &SKP_Silk_NLSF_CB1_16;
		}
		/* Reset part of the decoder state */
		SKP_memset(psDec->sLPC_Q14, 0, MAX_LPC_ORDER * sizeof(int32_t));
		SKP_memset(psDec->outBuf, 0,
			   MAX_FRAME_LENGTH * sizeof(int16_t));
		SKP_memset(psDec->prevNLSF_Q15, 0, MAX_LPC_ORDER * sizeof(int));

		psDec->sLTP_buf_idx = 0;
		psDec->lagPrev = 100;
		psDec->LastGainIndex = 1;
		psDec->prev_sigtype = 0;
		psDec->first_frame_after_reset = 1;

		if (fs_kHz == 24) {
			psDec->HP_A = SKP_Silk_Dec_A_HP_24;
			psDec->HP_B = SKP_Silk_Dec_B_HP_24;
		} else if (fs_kHz == 16) {
			psDec->HP_A = SKP_Silk_Dec_A_HP_16;
			psDec->HP_B = SKP_Silk_Dec_B_HP_16;
		} else if (fs_kHz == 12) {
			psDec->HP_A = SKP_Silk_Dec_A_HP_12;
			psDec->HP_B = SKP_Silk_Dec_B_HP_12;
		} else if (fs_kHz == 8) {
			psDec->HP_A = SKP_Silk_Dec_A_HP_8;
			psDec->HP_B = SKP_Silk_Dec_B_HP_8;
		} else {
			/* unsupported sampling rate */
			assert(0);
		}
	}

	/* Check that settings are valid */
	assert(psDec->frame_length > 0
		   && psDec->frame_length <= MAX_FRAME_LENGTH);
}
开发者ID:CEPBEP,项目名称:onion-phone,代码行数:53,代码来源:SKP_Silk_decoder_set_fs.c

示例8: 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 */
    SKP_memcpy( x1, state->sMid,  2 * sizeof( opus_int16 ) );
    SKP_memcpy( x2, state->sSide, 2 * sizeof( opus_int16 ) );
    SKP_memcpy( state->sMid,  &x1[ frame_length ], 2 * sizeof( opus_int16 ) );
    SKP_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  = SKP_DIV32_16( 1 << 16, STEREO_INTERP_LEN_MS * fs_kHz );
    delta0_Q13 = SKP_RSHIFT_ROUND( SKP_SMULBB( pred_Q13[ 0 ] - state->pred_prev_Q13[ 0 ], denom_Q16 ), 16 );
    delta1_Q13 = SKP_RSHIFT_ROUND( SKP_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 = SKP_LSHIFT( SKP_ADD_LSHIFT( x1[ n ] + x1[ n + 2 ], x1[ n + 1 ], 1 ), 9 );         /* Q11 */ 
        sum = SKP_SMLAWB( SKP_LSHIFT( ( opus_int32 )x2[ n + 1 ], 8 ), sum, pred0_Q13 );          /* Q8  */
        sum = SKP_SMLAWB( sum, SKP_LSHIFT( ( opus_int32 )x1[ n + 1 ], 11 ), pred1_Q13 );         /* Q8  */
        x2[ n + 1 ] = (opus_int16)SKP_SAT16( SKP_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 = SKP_LSHIFT( SKP_ADD_LSHIFT( x1[ n ] + x1[ n + 2 ], x1[ n + 1 ], 1 ), 9 );         /* Q11 */ 
        sum = SKP_SMLAWB( SKP_LSHIFT( ( opus_int32 )x2[ n + 1 ], 8 ), sum, pred0_Q13 );          /* Q8  */
        sum = SKP_SMLAWB( sum, SKP_LSHIFT( ( opus_int32 )x1[ n + 1 ], 11 ), pred1_Q13 );         /* Q8  */
        x2[ n + 1 ] = (opus_int16)SKP_SAT16( SKP_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)SKP_SAT16( sum );
        x2[ n + 1 ] = (opus_int16)SKP_SAT16( diff );
    }
}
开发者ID:bemasc,项目名称:opus-multimode,代码行数:52,代码来源:silk_stereo_MS_to_LR.c

示例9: silk_encode_signs

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

    icdf[ 1 ] = 0;
    q_ptr = pulses;
    i = SKP_SMULBB( 6, SKP_ADD_LSHIFT( quantOffsetType, signalType, 1 ) );
    icdf_ptr = &silk_sign_iCDF[ i ];
    length = SKP_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[ SKP_min( p - 1, 5 ) ];
            for( j = 0; j < SHELL_CODEC_FRAME_LENGTH; j++ ) {
                if( q_ptr[ j ] != 0 ) {
                    ec_enc_icdf( psRangeEnc, SKP_enc_map( q_ptr[ j ]), icdf, 8 );
                }
            }
        }
        q_ptr += SHELL_CODEC_FRAME_LENGTH;
    }
}
开发者ID:opuscodec,项目名称:ref,代码行数:33,代码来源:silk_code_signs.c

示例10: SKP_Silk_MA

/* Variable order MA filter */
void SKP_Silk_MA(
    const SKP_int16      *in,            /* I:   input signal                                */
    const SKP_int16      *B,             /* I:   MA coefficients, Q13 [order+1]              */
    SKP_int32            *S,             /* I/O: state vector [order]                        */
    SKP_int16            *out,           /* O:   output signal                               */
    const SKP_int32      len,            /* I:   signal length                               */
    const SKP_int32      order           /* I:   filter order                                */
)
{
    SKP_int   k, d, in16;
    SKP_int32 out32;
    
    for( k = 0; k < len; k++ ) {
        in16 = in[ k ];
        out32 = SKP_SMLABB( S[ 0 ], in16, B[ 0 ] );
        out32 = SKP_RSHIFT_ROUND( out32, 13 );
        
        for( d = 1; d < order; d++ ) {
            S[ d - 1 ] = SKP_SMLABB( S[ d ], in16, B[ d ] );
        }
        S[ order - 1 ] = SKP_SMULBB( in16, B[ order ] );

        /* Limit */
        out[ k ] = (SKP_int16)SKP_SAT16( out32 );
    }
}
开发者ID:371816210,项目名称:mysipdroid,代码行数:27,代码来源:SKP_Silk_MA.c

示例11: SKP_Silk_decode_signs

/* Decodes signs of excitation */
void SKP_Silk_decode_signs(SKP_Silk_range_coder_state * sRC,	/* I/O  Range coder state                           */
			   int q[],	/* I/O  pulse signal                                */
			   const int length,	/* I    length of output                            */
			   const int sigtype,	/* I    Signal type                                 */
			   const int QuantOffsetType,	/* I    Quantization offset type                    */
			   const int RateLevelIndex	/* I    Rate Level Index                            */
    )
{
	int i;
	int data;
	const uint16_t *cdf;

	i = SKP_SMULBB(N_RATE_LEVELS - 1,
		       SKP_LSHIFT(sigtype,
				  1) + QuantOffsetType) + RateLevelIndex;
	cdf = SKP_Silk_sign_CDF[i];

	for (i = 0; i < length; i++) {
		if (q[i] > 0) {
			SKP_Silk_range_decoder(&data, sRC, cdf, 1);
			/* attach sign */
			/* implementation with shift, subtraction, multiplication */
			q[i] *= SKP_dec_map(data);
		}
	}
}
开发者ID:CEPBEP,项目名称:onion-phone,代码行数:27,代码来源:SKP_Silk_code_signs.c

示例12: SKP_Silk_NLSF2A_stable

/* Convert NLSF parameters to stable AR prediction filter coefficients */
void SKP_Silk_NLSF2A_stable(
    SKP_int16                       pAR_Q12[ MAX_LPC_ORDER ],   /* O    Stabilized AR coefs [LPC_order]     */ 
    const SKP_int                   pNLSF[ MAX_LPC_ORDER ],     /* I    NLSF vector         [LPC_order]     */
    const SKP_int                   LPC_order                   /* I    LPC/LSF order                       */
)
{
    SKP_int   i;
    SKP_int32 invGain_Q30;

    SKP_Silk_NLSF2A( pAR_Q12, pNLSF, LPC_order );

    /* Ensure stable LPCs */
    for( i = 0; i < MAX_LPC_STABILIZE_ITERATIONS; i++ ) {
        if( SKP_Silk_LPC_inverse_pred_gain( &invGain_Q30, pAR_Q12, LPC_order ) == 1 ) {
            SKP_Silk_bwexpander( pAR_Q12, LPC_order, 65536 - SKP_SMULBB( 10 + i, i ) );		/* 10_Q16 = 0.00015 */
        } else {
            break;
        }
    }

    /* Reached the last iteration */
    if( i == MAX_LPC_STABILIZE_ITERATIONS ) {
        SKP_assert( 0 );
        for( i = 0; i < LPC_order; i++ ) {
            pAR_Q12[ i ] = 0;
        }
    }
}
开发者ID:AndyLavr,项目名称:wechat-dump,代码行数:29,代码来源:SKP_Silk_NLSF2A_stable.c

示例13: SKP_Silk_corrVector_FIX

/* Calculates correlation vector X'*t */
void SKP_Silk_corrVector_FIX(
    const SKP_int16                 *x,         /* I    x vector [L + order - 1] used to form data matrix X */
    const SKP_int16                 *t,         /* I    target vector [L]                                   */
    const SKP_int                   L,          /* I    Length of vectors                                   */
    const SKP_int                   order,      /* I    Max lag for correlation                             */
    SKP_int32                       *Xt,        /* O    Pointer to X'*t correlation vector [order]          */
    const SKP_int                   rshifts     /* I    Right shifts of correlations                        */
)
{
    SKP_int         lag, i;
    const SKP_int16 *ptr1, *ptr2;
    SKP_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 += SKP_RSHIFT32( SKP_SMULBB( ptr1[ i ], ptr2[i] ), rshifts );
            }
            Xt[ lag ] = inner_prod; /* X[:,lag]'*t */
            ptr1--; /* Go to next column of X */
        }
    } else {
        SKP_assert( rshifts == 0 );
        for( lag = 0; lag < order; lag++ ) {
            Xt[ lag ] = SKP_Silk_inner_prod_aligned( ptr1, ptr2, L ); /* X[:,lag]'*t */
            ptr1--; /* Go to next column of X */
        }
    }
}
开发者ID:FreeMCU,项目名称:freemcu,代码行数:35,代码来源:SKP_Silk_corrMatrix_FIX.c

示例14: SKP_Silk_MA_Prediction

/* Variable order MA prediction error filter */
void SKP_Silk_MA_Prediction(
    const SKP_int16      *in,            /* I:   Input signal                                */
    const SKP_int16      *B,             /* I:   MA prediction coefficients, Q12 [order]     */
    SKP_int32            *S,             /* I/O: State vector [order]                        */
    SKP_int16            *out,           /* O:   Output signal                               */
    const SKP_int32      len,            /* I:   Signal length                               */
    const SKP_int32      order           /* I:   Filter order                                */
)
{
    SKP_int   k, d, in16;
    SKP_int32 out32;

    for( k = 0; k < len; k++ ) {
        in16 = in[ k ];
        out32 = SKP_LSHIFT( in16, 12 ) - S[ 0 ];
        out32 = SKP_RSHIFT_ROUND( out32, 12 );
        
        for( d = 0; d < order - 1; d++ ) {
            S[ d ] = SKP_SMLABB_ovflw( S[ d + 1 ], in16, B[ d ] );
        }
        S[ order - 1 ] = SKP_SMULBB( in16, B[ order - 1 ] );

        /* Limit */
        out[ k ] = (SKP_int16)SKP_SAT16( out32 );
    }
}
开发者ID:Distrotech,项目名称:mssilk,代码行数:27,代码来源:SKP_Silk_MA.c

示例15: SKP_Silk_encode_signs

/* Encodes signs of excitation */
void SKP_Silk_encode_signs(
    SKP_Silk_range_coder_state      *sRC,               /* I/O  Range coder state                       */
    const SKP_int8                  q[],                /* I    Pulse signal                            */
    const SKP_int                   length,             /* I    Length of input                         */
    const SKP_int                   sigtype,            /* I    Signal type                             */
    const SKP_int                   QuantOffsetType,    /* I    Quantization offset type                */
    const SKP_int                   RateLevelIndex      /* I    Rate level index                        */
)
{
    SKP_int i;
    SKP_int inData;
    SKP_uint16 cdf[ 3 ];

    i = SKP_SMULBB( N_RATE_LEVELS - 1, SKP_LSHIFT( sigtype, 1 ) + QuantOffsetType ) + RateLevelIndex;
    cdf[ 0 ] = 0;
    cdf[ 1 ] = SKP_Silk_sign_CDF[ i ];
    cdf[ 2 ] = 65535;
    
    for( i = 0; i < length; i++ ) {
        if( q[ i ] != 0 ) {
            inData = SKP_enc_map( q[ i ] ); /* - = 0, + = 1 */
            SKP_Silk_range_encoder( sRC, inData, cdf );
        }
    }
}
开发者ID:Agostin,项目名称:csipsimple,代码行数:26,代码来源:SKP_Silk_code_signs.c


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