Commit abc4376b authored by Justin Ruggles's avatar Justin Ruggles
Browse files

alac: reduce the number of local variables needed in lpc prediction

parent 01880d28
...@@ -204,28 +204,27 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer, ...@@ -204,28 +204,27 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer,
/* general case */ /* general case */
for (i = predictor_coef_num + 1; i < output_size; i++) { for (i = predictor_coef_num + 1; i < output_size; i++) {
int j; int j;
int sum = 0; int val = 0;
int outval;
int error_val = error_buffer[i]; int error_val = error_buffer[i];
for (j = 0; j < predictor_coef_num; j++) { for (j = 0; j < predictor_coef_num; j++) {
sum += (buffer_out[predictor_coef_num-j] - buffer_out[0]) * val += (buffer_out[predictor_coef_num-j] - buffer_out[0]) *
predictor_coef_table[j]; predictor_coef_table[j];
} }
outval = (1 << (predictor_quantitization-1)) + sum; val = (val + (1 << (predictor_quantitization - 1))) >>
outval = outval >> predictor_quantitization; predictor_quantitization;
outval = outval + buffer_out[0] + error_val; val += buffer_out[0] + error_val;
outval = sign_extend(outval, readsamplesize);
buffer_out[predictor_coef_num+1] = outval; buffer_out[predictor_coef_num + 1] = sign_extend(val, readsamplesize);
if (error_val > 0) { if (error_val > 0) {
int predictor_num = predictor_coef_num - 1; int predictor_num = predictor_coef_num - 1;
while (predictor_num >= 0 && error_val > 0) { while (predictor_num >= 0 && error_val > 0) {
int val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num]; int sign;
int sign = sign_only(val); val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num];
sign = sign_only(val);
predictor_coef_table[predictor_num] -= sign; predictor_coef_table[predictor_num] -= sign;
...@@ -240,8 +239,9 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer, ...@@ -240,8 +239,9 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer,
int predictor_num = predictor_coef_num - 1; int predictor_num = predictor_coef_num - 1;
while (predictor_num >= 0 && error_val < 0) { while (predictor_num >= 0 && error_val < 0) {
int val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num]; int sign;
int sign = - sign_only(val); val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num];
sign = -sign_only(val);
predictor_coef_table[predictor_num] -= sign; predictor_coef_table[predictor_num] -= sign;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment