Mercurial > libavcodec.hg
comparison acelp_pitch_delay.c @ 8505:c8743c33eeef libavcodec
Remove duplicated dot product code. Use dsputil's
scalarproduct instead. Patch by Aurelien Jacobs.
author | reynaldo |
---|---|
date | Mon, 29 Dec 2008 17:14:30 +0000 |
parents | ecb1962c12f3 |
children | afad312b9989 |
comparison
equal
deleted
inserted
replaced
8504:3bfb7a2ea222 | 8505:c8743c33eeef |
---|---|
19 * License along with FFmpeg; if not, write to the Free Software | 19 * License along with FFmpeg; if not, write to the Free Software |
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
21 */ | 21 */ |
22 | 22 |
23 #include "avcodec.h" | 23 #include "avcodec.h" |
24 #include "dsputil.h" | |
24 #include "acelp_pitch_delay.h" | 25 #include "acelp_pitch_delay.h" |
25 #include "celp_math.h" | 26 #include "celp_math.h" |
26 | 27 |
27 int ff_acelp_decode_8bit_to_1st_delay3(int ac_index) | 28 int ff_acelp_decode_8bit_to_1st_delay3(int ac_index) |
28 { | 29 { |
85 else | 86 else |
86 quant_energy[0] = (6165 * ((ff_log2(gain_corr_factor) >> 2) - (13 << 13))) >> 13; | 87 quant_energy[0] = (6165 * ((ff_log2(gain_corr_factor) >> 2) - (13 << 13))) >> 13; |
87 } | 88 } |
88 | 89 |
89 int16_t ff_acelp_decode_gain_code( | 90 int16_t ff_acelp_decode_gain_code( |
91 DSPContext *dsp, | |
90 int gain_corr_factor, | 92 int gain_corr_factor, |
91 const int16_t* fc_v, | 93 const int16_t* fc_v, |
92 int mr_energy, | 94 int mr_energy, |
93 const int16_t* quant_energy, | 95 const int16_t* quant_energy, |
94 const int16_t* ma_prediction_coeff, | 96 const int16_t* ma_prediction_coeff, |
101 | 103 |
102 for(i=0; i<ma_pred_order; i++) | 104 for(i=0; i<ma_pred_order; i++) |
103 mr_energy += quant_energy[i] * ma_prediction_coeff[i]; | 105 mr_energy += quant_energy[i] * ma_prediction_coeff[i]; |
104 | 106 |
105 #ifdef G729_BITEXACT | 107 #ifdef G729_BITEXACT |
106 mr_energy += (((-6165LL * ff_log2(dot_product(fc_v, fc_v, subframe_size, 0))) >> 3) & ~0x3ff); | 108 mr_energy += (((-6165LL * ff_log2(dsp->scalarproduct_int16(fc_v, fc_v, subframe_size, 0))) >> 3) & ~0x3ff); |
107 | 109 |
108 mr_energy = (5439 * (mr_energy >> 15)) >> 8; // (0.15) = (0.15) * (7.23) | 110 mr_energy = (5439 * (mr_energy >> 15)) >> 8; // (0.15) = (0.15) * (7.23) |
109 | 111 |
110 return bidir_sal( | 112 return bidir_sal( |
111 ((ff_exp2(mr_energy & 0x7fff) + 16) >> 5) * (gain_corr_factor >> 1), | 113 ((ff_exp2(mr_energy & 0x7fff) + 16) >> 5) * (gain_corr_factor >> 1), |
112 (mr_energy >> 15) - 25 | 114 (mr_energy >> 15) - 25 |
113 ); | 115 ); |
114 #else | 116 #else |
115 mr_energy = gain_corr_factor * exp(M_LN10 / (20 << 23) * mr_energy) / | 117 mr_energy = gain_corr_factor * exp(M_LN10 / (20 << 23) * mr_energy) / |
116 sqrt(dot_product(fc_v, fc_v, subframe_size, 0)); | 118 sqrt(dsp->scalarproduct_int16(fc_v, fc_v, subframe_size, 0)); |
117 return mr_energy >> 12; | 119 return mr_energy >> 12; |
118 #endif | 120 #endif |
119 } | 121 } |