summaryrefslogtreecommitdiff
path: root/libavcodec/alac.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-07-09 12:57:16 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2012-07-19 13:26:47 -0400
commitebd4c3add1ecad2c65ac80f0787ca5c1e78b600e (patch)
tree6084fa661099ac273e4bf02b5032f3cf8a21411d /libavcodec/alac.c
parenta4ecd4144265368db7cdb112e098a6ab5142557a (diff)
alac: factor out loading of next decoded sample in LPC prediction
Diffstat (limited to 'libavcodec/alac.c')
-rw-r--r--libavcodec/alac.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index ba30bef7ea..42dfdad595 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -207,15 +207,16 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer,
int val = 0;
int error_val = error_buffer[i + 1];
int error_sign;
+ int d = buffer_out[i - predictor_coef_num];
for (j = 0; j < predictor_coef_num; j++) {
- val += (buffer_out[i - j] - buffer_out[i - predictor_coef_num]) *
+ val += (buffer_out[i - j] - d) *
predictor_coef_table[j];
}
val = (val + (1 << (predictor_quantitization - 1))) >>
predictor_quantitization;
- val += buffer_out[i - predictor_coef_num] + error_val;
+ val += d + error_val;
buffer_out[i + 1] = sign_extend(val, readsamplesize);
@@ -224,7 +225,7 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer,
if (error_sign) {
for (j = predictor_coef_num - 1; j >= 0 && error_val * error_sign > 0; j--) {
int sign;
- val = buffer_out[i - predictor_coef_num] - buffer_out[i - j];
+ val = d - buffer_out[i - j];
sign = sign_only(val) * error_sign;
predictor_coef_table[j] -= sign;
val *= sign;