sigh, I-DCT had to reverse the order of middle loop to stop
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 29 Jul 2021 19:52:29 +0000 (20:52 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 29 Jul 2021 19:52:29 +0000 (20:52 +0100)
overwrite-accumulation of iterative sum

src/openpower/decoder/isa/fastdct-test.py
src/openpower/decoder/isa/fastdctlee.py

index be786aa5f4b18bd617c5168dc30f5f1e907a0d08..d9031813d31ae39fb7dab48dc46c57857b12c2ee 100644 (file)
@@ -28,7 +28,7 @@ import fastdctlee, naivedct, remap_dct_yield
 class FastDctTest(unittest.TestCase):
 
     def test_fast_dct_lee_vs_naive(self):
-        for i in range(2, 3):
+        for i in range(3, 8):
             n = 2**i
             vector = FastDctTest.nonrandom_vector(n)
             expect = naivedct.transform(vector)
index 8163105058363b20fde37e6a0164aca27f42a465..719c4c93d873cae617743cc6e4d55322cbd1ea6b 100644 (file)
@@ -362,13 +362,14 @@ def inverse_transform_iter(vec):
 
     # first the outer butterfly (iterative sum thing)
     n = len(vec)
-    size = n // 2
-    while size >= 2:
+    size = 2
+    while size <= n:
         halfsize = size // 2
         ir = list(range(0, halfsize))
         print ("itersum", halfsize, size, ir)
         for i in ir:
             jr = list(range(i+halfsize, i+n-halfsize, size))
+            jr.reverse()
             print ("itersum    jr", i+halfsize, i+size, jr)
             for jh in jr:
                 x = vec[jh]
@@ -376,7 +377,7 @@ def inverse_transform_iter(vec):
                 vec[jh+size] = x + y
                 print ("    itersum", size, i, jh, jh+size,
                         x, y, "jh+sz", vec[jh+size])
-        size //= 2
+        size *= 2
 
     print("transform2-inv post-itersum", vec)
 
@@ -460,8 +461,9 @@ def inverse_transform2(vector, root=True, indent=0):
         for i in range(2, n, 2):
             alpha.append(vector[i])
             beta.append(vector[i - 1] + vector[i + 1])
-        print (idt, " alpha", alpha)
-        print (idt, " beta", beta)
+            print (idt, " alpha", i, vector[i])
+            print (idt, " beta", i-1, i+1, vector[i-1], vector[i+1], "->",
+                          beta[-1])
         inverse_transform2(alpha, False, indent+1)
         inverse_transform2(beta , False, indent+1)
         for i in range(half):