Originally committed as revision 17916 to svn://svn.ffmpeg.org/ffmpeg/trunk
Reynaldo H. Verdejo Pinochet authored on 2009/03/10 06:55:24... | ... |
@@ -165,7 +165,7 @@ OBJS-$(CONFIG_PNG_DECODER) += png.o pngdec.o |
165 | 165 |
OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o |
166 | 166 |
OBJS-$(CONFIG_PPM_ENCODER) += pnmenc.o pnm.o |
167 | 167 |
OBJS-$(CONFIG_PTX_DECODER) += ptx.o |
168 |
-OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o qcelp_lsp.o celp_math.o celp_filters.o |
|
168 |
+OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o qcelp_lsp.o celp_math.o celp_filters.o acelp_vectors.o |
|
169 | 169 |
OBJS-$(CONFIG_QDM2_DECODER) += qdm2.o mpegaudiodec.o mpegaudiodecheader.o mpegaudio.o mpegaudiodata.o |
170 | 170 |
OBJS-$(CONFIG_QDRAW_DECODER) += qdrw.o |
171 | 171 |
OBJS-$(CONFIG_QPEG_DECODER) += qpeg.o |
... | ... |
@@ -145,3 +145,13 @@ void ff_acelp_weighted_vector_sum( |
145 | 145 |
in_b[i] * weight_coeff_b + |
146 | 146 |
rounder) >> shift); |
147 | 147 |
} |
148 |
+ |
|
149 |
+void ff_weighted_vector_sumf(float *out, const float *in_a, const float *in_b, |
|
150 |
+ float weight_coeff_a, float weight_coeff_b, int length) |
|
151 |
+{ |
|
152 |
+ int i; |
|
153 |
+ |
|
154 |
+ for(i=0; i<length; i++) |
|
155 |
+ out[i] = weight_coeff_a * in_a[i] |
|
156 |
+ + weight_coeff_b * in_b[i]; |
|
157 |
+} |
... | ... |
@@ -150,4 +150,18 @@ void ff_acelp_weighted_vector_sum( |
150 | 150 |
int shift, |
151 | 151 |
int length); |
152 | 152 |
|
153 |
+/** |
|
154 |
+ * float implementation of weighted sum of two vectors. |
|
155 |
+ * @param out [out] result of addition |
|
156 |
+ * @param in_a first vector |
|
157 |
+ * @param in_b second vector |
|
158 |
+ * @param weight_coeff_a first vector weight coefficient |
|
159 |
+ * @param weight_coeff_a second vector weight coefficient |
|
160 |
+ * @param length vectors length |
|
161 |
+ * |
|
162 |
+ * @note It is safe to pass the same buffer for out and in_a or in_b. |
|
163 |
+ */ |
|
164 |
+void ff_weighted_vector_sumf(float *out, const float *in_a, const float *in_b, |
|
165 |
+ float weight_coeff_a, float weight_coeff_b, int length); |
|
166 |
+ |
|
153 | 167 |
#endif /* AVCODEC_ACELP_VECTORS_H */ |
... | ... |
@@ -37,6 +37,7 @@ |
37 | 37 |
|
38 | 38 |
#include "celp_math.h" |
39 | 39 |
#include "celp_filters.h" |
40 |
+#include "acelp_vectors.h" |
|
40 | 41 |
|
41 | 42 |
#undef NDEBUG |
42 | 43 |
#include <assert.h> |
... | ... |
@@ -81,17 +82,6 @@ typedef struct |
81 | 81 |
*/ |
82 | 82 |
void ff_celp_lspf2lpc(const double *lspf, float *lpc); |
83 | 83 |
|
84 |
-static void weighted_vector_sumf(float *out, const float *in_a, |
|
85 |
- const float *in_b, float weight_coeff_a, |
|
86 |
- float weight_coeff_b, int length) |
|
87 |
-{ |
|
88 |
- int i; |
|
89 |
- |
|
90 |
- for(i=0; i<length; i++) |
|
91 |
- out[i] = weight_coeff_a * in_a[i] |
|
92 |
- + weight_coeff_b * in_b[i]; |
|
93 |
-} |
|
94 |
- |
|
95 | 84 |
/** |
96 | 85 |
* Initialize the speech codec according to the specification. |
97 | 86 |
* |
... | ... |
@@ -174,7 +164,7 @@ static int decode_lspf(QCELPContext *q, float *lspf) |
174 | 174 |
lspf[i-1] = FFMIN(lspf[i-1], (lspf[i] - QCELP_LSP_SPREAD_FACTOR)); |
175 | 175 |
|
176 | 176 |
// Low-pass filter the LSP frequencies. |
177 |
- weighted_vector_sumf(lspf, lspf, q->prev_lspf, smooth, 1.0-smooth, 10); |
|
177 |
+ ff_weighted_vector_sumf(lspf, lspf, q->prev_lspf, smooth, 1.0-smooth, 10); |
|
178 | 178 |
}else |
179 | 179 |
{ |
180 | 180 |
q->octave_count = 0; |
... | ... |
@@ -640,7 +630,7 @@ void interpolate_lpc(QCELPContext *q, const float *curr_lspf, float *lpc, |
640 | 640 |
|
641 | 641 |
if(weight != 1.0) |
642 | 642 |
{ |
643 |
- weighted_vector_sumf(interpolated_lspf, curr_lspf, q->prev_lspf, |
|
643 |
+ ff_weighted_vector_sumf(interpolated_lspf, curr_lspf, q->prev_lspf, |
|
644 | 644 |
weight, 1.0 - weight, 10); |
645 | 645 |
lspf2lpc(interpolated_lspf, lpc); |
646 | 646 |
}else if(q->bitrate >= RATE_QUARTER || |