vorbis: simplify the inner loop in setup_classifs
authorLuca Barbato <lu_zero@gentoo.org>
Sun, 19 May 2013 16:59:13 +0000 (18:59 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Sun, 19 May 2013 20:56:37 +0000 (22:56 +0200)
libavcodec/vorbisdec.c

index 718f7607a2ed18cb028ea513d59cc256c2482d59..caf36eb3f21ae885cd60d5cb043a0d8e869892ce 100644 (file)
@@ -1321,11 +1321,11 @@ static av_always_inline int setup_classifs(vorbis_context *vc,
 
             assert(vr->classifications > 1 && temp <= 65536); //needed for inverse[]
 
-            for (i = 0; i < c_p_c; ++i) {
+            for (i = partition_count + c_p_c - 1; i >= partition_count; i--) {
                 temp2 = (((uint64_t)temp) * inverse_class) >> 32;
-                if (partition_count + c_p_c - 1 - i < vr->ptns_to_read)
-                    vr->classifs[p + partition_count + c_p_c - 1 - i] =
-                        temp - temp2 * vr->classifications;
+
+                if (i < vr->ptns_to_read)
+                    vr->classifs[p + i] = temp - temp2 * vr->classifications;
                 temp = temp2;
             }
         }