comparison ra288.c @ 7847:5a114f24632a libavcodec

misc spelling/wording/grammar fixes
author diego
date Thu, 11 Sep 2008 08:13:23 +0000
parents 58f33e404d6a
children f29ec8e5d186
comparison
equal deleted inserted replaced
7846:a7162bb60138 7847:5a114f24632a
27 27
28 typedef struct { 28 typedef struct {
29 float sp_lpc[36]; ///< LPC coefficients for speech data (spec: A) 29 float sp_lpc[36]; ///< LPC coefficients for speech data (spec: A)
30 float gain_lpc[10]; ///< LPC coefficients for gain (spec: GB) 30 float gain_lpc[10]; ///< LPC coefficients for gain (spec: GB)
31 31
32 float sp_hist[111]; ///< Speech data history (spec: SB) 32 float sp_hist[111]; ///< speech data history (spec: SB)
33 33
34 /** Speech part of the gain autocorrelation (spec: REXP) */ 34 /** speech part of the gain autocorrelation (spec: REXP) */
35 float sp_rec[37]; 35 float sp_rec[37];
36 36
37 float gain_hist[38]; ///< Log-gain history (spec: SBLG) 37 float gain_hist[38]; ///< log-gain history (spec: SBLG)
38 38
39 /** Recursive part of the gain autocorrelation (spec: REXPLG) */ 39 /** recursive part of the gain autocorrelation (spec: REXPLG) */
40 float gain_rec[11]; 40 float gain_rec[11];
41 41
42 float sp_block[41]; ///< Speech data of four blocks (spec: STTMP) 42 float sp_block[41]; ///< four blocks of speech data (spec: STTMP)
43 float gain_block[10]; ///< Gain data of four blocks (spec: GSTATE) 43 float gain_block[10]; ///< four blocks of gain data (spec: GSTATE)
44 } RA288Context; 44 } RA288Context;
45 45
46 static av_cold int ra288_decode_init(AVCodecContext *avctx) 46 static av_cold int ra288_decode_init(AVCodecContext *avctx)
47 { 47 {
48 avctx->sample_fmt = SAMPLE_FMT_S16; 48 avctx->sample_fmt = SAMPLE_FMT_S16;
69 static void decode(RA288Context *ractx, float gain, int cb_coef) 69 static void decode(RA288Context *ractx, float gain, int cb_coef)
70 { 70 {
71 int i, j; 71 int i, j;
72 double sumsum; 72 double sumsum;
73 float sum, buffer[5]; 73 float sum, buffer[5];
74 float *block = ractx->sp_block + 36; // Current block 74 float *block = ractx->sp_block + 36; // current block
75 75
76 memmove(ractx->sp_block, ractx->sp_block + 5, 36*sizeof(*ractx->sp_block)); 76 memmove(ractx->sp_block, ractx->sp_block + 5, 36*sizeof(*ractx->sp_block));
77 77
78 for (i=0; i < 5; i++) { 78 for (i=0; i < 5; i++) {
79 block[i] = 0.; 79 block[i] = 0.;
120 tgt[n] = scalar_product_float(src, src - n, len); 120 tgt[n] = scalar_product_float(src, src - n, len);
121 121
122 } 122 }
123 123
124 /** 124 /**
125 * Hybrid window filtering. See blocks 36 and 49 of the G.728 specification. 125 * Hybrid window filtering, see blocks 36 and 49 of the G.728 specification.
126 * 126 *
127 * @param order the order of the filter 127 * @param order filter order
128 * @param n the length of the input 128 * @param n input length
129 * @param non_rec the number of non-recursive samples 129 * @param non_rec number of non-recursive samples
130 * @param out the filter output 130 * @param out filter output
131 * @param in pointer to the input of the filter 131 * @param in pointer to the input of the filter
132 * @param hist pointer to the input history of the filter. It is updated by 132 * @param hist Pointer to the input history of the filter, it is updated by
133 * this function. 133 * this function.
134 * @param out pointer to the non-recursive part of the output 134 * @param out pointer to the non-recursive part of the output
135 * @param out2 pointer to the recursive part of the output 135 * @param out2 pointer to the recursive part of the output
136 * @param window pointer to the windowing function table 136 * @param window pointer to the windowing function table
137 */ 137 */
156 for (i=0; i <= order; i++) { 156 for (i=0; i <= order; i++) {
157 out2[i] = out2[i] * 0.5625 + buffer1[i]; 157 out2[i] = out2[i] * 0.5625 + buffer1[i];
158 out [i] = out2[i] + buffer2[i]; 158 out [i] = out2[i] + buffer2[i];
159 } 159 }
160 160
161 /* Multiply by the white noise correcting factor (WNCF) */ 161 /* Multiply by the white noise correcting factor (WNCF). */
162 *out *= 257./256.; 162 *out *= 257./256.;
163 } 163 }
164 164
165 /** 165 /**
166 * Backward synthesis filter. Find the LPC coefficients from past speech data. 166 * Backward synthesis filter, find the LPC coefficients from past speech data.
167 */ 167 */
168 static void backward_filter(RA288Context *ractx) 168 static void backward_filter(RA288Context *ractx)
169 { 169 {
170 float temp1[37]; // RTMP in the spec 170 float temp1[37]; // RTMP in the spec
171 float temp2[11]; // GPTPMP in the spec 171 float temp2[11]; // GPTPMP in the spec