[FFmpeg-cvslog] alac: use index into buffer_out instead of incrementing the pointer

Justin Ruggles git at videolan.org
Thu Jul 19 23:35:53 CEST 2012


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Mon Jul  9 12:52:30 2012 -0400| [a4ecd4144265368db7cdb112e098a6ab5142557a] | committer: Justin Ruggles

alac: use index into buffer_out instead of incrementing the pointer

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a4ecd4144265368db7cdb112e098a6ab5142557a
---

 libavcodec/alac.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 110d2cb..ba30bef 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -202,29 +202,29 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer,
     /* NOTE: 4 and 8 are very common cases that could be optimized. */
 
     /* general case */
-    for (i = predictor_coef_num + 1; i < output_size; i++) {
+    for (i = predictor_coef_num; i < output_size - 1; i++) {
         int j;
         int val = 0;
-        int error_val = error_buffer[i];
+        int error_val = error_buffer[i + 1];
         int error_sign;
 
         for (j = 0; j < predictor_coef_num; j++) {
-            val += (buffer_out[predictor_coef_num-j] - buffer_out[0]) *
+            val += (buffer_out[i - j] - buffer_out[i - predictor_coef_num]) *
                    predictor_coef_table[j];
         }
 
         val = (val + (1 << (predictor_quantitization - 1))) >>
               predictor_quantitization;
-        val += buffer_out[0] + error_val;
+        val += buffer_out[i - predictor_coef_num] + error_val;
 
-        buffer_out[predictor_coef_num + 1] = sign_extend(val, readsamplesize);
+        buffer_out[i + 1] = sign_extend(val, readsamplesize);
 
         /* adapt LPC coefficients */
         error_sign = sign_only(error_val);
         if (error_sign) {
             for (j = predictor_coef_num - 1; j >= 0 && error_val * error_sign > 0; j--) {
                 int sign;
-                val  = buffer_out[0] - buffer_out[predictor_coef_num - j];
+                val  = buffer_out[i - predictor_coef_num] - buffer_out[i - j];
                 sign = sign_only(val) * error_sign;
                 predictor_coef_table[j] -= sign;
                 val *= sign;
@@ -232,8 +232,6 @@ static void predictor_decompress_fir_adapt(int32_t *error_buffer,
                               (predictor_coef_num - j));
             }
         }
-
-        buffer_out++;
     }
 }
 



More information about the ffmpeg-cvslog mailing list