Mercurial > libavcodec.hg
comparison lpc.c @ 12139:e59926e2c50c libavcodec
Add AVCodecContext.lpc_type and Add AVCodecContext.lpc_passes fields.
Add AVLPCType enum.
Deprecate AVCodecContext.use_lpc.
author | jbr |
---|---|
date | Sun, 11 Jul 2010 16:56:20 +0000 |
parents | fdafbcef52f5 |
children |
comparison
equal
deleted
inserted
replaced
12138:41f078d6869d | 12139:e59926e2c50c |
---|---|
163 * 2+ = LPC with coeffs determined by Cholesky factorization using (use_lpc-1) passes. | 163 * 2+ = LPC with coeffs determined by Cholesky factorization using (use_lpc-1) passes. |
164 */ | 164 */ |
165 int ff_lpc_calc_coefs(DSPContext *s, | 165 int ff_lpc_calc_coefs(DSPContext *s, |
166 const int32_t *samples, int blocksize, int min_order, | 166 const int32_t *samples, int blocksize, int min_order, |
167 int max_order, int precision, | 167 int max_order, int precision, |
168 int32_t coefs[][MAX_LPC_ORDER], int *shift, int use_lpc, | 168 int32_t coefs[][MAX_LPC_ORDER], int *shift, |
169 enum AVLPCType lpc_type, int lpc_passes, | |
169 int omethod, int max_shift, int zero_shift) | 170 int omethod, int max_shift, int zero_shift) |
170 { | 171 { |
171 double autoc[MAX_LPC_ORDER+1]; | 172 double autoc[MAX_LPC_ORDER+1]; |
172 double ref[MAX_LPC_ORDER]; | 173 double ref[MAX_LPC_ORDER]; |
173 double lpc[MAX_LPC_ORDER][MAX_LPC_ORDER]; | 174 double lpc[MAX_LPC_ORDER][MAX_LPC_ORDER]; |
174 int i, j, pass; | 175 int i, j, pass; |
175 int opt_order; | 176 int opt_order; |
176 | 177 |
177 assert(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER && use_lpc > 0); | 178 assert(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER && |
178 | 179 lpc_type > AV_LPC_TYPE_FIXED); |
179 if(use_lpc == 1){ | 180 |
181 if (lpc_type == AV_LPC_TYPE_LEVINSON) { | |
180 s->lpc_compute_autocorr(samples, blocksize, max_order, autoc); | 182 s->lpc_compute_autocorr(samples, blocksize, max_order, autoc); |
181 | 183 |
182 compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1); | 184 compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1); |
183 | 185 |
184 for(i=0; i<max_order; i++) | 186 for(i=0; i<max_order; i++) |
185 ref[i] = fabs(lpc[i][i]); | 187 ref[i] = fabs(lpc[i][i]); |
186 }else{ | 188 } else if (lpc_type == AV_LPC_TYPE_CHOLESKY) { |
187 LLSModel m[2]; | 189 LLSModel m[2]; |
188 double var[MAX_LPC_ORDER+1], av_uninit(weight); | 190 double var[MAX_LPC_ORDER+1], av_uninit(weight); |
189 | 191 |
190 for(pass=0; pass<use_lpc-1; pass++){ | 192 for(pass=0; pass<lpc_passes; pass++){ |
191 av_init_lls(&m[pass&1], max_order); | 193 av_init_lls(&m[pass&1], max_order); |
192 | 194 |
193 weight=0; | 195 weight=0; |
194 for(i=max_order; i<blocksize; i++){ | 196 for(i=max_order; i<blocksize; i++){ |
195 for(j=0; j<=max_order; j++) | 197 for(j=0; j<=max_order; j++) |