comparison alacenc.c @ 10365:b44de7b79bee libavcodec

alacenc: add a fixed LPC coefficient mode as compression level 1. old compression level 1 is now compression level 2 and is still the default.
author jbr
date Mon, 05 Oct 2009 21:27:36 +0000
parents 2b8a327189cd
children 55f4c141dbb0
comparison
equal deleted inserted replaced
10364:917c88a80b67 10365:b44de7b79bee
130 { 130 {
131 int32_t coefs[MAX_LPC_ORDER][MAX_LPC_ORDER]; 131 int32_t coefs[MAX_LPC_ORDER][MAX_LPC_ORDER];
132 int shift[MAX_LPC_ORDER]; 132 int shift[MAX_LPC_ORDER];
133 int opt_order; 133 int opt_order;
134 134
135 if (s->avctx->compression_level > 1) {
135 opt_order = ff_lpc_calc_coefs(&s->dspctx, s->sample_buf[ch], s->avctx->frame_size, s->min_prediction_order, s->max_prediction_order, 136 opt_order = ff_lpc_calc_coefs(&s->dspctx, s->sample_buf[ch], s->avctx->frame_size, s->min_prediction_order, s->max_prediction_order,
136 ALAC_MAX_LPC_PRECISION, coefs, shift, 1, ORDER_METHOD_EST, ALAC_MAX_LPC_SHIFT, 1); 137 ALAC_MAX_LPC_PRECISION, coefs, shift, 1, ORDER_METHOD_EST, ALAC_MAX_LPC_SHIFT, 1);
137 138
138 s->lpc[ch].lpc_order = opt_order; 139 s->lpc[ch].lpc_order = opt_order;
139 s->lpc[ch].lpc_quant = shift[opt_order-1]; 140 s->lpc[ch].lpc_quant = shift[opt_order-1];
140 memcpy(s->lpc[ch].lpc_coeff, coefs[opt_order-1], opt_order*sizeof(int)); 141 memcpy(s->lpc[ch].lpc_coeff, coefs[opt_order-1], opt_order*sizeof(int));
142 } else {
143 s->lpc[ch].lpc_order = 6;
144 s->lpc[ch].lpc_quant = 6;
145 s->lpc[ch].lpc_coeff[0] = 160;
146 s->lpc[ch].lpc_coeff[1] = -190;
147 s->lpc[ch].lpc_coeff[2] = 170;
148 s->lpc[ch].lpc_coeff[3] = -130;
149 s->lpc[ch].lpc_coeff[4] = 80;
150 s->lpc[ch].lpc_coeff[5] = -25;
151 }
141 } 152 }
142 153
143 static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n) 154 static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n)
144 { 155 {
145 int i, best; 156 int i, best;
373 return -1; 384 return -1;
374 } 385 }
375 386
376 // Set default compression level 387 // Set default compression level
377 if(avctx->compression_level == FF_COMPRESSION_DEFAULT) 388 if(avctx->compression_level == FF_COMPRESSION_DEFAULT)
378 s->compression_level = 1; 389 s->compression_level = 2;
379 else 390 else
380 s->compression_level = av_clip(avctx->compression_level, 0, 1); 391 s->compression_level = av_clip(avctx->compression_level, 0, 2);
381 392
382 // Initialize default Rice parameters 393 // Initialize default Rice parameters
383 s->rc.history_mult = 40; 394 s->rc.history_mult = 40;
384 s->rc.initial_history = 10; 395 s->rc.initial_history = 10;
385 s->rc.k_modifier = 14; 396 s->rc.k_modifier = 14;