[FFmpeg-soc] [soc]: r5127 - als/alsdec.c

thilo.borgmann subversion at mplayerhq.hu
Sat Aug 15 14:36:35 CEST 2009


Author: thilo.borgmann
Date: Sat Aug 15 14:36:35 2009
New Revision: 5127

Log:
Merge two loops to reduce code duplication. Benchmark shows up to 2%
less dezicyles for a single loop.

Modified:
   als/alsdec.c

Modified: als/alsdec.c
==============================================================================
--- als/alsdec.c	Sat Aug 15 14:04:02 2009	(r5126)
+++ als/alsdec.c	Sat Aug 15 14:36:35 2009	(r5127)
@@ -642,23 +642,25 @@ static int read_block_data(ALSDecContext
         if (ra_block) {
             unsigned int progressive = FFMIN(block_length, opt_order);
 
-            for (smp = 0; smp < progressive; smp++) {
-                y = 1 << 19;
-
-                for (sb = 0; sb < smp; sb++)
-                    y += lpc_cof[sb] * raw_samples[smp - (sb + 1)];
+            for (smp = 0; smp < block_length; smp++) {
+                unsigned int max, convert;
 
-                raw_samples[smp] -= y >> 20;
-                parcor_to_lpc(smp, quant_cof, lpc_cof);
-            }
+                if (smp < progressive) {
+                    max     = smp;
+                    convert = 1;
+                } else {
+                    max     = progressive;
+                    convert = 0;
+                }
 
-            for (; smp < block_length; smp++) {
                 y = 1 << 19;
 
-                for (sb = 0; sb < progressive; sb++)
+                for (sb = 0; sb < max; sb++)
                     y += lpc_cof[sb] * raw_samples[smp - (sb + 1)];
 
                 raw_samples[smp] -= y >> 20;
+                if (convert)
+                    parcor_to_lpc(smp, quant_cof, lpc_cof);
             }
         } else {
             // reconstruct difference signal for prediction (joint-stereo)


More information about the FFmpeg-soc mailing list