OLD | NEW |
1 /*********************************************************************** | 1 /*********************************************************************** |
2 Copyright (c) 2006-2011, Skype Limited. All rights reserved. | 2 Copyright (c) 2006-2011, Skype Limited. All rights reserved. |
3 Redistribution and use in source and binary forms, with or without | 3 Redistribution and use in source and binary forms, with or without |
4 modification, are permitted provided that the following conditions | 4 modification, are permitted provided that the following conditions |
5 are met: | 5 are met: |
6 - Redistributions of source code must retain the above copyright notice, | 6 - Redistributions of source code must retain the above copyright notice, |
7 this list of conditions and the following disclaimer. | 7 this list of conditions and the following disclaimer. |
8 - Redistributions in binary form must reproduce the above copyright | 8 - Redistributions in binary form must reproduce the above copyright |
9 notice, this list of conditions and the following disclaimer in the | 9 notice, this list of conditions and the following disclaimer in the |
10 documentation and/or other materials provided with the distribution. | 10 documentation and/or other materials provided with the distribution. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 opus_int32 LF_shp_Q14, /* I
*/ | 54 opus_int32 LF_shp_Q14, /* I
*/ |
55 opus_int32 Gain_Q16, /* I
*/ | 55 opus_int32 Gain_Q16, /* I
*/ |
56 opus_int Lambda_Q10, /* I
*/ | 56 opus_int Lambda_Q10, /* I
*/ |
57 opus_int offset_Q10, /* I
*/ | 57 opus_int offset_Q10, /* I
*/ |
58 opus_int length, /* I Input length
*/ | 58 opus_int length, /* I Input length
*/ |
59 opus_int subfr, /* I Subframe number
*/ | 59 opus_int subfr, /* I Subframe number
*/ |
60 opus_int shapingLPCOrder, /* I Shaping LPC filter order
*/ | 60 opus_int shapingLPCOrder, /* I Shaping LPC filter order
*/ |
61 opus_int predictLPCOrder, /* I Prediction filter order
*/ | 61 opus_int predictLPCOrder, /* I Prediction filter order
*/ |
62 opus_int warping_Q16, /* I
*/ | 62 opus_int warping_Q16, /* I
*/ |
63 opus_int nStatesDelayedDecision, /* I Number of states in deci
sion tree */ | 63 opus_int nStatesDelayedDecision, /* I Number of states in deci
sion tree */ |
64 opus_int *smpl_buf_idx, /* I Index to newest samples
in buffers */ | 64 opus_int *smpl_buf_idx, /* I/O Index to newest samples
in buffers */ |
65 opus_int decisionDelay, /* I
*/ | 65 opus_int decisionDelay, /* I
*/ |
66 int arch /* I
*/ | 66 int arch /* I
*/ |
67 ) | 67 ) |
68 { | 68 { |
69 opus_int i, j, k, Winner_ind, RDmin_ind, RDmax_ind, last_smple_idx; | 69 opus_int i, j, k, Winner_ind, RDmin_ind, RDmax_ind, last_smple_idx; |
70 opus_int32 Winner_rand_state; | 70 opus_int32 Winner_rand_state; |
71 opus_int32 LTP_pred_Q14, LPC_pred_Q14, n_AR_Q14, n_LTP_Q14; | 71 opus_int32 LTP_pred_Q14, LPC_pred_Q14, n_AR_Q14, n_LTP_Q14; |
72 opus_int32 n_LF_Q14, r_Q10, rr_Q10, rd1_Q10, rd2_Q10, RDmin_Q10, RDmax_Q10
; | 72 opus_int32 n_LF_Q14, r_Q10, rr_Q10, rd1_Q10, rd2_Q10, RDmin_Q10, RDmax_Q10
; |
73 opus_int32 q1_Q0, q1_Q10, q2_Q10, exc_Q14, LPC_exc_Q14, xq_Q14, Gain_Q10; | 73 opus_int32 q1_Q0, q1_Q10, q2_Q10, exc_Q14, LPC_exc_Q14, xq_Q14, Gain_Q10; |
74 opus_int32 tmp1, tmp2, sLF_AR_shp_Q14; | 74 opus_int32 tmp1, tmp2, sLF_AR_shp_Q14; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 xq_Q14 = silk_ADD32( LPC_exc_Q14, LPC_pred_Q14 ); | 316 xq_Q14 = silk_ADD32( LPC_exc_Q14, LPC_pred_Q14 ); |
317 | 317 |
318 /* Update states */ | 318 /* Update states */ |
319 sLF_AR_shp_Q14 = silk_SUB32( xq_Q14, n_AR_Q14 ); | 319 sLF_AR_shp_Q14 = silk_SUB32( xq_Q14, n_AR_Q14 ); |
320 psSS[ 1 ].sLTP_shp_Q14 = silk_SUB32( sLF_AR_shp_Q14, n_LF_Q14 ); | 320 psSS[ 1 ].sLTP_shp_Q14 = silk_SUB32( sLF_AR_shp_Q14, n_LF_Q14 ); |
321 psSS[ 1 ].LF_AR_Q14 = sLF_AR_shp_Q14; | 321 psSS[ 1 ].LF_AR_Q14 = sLF_AR_shp_Q14; |
322 psSS[ 1 ].LPC_exc_Q14 = LPC_exc_Q14; | 322 psSS[ 1 ].LPC_exc_Q14 = LPC_exc_Q14; |
323 psSS[ 1 ].xq_Q14 = xq_Q14; | 323 psSS[ 1 ].xq_Q14 = xq_Q14; |
324 } | 324 } |
325 | 325 |
326 *smpl_buf_idx = ( *smpl_buf_idx - 1 ) & DECISION_DELAY_MASK;
/* Index to newest samples */ | 326 *smpl_buf_idx = ( *smpl_buf_idx - 1 ) % DECISION_DELAY; |
327 last_smple_idx = ( *smpl_buf_idx + decisionDelay ) & DECISION_DELAY_MASK
; /* Index to decisionDelay old samples */ | 327 if( *smpl_buf_idx < 0 ) *smpl_buf_idx += DECISION_DELAY; |
| 328 last_smple_idx = ( *smpl_buf_idx + decisionDelay ) % DECISION_DELAY; |
328 | 329 |
329 /* Find winner */ | 330 /* Find winner */ |
330 RDmin_Q10 = psSampleState[ 0 ][ 0 ].RD_Q10; | 331 RDmin_Q10 = psSampleState[ 0 ][ 0 ].RD_Q10; |
331 Winner_ind = 0; | 332 Winner_ind = 0; |
332 for( k = 1; k < nStatesDelayedDecision; k++ ) { | 333 for( k = 1; k < nStatesDelayedDecision; k++ ) { |
333 if( psSampleState[ k ][ 0 ].RD_Q10 < RDmin_Q10 ) { | 334 if( psSampleState[ k ][ 0 ].RD_Q10 < RDmin_Q10 ) { |
334 RDmin_Q10 = psSampleState[ k ][ 0 ].RD_Q10; | 335 RDmin_Q10 = psSampleState[ k ][ 0 ].RD_Q10; |
335 Winner_ind = k; | 336 Winner_ind = k; |
336 } | 337 } |
337 } | 338 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 delayedGain_Q10[ *smpl_buf_idx ] = Gain_Q10; | 401 delayedGain_Q10[ *smpl_buf_idx ] = Gain_Q10; |
401 } | 402 } |
402 /* Update LPC states */ | 403 /* Update LPC states */ |
403 for( k = 0; k < nStatesDelayedDecision; k++ ) { | 404 for( k = 0; k < nStatesDelayedDecision; k++ ) { |
404 psDD = &psDelDec[ k ]; | 405 psDD = &psDelDec[ k ]; |
405 silk_memcpy( psDD->sLPC_Q14, &psDD->sLPC_Q14[ length ], NSQ_LPC_BUF_LENG
TH * sizeof( opus_int32 ) ); | 406 silk_memcpy( psDD->sLPC_Q14, &psDD->sLPC_Q14[ length ], NSQ_LPC_BUF_LENG
TH * sizeof( opus_int32 ) ); |
406 } | 407 } |
407 } | 408 } |
408 | 409 |
409 #endif /* __NSQ_DEL_DEC_MIPSR1_H__ */ | 410 #endif /* __NSQ_DEL_DEC_MIPSR1_H__ */ |
OLD | NEW |