| OLD | NEW |
| 1 /* | 1 /* |
| 2 * gain code, gain pitch and pitch delay decoding | 2 * gain code, gain pitch and pitch delay decoding |
| 3 * | 3 * |
| 4 * Copyright (c) 2008 Vladimir Voroshilov | 4 * Copyright (c) 2008 Vladimir Voroshilov |
| 5 * | 5 * |
| 6 * This file is part of FFmpeg. | 6 * This file is part of FFmpeg. |
| 7 * | 7 * |
| 8 * FFmpeg is free software; you can redistribute it and/or | 8 * FFmpeg is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 | 122 |
| 123 float ff_amr_set_fixed_gain(float fixed_gain_factor, float fixed_mean_energy, | 123 float ff_amr_set_fixed_gain(float fixed_gain_factor, float fixed_mean_energy, |
| 124 float *prediction_error, float energy_mean, | 124 float *prediction_error, float energy_mean, |
| 125 const float *pred_table) | 125 const float *pred_table) |
| 126 { | 126 { |
| 127 // Equations 66-69: | 127 // Equations 66-69: |
| 128 // ^g_c = ^gamma_gc * 100.05 (predicted dB + mean dB - dB of fixed vector) | 128 // ^g_c = ^gamma_gc * 100.05 (predicted dB + mean dB - dB of fixed vector) |
| 129 // Note 10^(0.05 * -10log(average x2)) = 1/sqrt((average x2)). | 129 // Note 10^(0.05 * -10log(average x2)) = 1/sqrt((average x2)). |
| 130 float val = fixed_gain_factor * | 130 float val = fixed_gain_factor * |
| 131 exp2f(log2f(10.0) * 0.05 * | 131 exp2f(M_LOG2_10 * 0.05 * |
| 132 (ff_dot_productf(pred_table, prediction_error, 4) + | 132 (ff_dot_productf(pred_table, prediction_error, 4) + |
| 133 energy_mean)) / | 133 energy_mean)) / |
| 134 sqrtf(fixed_mean_energy); | 134 sqrtf(fixed_mean_energy); |
| 135 | 135 |
| 136 // update quantified prediction error energy history | 136 // update quantified prediction error energy history |
| 137 memmove(&prediction_error[0], &prediction_error[1], | 137 memmove(&prediction_error[0], &prediction_error[1], |
| 138 3 * sizeof(prediction_error[0])); | 138 3 * sizeof(prediction_error[0])); |
| 139 prediction_error[3] = 20.0 * log10f(fixed_gain_factor); | 139 prediction_error[3] = 20.0 * log10f(fixed_gain_factor); |
| 140 | 140 |
| 141 return val; | 141 return val; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 pitch_index += 3 * av_clip(prev_lag_int - 10, PITCH_DELAY_MIN, | 177 pitch_index += 3 * av_clip(prev_lag_int - 10, PITCH_DELAY_MIN, |
| 178 PITCH_DELAY_MAX - 19); | 178 PITCH_DELAY_MAX - 19); |
| 179 } else | 179 } else |
| 180 pitch_index += 3 * av_clip(prev_lag_int - 5, PITCH_DELAY_MIN, | 180 pitch_index += 3 * av_clip(prev_lag_int - 5, PITCH_DELAY_MIN, |
| 181 PITCH_DELAY_MAX - 9); | 181 PITCH_DELAY_MAX - 9); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 *lag_int = pitch_index * 10923 >> 15; | 184 *lag_int = pitch_index * 10923 >> 15; |
| 185 *lag_frac = pitch_index - 3 * *lag_int - 1; | 185 *lag_frac = pitch_index - 3 * *lag_int - 1; |
| 186 } | 186 } |
| OLD | NEW |