| OLD | NEW |
| 1 /* | 1 /* |
| 2 * various filters for ACELP-based codecs | 2 * various filters for ACELP-based codecs |
| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 return 0; | 80 return 0; |
| 81 } | 81 } |
| 82 | 82 |
| 83 void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, | 83 void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, |
| 84 const float* in, int buffer_length, | 84 const float* in, int buffer_length, |
| 85 int filter_length) | 85 int filter_length) |
| 86 { | 86 { |
| 87 int i,n; | 87 int i,n; |
| 88 | 88 |
| 89 #if 0 // Unoptimized code path for improved readability |
| 90 for (n = 0; n < buffer_length; n++) { |
| 91 out[n] = in[n]; |
| 92 for (i = 1; i <= filter_length; i++) |
| 93 out[n] -= filter_coeffs[i-1] * out[n-i]; |
| 94 } |
| 95 #else |
| 89 float out0, out1, out2, out3; | 96 float out0, out1, out2, out3; |
| 90 float old_out0, old_out1, old_out2, old_out3; | 97 float old_out0, old_out1, old_out2, old_out3; |
| 91 float a,b,c; | 98 float a,b,c; |
| 92 | 99 |
| 93 a = filter_coeffs[0]; | 100 a = filter_coeffs[0]; |
| 94 b = filter_coeffs[1]; | 101 b = filter_coeffs[1]; |
| 95 c = filter_coeffs[2]; | 102 c = filter_coeffs[2]; |
| 96 b -= filter_coeffs[0] * filter_coeffs[0]; | 103 b -= filter_coeffs[0] * filter_coeffs[0]; |
| 97 c -= filter_coeffs[1] * filter_coeffs[0]; | 104 c -= filter_coeffs[1] * filter_coeffs[0]; |
| 98 c -= filter_coeffs[0] * b; | 105 c -= filter_coeffs[0] * b; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 in += 4; | 186 in += 4; |
| 180 } | 187 } |
| 181 | 188 |
| 182 out -= n; | 189 out -= n; |
| 183 in -= n; | 190 in -= n; |
| 184 for (; n < buffer_length; n++) { | 191 for (; n < buffer_length; n++) { |
| 185 out[n] = in[n]; | 192 out[n] = in[n]; |
| 186 for (i = 1; i <= filter_length; i++) | 193 for (i = 1; i <= filter_length; i++) |
| 187 out[n] -= filter_coeffs[i-1] * out[n-i]; | 194 out[n] -= filter_coeffs[i-1] * out[n-i]; |
| 188 } | 195 } |
| 196 #endif |
| 189 } | 197 } |
| 190 | 198 |
| 191 void ff_celp_lp_zero_synthesis_filterf(float *out, const float *filter_coeffs, | 199 void ff_celp_lp_zero_synthesis_filterf(float *out, const float *filter_coeffs, |
| 192 const float *in, int buffer_length, | 200 const float *in, int buffer_length, |
| 193 int filter_length) | 201 int filter_length) |
| 194 { | 202 { |
| 195 int i,n; | 203 int i,n; |
| 196 | 204 |
| 197 for (n = 0; n < buffer_length; n++) { | 205 for (n = 0; n < buffer_length; n++) { |
| 198 out[n] = in[n]; | 206 out[n] = in[n]; |
| 199 for (i = 1; i <= filter_length; i++) | 207 for (i = 1; i <= filter_length; i++) |
| 200 out[n] += filter_coeffs[i-1] * in[n-i]; | 208 out[n] += filter_coeffs[i-1] * in[n-i]; |
| 201 } | 209 } |
| 202 } | 210 } |
| OLD | NEW |