Mercurial > libavcodec.hg
comparison acelp_filters.c @ 6856:94465a2c3b34 libavcodec
Move pitch vector interpolation code to acelp_filters
and convert it to a generic interpolation routine.
author | voroshil |
---|---|
date | Sat, 24 May 2008 17:18:42 +0000 |
parents | 1f02f929b9ff |
children | 2b763a495c07 |
comparison
equal
deleted
inserted
replaced
6855:128af7cac045 | 6856:94465a2c3b34 |
---|---|
24 | 24 |
25 #include "avcodec.h" | 25 #include "avcodec.h" |
26 #include "acelp_filters.h" | 26 #include "acelp_filters.h" |
27 #define FRAC_BITS 13 | 27 #define FRAC_BITS 13 |
28 #include "mathops.h" | 28 #include "mathops.h" |
29 | |
30 const int16_t ff_acelp_interp_filter[61] = | |
31 { /* (0.15) */ | |
32 29443, 28346, 25207, 20449, 14701, 8693, | |
33 3143, -1352, -4402, -5865, -5850, -4673, | |
34 -2783, -672, 1211, 2536, 3130, 2991, | |
35 2259, 1170, 0, -1001, -1652, -1868, | |
36 -1666, -1147, -464, 218, 756, 1060, | |
37 1099, 904, 550, 135, -245, -514, | |
38 -634, -602, -451, -231, 0, 191, | |
39 308, 340, 296, 198, 78, -36, | |
40 -120, -163, -165, -132, -79, -19, | |
41 34, 73, 91, 89, 70, 38, | |
42 0, | |
43 }; | |
44 | |
45 void ff_acelp_interpolate( | |
46 int16_t* out, | |
47 const int16_t* in, | |
48 const int16_t* filter_coeffs, | |
49 int precision, | |
50 int pitch_delay_frac, | |
51 int filter_length, | |
52 int length) | |
53 { | |
54 int n, i; | |
55 | |
56 assert(pitch_delay_frac >= 0 && pitch_delay_frac < precision); | |
57 | |
58 for(n=0; n<length; n++) | |
59 { | |
60 int idx = 0; | |
61 int v = 0x4000; | |
62 | |
63 for(i=0; i<filter_length;) | |
64 { | |
65 | |
66 /* The reference G.729 and AMR fixed point code performs clipping after | |
67 each of the two following accumulations. | |
68 Since clipping affects only the synthetic OVERFLOW test without | |
69 causing an int type overflow, it was moved outside the loop. */ | |
70 | |
71 /* R(x):=ac_v[-k+x] | |
72 v += R(n-i)*ff_acelp_interp_filter(t+6i) | |
73 v += R(n+i+1)*ff_acelp_interp_filter(6-t+6i) */ | |
74 | |
75 v += in[n + i] * filter_coeffs[idx + pitch_delay_frac]; | |
76 idx += precision; | |
77 i++; | |
78 v += in[n - i] * filter_coeffs[idx - pitch_delay_frac]; | |
79 } | |
80 out[n] = av_clip_int16(v >> 15); | |
81 } | |
82 } | |
29 | 83 |
30 void ff_acelp_convolve_circ( | 84 void ff_acelp_convolve_circ( |
31 int16_t* fc_out, | 85 int16_t* fc_out, |
32 const int16_t* fc_in, | 86 const int16_t* fc_in, |
33 const int16_t* filter, | 87 const int16_t* filter, |