comparison alacenc.c @ 10417:952912ff616a libavcodec

alacenc : Move some code around for clarity.
author jai_menon
date Fri, 16 Oct 2009 16:50:15 +0000
parents 55f4c141dbb0
children 1c33160b0722
comparison
equal deleted inserted replaced
10416:1052fe7823e8 10417:952912ff616a
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 if (s->avctx->compression_level == 1) {
136 opt_order = ff_lpc_calc_coefs(&s->dspctx, s->sample_buf[ch],
137 s->avctx->frame_size,
138 s->min_prediction_order,
139 s->max_prediction_order,
140 ALAC_MAX_LPC_PRECISION, coefs, shift, 1,
141 ORDER_METHOD_EST, ALAC_MAX_LPC_SHIFT, 1);
142
143 s->lpc[ch].lpc_order = opt_order;
144 s->lpc[ch].lpc_quant = shift[opt_order-1];
145 memcpy(s->lpc[ch].lpc_coeff, coefs[opt_order-1], opt_order*sizeof(int));
146 } else {
147 s->lpc[ch].lpc_order = 6; 136 s->lpc[ch].lpc_order = 6;
148 s->lpc[ch].lpc_quant = 6; 137 s->lpc[ch].lpc_quant = 6;
149 s->lpc[ch].lpc_coeff[0] = 160; 138 s->lpc[ch].lpc_coeff[0] = 160;
150 s->lpc[ch].lpc_coeff[1] = -190; 139 s->lpc[ch].lpc_coeff[1] = -190;
151 s->lpc[ch].lpc_coeff[2] = 170; 140 s->lpc[ch].lpc_coeff[2] = 170;
152 s->lpc[ch].lpc_coeff[3] = -130; 141 s->lpc[ch].lpc_coeff[3] = -130;
153 s->lpc[ch].lpc_coeff[4] = 80; 142 s->lpc[ch].lpc_coeff[4] = 80;
154 s->lpc[ch].lpc_coeff[5] = -25; 143 s->lpc[ch].lpc_coeff[5] = -25;
144 } else {
145 opt_order = ff_lpc_calc_coefs(&s->dspctx, s->sample_buf[ch],
146 s->avctx->frame_size,
147 s->min_prediction_order,
148 s->max_prediction_order,
149 ALAC_MAX_LPC_PRECISION, coefs, shift, 1,
150 ORDER_METHOD_EST, ALAC_MAX_LPC_SHIFT, 1);
151
152 s->lpc[ch].lpc_order = opt_order;
153 s->lpc[ch].lpc_quant = shift[opt_order-1];
154 memcpy(s->lpc[ch].lpc_coeff, coefs[opt_order-1], opt_order*sizeof(int));
155 } 155 }
156 } 156 }
157 157
158 static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n) 158 static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n)
159 { 159 {